0
Commit Graph

1633 Commits

Author SHA1 Message Date
074b539cc1 [pdf] Share MockWebAssociatedURLLoader
Consolidates blink::WebAssociatedURLLoader mocks into a single
implementation.

Bug: 1056817
Change-Id: I86f7e779f5b7feda82e7fe78c7776e5c8961bc21
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3709666
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1015601}
2022-06-18 00:15:52 +00:00
1a2a8453a8 GCC: workaround of GCC bug passing a parent class method to a fixed_flat_map
In PdfViewWebPlugin we are hitting a GCC bug on initialization of
message handlers fixed_flat_map with the members of the parent class.

Bug reported to GCC at:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105996

Bug: 819294
Change-Id: Ied9a050145675be8865304eed6fdb9cf0fd09df4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3709463
Reviewed-by: K. Moon <kmoon@chromium.org>
Commit-Queue: José Dapena Paz <jdapena@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1015489}
2022-06-17 19:55:53 +00:00
c6ef2d7f18 Inline PdfViewWebPlugin::CreateUrlLoaderInternal()
Inlines PdfViewWebPlugin::CreateUrlLoaderInternal() into the call sites,
as this method does very little now.

Also gets rid of UrlLoader::GrantUniversalAccess(), which the PDF viewer
always uses for all requests.

Bug: 1322928
Change-Id: I34c49fb2f83debeb52515819c21d1e188f0f452d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3710222
Auto-Submit: K. Moon <kmoon@chromium.org>
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: Nigi <nigi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1015447}
2022-06-17 18:42:20 +00:00
2ec4f30390 [pdf] Merge BlinkUrlLoader into UrlLoader
Merges BlinkUrlLoader into its base class, UrlLoader.

Bug: 1322928
Change-Id: I8a6c16b1be8a781f26a70d6570090504bb239e9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3708045
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1015241}
2022-06-17 05:10:21 +00:00
efbad4c96e Create //pdf/loader
Moves loading-related logic to a new //pdf/loader directory.

Also removes the now-empty //pdf/ppapi_migration directory.

Bug: 1322928
Change-Id: I956d14b66466380281836e6df6cef737ca7db7dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3707509
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1015081}
2022-06-16 20:34:48 +00:00
4d6513f719 Migrate PdfViewPluginBase::LoadUrl()
Migrates LoadUrl() from PdfViewPluginBase to PdfViewWebPlugin, removing
the last references to UrlLoader from PdfViewPluginBase.

Bug: 1322928
Change-Id: I501b6fb5abec2702607cd51fed5144e1ec1ee5be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3709988
Auto-Submit: K. Moon <kmoon@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1014983}
2022-06-16 17:33:48 +00:00
bb021506e3 [Cast Convergence] Remove is_chromecast from missed places
This CL updates code previously missed when either filing
crbug.com/1293594 or in a past Cast Convergence CL
(https://chromium-review.googlesource.com/q/hashtag:cast-convergence)
to remove is_chromecast and replace it with new `is_castos`,
`is_cast_android` and `enable_cast_receiver` flags as appropriate,
which signify either "a nest chromecast-hardware device", "an android
cast receiving hardware device", or "a platform which can act as a cast
receiver" (such as ATV, Fuchsia, etc) respectively.

Bug: 1219802, 1293594
Change-Id: I50b2ba171fb3ece00e09f278073ac2591c584816
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3700681
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Reviewed-by: Derek Schuff <dschuff@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Ryan Keane <rwkeane@google.com>
Reviewed-by: David Dorwin <ddorwin@chromium.org>
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Gary Kacmarcik <garykac@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1014940}
2022-06-16 16:15:17 +00:00
8bf0e9afdc Migrate PdfViewPluginBase::UpdateGeometryOnPluginRectChanged()
Migrates UpdateGeometryOnPluginRectChanged() from PdfViewPluginBase to
PdfViewWebPlugin, inlining into PdfViewWebPlugin::OnViewportChanged().

Also migrates first_paint_ and PrepareForFirstPaint(), as these are
simpler to migrate simultaneously with
UpdateGeometryOnPluginRectChanged().

Bug: 1302059
Change-Id: I4655f5569f79c2f29e40737633685752a595e8ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3708313
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1014800}
2022-06-16 05:31:41 +00:00
e191c5379e Migrate PdfViewPluginBase::HandleViewportMessage()
Migrates HandleViewportMessage() from PdfViewPluginBase to
PdfViewWebPlugin.

Also migrates stop_scrolling_, HandleStopScrollingMessage(), and
UpdateScroll(), as these are simpler to migrate simultaneously with
HandleViewportMessage().

Bug: 1302059
Change-Id: I542ae895838e515009cda99a6d9b2d18521c3ebd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3708002
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1014798}
2022-06-16 05:23:27 +00:00
daea7d0939 [pdf] Migrate Print Preview loading
Migrates Print Preview loading logic from PdfViewPluginBase to
PdfViewWebPlugin. This logic is tightly coupled, so it makes sense to
migrate it as a unit.

Reorders and inlines some of the methods to reflect control flow better.

Also migrates PdfViewPluginBase::url_, since all uses are now in
PdfViewWebPlugin.

Bug: 1302059
Change-Id: I9a377b3c5b2242d59f7e0bc9df91849117cc4827
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3708337
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1014796}
2022-06-16 05:19:40 +00:00
1fb4fe7428 Migrate PdfViewPluginBase::cursor_type_
Migrates cursor_type_ from PdfViewPluginBase to PdfViewWebPlugin.

Bug: 1302059
Change-Id: I562337a1dca4abd7f921166579b523109c5d2159
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3704061
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: Nigi <nigi@chromium.org>
Auto-Submit: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1013731}
2022-06-14 00:03:41 +00:00
7c04d8c002 Migrate PdfViewPluginBase::engine_
Migrates engine_ from PdfViewPluginBase to PdfViewWebPlugin.

Bug: 1302059
Change-Id: Iccfd9071534c1df4763ea9da5d92d401ce30c1a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3703918
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Auto-Submit: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1013662}
2022-06-13 21:22:03 +00:00
0471356ed8 Add nigi@ to //pdf/OWNERS.
With over 100 commits to //pdf and numerous reviews in this directory,
nigi@ should be in the OWNERS file.

Change-Id: I0bbf87bf6a620e5100813b98d8708e5c8a937e04
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3703405
Commit-Queue: Nigi <nigi@chromium.org>
Reviewed-by: K. Moon <kmoon@chromium.org>
Reviewed-by: Nigi <nigi@chromium.org>
Auto-Submit: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1013646}
2022-06-13 20:59:20 +00:00
6aae690bd5 Migrate PdfViewPluginBase::ProposeDocumentLayout()
Migrates ProposeDocumentLayout() from PdfViewPluginBase to
PdfViewWebPlugin.

Bug: 1302059
Change-Id: I568772ca998d777f335e8e0e27a5eaeee923a4b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3704058
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: Nigi <nigi@chromium.org>
Auto-Submit: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1013645}
2022-06-13 20:59:15 +00:00
0aca974a12 Migrate PdfViewPluginBase::HandleMessage()
Migrates HandleMessage() from PdfViewPluginBase to PdfViewWebPlugin.

Also makes all private methods in PdfViewPluginBase protected, since
these will be merged into the only subclass (PdfViewWebPlugin) anyway.

Bug: 1302059
Change-Id: I8ffaaf7ae00513e24d2ad4e98dcf84c18c3dd508
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3704196
Commit-Queue: K. Moon <kmoon@chromium.org>
Auto-Submit: K. Moon <kmoon@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1013612}
2022-06-13 19:38:30 +00:00
19ccc4de5f Remove an extra header in pdf/pdfium/pdfium_engine.cc
"base/numerics/safe_conversions.h" was accidentally added in
https://crrev.com/c/3696844. Remove it since it's unnecessary.

Change-Id: I9669ef878952b98101ad2a925c6b2a363e95138d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3700471
Commit-Queue: Nigi <nigi@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1013041}
2022-06-10 18:25:28 +00:00
03f42df3bd Handle out-of-range page numbers from named destinations.
A named destination in a PDF file sometimes can contain an out-of-range
page number, which will trigger out-of-bounds accesses in
PDFiumEngine::GetNamedDestination().

This CL makes PDFiumEngine::GetNamedDestination() treat an invalid page
number as an error and return an empty result. Also adds a unit test
for this function to test getting both valid and invalid page
destinations.

Bug: 1333374
Change-Id: I8a62274146430c6f4bf170f652d4b158d907924b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3696844
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Nigi <nigi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1012771}
2022-06-09 23:39:42 +00:00
abaa64513d Migrate remaining PdfViewPluginBase tests
Migrates all of the remaining PdfViewPluginBase tests.

Drops the existing PdfViewWebPluginMouseEventsTest.HandleInputEvent and
PdfViewWebPluginTest.SetCaretPositionIgnoresOrigin tests, as they're
redundant with the migrated tests.

Fixed: 1323307
Change-Id: I74129c23250659a894baec600f91fcfa4767c80b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3698751
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1012756}
2022-06-09 23:08:25 +00:00
6ec3253076 [pdf] Migrate SelectionChanged() tests
Migrates tests exercising PdfViewPluginBase's SelectionChanged() method.

Bug: 1323307
Change-Id: Idb07492c76e2063a8203968680ed7839e7f5a426
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3696190
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1012749}
2022-06-09 22:47:32 +00:00
2951161f57 Delete PdfViewPluginBase::plugin_offset_in_frame()
Deletes PdfViewPluginBase::plugin_offset_in_frame(), as the unseasoned
plugin always uses an offset of 0 (see crbug.com/1270502).

Bug: 1302059
Change-Id: I8bb38652ba4824620e38e5449901073374913350
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3698784
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1012699}
2022-06-09 21:13:03 +00:00
b75dba0f30 Simplify message parsing in PdfViewWebPluginTest
Adds a ParseMessage() wrapper around base::test::ParseJson() that
returns a base::Value::Dict instead of a base::Value. This makes it
easier to construct test messages in a readable way.

Bug: 1323307
Change-Id: I3c8a3be545616103e5b305f9fbd1eee8b31e6634
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3698903
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1012672}
2022-06-09 20:17:25 +00:00
a6d49b0d74 [pdf] Migrate UpdateScroll() tests
Migrates tests exercising PdfViewPluginBase's UpdateScroll() method.

Also cleans up more dead code in pdf_view_plugin_base_unittest.cc.

Bug: 1323307
Change-Id: Id7e318c581282e02b4dd16dcaddabb31306df32c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3696528
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1012644}
2022-06-09 19:08:25 +00:00
aefb773cce [pdf] Migrate HandleViewportMessage() tests
Migrates tests exercising PdfViewPluginBase's HandleViewportMessage()
method.

Bug: 1323307
Change-Id: I803d592177aec7ac5d1960b073ee9d9fbe24bbf7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3696544
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1012615}
2022-06-09 18:17:35 +00:00
9dc6319127 [pdf] Migrate DocumentLoadProgress() tests
Migrates tests exercising PdfViewPluginBase's DocumentLoadProgress()
method.

Also cleans up some dead code in pdf_view_plugin_base_unittest.cc.

Bug: 1323307
Change-Id: I67896678871983f4fee0220c99b148f728281b12
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3697241
Commit-Queue: Lei Zhang <thestig@chromium.org>
Auto-Submit: K. Moon <kmoon@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1012613}
2022-06-09 18:09:10 +00:00
4ee171d2bf [pdf] Migrate remaining permission unit tests
Migrates remaining PdfViewPluginBase tests that rely on PDFiumEngine's
HasPermission() API.

Bug: 1323307
Change-Id: I04ee984bd561126e2fc84de054c0a087cb84cf9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3696918
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1012251}
2022-06-09 00:26:34 +00:00
fac20b00e9 [pdf] Migrate printing unit tests
Migrates PdfViewPluginBase tests that exercise printing.

Also replaces the ad hoc TestPDFiumEngine::SetPermissions() API with a
gMock-based equivalent.

Bug: 1323307
Change-Id: I6fe7cd54a5bc208990fccdbef16a6e5cdf7aa879
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3696484
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1012236}
2022-06-09 00:02:08 +00:00
8f314aee5a Delete PdfViewPluginBase::InitializeBase()
Deletes PdfViewPluginBase::InitializeBase(), consolidating remaining
initialization logic in PdfViewWebPlugin::InitializeCommon().

Bug: 1302059
Change-Id: If4025ced3112d5f32c0d41038ecb0ce0f0c1bbe8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3691872
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1011742}
2022-06-07 23:43:25 +00:00
c74d944168 Migrate PdfViewPluginBase::full_frame_
Migrates full_frame_ from PdfViewPluginBase to PdfViewWebPlugin.

Bug: 1302059
Change-Id: I0ce266d98b5c4f9b8d08a6e84bdde53b50b79e48
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3690629
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1011714}
2022-06-07 23:11:34 +00:00
045bd3e455 [pdf] Migrate EnableAccessibility() tests
Migrates tests exercising PdfViewPluginBase's EnableAccessibility()
method.

Bug: 1323307
Change-Id: I88405b31fd09b2abf772385f3c35d7d87ebc7da5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3691865
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1011694}
2022-06-07 22:04:07 +00:00
36ec3c6796 Move PostTask() calls to PdfAccessibilityTree
Moves accessibility-related PostTask() calls from PdfViewWebPlugin to
PdfAccessibilityTree. This makes it easier to test the calls to
PdfAccessibilityDataHandler by making them synchronous.

Note that the accessibility operations are asynchronous in order to fix
crbug.com/1274376, but this essentially is an implementation detail of
PdfAccessibilityTree (which triggers layout), rather than being
fundamental to all PdfAccessibilityDataHandler implementations.

Bug: 1323307
Change-Id: Ibcfc0ab2a1b44f55430f0c31f420b77069ec3b29
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3692602
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1011669}
2022-06-07 21:26:00 +00:00
1d4d189871 [pdf] Remove use of base::DictStorage and base::ListStorage.
Both of these are deprecated. Switch to base::Dict and base::List
instead.

Bug: 1187001
Change-Id: If08fc836eeaa9a564681f5007deb2a59d280b945
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3689473
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1011488}
2022-06-07 16:32:18 +00:00
d0f4e869e8 Migrate basic DocumentLoadComplete tests
Migrates tests exercising the basic functionality of PdfViewPluginBase's
DocumentLoadComplete() method.

Adds a mock for TestPDFiumEngine::OnDocumentCanceled(), to avoid
inheriting the default implementation from PDFiumEngine. This simplifies
testing loading.

Also renames the *.DocumentLoadCompletePostMessages tests to
*.OnDocumentLoadComplete, as these mainly test PdfViewWebPlugin's
OnDocumentLoadComplete() method, rather than DocumentLoadComplete()
itself.

Bug: 1323307
Change-Id: I4c91cd9562499f5096eeeeb8a3d6d884d2b0c8d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3688326
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1011487}
2022-06-07 16:30:57 +00:00
9c0be32fbe [pdf] Migrate DocumentHasUnsupportedFeature()
Migrates DocumentHasUnsupportedFeature() from PdfViewPluginBase to
PdfViewWebPlugin.

Bug: 1302059
Change-Id: I267d5a103712c37b2889f566243489855a32ea84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3690289
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Nigi <nigi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1011050}
2022-06-06 16:31:54 +00:00
18742cc39b [pdf] Migrate DocumentHasUnsupportedFeature() tests
Migrates tests exercising PdfViewPluginBase's
DocumentHasUnsupportedFeature() method.

Bug: 1323307
Change-Id: I6fa71c619c0f0a430b314f4078fca8970a7e08d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3689708
Reviewed-by: Nigi <nigi@chromium.org>
Auto-Submit: K. Moon <kmoon@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Commit-Queue: Nigi <nigi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1011047}
2022-06-06 16:21:54 +00:00
86b26bb4bd Delete PDF.IsTagged histogram
Deletes the PDF.IsTagged histogram, which expired after 2022-04-17, and
is no longer needed.

Fixed: 1303763
Change-Id: Ibfbef948a659b35aa57f8f0c2b300fe6a0f7afd6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3669229
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Alan Screen <awscreen@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1009717}
2022-06-01 18:27:41 +00:00
8c5aba7296 Migrate PdfViewPluginBase::HandleSaveMessage()
Migrates HandleSaveMessage() from PdfViewPluginBase to PdfViewWebPlugin.

Bug: 1323307
Change-Id: Idbece51e91645ce11746b3f934140a08bc8e4104
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3662129
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Auto-Submit: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1007947}
2022-05-26 19:28:51 +00:00
d7abc96f14 [pdf] Migrate HandleSaveMessage() tests
Migrates tests exercising PdfViewPluginBase::HandleSaveMessage().

Also splits TestPDFiumEngine::kSaveData into two separate constants to
distinguish between initially loaded data, and modified data to save.

Bug: 1323307
Change-Id: I6627f233eee94c56456cbbc77edeb09f28787bc0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3664682
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1007224}
2022-05-25 04:13:47 +00:00
6d14c3a000 Simplify pdf::mojom::PdfService usage
Simplifies usage of pdf::mojom::PdfService:

1. Don't handle unbound remotes; unit tests pass in a (fake) bound
   remote as of r1005941.
2. Use mojo::AssociatedRemote like a smart pointer; don't use get().
3. Rename "pdf_service_remote" to "pdf_service"; the type of endpoint
   usually is clear from context.

Bug: 1302059
Change-Id: Id27820c585b9fa26dc0259404d0a0f4f2ea8b2be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3658347
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Nigi <nigi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1006593}
2022-05-23 20:50:52 +00:00
e22ef3cdf6 Migrate PdfViewPluginBase::GetBackgroundColor()
Migrates GetBackgroundColor() from PdfViewPluginBase to
PdfViewWebPlugin.

Also makes PDFEngine::Client::GetBackgroundColor() const.

Bug: 1323307
Change-Id: I7a9a707f2a3593804ff2fb2584c7895a0f4ed0ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3656546
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1006585}
2022-05-23 20:33:52 +00:00
7d31c2b352 Migrate PdfViewPluginBase::IsPrintPreview()
Migrates IsPrintPreview() from PdfViewPluginBase to PdfViewWebPlugin.

Bug: 1302059
Change-Id: I2f66a59e79f001c1d3178ec64ef97bd3b10267b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3657934
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1006581}
2022-05-23 20:28:32 +00:00
aee09ed0cb Migrate PdfViewPluginBase::CreateUrlLoader()
Migrates CreateUrlLoader() from PdfViewPluginBase to PdfViewWebPlugin.

Bug: 1322928
Change-Id: I62e4b4d5c0b934c7a0631b0cbbf231bd9022873b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3652914
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1006561}
2022-05-23 19:50:11 +00:00
b0f3ca7cd6 Eliminate base::LowerCaseEqualsASCII() in /pdf
This CL is a behavior-preserving refactor. It replaces calls to
base::LowerCaseEqualsASCII() with base::EqualsCaseInsensitiveASCII().

We are deprecating base::LowerCaseEqualsASCII() because its interface is
mildly surprising: it requires the second parameter to be lowercase.

See the design doc for more details.
https://docs.google.com/document/d/18zWV0zN4oAqMZpond1Ut0QviHUeHCSwCo08mqThwHkQ/edit?usp=sharing

This CL was uploaded by git cl split.

R=thestig@chromium.org

Bug: 1326529
Change-Id: Ib46471d54f9f9514dc3e9b91118b543dd4e5a29c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3657772
Auto-Submit: Dan McArdle <dmcardle@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1005995}
2022-05-20 22:25:47 +00:00
bbff175631 [pdf] Migrate DidStartLoading() and DidStopLoading()
Migrates PdfViewPluginBase's DidStartLoading() and DidStopLoading()
methods to PdfViewWebPlugin.

Bug: 1323307
Change-Id: Ieab4cac9427bdf2b1bd6ecb3aa8188d1eff0bb89
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3656668
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1005941}
2022-05-20 20:44:06 +00:00
f3329afdb3 Migrate PdfViewPluginBase::LoadUrl()
Migrates PdfViewPluginBase::LoadUrl() to PdfViewWebPlugin. A callback
replaces the `is_print_preview` parameter; resetting
`last_progress_sent_` is now handled by the caller.

Bug: 1322928
Change-Id: Id05012c07c89458ac6398ed3c18339bf5fbc67a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3645902
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1005465}
2022-05-19 23:31:53 +00:00
6e6aee20d7 [pdf] Migrate IsPrintPreview() tests
Migrates tests that rely on IsPrintPreview() returning true.

Bug: 1323307
Change-Id: I9089ee1e2365f7612c117ba1c111e297e85e460d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3655120
Reviewed-by: Nigi <nigi@chromium.org>
Auto-Submit: K. Moon <kmoon@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Commit-Queue: Nigi <nigi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1005302}
2022-05-19 17:29:27 +00:00
88b6cd88f2 Inject PDFiumEngine from PdfViewWebPlugin::Client
Injects PDFiumEngine from PdfViewWebPlugin::Client, in order to simplify
creating custom engines when testing PdfViewWebPlugin. The previous
approach of passing the engine to InitializeForTesting() doesn't support
the creation of additional engines, which Print Preview requires.

Also simplifies FakePdfViewWebPluginClient to use gMock consistently,
instead of implementing a handful of manual mocks.

Bug: 1323307
Change-Id: I9bc120f20b8f327d41e8bc983939db03793fd8e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3653003
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1004955}
2022-05-18 21:01:45 +00:00
42feac3bf0 Improve PdfViewWebPlugin unit tests
Various small improvements to the PdfViewWebPlugin unit tests:

1. Adds expectations on the URL load started by Initialize().
2. Adds an expectation on WebHttpBody::ElementCount(), to detect excess
   elements.
3. Improves CompleteURL() emulation by using an explicit document URL.
   This better matches the actual behavior, which resolves against the
   base URL of the embedding document, not PdfViewWebPlugin::GetURL().
4. Uses a valid document base URL; GURL does not accept "dummy.pdf".
5. More consistently converts blink::WebString to std::string, for
   better failure messages.

Bug: 1323307
Change-Id: I4da7ba86c19ef5c131417bcf2039dceabf1e91c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3649746
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1003962}
2022-05-16 21:55:40 +00:00
d74a56d2d0 Migrate PdfViewPluginBase::SubmitForm()
Migrates SubmitForm() from PdfViewPluginBase to PdfViewWebPlugin.

Bug: 1322928
Change-Id: I113f3c4f8e610ce27f1c80b1346c4e14bc053b27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3646512
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1003583}
2022-05-15 22:55:06 +00:00
9572046fe2 Migrate PdfViewPluginBaseSubmitFormTest
Migrates PdfViewPluginBaseSubmitFormTest to work with PdfViewWebPlugin
instead of PdfViewPluginBase.

The InitializeWithEmptyUrl test replaces the EmptyDocumentUrl test, as
it's not possible to initialize a PdfViewWebPlugin with an empty
document URL.

Bug: 1323307
Change-Id: If4f0e1ba31a0575867540b370b5ef5c212c26af3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3647676
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Nigi <nigi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1003538}
2022-05-15 20:23:18 +00:00
7c79c462d6 Replace myself with mlippautz@ for V8 / gin related directories
Change-Id: I44d668e748c1a1c5de6cdd77cb5626401912b979
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3647742
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1003534}
2022-05-15 20:21:08 +00:00