diff --git a/BUILD.gn b/BUILD.gn index 89fff8cc..d42efcb 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -26,7 +26,6 @@ import("//media/media_options.gni") import("//remoting/remoting_enable.gni") import("//third_party/closure_compiler/compile_js.gni") -import("//third_party/openh264/openh264_args.gni") import("//tools/ipc_fuzzer/ipc_fuzzer.gni") import("//ui/base/ui_features.gni") import("//ui/gl/features.gni") @@ -684,14 +683,6 @@ ] } - if (use_openh264) { - deps += [ - "//third_party/openh264:common", - "//third_party/openh264:encoder", - "//third_party/openh264:processing", - ] - } - if (enable_message_center) { deps += [ "//ui/message_center:message_center_unittests" ] }
diff --git a/DEPS b/DEPS index c7c9bf1..b85e1d9 100644 --- a/DEPS +++ b/DEPS
@@ -199,11 +199,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '80dc74b30b5a50f133de6e8985d1c10a0c0f380e', + 'skia_revision': '88883c4ca259aa1340286c3a0f85fe97a911292d', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': 'c4b600873d9668aeeb4f28e20f86d82b5c75379c', + 'v8_revision': 'b96d7e2a4be85264b9cd7ba26d91f7fb98baa9a5', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -211,7 +211,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': 'ed9213bca0643edb65b7d39a938210419398a1b3', + 'angle_revision': '4ebcee3eb02ffdd586e20965b9c4bb609876db36', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -274,7 +274,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': '2d25220a33955364a5d806c265cd1d161b03f0d9', + 'devtools_frontend_revision': 'cde5182f7aa484bea3ea9d2ba2a5f49b2cfd738a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -1514,7 +1514,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '3c2fe3888658d82b47ca831d59a2e07579619c2d', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'd7f750f7be4b2f61018d3cb55a995d09daa226e6', + Var('webrtc_git') + '/src.git' + '@' + 'ef9c4e07a351c9396c72e72efaa1be3df728c440', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1586,7 +1586,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@fedff31db07933f52e860a4fa75744c90c71a383', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@3974e673643526eb5e4050be7da7abcc86e70699', 'condition': 'checkout_src_internal', }, @@ -1605,7 +1605,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/media_app/app', - 'version': 'cLMbR5hrZxbw11Uo04_qMEm4sHJn3Ur2ZPVxIm1LhUQC', + 'version': '97cSjc_Tjv810DAVmAh-xqhwbphGqNsTmBJluRhxfZ8C', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/base/process/launch.h b/base/process/launch.h index c87312b..04228c7 100644 --- a/base/process/launch.h +++ b/base/process/launch.h
@@ -20,7 +20,6 @@ #include "base/process/process.h" #include "base/process/process_handle.h" #include "base/strings/string_piece.h" -#include "base/threading/thread_restrictions.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" @@ -430,17 +429,6 @@ BASE_EXPORT pid_t ForkWithFlags(unsigned long flags, pid_t* ptid, pid_t* ctid); #endif -namespace internal { - -// Friend and derived class of ScopedAllowBaseSyncPrimitives which allows -// GetAppOutputInternal() to join a process. GetAppOutputInternal() can't itself -// be a friend of ScopedAllowBaseSyncPrimitives because it is in the anonymous -// namespace. -class GetAppOutputScopedAllowBaseSyncPrimitives - : public base::ScopedAllowBaseSyncPrimitives {}; - -} // namespace internal - } // namespace base #endif // BASE_PROCESS_LAUNCH_H_
diff --git a/base/process/launch_fuchsia.cc b/base/process/launch_fuchsia.cc index 1a44938d..fe39f485 100644 --- a/base/process/launch_fuchsia.cc +++ b/base/process/launch_fuchsia.cc
@@ -21,8 +21,6 @@ #include "base/memory/ptr_util.h" #include "base/process/environment_internal.h" #include "base/scoped_generic.h" -#include "base/threading/scoped_blocking_call.h" -#include "base/trace_event/base_tracing.h" namespace base { @@ -33,7 +31,6 @@ std::string* output, int* exit_code) { DCHECK(exit_code); - TRACE_EVENT0("base", "GetAppOutput"); LaunchOptions options; @@ -63,10 +60,6 @@ } close(pipe_fd[0]); - // It is okay to allow this process to wait on the launched process as a - // process launched with GetAppOutput*() shouldn't wait back on the process - // that launched it. - internal::GetAppOutputScopedAllowBaseSyncPrimitives allow_wait; return process.WaitForExit(exit_code); }
diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc index d3396d98..c074f0d 100644 --- a/base/process/launch_mac.cc +++ b/base/process/launch_mac.cc
@@ -36,6 +36,13 @@ namespace base { +// Friend and derived class of ScopedAllowBaseSyncPrimitives which allows +// GetAppOutputInternal() to join a process. GetAppOutputInternal() can't itself +// be a friend of ScopedAllowBaseSyncPrimitives because it is in the anonymous +// namespace. +class GetAppOutputScopedAllowBaseSyncPrimitives + : public base::ScopedAllowBaseSyncPrimitives {}; + namespace { // DPSXCHECK is a Debug Posix Spawn Check macro. The posix_spawn* family of @@ -124,8 +131,6 @@ bool GetAppOutputInternal(const std::vector<std::string>& argv, GetAppOutputOptions* gao_options) { - TRACE_EVENT0("base", "GetAppOutput"); - ScopedFD read_fd, write_fd; { int pipefds[2]; @@ -167,10 +172,8 @@ } } while (read_this_pass > 0); - // It is okay to allow this process to wait on the launched process as a - // process launched with GetAppOutput*() shouldn't wait back on the process - // that launched it. - internal::GetAppOutputScopedAllowBaseSyncPrimitives allow_wait; + // Reap the child process. + GetAppOutputScopedAllowBaseSyncPrimitives allow_wait; if (!process.WaitForExit(&gao_options->exit_code)) { return false; }
diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc index 440975c74..e4ca8e4 100644 --- a/base/process/launch_posix.cc +++ b/base/process/launch_posix.cc
@@ -43,6 +43,7 @@ #include "base/threading/platform_thread.h" #include "base/threading/platform_thread_internal_posix.h" #include "base/threading/scoped_blocking_call.h" +#include "base/threading/thread_restrictions.h" #include "base/time/time.h" #include "base/trace_event/base_tracing.h" #include "build/build_config.h" @@ -69,6 +70,13 @@ namespace base { +// Friend and derived class of ScopedAllowBaseSyncPrimitives which allows +// GetAppOutputInternal() to join a process. GetAppOutputInternal() can't itself +// be a friend of ScopedAllowBaseSyncPrimitives because it is in the anonymous +// namespace. +class GetAppOutputScopedAllowBaseSyncPrimitives + : public base::ScopedAllowBaseSyncPrimitives {}; + #if !defined(OS_NACL_NONSFI) namespace { @@ -516,6 +524,7 @@ std::string* output, bool do_search_path, int* exit_code) { + ScopedBlockingCall scoped_blocking_call(FROM_HERE, BlockingType::MAY_BLOCK); // exit_code must be supplied so calling function can determine success. DCHECK(exit_code); *exit_code = EXIT_FAILURE; @@ -597,8 +606,6 @@ // write to the pipe). close(pipe_fd[1]); - TRACE_EVENT0("base", "GetAppOutput"); - output->clear(); while (true) { @@ -614,10 +621,9 @@ // Always wait for exit code (even if we know we'll declare // GOT_MAX_OUTPUT). Process process(pid); - // It is okay to allow this process to wait on the launched process as a - // process launched with GetAppOutput*() shouldn't wait back on the - // process that launched it. - internal::GetAppOutputScopedAllowBaseSyncPrimitives allow_wait; + // A process launched with GetAppOutput*() usually doesn't wait on the + // process that launched it and thus chances of deadlock are low. + GetAppOutputScopedAllowBaseSyncPrimitives allow_base_sync_primitives; return process.WaitForExit(exit_code); } }
diff --git a/base/process/launch_win.cc b/base/process/launch_win.cc index 0ead12e1..d47d49b 100644 --- a/base/process/launch_win.cc +++ b/base/process/launch_win.cc
@@ -25,9 +25,7 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/system/sys_info.h" -#include "base/threading/scoped_blocking_call.h" #include "base/threading/scoped_thread_priority.h" -#include "base/trace_event/base_tracing.h" #include "base/win/scoped_handle.h" #include "base/win/scoped_process_information.h" #include "base/win/startup_information.h" @@ -41,8 +39,6 @@ bool include_stderr, std::string* output, int* exit_code) { - TRACE_EVENT0("base", "GetAppOutput"); - HANDLE out_read = nullptr; HANDLE out_write = nullptr; @@ -117,13 +113,7 @@ } // Let's wait for the process to finish. - { - // It is okay to allow this process to wait on the launched process as a - // process launched with GetAppOutput*() shouldn't wait back on the process - // that launched it. - internal::GetAppOutputScopedAllowBaseSyncPrimitives allow_wait; - WaitForSingleObject(proc_info.process_handle(), INFINITE); - } + WaitForSingleObject(proc_info.process_handle(), INFINITE); TerminationStatus status = GetTerminationStatus(proc_info.process_handle(), exit_code);
diff --git a/base/process/process_fuchsia.cc b/base/process/process_fuchsia.cc index ae080ffa..3f71ea8 100644 --- a/base/process/process_fuchsia.cc +++ b/base/process/process_fuchsia.cc
@@ -12,10 +12,7 @@ #include "base/debug/activity_tracker.h" #include "base/fuchsia/default_job.h" #include "base/fuchsia/fuchsia_logging.h" -#include "base/optional.h" #include "base/strings/stringprintf.h" -#include "base/threading/thread_restrictions.h" -#include "base/trace_event/base_tracing.h" #if BUILDFLAG(CLANG_PROFILING) #include "base/test/clang_profiling.h" @@ -219,18 +216,8 @@ if (is_current_process_) return false; - TRACE_EVENT0("base", "Process::WaitForExitWithTimeout"); - // Record the event that this thread is blocking upon (for hang diagnosis). - Optional<debug::ScopedProcessWaitActivity> process_activity; - if (!timeout.is_zero()) { - process_activity.emplace(this); - // Assert that this thread is allowed to wait below. This intentionally - // doesn't use ScopedBlockingCallWithBaseSyncPrimitives because the process - // being waited upon tends to itself be using the CPU and considering this - // thread non-busy causes more issue than it fixes: http://crbug.com/905788 - internal::AssertBaseSyncPrimitivesAllowed(); - } + base::debug::ScopedProcessWaitActivity process_activity(this); zx_time_t deadline = timeout == TimeDelta::Max() ? ZX_TIME_INFINITE
diff --git a/base/process/process_posix.cc b/base/process/process_posix.cc index 51f5348..79235e0 100644 --- a/base/process/process_posix.cc +++ b/base/process/process_posix.cc
@@ -16,11 +16,9 @@ #include "base/debug/activity_tracker.h" #include "base/files/scoped_file.h" #include "base/logging.h" -#include "base/optional.h" #include "base/posix/eintr_wrapper.h" #include "base/process/kill.h" #include "base/threading/thread_restrictions.h" -#include "base/trace_event/base_tracing.h" #include "build/build_config.h" #if defined(OS_MAC) @@ -196,8 +194,6 @@ return false; } - TRACE_EVENT0("base", "Process::WaitForExitWithTimeout"); - const base::ProcessHandle parent_pid = base::GetParentProcessId(handle); const bool exited = (parent_pid < 0); @@ -347,16 +343,14 @@ } bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) const { - // Record the event that this thread is blocking upon (for hang diagnosis). - Optional<debug::ScopedProcessWaitActivity> process_activity; - if (!timeout.is_zero()) { - process_activity.emplace(this); - // Assert that this thread is allowed to wait below. This intentionally - // doesn't use ScopedBlockingCallWithBaseSyncPrimitives because the process - // being waited upon tends to itself be using the CPU and considering this - // thread non-busy causes more issue than it fixes: http://crbug.com/905788 + // Intentionally avoid instantiating ScopedBlockingCallWithBaseSyncPrimitives. + // In some cases, this function waits on a child Process doing CPU work. + // http://crbug.com/905788 + if (!timeout.is_zero()) internal::AssertBaseSyncPrimitivesAllowed(); - } + + // Record the event that this thread is blocking upon (for hang diagnosis). + base::debug::ScopedProcessWaitActivity process_activity(this); int local_exit_code = 0; bool exited = WaitForExitWithTimeoutImpl(Handle(), &local_exit_code, timeout);
diff --git a/base/process/process_win.cc b/base/process/process_win.cc index ccc152a6..abbfa18b 100644 --- a/base/process/process_win.cc +++ b/base/process/process_win.cc
@@ -8,10 +8,8 @@ #include "base/debug/activity_tracker.h" #include "base/logging.h" #include "base/numerics/safe_conversions.h" -#include "base/optional.h" #include "base/process/kill.h" #include "base/threading/thread_restrictions.h" -#include "base/trace_event/base_tracing.h" #include <windows.h> @@ -214,18 +212,14 @@ } bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) const { - TRACE_EVENT0("base", "Process::WaitForExitWithTimeout"); + // Intentionally avoid instantiating ScopedBlockingCallWithBaseSyncPrimitives. + // In some cases, this function waits on a child Process doing CPU work. + // http://crbug.com/905788 + if (!timeout.is_zero()) + internal::AssertBaseSyncPrimitivesAllowed(); // Record the event that this thread is blocking upon (for hang diagnosis). - Optional<debug::ScopedProcessWaitActivity> process_activity; - if (!timeout.is_zero()) { - process_activity.emplace(this); - // Assert that this thread is allowed to wait below. This intentionally - // doesn't use ScopedBlockingCallWithBaseSyncPrimitives because the process - // being waited upon tends to itself be using the CPU and considering this - // thread non-busy causes more issue than it fixes: http://crbug.com/905788 - internal::AssertBaseSyncPrimitivesAllowed(); - } + base::debug::ScopedProcessWaitActivity process_activity(this); // Limit timeout to INFINITE. DWORD timeout_ms = saturated_cast<DWORD>(timeout.InMilliseconds());
diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h index 67146a4..cc1ca9ba 100644 --- a/base/threading/thread_restrictions.h +++ b/base/threading/thread_restrictions.h
@@ -266,7 +266,6 @@ namespace remoting { class AutoThread; -class ScopedBypassIOThreadRestrictions; namespace protocol { class ScopedAllowThreadJoinForWebRtcTransport; } @@ -318,7 +317,6 @@ } namespace internal { -class GetAppOutputScopedAllowBaseSyncPrimitives; class JobTaskSource; class TaskTracker; } @@ -326,6 +324,7 @@ class AdjustOOMScoreHelper; class FileDescriptorWatcher; class FilePath; +class GetAppOutputScopedAllowBaseSyncPrimitives; class ScopedAllowThreadRecallForStackSamplingProfiler; class SimpleThread; class StackSamplingProfiler; @@ -401,7 +400,6 @@ friend class mojo::CoreLibraryInitializer; friend class printing::LocalPrinterHandlerDefault; friend class printing::PrintJobWorker; - friend class remoting::ScopedBypassIOThreadRestrictions; // crbug.com/1144161 friend class resource_coordinator::TabManagerDelegate; // crbug.com/778703 friend class web::WebSubThread; friend class weblayer::BrowserContextImpl; @@ -452,7 +450,7 @@ // Allowed usage: friend class SimpleThread; friend class ::ChromeNSSCryptoModuleDelegate; - friend class base::internal::GetAppOutputScopedAllowBaseSyncPrimitives; + friend class base::GetAppOutputScopedAllowBaseSyncPrimitives; friend class blink::SourceStream; friend class blink::WorkerThread; friend class blink::scheduler::WorkerThread;
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 81b433cf..a0251159 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -0.20201219.1.1 +0.20201221.0.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 81b433cf..a0251159 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -0.20201219.1.1 +0.20201221.0.1
diff --git a/chrome/VERSION b/chrome/VERSION index 45e4f4a5..95be3f3 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=89 MINOR=0 -BUILD=4361 +BUILD=4363 PATCH=0
diff --git a/chrome/android/java/res/layout/account_picker_bottom_sheet_header.xml b/chrome/android/java/res/layout/account_picker_bottom_sheet_header.xml index 8ca2608..2a69bea 100644 --- a/chrome/android/java/res/layout/account_picker_bottom_sheet_header.xml +++ b/chrome/android/java/res/layout/account_picker_bottom_sheet_header.xml
@@ -30,6 +30,7 @@ android:layout_marginStart="24dp" android:layout_marginEnd="24dp" android:layout_marginBottom="16dp" + android:focusable="true" android:gravity="center_horizontal" android:textAppearance="@style/TextAppearance.TextMedium.Secondary" android:text="@string/signin_account_picker_bottom_sheet_subtitle"
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/read_later/ReadLaterIPHController.java b/chrome/android/java/src/org/chromium/chrome/browser/read_later/ReadLaterIPHController.java index ec2227c..c0df10e2 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/read_later/ReadLaterIPHController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/read_later/ReadLaterIPHController.java
@@ -44,6 +44,10 @@ */ public void onCopyContextMenuItemClicked() { if (!ChromeFeatureList.isEnabled(ChromeFeatureList.READ_LATER)) return; + if (ChromeFeatureList.isEnabled( + ChromeFeatureList.TABBED_APP_OVERFLOW_MENU_THREE_BUTTON_ACTIONBAR)) { + return; + } mUserEducationHelper.requestShowIPH( new IPHCommandBuilder(mToolbarMenuButton.getContext().getResources(), FeatureConstants.READ_LATER_APP_MENU_BOOKMARK_THIS_PAGE_FEATURE, @@ -65,6 +69,10 @@ private void showReadLaterAppMenuBookmarksIPH() { if (!ChromeFeatureList.isEnabled(ChromeFeatureList.READ_LATER)) return; + if (ChromeFeatureList.isEnabled( + ChromeFeatureList.TABBED_APP_OVERFLOW_MENU_THREE_BUTTON_ACTIONBAR)) { + return; + } mUserEducationHelper.requestShowIPH( new IPHCommandBuilder(mToolbarMenuButton.getContext().getResources(), FeatureConstants.READ_LATER_APP_MENU_BOOKMARKS_FEATURE,
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/read_later/ReadLaterIphTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/read_later/ReadLaterIphTest.java index 76ef063..55c0da4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/read_later/ReadLaterIphTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/read_later/ReadLaterIphTest.java
@@ -111,8 +111,13 @@ RevampedContextMenuUtils.selectContextMenuItem(InstrumentationRegistry.getInstrumentation(), activity, tab, CONTEXT_MENU_LINK_DOM_ID, R.id.contextmenu_copy_link_address); - onView(withId(R.id.menu_button_wrapper)).check(matches(withHighlight(true))); - waitForHelpBubble(withText(R.string.reading_list_save_pages_for_later)); + boolean threeButtonActionBarEnabled = ChromeFeatureList.isEnabled( + ChromeFeatureList.TABBED_APP_OVERFLOW_MENU_THREE_BUTTON_ACTIONBAR); + onView(withId(R.id.menu_button_wrapper)) + .check(matches(withHighlight(!threeButtonActionBarEnabled))); + if (!threeButtonActionBarEnabled) { + waitForHelpBubble(withText(R.string.reading_list_save_pages_for_later)); + } } @Test
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index 6b79faeb..7c77b0f 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp
@@ -5405,6 +5405,9 @@ <message name="IDS_CAMERA_MIC_NOTIFICATION_SOURCE" desc="The name of the source of a 'camera and mic' notification"> Camera & microphone </message> + <message name="IDS_CHROME_OS_NOTIFICATION_SOURCE" desc="The name of the source of a Chrome OS notificatoin"> + Chrome OS + </message> <message name="IDS_APP_USING_CAMERA_NOTIFICATION_MESSAGE" desc="Message shown in notification when an app is using the camera"> <ph name="APP_NAME">$1<ex>Parallels Desktop</ex></ph> is using your camera </message>
diff --git a/chrome/app/chromeos_strings_grdp/IDS_CHROME_OS_NOTIFICATION_SOURCE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_CHROME_OS_NOTIFICATION_SOURCE.png.sha1 new file mode 100644 index 0000000..f07e71c1 --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_CHROME_OS_NOTIFICATION_SOURCE.png.sha1
@@ -0,0 +1 @@ +234e0982d252ad24116e6de2905ab9eab7274c07 \ No newline at end of file
diff --git a/chrome/browser/chrome_navigation_browsertest.cc b/chrome/browser/chrome_navigation_browsertest.cc index 6926249..26bef37 100644 --- a/chrome/browser/chrome_navigation_browsertest.cc +++ b/chrome/browser/chrome_navigation_browsertest.cc
@@ -367,7 +367,7 @@ // This corresponds to "Open link in new tab". content::ContextMenuParams params; params.is_editable = false; - params.media_type = blink::ContextMenuDataMediaType::kNone; + params.media_type = blink::mojom::ContextMenuDataMediaType::kNone; params.page_url = initial_url; params.link_url = new_tab_url;
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index d976ddb..c744f28 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -1086,6 +1086,8 @@ "crostini/ansible/ansible_management_service_factory.h", "crostini/crostini_disk.cc", "crostini/crostini_disk.h", + "crostini/crostini_engagement_metrics_service.cc", + "crostini/crostini_engagement_metrics_service.h", "crostini/crostini_export_import.cc", "crostini/crostini_export_import.h", "crostini/crostini_export_import_notification_controller.cc", @@ -2927,6 +2929,8 @@ "web_applications/terminal_source.h", "web_applications/terminal_system_web_app_info.cc", "web_applications/terminal_system_web_app_info.h", + "web_applications/terminal_ui.cc", + "web_applications/terminal_ui.h", "wilco_dtc_supportd/fake_wilco_dtc_supportd_client.cc", "wilco_dtc_supportd/fake_wilco_dtc_supportd_client.h", "wilco_dtc_supportd/wilco_dtc_supportd_bridge.cc",
diff --git a/chrome/browser/chromeos/browser_context_keyed_service_factories.cc b/chrome/browser/chromeos/browser_context_keyed_service_factories.cc index fec3b82..5339a0f3 100644 --- a/chrome/browser/chromeos/browser_context_keyed_service_factories.cc +++ b/chrome/browser/chromeos/browser_context_keyed_service_factories.cc
@@ -10,6 +10,7 @@ #include "chrome/browser/chromeos/authpolicy/authpolicy_credentials_manager.h" #include "chrome/browser/chromeos/bluetooth/debug_logs_manager_factory.h" #include "chrome/browser/chromeos/cert_provisioning/cert_provisioning_scheduler_user_service.h" +#include "chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.h" #include "chrome/browser/chromeos/extensions/file_manager/event_router_factory.h" #include "chrome/browser/chromeos/extensions/input_method_api.h" #include "chrome/browser/chromeos/extensions/login_screen/login_state/session_state_changed_event_dispatcher.h" @@ -61,6 +62,7 @@ cert_provisioning::CertProvisioningSchedulerUserServiceFactory::GetInstance(); chromeos::full_restore::FullRestoreServiceFactory::GetInstance(); CroshLoaderFactory::GetInstance(); + crostini::CrostiniEngagementMetricsService::Factory::GetInstance(); #if defined(USE_CUPS) CupsProxyServiceManagerFactory::GetInstance(); #endif
diff --git a/chrome/browser/chromeos/camera_mic/vm_camera_mic_manager.cc b/chrome/browser/chromeos/camera_mic/vm_camera_mic_manager.cc index 0c2d70b..0822e29 100644 --- a/chrome/browser/chromeos/camera_mic/vm_camera_mic_manager.cc +++ b/chrome/browser/chromeos/camera_mic/vm_camera_mic_manager.cc
@@ -256,24 +256,18 @@ return; } - const char* notifier_id = ash::kVmCameraMicNotifierId; - const gfx::VectorIcon* source_icon = nullptr; - int source_id; int message_id; if (type[static_cast<size_t>(DeviceType::kCamera)]) { source_icon = &::vector_icons::kVideocamIcon; if (type[static_cast<size_t>(DeviceType::kMic)]) { - source_id = IDS_CAMERA_MIC_NOTIFICATION_SOURCE; message_id = IDS_APP_USING_CAMERA_MIC_NOTIFICATION_MESSAGE; } else { - source_id = IDS_CAMERA_NOTIFICATION_SOURCE; message_id = IDS_APP_USING_CAMERA_NOTIFICATION_MESSAGE; } } else { DCHECK_EQ(type, kMicNotification); source_icon = &::vector_icons::kMicIcon; - source_id = IDS_MIC_NOTIFICATION_SOURCE; message_id = IDS_APP_USING_MIC_NOTIFICATION_MESSAGE; } @@ -303,10 +297,11 @@ l10n_util::GetStringUTF16(app_name_id)), /*message=*/base::string16(), /*icon=*/gfx::Image(), - /*display_source=*/l10n_util::GetStringUTF16(source_id), + /*display_source=*/ + l10n_util::GetStringUTF16(IDS_CHROME_OS_NOTIFICATION_SOURCE), /*origin_url=*/GURL(), message_center::NotifierId(message_center::NotifierType::SYSTEM_COMPONENT, - notifier_id), + ash::kVmCameraMicNotifierId), rich_notification_data, base::MakeRefCounted<message_center::ThunkNotificationDelegate>( std::move(notification_observer_)));
diff --git a/chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.cc b/chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.cc new file mode 100644 index 0000000..fb6fee20 --- /dev/null +++ b/chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.cc
@@ -0,0 +1,77 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.h" + +#include "chrome/browser/chromeos/crostini/crostini_features.h" +#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" +#include "chrome/browser/chromeos/crostini/crostini_util.h" +#include "chrome/browser/profiles/profile.h" +#include "components/keyed_service/content/browser_context_dependency_manager.h" + +namespace crostini { + +constexpr char kUmaPrefix[] = "Crostini"; + +CrostiniEngagementMetricsService* +CrostiniEngagementMetricsService::Factory::GetForProfile(Profile* profile) { + return static_cast<CrostiniEngagementMetricsService*>( + GetInstance()->GetServiceForBrowserContext(profile, true)); +} + +CrostiniEngagementMetricsService::Factory* +CrostiniEngagementMetricsService::Factory::GetInstance() { + static base::NoDestructor<CrostiniEngagementMetricsService::Factory> factory; + return factory.get(); +} + +CrostiniEngagementMetricsService::Factory::Factory() + : BrowserContextKeyedServiceFactory( + "CrostiniEngagementMetricsService", + BrowserContextDependencyManager::GetInstance()) {} + +CrostiniEngagementMetricsService::Factory::~Factory() = default; + +KeyedService* +CrostiniEngagementMetricsService::Factory::BuildServiceInstanceFor( + content::BrowserContext* context) const { + Profile* profile = Profile::FromBrowserContext(context); + return new CrostiniEngagementMetricsService(profile); +} + +bool CrostiniEngagementMetricsService::Factory:: + ServiceIsCreatedWithBrowserContext() const { + return true; +} + +bool CrostiniEngagementMetricsService::Factory::ServiceIsNULLWhileTesting() + const { + // Checking whether Crostini is allowed requires more setup than is present + // in most unit tests. + return true; +} + +CrostiniEngagementMetricsService::CrostiniEngagementMetricsService( + Profile* profile) { + if (!CrostiniFeatures::Get()->IsEnabled(profile)) + return; + guest_os_engagement_metrics_ = + std::make_unique<guest_os::GuestOsEngagementMetrics>( + profile->GetPrefs(), base::BindRepeating(IsCrostiniWindow), + prefs::kEngagementPrefsPrefix, kUmaPrefix); +} + +CrostiniEngagementMetricsService::~CrostiniEngagementMetricsService() = default; + +void CrostiniEngagementMetricsService::SetBackgroundActive( + bool background_active) { + // If policy changes to enable Crostini, we won't have created the helper + // object. This should be relatively rare so for now we don't track this + // case. + if (!guest_os_engagement_metrics_) + return; + guest_os_engagement_metrics_->SetBackgroundActive(background_active); +} + +} // namespace crostini
diff --git a/chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.h b/chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.h new file mode 100644 index 0000000..7878d5e --- /dev/null +++ b/chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.h
@@ -0,0 +1,56 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_ENGAGEMENT_METRICS_SERVICE_H_ +#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_ENGAGEMENT_METRICS_SERVICE_H_ + +#include "base/macros.h" +#include "base/no_destructor.h" +#include "components/guest_os/guest_os_engagement_metrics.h" +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" +#include "components/keyed_service/core/keyed_service.h" + +class Profile; + +namespace crostini { + +// A KeyedService for tracking engagement with Crostini, reporting values as +// per GuestOsEngagementMetrics. +class CrostiniEngagementMetricsService : public KeyedService { + public: + class Factory : public BrowserContextKeyedServiceFactory { + public: + static CrostiniEngagementMetricsService* GetForProfile(Profile* profile); + static Factory* GetInstance(); + + private: + friend class base::NoDestructor<Factory>; + + Factory(); + ~Factory() override; + + // BrowserContextKeyedServiceFactory: + KeyedService* BuildServiceInstanceFor( + content::BrowserContext* context) const override; + bool ServiceIsCreatedWithBrowserContext() const override; + bool ServiceIsNULLWhileTesting() const override; + }; + + explicit CrostiniEngagementMetricsService(Profile* profile); + ~CrostiniEngagementMetricsService() override; + + // This needs to be called when Crostini starts and stops being active so we + // can correctly track background active time. + void SetBackgroundActive(bool background_active); + + private: + std::unique_ptr<guest_os::GuestOsEngagementMetrics> + guest_os_engagement_metrics_; + + DISALLOW_COPY_AND_ASSIGN(CrostiniEngagementMetricsService); +}; + +} // namespace crostini + +#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_ENGAGEMENT_METRICS_SERVICE_H_
diff --git a/chrome/browser/chromeos/crostini/crostini_manager.cc b/chrome/browser/chromeos/crostini/crostini_manager.cc index f766a372..ca22a89 100644 --- a/chrome/browser/chromeos/crostini/crostini_manager.cc +++ b/chrome/browser/chromeos/crostini/crostini_manager.cc
@@ -29,6 +29,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/chromeos/crostini/ansible/ansible_management_service.h" +#include "chrome/browser/chromeos/crostini/crostini_engagement_metrics_service.h" #include "chrome/browser/chromeos/crostini/crostini_features.h" #include "chrome/browser/chromeos/crostini/crostini_manager_factory.h" #include "chrome/browser/chromeos/crostini/crostini_port_forwarder.h" @@ -2569,6 +2570,13 @@ return; ContainerId container_id(signal.vm_name(), signal.container_name()); + auto* engagement_metrics_service = + CrostiniEngagementMetricsService::Factory::GetForProfile(profile_); + // This is null in unit tests. + if (engagement_metrics_service) { + engagement_metrics_service->SetBackgroundActive(true); + } + running_containers_.emplace( signal.vm_name(), ContainerInfo(signal.container_name(), signal.container_username(), @@ -2667,6 +2675,14 @@ break; } } + if (running_containers_.empty()) { + auto* engagement_metrics_service = + CrostiniEngagementMetricsService::Factory::GetForProfile(profile_); + // This is null in unit tests. + if (engagement_metrics_service) { + engagement_metrics_service->SetBackgroundActive(false); + } + } } void CrostiniManager::OnInstallLinuxPackageProgress(
diff --git a/chrome/browser/chromeos/crostini/crostini_pref_names.cc b/chrome/browser/chromeos/crostini/crostini_pref_names.cc index 0d6a1ad..d8f9a72 100644 --- a/chrome/browser/chromeos/crostini/crostini_pref_names.cc +++ b/chrome/browser/chromeos/crostini/crostini_pref_names.cc
@@ -10,6 +10,7 @@ #include "base/values.h" #include "chrome/browser/chromeos/crostini/crostini_simple_types.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" +#include "components/guest_os/guest_os_prefs.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_registry_simple.h" @@ -85,6 +86,9 @@ const char kCrostiniArcAdbSideloadingUserPref[] = "crostini.arc_adb_sideloading.user_pref"; +// Prefix for storing engagement time data, per GuestOSEngagementMetrics. +const char kEngagementPrefsPrefix[] = "crostini.metrics"; + void RegisterProfilePrefs(PrefRegistrySimple* registry) { registry->RegisterBooleanPref(kCrostiniEnabled, false); registry->RegisterDictionaryPref(kCrostiniMimeTypes); @@ -129,6 +133,9 @@ registry->RegisterIntegerPref( kCrostiniArcAdbSideloadingUserPref, static_cast<int>(CrostiniArcAdbSideloadingUserAllowanceMode::kDisallow)); + + guest_os::prefs::RegisterEngagementProfilePrefs(registry, + kEngagementPrefsPrefix); } } // namespace prefs
diff --git a/chrome/browser/chromeos/crostini/crostini_pref_names.h b/chrome/browser/chromeos/crostini/crostini_pref_names.h index 98c8bf3..2f35dee 100644 --- a/chrome/browser/chromeos/crostini/crostini_pref_names.h +++ b/chrome/browser/chromeos/crostini/crostini_pref_names.h
@@ -42,6 +42,8 @@ extern const char kCrostiniLastDiskSize[]; extern const char kCrostiniPortForwarding[]; +extern const char kEngagementPrefsPrefix[]; + void RegisterProfilePrefs(PrefRegistrySimple* registry); } // namespace prefs
diff --git a/chrome/browser/chromeos/crostini/crostini_util.cc b/chrome/browser/chromeos/crostini/crostini_util.cc index 625f5c9b..4d584c4 100644 --- a/chrome/browser/chromeos/crostini/crostini_util.cc +++ b/chrome/browser/chromeos/crostini/crostini_util.cc
@@ -177,6 +177,9 @@ crostini_tracker->OnAppLaunchRequested(app_id, display_id); + auto* share_path = guest_os::GuestOsSharePath::GetForProfile(profile); + const auto vm_name = registration.VmName(); + // Share any paths not in crostini. The user will see the spinner while this // is happening. std::vector<base::FilePath> paths_to_share; @@ -196,7 +199,8 @@ "Cannot share file with crostini: " + url.DebugString()); } if (url.mount_filesystem_id() != - file_manager::util::GetCrostiniMountPointName(profile)) { + file_manager::util::GetCrostiniMountPointName(profile) && + !share_path->IsPathShared(vm_name, url.path())) { paths_to_share.push_back(url.path()); } launch_args.push_back(path.value()); @@ -207,8 +211,7 @@ display_id, std::move(launch_args), std::move(callback), true, ""); } else { - const auto vm_name = registration.VmName(); - guest_os::GuestOsSharePath::GetForProfile(profile)->SharePaths( + share_path->SharePaths( vm_name, std::move(paths_to_share), /*persist=*/false, base::BindOnce(OnSharePathForLaunchApplication, profile, app_id, std::move(registration), display_id, @@ -572,7 +575,12 @@ return *container_id; } -bool IsCrostiniWindow(aura::Window* window) { +bool IsCrostiniWindow(const aura::Window* window) { + // TODO(crbug/1158644): Non-Crostini apps (borealis, ...) have also been + // identifying as Crostini. For now they're less common, and as they become + // more productionised they get their own app type (e.g. lacros), but at some + // point we'll want to untangle these different types to e.g. avoid double + // counting in usage metrics. return window->GetProperty(aura::client::kAppType) == static_cast<int>(ash::AppType::CROSTINI_APP); }
diff --git a/chrome/browser/chromeos/crostini/crostini_util.h b/chrome/browser/chromeos/crostini/crostini_util.h index 3d8d20f..bae86682 100644 --- a/chrome/browser/chromeos/crostini/crostini_util.h +++ b/chrome/browser/chromeos/crostini/crostini_util.h
@@ -209,7 +209,7 @@ const ContainerId& DefaultContainerId(); -bool IsCrostiniWindow(aura::Window* window); +bool IsCrostiniWindow(const aura::Window* window); } // namespace crostini
diff --git a/chrome/browser/chromeos/input_method/autocorrect_manager.cc b/chrome/browser/chromeos/input_method/autocorrect_manager.cc index 12935d6..2bf4d24 100644 --- a/chrome/browser/chromeos/input_method/autocorrect_manager.cc +++ b/chrome/browser/chromeos/input_method/autocorrect_manager.cc
@@ -8,6 +8,7 @@ #include "base/strings/strcat.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/chromeos/input_method/assistive_window_properties.h" +#include "chrome/browser/chromeos/input_method/suggestion_enums.h" #include "chrome/grit/generated_resources.h" #include "ui/base/ime/chromeos/ime_bridge.h" #include "ui/base/ime/chromeos/ime_input_context_handler_interface.h" @@ -32,6 +33,14 @@ action); } +void RecordAssistiveCoverage(AssistiveType type) { + base::UmaHistogramEnumeration("InputMethod.Assistive.Coverage", type); +} + +void RecordAssistiveSuccess(AssistiveType type) { + base::UmaHistogramEnumeration("InputMethod.Assistive.Success", type); +} + constexpr int kKeysUntilAutocorrectWindowHides = 4; } // namespace @@ -54,6 +63,8 @@ ClearUnderline(); input_context->SetAutocorrectRange(autocorrect_range); + LogAssistiveAutocorrectAction(AutocorrectActions::kUnderlined); + RecordAssistiveCoverage(AssistiveType::kAutocorrectUnderlined); autocorrect_time_ = base::TimeTicks::Now(); } @@ -120,6 +131,7 @@ suggestion_handler_->SetAssistiveWindowProperties(context_id_, properties, &error); LogAssistiveAutocorrectAction(AutocorrectActions::kWindowShown); + RecordAssistiveCoverage(AssistiveType::kAutocorrectWindowShown); } key_presses_until_underline_hide_ = kKeysUntilAutocorrectWindowHides; } else if (window_visible) { @@ -179,6 +191,8 @@ surrounding_text.surrounding_text.substr(0, range.start())) + original_text_)); LogAssistiveAutocorrectAction(AutocorrectActions::kReverted); + RecordAssistiveCoverage(AssistiveType::kAutocorrectReverted); + RecordAssistiveSuccess(AssistiveType::kAutocorrectReverted); base::UmaHistogramMediumTimes("InputMethod.Assistive.Autocorrect.Delay", (base::TimeTicks::Now() - autocorrect_time_)); }
diff --git a/chrome/browser/chromeos/input_method/component_extension_ime_manager_delegate_impl.cc b/chrome/browser/chromeos/input_method/component_extension_ime_manager_delegate_impl.cc index 532a453..89779a8 100644 --- a/chrome/browser/chromeos/input_method/component_extension_ime_manager_delegate_impl.cc +++ b/chrome/browser/chromeos/input_method/component_extension_ime_manager_delegate_impl.cc
@@ -8,6 +8,7 @@ #include <algorithm> +#include "base/feature_list.h" #include "base/files/file_util.h" #include "base/json/json_string_value_serializer.h" #include "base/logging.h" @@ -24,6 +25,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/grit/browser_resources.h" +#include "chromeos/constants/chromeos_features.h" #include "chromeos/ime/input_methods.h" #include "extensions/browser/extension_pref_value_map.h" #include "extensions/browser/extension_pref_value_map_factory.h" @@ -231,11 +233,6 @@ const base::DictionaryValue& dict, ComponentExtensionEngine* out) { DCHECK(out); - std::string type; - if (!dict.GetString(extensions::manifest_keys::kType, &type)) - return false; - if (type != "ime") - return false; if (!dict.GetString(extensions::manifest_keys::kId, &out->engine_id)) return false; if (!dict.GetString(extensions::manifest_keys::kName, &out->display_name)) @@ -391,6 +388,14 @@ ComponentExtensionEngine engine; ReadEngineComponent(component_ime, *dictionary, &engine); + + if (base::StartsWith(engine.engine_id, "experimental_", + base::CompareCase::SENSITIVE) && + !base::FeatureList::IsEnabled( + chromeos::features::kMultilingualTyping)) { + continue; + } + component_ime.engines.push_back(engine); } out_imes->push_back(component_ime);
diff --git a/chrome/browser/chromeos/input_method/native_input_method_engine_browsertest.cc b/chrome/browser/chromeos/input_method/native_input_method_engine_browsertest.cc index 3118215..25c82e0b 100644 --- a/chrome/browser/chromeos/input_method/native_input_method_engine_browsertest.cc +++ b/chrome/browser/chromeos/input_method/native_input_method_engine_browsertest.cc
@@ -815,6 +815,55 @@ SetFocus(nullptr); } +IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, + SendsAutocorrectMetricsforUnderline) { + base::HistogramTester histogram_tester; + engine_->Enable(kEngineIdUs); + + TextInputTestHelper helper(GetBrowserInputMethod()); + SetUpTextInput(helper); + const base::string16 corrected_text = base::UTF8ToUTF16("corrected"); + const base::string16 typed_text = base::UTF8ToUTF16("typed"); + helper.GetTextInputClient()->InsertText( + corrected_text, + ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); + helper.WaitForSurroundingTextChanged(corrected_text); + EXPECT_EQ(ui::IMEBridge::Get() + ->GetInputContextHandler() + ->GetSurroundingTextInfo() + .surrounding_text, + corrected_text); + + histogram_tester.ExpectBucketCount("InputMethod.Assistive.Coverage", + AssistiveType::kAutocorrectWindowShown, 0); + engine_->OnAutocorrect("typed", "corrected", 0); + histogram_tester.ExpectBucketCount("InputMethod.Assistive.Coverage", + AssistiveType::kAutocorrectUnderlined, 1); + + histogram_tester.ExpectBucketCount("InputMethod.Assistive.Coverage", + AssistiveType::kAutocorrectWindowShown, 0); + // Move cursor into the corrected word, sending VKEY_LEFT fails, so use JS. + content::WebContents* tab = + browser()->tab_strip_model()->GetActiveWebContents(); + ASSERT_TRUE(content::ExecuteScript( + tab, "document.getElementById('text_id').setSelectionRange(2,2)")); + helper.WaitForSurroundingTextChanged(corrected_text, gfx::Range(2, 2)); + histogram_tester.ExpectBucketCount("InputMethod.Assistive.Coverage", + AssistiveType::kAutocorrectWindowShown, 1); + + histogram_tester.ExpectBucketCount("InputMethod.Assistive.Coverage", + AssistiveType::kAutocorrectReverted, 0); + DispatchKeyPress(ui::VKEY_UP, false); + DispatchKeyPress(ui::VKEY_RETURN, false); + + helper.WaitForSurroundingTextChanged(typed_text); + + histogram_tester.ExpectBucketCount("InputMethod.Assistive.Coverage", + AssistiveType::kAutocorrectReverted, 1); + + SetFocus(nullptr); +} + class NativeInputMethodEngineAssistiveOff : public InProcessBrowserTest { public: NativeInputMethodEngineAssistiveOff() {
diff --git a/chrome/browser/chromeos/input_method/suggestion_enums.h b/chrome/browser/chromeos/input_method/suggestion_enums.h index ad361feb..ad7772e 100644 --- a/chrome/browser/chromeos/input_method/suggestion_enums.h +++ b/chrome/browser/chromeos/input_method/suggestion_enums.h
@@ -19,7 +19,10 @@ kPersonalNumber = 7, // Deprecated, combined with kPersonalPhoneNumber kPersonalFirstName = 8, kPersonalLastName = 9, - kMaxValue = kPersonalLastName, + kAutocorrectWindowShown = 10, + kAutocorrectUnderlined = 11, + kAutocorrectReverted = 12, + kMaxValue = kAutocorrectReverted, }; enum class SuggestionStatus {
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_service_nss.cc b/chrome/browser/chromeos/platform_keys/platform_keys_service_nss.cc index 2d26e8d..a559c17 100644 --- a/chrome/browser/chromeos/platform_keys/platform_keys_service_nss.cc +++ b/chrome/browser/chromeos/platform_keys/platform_keys_service_nss.cc
@@ -826,6 +826,36 @@ base::BindOnce(&GenerateECKeyOnWorkerThread, std::move(state))); } +// Performs "raw" PKCS1 v1.5 padding + signing by calling PK11_Sign on +// |rsa_key|. +void SignRSAPKCS1RawOnWorkerThread(std::unique_ptr<SignState> state, + crypto::ScopedSECKEYPrivateKey rsa_key) { + static_assert( + sizeof(*state->data_.data()) == sizeof(char), + "Can't reinterpret data if it's characters are not 8 bit large."); + SECItem input = { + siBuffer, + reinterpret_cast<unsigned char*>(const_cast<char*>(state->data_.data())), + state->data_.size()}; + + // Compute signature of hash. + int signature_len = PK11_SignatureLen(rsa_key.get()); + if (signature_len <= 0) { + state->OnError(FROM_HERE, Status::kErrorInternal); + return; + } + + std::vector<unsigned char> signature(signature_len); + SECItem signature_output = {siBuffer, signature.data(), signature.size()}; + if (PK11_Sign(rsa_key.get(), &signature_output, &input) != SECSuccess) { + LOG(ERROR) << "Couldn't sign."; + state->OnError(FROM_HERE, Status::kErrorInternal); + return; + } + std::string signature_str(signature.begin(), signature.end()); + state->OnSuccess(FROM_HERE, signature_str); +} + // Does the actual RSA signing on a worker thread. void SignRSAOnWorkerThread(std::unique_ptr<SignState> state) { crypto::ScopedSECKEYPrivateKey rsa_key = @@ -837,63 +867,42 @@ return; } - std::string signature_str; if (state->raw_pkcs1_) { - static_assert( - sizeof(*state->data_.data()) == sizeof(char), - "Can't reinterpret data if it's characters are not 8 bit large."); - SECItem input = {siBuffer, - reinterpret_cast<unsigned char*>( - const_cast<char*>(state->data_.data())), - state->data_.size()}; - - // Compute signature of hash. - int signature_len = PK11_SignatureLen(rsa_key.get()); - if (signature_len <= 0) { - state->OnError(FROM_HERE, Status::kErrorInternal); - return; - } - - std::vector<unsigned char> signature(signature_len); - SECItem signature_output = {siBuffer, signature.data(), signature.size()}; - if (PK11_Sign(rsa_key.get(), &signature_output, &input) == SECSuccess) - signature_str.assign(signature.begin(), signature.end()); - } else { - SECOidTag sign_alg_tag = SEC_OID_UNKNOWN; - switch (state->hash_algorithm_) { - case HASH_ALGORITHM_SHA1: - sign_alg_tag = SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION; - break; - case HASH_ALGORITHM_SHA256: - sign_alg_tag = SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION; - break; - case HASH_ALGORITHM_SHA384: - sign_alg_tag = SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION; - break; - case HASH_ALGORITHM_SHA512: - sign_alg_tag = SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION; - break; - case HASH_ALGORITHM_NONE: - NOTREACHED(); - break; - } - - crypto::ScopedSECItem sign_result(SECITEM_AllocItem(nullptr, nullptr, 0)); - if (SEC_SignData( - sign_result.get(), - reinterpret_cast<const unsigned char*>(state->data_.data()), - state->data_.size(), rsa_key.get(), sign_alg_tag) == SECSuccess) { - signature_str.assign(sign_result->data, - sign_result->data + sign_result->len); - } + SignRSAPKCS1RawOnWorkerThread(std::move(state), std::move(rsa_key)); + return; } - if (signature_str.empty()) { + SECOidTag sign_alg_tag = SEC_OID_UNKNOWN; + switch (state->hash_algorithm_) { + case HASH_ALGORITHM_SHA1: + sign_alg_tag = SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION; + break; + case HASH_ALGORITHM_SHA256: + sign_alg_tag = SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION; + break; + case HASH_ALGORITHM_SHA384: + sign_alg_tag = SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION; + break; + case HASH_ALGORITHM_SHA512: + sign_alg_tag = SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION; + break; + case HASH_ALGORITHM_NONE: + NOTREACHED(); + break; + } + + crypto::ScopedSECItem sign_result(SECITEM_AllocItem(nullptr, nullptr, 0)); + if (SEC_SignData(sign_result.get(), + reinterpret_cast<const unsigned char*>(state->data_.data()), + state->data_.size(), rsa_key.get(), + sign_alg_tag) != SECSuccess) { LOG(ERROR) << "Couldn't sign."; state->OnError(FROM_HERE, Status::kErrorInternal); return; } + std::string signature_str(sign_result->data, + sign_result->data + sign_result->len); state->OnSuccess(FROM_HERE, signature_str); }
diff --git a/chrome/browser/chromeos/web_applications/OWNERS b/chrome/browser/chromeos/web_applications/OWNERS index db5ba103..da5b1851a 100644 --- a/chrome/browser/chromeos/web_applications/OWNERS +++ b/chrome/browser/chromeos/web_applications/OWNERS
@@ -8,6 +8,6 @@ per-file chrome_file_manager*=file://chromeos/components/file_manager/OWNERS per-file file_manager*=file://chromeos/components/file_manager/OWNERS per-file *media_app*=file://chromeos/components/media_app_ui/OWNERS -per-file terminal_source*=calamity@chromium.org -per-file terminal_source*=joelhockey@chromium.org +per-file terminal*=calamity@chromium.org +per-file terminal*=joelhockey@chromium.org per-file default_web_app_ids.h=jshikaram@chromium.org
diff --git a/chrome/browser/chromeos/web_applications/terminal_ui.cc b/chrome/browser/chromeos/web_applications/terminal_ui.cc new file mode 100644 index 0000000..fa1fed42 --- /dev/null +++ b/chrome/browser/chromeos/web_applications/terminal_ui.cc
@@ -0,0 +1,30 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/web_applications/terminal_ui.h" + +#include "chrome/browser/chromeos/web_applications/terminal_source.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/common/webui_url_constants.h" +#include "content/public/common/url_constants.h" +#include "url/gurl.h" + +TerminalUIConfig::TerminalUIConfig() + : WebUIConfig(content::kChromeUIUntrustedScheme, + chrome::kChromeUIUntrustedTerminalHost) {} + +TerminalUIConfig::~TerminalUIConfig() = default; + +std::unique_ptr<content::WebUIController> +TerminalUIConfig::CreateWebUIController(content::WebUI* web_ui) { + return std::make_unique<TerminalUI>(web_ui); +} + +TerminalUI::TerminalUI(content::WebUI* web_ui) + : ui::UntrustedWebUIController(web_ui) { + auto* profile = Profile::FromWebUI(web_ui); + content::URLDataSource::Add(profile, TerminalSource::ForTerminal(profile)); +} + +TerminalUI::~TerminalUI() = default;
diff --git a/chrome/browser/chromeos/web_applications/terminal_ui.h b/chrome/browser/chromeos/web_applications/terminal_ui.h new file mode 100644 index 0000000..2ff517a --- /dev/null +++ b/chrome/browser/chromeos/web_applications/terminal_ui.h
@@ -0,0 +1,32 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_WEB_APPLICATIONS_TERMINAL_UI_H_ +#define CHROME_BROWSER_CHROMEOS_WEB_APPLICATIONS_TERMINAL_UI_H_ + +#include "ui/webui/untrusted_web_ui_controller.h" +#include "ui/webui/webui_config.h" + +namespace content { +class WebUI; +} // namespace content + +class TerminalUIConfig : public ui::WebUIConfig { + public: + TerminalUIConfig(); + ~TerminalUIConfig() override; + + std::unique_ptr<content::WebUIController> CreateWebUIController( + content::WebUI* web_ui) override; +}; + +class TerminalUI : public ui::UntrustedWebUIController { + public: + explicit TerminalUI(content::WebUI* web_ui); + TerminalUI(const TerminalUI&) = delete; + TerminalUI& operator=(const TerminalUI&) = delete; + ~TerminalUI() override; +}; + +#endif // CHROME_BROWSER_CHROMEOS_WEB_APPLICATIONS_TERMINAL_UI_H_
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc index ef155c8a..7bec5f62c0 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc
@@ -23,7 +23,7 @@ #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" #include "net/test/embedded_test_server/embedded_test_server.h" -#include "third_party/blink/public/common/context_menu_data/media_type.h" +#include "third_party/blink/public/mojom/context_menu/context_menu_data.mojom.h" #if defined(OS_MAC) #include "chrome/test/base/launchservices_utils_mac.h" @@ -67,7 +67,7 @@ TestRenderViewContextMenu* CreateContextMenu(GURL url) { content::ContextMenuParams params; - params.media_type = blink::ContextMenuDataMediaType::kNone; + params.media_type = blink::mojom::ContextMenuDataMediaType::kNone; params.link_url = url; params.unfiltered_link_url = url; WebContents* web_contents =
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 7422d51..fbc815a 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc
@@ -2687,7 +2687,8 @@ DownloadManagerForBrowser(browser()), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); content::ContextMenuParams context_menu_params; - context_menu_params.media_type = blink::ContextMenuDataMediaType::kImage; + context_menu_params.media_type = + blink::mojom::ContextMenuDataMediaType::kImage; context_menu_params.src_url = url; context_menu_params.page_url = url; TestRenderViewContextMenu menu( @@ -2759,7 +2760,8 @@ DownloadManagerForBrowser(browser()), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); content::ContextMenuParams context_menu_params; - context_menu_params.media_type = blink::ContextMenuDataMediaType::kImage; + context_menu_params.media_type = + blink::mojom::ContextMenuDataMediaType::kImage; context_menu_params.src_url = GURL(data_url); context_menu_params.page_url = url; TestRenderViewContextMenu menu( @@ -2863,7 +2865,8 @@ DownloadManagerForBrowser(browser()), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); content::ContextMenuParams context_menu_params; - context_menu_params.media_type = blink::ContextMenuDataMediaType::kImage; + context_menu_params.media_type = + blink::mojom::ContextMenuDataMediaType::kImage; context_menu_params.src_url = jpeg_url; context_menu_params.page_url = jpeg_url; TestRenderViewContextMenu menu(web_contents->GetMainFrame(), @@ -3367,7 +3370,8 @@ DownloadManagerForBrowser(browser()), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); content::ContextMenuParams context_menu_params; - context_menu_params.media_type = blink::ContextMenuDataMediaType::kImage; + context_menu_params.media_type = + blink::mojom::ContextMenuDataMediaType::kImage; context_menu_params.page_url = url; context_menu_params.src_url = img_url; TestRenderViewContextMenu menu(
diff --git a/chrome/browser/extensions/api/font_settings/font_settings_api.cc b/chrome/browser/extensions/api/font_settings/font_settings_api.cc index 6d47d67d..aaa5b14 100644 --- a/chrome/browser/extensions/api/font_settings/font_settings_api.cc +++ b/chrome/browser/extensions/api/font_settings/font_settings_api.cc
@@ -26,7 +26,6 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/font_pref_change_notifier_factory.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/webui/settings_utils.h" #include "chrome/common/extensions/api/font_settings.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_names_util.h"
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc b/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc index 5526816..adb1a387 100644 --- a/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc +++ b/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc
@@ -544,8 +544,6 @@ // descriptors for component IME extensions are managed by InputMethodUtil. if (!comp_ext_ime_manager->IsAllowlistedExtension(extension_id)) { for (const auto& component : input_components) { - DCHECK(component.type == INPUT_COMPONENT_TYPE_IME); - // For legacy reasons, multiple physical keyboard XKB layouts can be // specified in the IME extension manifest for each input method. However, // CrOS only supports one layout per input method. Thus use the "first"
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc index b5a52ba..1382e2b 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
@@ -50,8 +50,8 @@ #include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_response.h" -#include "third_party/blink/public/common/context_menu_data/media_type.h" #include "third_party/blink/public/common/input/web_input_event.h" +#include "third_party/blink/public/mojom/context_menu/context_menu_data.mojom.h" using content::WebContents; @@ -333,7 +333,7 @@ // This corresponds to "Open link in new tab". content::ContextMenuParams params; params.is_editable = false; - params.media_type = blink::ContextMenuDataMediaType::kNone; + params.media_type = blink::mojom::ContextMenuDataMediaType::kNone; params.page_url = url; params.link_url = extension->GetResourceURL("b.html");
diff --git a/chrome/browser/extensions/menu_manager.cc b/chrome/browser/extensions/menu_manager.cc index 8f49c124..96656b8 100644 --- a/chrome/browser/extensions/menu_manager.cc +++ b/chrome/browser/extensions/menu_manager.cc
@@ -639,13 +639,13 @@ SetIdKeyValue(properties.get(), "parentMenuItemId", *item->parent_id()); switch (params.media_type) { - case blink::ContextMenuDataMediaType::kImage: + case blink::mojom::ContextMenuDataMediaType::kImage: properties->SetString("mediaType", "image"); break; - case blink::ContextMenuDataMediaType::kVideo: + case blink::mojom::ContextMenuDataMediaType::kVideo: properties->SetString("mediaType", "video"); break; - case blink::ContextMenuDataMediaType::kAudio: + case blink::mojom::ContextMenuDataMediaType::kAudio: properties->SetString("mediaType", "audio"); break; default: {} // Do nothing.
diff --git a/chrome/browser/extensions/menu_manager_unittest.cc b/chrome/browser/extensions/menu_manager_unittest.cc index 6b345762..f773e01 100644 --- a/chrome/browser/extensions/menu_manager_unittest.cc +++ b/chrome/browser/extensions/menu_manager_unittest.cc
@@ -579,7 +579,7 @@ &profile, base::BindRepeating(&MockEventRouterFactoryFunction))); content::ContextMenuParams params; - params.media_type = blink::ContextMenuDataMediaType::kImage; + params.media_type = blink::mojom::ContextMenuDataMediaType::kImage; params.src_url = GURL("http://foo.bar/image.png"); params.page_url = GURL("http://foo.bar"); params.selection_text = base::ASCIIToUTF16("Hello World");
diff --git a/chrome/browser/extensions/service_worker_apitest.cc b/chrome/browser/extensions/service_worker_apitest.cc index 1bad5b7..6f3f709b 100644 --- a/chrome/browser/extensions/service_worker_apitest.cc +++ b/chrome/browser/extensions/service_worker_apitest.cc
@@ -637,13 +637,19 @@ // ServiceWorkerTaskQueue::TestObserver: void DidStartWorkerFail(const ExtensionId& extension_id, - size_t num_pending_tasks) override { + size_t num_pending_tasks, + blink::ServiceWorkerStatusCode status_code) override { if (extension_id == extension_id_) { pending_tasks_count_at_worker_failure_ = num_pending_tasks; + status_code_ = status_code; run_loop_.Quit(); } } + base::Optional<blink::ServiceWorkerStatusCode> status_code() { + return status_code_; + } + private: // Holds number of pending tasks for worker at the time DidStartWorkerFail is // observed. @@ -651,6 +657,7 @@ ExtensionId extension_id_; base::RunLoop run_loop_; + base::Optional<blink::ServiceWorkerStatusCode> status_code_; }; // Test extension id at @@ -2078,6 +2085,8 @@ // And the task count will be reset to zero afterwards. EXPECT_EQ(0u, service_worker_task_queue->GetNumPendingTasksForTest(context_id)); + EXPECT_EQ(blink::ServiceWorkerStatusCode::kErrorNotFound, + worker_start_failure_observer.status_code()); } IN_PROC_BROWSER_TEST_F(ServiceWorkerBasedBackgroundTest,
diff --git a/chrome/browser/federated_learning/floc_id_provider_browsertest.cc b/chrome/browser/federated_learning/floc_id_provider_browsertest.cc index 374ebef..556ca2ba 100644 --- a/chrome/browser/federated_learning/floc_id_provider_browsertest.cc +++ b/chrome/browser/federated_learning/floc_id_provider_browsertest.cc
@@ -21,10 +21,10 @@ #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/sync/user_event_service_factory.h" #include "chrome/browser/ui/browser.h" -#include "chrome/common/chrome_features.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/content_settings/core/browser/cookie_settings.h" +#include "components/federated_learning/features/features.h" #include "components/federated_learning/floc_constants.h" #include "components/history/core/test/fake_web_history_service.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" @@ -152,7 +152,7 @@ public: FlocIdProviderWithCustomizedServicesBrowserTest() { scoped_feature_list_.InitAndEnableFeatureWithParameters( - features::kFederatedLearningOfCohorts, + kFederatedLearningOfCohorts, {{"minimum_history_domain_size_required", "1"}}); } @@ -224,38 +224,6 @@ return enumerator.urls(); } - std::pair<base::Time, base::Time> GetHistoryTimeRange() { - history::QueryOptions options; - options.duplicate_policy = history::QueryOptions::KEEP_ALL_DUPLICATES; - - base::Time history_begin_time = base::Time::Max(); - base::Time history_end_time = base::Time::Min(); - - base::RunLoop run_loop; - base::CancelableTaskTracker tracker; - HistoryServiceFactory::GetForProfile(browser()->profile(), - ServiceAccessType::EXPLICIT_ACCESS) - ->QueryHistory( - base::string16(), options, - base::BindLambdaForTesting([&](history::QueryResults results) { - for (const history::URLResult& url_result : results) { - if (!url_result.floc_allowed()) - continue; - - if (url_result.visit_time() < history_begin_time) - history_begin_time = url_result.visit_time(); - - if (url_result.visit_time() > history_end_time) - history_end_time = url_result.visit_time(); - } - run_loop.Quit(); - }), - &tracker); - run_loop.Run(); - - return {history_begin_time, history_end_time}; - } - void FinishOutstandingRemotePermissionQueries() { base::RunLoop run_loop; FlocRemotePermissionServiceFactory::GetForProfile(browser()->profile()) @@ -341,10 +309,8 @@ FinishOutstandingRemotePermissionQueries(); FinishOutstandingHistoryQueries(); - if (base::FeatureList::IsEnabled( - features::kFlocIdSortingLshBasedComputation)) { + if (base::FeatureList::IsEnabled(kFlocIdSortingLshBasedComputation)) FinishOutstandingSortingLshQueries(); - } } // Turn on sync-history. @@ -575,10 +541,10 @@ InitializeHistorySync(); // Promise resolved with the expected string. - EXPECT_EQ(FlocId(FlocId::SimHashHistory({test_host()}), base::Time(), - base::Time(), 0) - .ToStringForJsApi(), - InvokeInterestCohortJsApi(web_contents())); + EXPECT_EQ( + base::StrCat({base::NumberToString(FlocId::SimHashHistory({test_host()})), + ".1.0"}), + InvokeInterestCohortJsApi(web_contents())); } IN_PROC_BROWSER_TEST_F(FlocIdProviderWithCustomizedServicesBrowserTest, @@ -604,10 +570,10 @@ content::ChildFrameAt(web_contents()->GetMainFrame(), 0); // Promise resolved with the expected string. - EXPECT_EQ(FlocId(FlocId::SimHashHistory({test_host()}), base::Time(), - base::Time(), 0) - .ToStringForJsApi(), - InvokeInterestCohortJsApi(child)); + EXPECT_EQ( + base::StrCat({base::NumberToString(FlocId::SimHashHistory({test_host()})), + ".1.0"}), + InvokeInterestCohortJsApi(child)); } IN_PROC_BROWSER_TEST_F(FlocIdProviderWithCustomizedServicesBrowserTest, @@ -633,10 +599,10 @@ content::ChildFrameAt(web_contents()->GetMainFrame(), 0); // Promise resolved with the expected string. - EXPECT_EQ(FlocId(FlocId::SimHashHistory({test_host()}), base::Time(), - base::Time(), 0) - .ToStringForJsApi(), - InvokeInterestCohortJsApi(child)); + EXPECT_EQ( + base::StrCat({base::NumberToString(FlocId::SimHashHistory({test_host()})), + ".1.0"}), + InvokeInterestCohortJsApi(child)); } IN_PROC_BROWSER_TEST_F(FlocIdProviderWithCustomizedServicesBrowserTest, @@ -671,10 +637,10 @@ EXPECT_EQ("rejected", InvokeInterestCohortJsApi(child)); // Promise resolved with the expected string. - EXPECT_EQ(FlocId(FlocId::SimHashHistory({test_host()}), base::Time(), - base::Time(), 0) - .ToStringForJsApi(), - InvokeInterestCohortJsApi(web_contents())); + EXPECT_EQ( + base::StrCat({base::NumberToString(FlocId::SimHashHistory({test_host()})), + ".1.0"}), + InvokeInterestCohortJsApi(web_contents())); } class FlocIdProviderSortingLshEnabledBrowserTest @@ -683,9 +649,9 @@ FlocIdProviderSortingLshEnabledBrowserTest() { scoped_feature_list_.Reset(); scoped_feature_list_.InitWithFeaturesAndParameters( - {{features::kFederatedLearningOfCohorts, + {{kFederatedLearningOfCohorts, {{"minimum_history_domain_size_required", "1"}}}, - {features::kFlocIdSortingLshBasedComputation, {}}}, + {kFlocIdSortingLshBasedComputation, {}}}, {}); } }; @@ -701,9 +667,6 @@ browser(), https_server_.GetURL(test_host(), cookies_to_set)); EXPECT_EQ(1u, GetHistoryUrls().size()); - auto p = GetHistoryTimeRange(); - base::Time history_begin_time = p.first; - base::Time history_end_time = p.second; EXPECT_FALSE(GetFlocId().IsValid()); @@ -717,7 +680,7 @@ EXPECT_NE(0u, FlocId::SimHashHistory({test_host()})); // Expect that the final id is 0 because the sorting-lsh was applied. - EXPECT_EQ(FlocId(0, history_begin_time, history_end_time, 9), GetFlocId()); + EXPECT_EQ("0.1.9", InvokeInterestCohortJsApi(web_contents())); } IN_PROC_BROWSER_TEST_F(FlocIdProviderSortingLshEnabledBrowserTest,
diff --git a/chrome/browser/federated_learning/floc_id_provider_impl.cc b/chrome/browser/federated_learning/floc_id_provider_impl.cc index af25f1b..8961ed5 100644 --- a/chrome/browser/federated_learning/floc_id_provider_impl.cc +++ b/chrome/browser/federated_learning/floc_id_provider_impl.cc
@@ -14,8 +14,8 @@ #include "chrome/browser/net/profile_network_context_service_factory.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/sync/user_event_service_factory.h" -#include "chrome/common/chrome_features.h" #include "components/content_settings/core/browser/cookie_settings.h" +#include "components/federated_learning/features/features.h" #include "components/history/core/browser/history_service.h" #include "components/prefs/pref_service.h" #include "components/sync/driver/profile_sync_service.h" @@ -31,8 +31,48 @@ // The placeholder sorting-lsh version when the sorting-lsh feature is disabled. constexpr uint32_t kSortingLshVersionPlaceholder = 0; -base::TimeDelta GetFlocIdScheduledUpdateInterval() { - return features::kFlocIdScheduledUpdateInterval.Get(); +// Checks whether we can keep using the previous floc. If so, write to +// |next_compute_delay| the time period we should wait until the floc needs to +// be recomputed. +bool ShouldKeepUsingPreviousFloc(const FlocId& last_floc, + base::TimeDelta* next_compute_delay) { + // The floc has never been computed. This could happen with a fresh profile, + // or some early trigger conditions were never met (e.g. sync has been + // disabled). + if (last_floc.compute_time().is_null()) + return false; + + // The browser started with a kFlocIdFinchConfigVersion param different from + // the param when floc was computed last time. + // + // TODO(yaoxia): Ideally we want to compare the entire version that also + // includes the sorting-lsh version. We'll need to postpone those checks to + // a point where an existing sorting-lsh file would have been loaded, i.e. not + // too soon when the file is not ready yet, but not too late if the file + // wouldn't arrive due to e.g. component updater issue. + if (last_floc.finch_config_version() != + static_cast<uint32_t>(kFlocIdFinchConfigVersion.Get())) { + return false; + } + + base::TimeDelta presumed_next_compute_delay = + kFlocIdScheduledUpdateInterval.Get() + last_floc.compute_time() - + base::Time::Now(); + + // The last floc has expired. + if (presumed_next_compute_delay <= base::TimeDelta()) + return false; + + // This could happen if the machine time has changed since the last + // computation. Return false in order to keep computing the floc at the + // anticipated schedule rather than potentially stop computing for a very long + // time. + if (presumed_next_compute_delay >= 2 * kFlocIdScheduledUpdateInterval.Get()) + return false; + + *next_compute_delay = presumed_next_compute_delay; + + return true; } } // namespace @@ -49,23 +89,22 @@ cookie_settings_(std::move(cookie_settings)), floc_remote_permission_service_(floc_remote_permission_service), history_service_(history_service), - user_event_service_(user_event_service) { + user_event_service_(user_event_service), + floc_id_(FlocId::ReadFromPrefs(prefs_)) { history_service->AddObserver(this); sync_service_->AddObserver(this); g_browser_process->floc_sorting_lsh_clusters_service()->AddObserver(this); - base::Time last_compute_time = FlocId::ReadComputeTimeFromPrefs(prefs_); - - if (!last_compute_time.is_null()) { - base::TimeDelta time_since_last_compute = - base::Time::Now() - last_compute_time; - if (time_since_last_compute < GetFlocIdScheduledUpdateInterval()) { - // Keep using the last floc. Schedule a recompute event when it's - // |GetFlocIdScheduledUpdateInterval()| from the last compute time. - floc_id_ = FlocId::ReadFromPrefs(prefs_); - ScheduleFlocComputation(GetFlocIdScheduledUpdateInterval() - - time_since_last_compute); - } + // If the previous floc has expired, invalidate it. The next computation will + // be "immediate", i.e. will occur after we first observe that sync & + // sync-history is enabled and the SortingLSH file is loaded; otherwise, keep + // using the last floc (which may still have be invalid), and schedule a + // recompute event with the desired delay. + base::TimeDelta next_compute_delay; + if (ShouldKeepUsingPreviousFloc(floc_id_, &next_compute_delay)) { + ScheduleFlocComputation(next_compute_delay); + } else { + floc_id_.InvalidateIdAndSaveToPrefs(prefs_); } OnStateChanged(sync_service); @@ -113,16 +152,15 @@ } LogFlocComputedEvent(result); + floc_id_ = result.floc_id; - floc_id_.SaveToPrefs(prefs_); - FlocId::SaveComputeTimeToPrefs(base::Time::Now(), prefs_); - ScheduleFlocComputation(GetFlocIdScheduledUpdateInterval()); + ScheduleFlocComputation(kFlocIdScheduledUpdateInterval.Get()); } void FlocIdProviderImpl::LogFlocComputedEvent(const ComputeFlocResult& result) { - if (!base::FeatureList::IsEnabled(features::kFlocIdComputedEventLogging)) + if (!base::FeatureList::IsEnabled(kFlocIdComputedEventLogging)) return; auto specifics = std::make_unique<sync_pb::UserEventSpecifics>(); @@ -179,8 +217,8 @@ // It'd give us a better idea how often the floc is invalidated due to // history-delete. LogFlocComputedEvent(ComputeFlocResult()); - floc_id_ = FlocId(); - floc_id_.SaveToPrefs(prefs_); + + floc_id_.InvalidateIdAndSaveToPrefs(prefs_); } void FlocIdProviderImpl::OnSortingLshClustersFileReady() { @@ -212,8 +250,7 @@ return; bool sorting_lsh_ready_or_not_required = - !base::FeatureList::IsEnabled( - features::kFlocIdSortingLshBasedComputation) || + !base::FeatureList::IsEnabled(kFlocIdSortingLshBasedComputation) || first_sorting_lsh_file_ready_seen_; if (!first_sync_history_enabled_seen_ || !sorting_lsh_ready_or_not_required) @@ -341,8 +378,7 @@ } if (domains.size() < - static_cast<size_t>( - features::kFlocIdMinimumHistoryDomainSizeRequired.Get())) { + static_cast<size_t>(kFlocIdMinimumHistoryDomainSizeRequired.Get())) { std::move(callback).Run(ComputeFlocResult()); return; } @@ -357,8 +393,7 @@ uint64_t sim_hash, base::Time history_begin_time, base::Time history_end_time) { - if (!base::FeatureList::IsEnabled( - features::kFlocIdSortingLshBasedComputation)) { + if (!base::FeatureList::IsEnabled(kFlocIdSortingLshBasedComputation)) { std::move(callback).Run(ComputeFlocResult( sim_hash, FlocId(sim_hash, history_begin_time, history_end_time, kSortingLshVersionPlaceholder)));
diff --git a/chrome/browser/federated_learning/floc_id_provider_impl.h b/chrome/browser/federated_learning/floc_id_provider_impl.h index f1460b9b..cb14c9b 100644 --- a/chrome/browser/federated_learning/floc_id_provider_impl.h +++ b/chrome/browser/federated_learning/floc_id_provider_impl.h
@@ -168,7 +168,22 @@ // |delay|. void ScheduleFlocComputation(base::TimeDelta delay); - // The id to be exposed to the JS API. + // The following raw pointer references are guaranteed to outlive this object. + // |prefs_| is owned by Profile, and it won't be destroyed until the + // destructor of Profile is called, where all the profile-keyed services + // including this object will be destroyed. Other services are all created by + // profile-keyed service factories, and the dependency declared in + // FlocIdProviderFactory::FlocIdProviderFactory() guarantees that this object + // will be destroyed first among those services. + PrefService* prefs_; + syncer::SyncService* sync_service_; + scoped_refptr<content_settings::CookieSettings> cookie_settings_; + FlocRemotePermissionService* floc_remote_permission_service_; + history::HistoryService* history_service_; + syncer::UserEventService* user_event_service_; + + // The id to be exposed to the JS API. It will always be in sync with the one + // stored in prefs. FlocId floc_id_; bool floc_computation_in_progress_ = false; @@ -184,20 +199,6 @@ bool first_sorting_lsh_file_ready_seen_ = false; bool first_sync_history_enabled_seen_ = false; - // The following raw pointer references are guaranteed to outlive this object. - // |prefs_| is owned by Profile, and it won't be destroyed until the - // destructor of Profile is called, where all the profile-keyed services - // including this object will be destroyed. Other services are all created by - // profile-keyed service factories, and the dependency declared in - // FlocIdProviderFactory::FlocIdProviderFactory() guarantees that this object - // will be destroyed first among those services. - PrefService* prefs_; - syncer::SyncService* sync_service_; - scoped_refptr<content_settings::CookieSettings> cookie_settings_; - FlocRemotePermissionService* floc_remote_permission_service_; - history::HistoryService* history_service_; - syncer::UserEventService* user_event_service_; - // Used for the async tasks querying the HistoryService. base::CancelableTaskTracker history_task_tracker_;
diff --git a/chrome/browser/federated_learning/floc_id_provider_unittest.cc b/chrome/browser/federated_learning/floc_id_provider_unittest.cc index 19d7691e..1f403759 100644 --- a/chrome/browser/federated_learning/floc_id_provider_unittest.cc +++ b/chrome/browser/federated_learning/floc_id_provider_unittest.cc
@@ -11,12 +11,12 @@ #include "build/build_config.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/federated_learning/floc_remote_permission_service.h" -#include "chrome/common/chrome_features.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" #include "components/content_settings/core/browser/content_settings_registry.h" #include "components/content_settings/core/browser/cookie_settings.h" #include "components/content_settings/core/common/pref_names.h" +#include "components/federated_learning/features/features.h" #include "components/history/core/browser/history_database_params.h" #include "components/history/core/browser/history_service.h" #include "components/history/core/test/test_history_database.h" @@ -179,6 +179,21 @@ } // namespace +// Used to create a floc id with non-current finch_config_version or +// compute_time. +class FlocIdTester { + public: + static FlocId Create(base::Optional<uint64_t> id, + base::Time history_begin_time, + base::Time history_end_time, + uint32_t finch_config_version, + uint32_t sorting_lsh_version, + base::Time compute_time) { + return FlocId(id, history_begin_time, history_end_time, + finch_config_version, sorting_lsh_version, compute_time); + } +}; + class FlocIdProviderUnitTest : public testing::Test { public: FlocIdProviderUnitTest() @@ -454,7 +469,7 @@ FlocIdProviderSimpleFeatureParamUnitTest() { feature_list_.Reset(); feature_list_.InitAndEnableFeatureWithParameters( - features::kFederatedLearningOfCohorts, + kFederatedLearningOfCohorts, {{"update_interval", "24h"}, {"minimum_history_domain_size_required", "1"}}); } @@ -985,10 +1000,10 @@ FlocIdProviderUnitTestSortingLshEnabled() { feature_list_.Reset(); feature_list_.InitWithFeaturesAndParameters( - {{features::kFederatedLearningOfCohorts, + {{kFederatedLearningOfCohorts, {{"update_interval", "24h"}, {"minimum_history_domain_size_required", "1"}}}, - {features::kFlocIdSortingLshBasedComputation, {}}}, + {kFlocIdSortingLshBasedComputation, {}}}, {}); } }; @@ -1031,6 +1046,8 @@ EXPECT_EQ(FlocId(123, kSevenDaysBeforeStart, kFiveDaysBeforeStart, 999), floc_id()); + base::Time time_before_advancing = base::Time::Now(); + // Advance the clock by 1 day. The "foo.com" should expire. However, we pause // before the computation completes. floc_id_provider_->set_should_pause_before_compute_floc_completed(true); @@ -1038,8 +1055,10 @@ EXPECT_TRUE(floc_computation_in_progress()); EXPECT_FALSE(need_recompute()); - EXPECT_EQ(FlocId(123, kSevenDaysBeforeStart, kFiveDaysBeforeStart, 999), - floc_id()); + EXPECT_EQ( + FlocIdTester::Create(123, kSevenDaysBeforeStart, kFiveDaysBeforeStart, 1, + 999, time_before_advancing), + floc_id()); EXPECT_EQ(FlocId(456, kSixDaysBeforeStart, kFiveDaysBeforeStart, 999), floc_id_provider_->paused_result().floc_id); @@ -1241,14 +1260,13 @@ base::Time::Now() - base::TimeDelta::FromDays(4); const base::Time kThreeDaysBeforeStart = base::Time::Now() - base::TimeDelta::FromDays(3); - - FlocId floc_id = - FlocId(123, kFourDaysBeforeStart, kThreeDaysBeforeStart, 999); - base::Time last_compute_time = + const base::Time kLastComputeTime = base::Time::Now() - base::TimeDelta::FromHours(12); + FlocId floc_id = + FlocIdTester::Create(123, kFourDaysBeforeStart, kThreeDaysBeforeStart, + 1, 999, kLastComputeTime); floc_id.SaveToPrefs(&prefs_); - FlocId::SaveComputeTimeToPrefs(last_compute_time, &prefs_); } void InitializeHistory() override { @@ -1269,11 +1287,16 @@ base::Time::Now() - base::TimeDelta::FromDays(3); const base::Time kTwoDaysBeforeStart = base::Time::Now() - base::TimeDelta::FromDays(2); + const base::Time kLastComputeTime = + base::Time::Now() - base::TimeDelta::FromHours(12); + + FlocId initial_floc_id = + FlocIdTester::Create(123, kFourDaysBeforeStart, kThreeDaysBeforeStart, 1, + 999, kLastComputeTime); // Initially the floc is set to the entry from the prefs. No computation has // occurred for this session. - EXPECT_EQ(floc_id(), - FlocId(123, kFourDaysBeforeStart, kThreeDaysBeforeStart, 999)); + EXPECT_EQ(floc_id(), initial_floc_id); EXPECT_FALSE(floc_computation_in_progress()); EXPECT_TRUE(floc_computation_scheduled()); EXPECT_EQ(0u, floc_id_provider_->compute_floc_completed_count()); @@ -1293,8 +1316,7 @@ // Fast forward by 12 hours. This should trigger a scheduled update. task_environment_.FastForwardBy(base::TimeDelta::FromHours(12)); - // Expect a compute, an event logging with trigger FlocIdComputed::REFRESHED, - // and an update to the local prefs. + // Expect a compute, an event logging and an update to the local prefs. EXPECT_EQ(1u, floc_id_provider_->compute_floc_completed_count()); EXPECT_EQ( floc_id(), @@ -1309,7 +1331,6 @@ event.floc_id()); EXPECT_EQ(floc_id(), FlocId::ReadFromPrefs(&prefs_)); - EXPECT_EQ(base::Time::Now(), FlocId::ReadComputeTimeFromPrefs(&prefs_)); } TEST_F(FlocIdProviderUnitTestLastFlocUnexpired, HistoryDelete) { @@ -1317,11 +1338,16 @@ base::Time::Now() - base::TimeDelta::FromDays(4); const base::Time kThreeDaysBeforeStart = base::Time::Now() - base::TimeDelta::FromDays(3); + const base::Time kLastComputeTime = + base::Time::Now() - base::TimeDelta::FromHours(12); + + FlocId initial_floc_id = + FlocIdTester::Create(123, kFourDaysBeforeStart, kThreeDaysBeforeStart, 1, + 999, kLastComputeTime); // Initially the floc is set to the entry from the prefs. No computation has // occurred for this session. - EXPECT_EQ(floc_id(), - FlocId(123, kFourDaysBeforeStart, kThreeDaysBeforeStart, 999)); + EXPECT_EQ(floc_id(), initial_floc_id); EXPECT_FALSE(floc_computation_in_progress()); EXPECT_TRUE(floc_computation_scheduled()); EXPECT_EQ(0u, floc_id_provider_->compute_floc_completed_count()); @@ -1334,9 +1360,10 @@ // changed. EXPECT_EQ(0u, floc_id_provider_->compute_floc_completed_count()); EXPECT_FALSE(floc_id().IsValid()); - EXPECT_FALSE(FlocId::ReadFromPrefs(&prefs_).IsValid()); - EXPECT_EQ(base::Time::Now() - base::TimeDelta::FromHours(12), - FlocId::ReadComputeTimeFromPrefs(&prefs_)); + + FlocId floc_id_in_prefs = FlocId::ReadFromPrefs(&prefs_); + EXPECT_FALSE(floc_id_in_prefs.IsValid()); + EXPECT_EQ(kLastComputeTime, floc_id_in_prefs.compute_time()); } class FlocIdProviderUnitTestLastFlocExpired @@ -1347,14 +1374,14 @@ base::Time::Now() - base::TimeDelta::FromDays(20); const base::Time kNineteenDaysBeforeStart = base::Time::Now() - base::TimeDelta::FromDays(19); - - FlocId floc_id = - FlocId(123, kTwentyDaysBeforeStart, kNineteenDaysBeforeStart, 888); - base::Time last_compute_time = + const base::Time kLastComputeTime = base::Time::Now() - base::TimeDelta::FromHours(25); + FlocId floc_id = FlocIdTester::Create(123, kTwentyDaysBeforeStart, + kNineteenDaysBeforeStart, 1, 888, + kLastComputeTime); + floc_id.SaveToPrefs(&prefs_); - FlocId::SaveComputeTimeToPrefs(last_compute_time, &prefs_); } void InitializeHistory() override { @@ -1368,10 +1395,24 @@ } }; -TEST_F(FlocIdProviderUnitTestLastFlocExpired, ComputeOnInitialSetupReady) { - // Initially the floc is invalid as the last floc has expired. No computation - // has occurred for this session. - EXPECT_FALSE(floc_id().IsValid()); +TEST_F(FlocIdProviderUnitTestLastFlocExpired, + ImmediateComputeOnInitialSetupReady) { + const base::Time kTwentyDaysBeforeStart = + base::Time::Now() - base::TimeDelta::FromDays(20); + const base::Time kNineteenDaysBeforeStart = + base::Time::Now() - base::TimeDelta::FromDays(19); + const base::Time kLastComputeTime = + base::Time::Now() - base::TimeDelta::FromHours(25); + + FlocId initial_invalid_floc_id = + FlocIdTester::Create(base::nullopt, kTwentyDaysBeforeStart, + kNineteenDaysBeforeStart, 1, 888, kLastComputeTime); + + // Initially the floc is invalidated as the last floc has expired, but other + // fields remains unchanged. The invalidation is also written to the prefs. No + // computation has occurred for this session. + EXPECT_EQ(floc_id(), initial_invalid_floc_id); + EXPECT_EQ(FlocId::ReadFromPrefs(&prefs_), initial_invalid_floc_id); EXPECT_FALSE(floc_computation_in_progress()); EXPECT_FALSE(floc_computation_scheduled()); EXPECT_EQ(0u, floc_id_provider_->compute_floc_completed_count()); @@ -1394,8 +1435,7 @@ EXPECT_FALSE(floc_computation_in_progress()); EXPECT_TRUE(floc_computation_scheduled()); - // Expect a compute, an event logging with trigger FlocIdComputed::REFRESHED, - // and an update to the local prefs. + // Expect a compute, an event logging and an update to the local prefs. EXPECT_EQ(1u, floc_id_provider_->compute_floc_completed_count()); EXPECT_EQ(floc_id(), FlocId(FlocId::SimHashHistory({"foo.com"}), kTwoDaysBeforeStart, kTwoDaysBeforeStart, 0)); @@ -1407,7 +1447,155 @@ EXPECT_EQ(FlocId::SimHashHistory({"foo.com"}), event.floc_id()); EXPECT_EQ(floc_id(), FlocId::ReadFromPrefs(&prefs_)); - EXPECT_EQ(base::Time::Now(), FlocId::ReadComputeTimeFromPrefs(&prefs_)); +} + +class FlocIdProviderUnitTestPresumedNextComputeDelayTooBig + : public FlocIdProviderSimpleFeatureParamUnitTest { + public: + void InitializeFlocPrefs() override { + const base::Time kFourDaysBeforeStart = + base::Time::Now() - base::TimeDelta::FromDays(4); + const base::Time kThreeDaysBeforeStart = + base::Time::Now() - base::TimeDelta::FromDays(3); + const base::Time kLastComputeTime = + base::Time::Now() + base::TimeDelta::FromDays(1); + + // Configure the last compute time to be 1 day after the start time, that + // emulates the situation when the machine time has changed. + FlocId floc_id = + FlocIdTester::Create(123, kFourDaysBeforeStart, kThreeDaysBeforeStart, + 1, 999, kLastComputeTime); + floc_id.SaveToPrefs(&prefs_); + } +}; + +TEST_F(FlocIdProviderUnitTestPresumedNextComputeDelayTooBig, + ImmediateComputeOnInitialSetupReady) { + const base::Time kFourDaysBeforeStart = + base::Time::Now() - base::TimeDelta::FromDays(4); + const base::Time kThreeDaysBeforeStart = + base::Time::Now() - base::TimeDelta::FromDays(3); + const base::Time kLastComputeTime = + base::Time::Now() + base::TimeDelta::FromDays(1); + + FlocId initial_invalid_floc_id = + FlocIdTester::Create(base::nullopt, kFourDaysBeforeStart, + kThreeDaysBeforeStart, 1, 999, kLastComputeTime); + + // Initially the floc is invalidated as the "presumed next computation delay" + // >= "2 x the scheduled update interval", implying the machine time has + // changed. Other fields should remain unchanged. The invalidation is also + // written to the prefs. No computation has occurred for this session. + EXPECT_EQ(floc_id(), initial_invalid_floc_id); + EXPECT_EQ(FlocId::ReadFromPrefs(&prefs_), initial_invalid_floc_id); + EXPECT_FALSE(floc_computation_in_progress()); + EXPECT_FALSE(floc_computation_scheduled()); + EXPECT_EQ(0u, floc_id_provider_->compute_floc_completed_count()); + + const base::Time kTwoDaysBeforeStart = + base::Time::Now() - base::TimeDelta::FromDays(2); + + AddHistoryEntriesForDomains({"foo.com"}, kTwoDaysBeforeStart); + + // Turn on sync-history. This should trigger the computation. + test_sync_service_->SetTransportState( + syncer::SyncService::TransportState::ACTIVE); + test_sync_service_->FireStateChanged(); + + EXPECT_TRUE(floc_computation_in_progress()); + EXPECT_FALSE(floc_computation_scheduled()); + + task_environment_.RunUntilIdle(); + + EXPECT_FALSE(floc_computation_in_progress()); + EXPECT_TRUE(floc_computation_scheduled()); + + // Expect a compute, an event logging and an update to the local prefs. + EXPECT_EQ(1u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(floc_id(), FlocId(FlocId::SimHashHistory({"foo.com"}), + kTwoDaysBeforeStart, kTwoDaysBeforeStart, 0)); + + EXPECT_EQ(1u, fake_user_event_service_->GetRecordedUserEvents().size()); + const sync_pb::UserEventSpecifics_FlocIdComputed& event = + fake_user_event_service_->GetRecordedUserEvents()[0] + .floc_id_computed_event(); + EXPECT_EQ(FlocId::SimHashHistory({"foo.com"}), event.floc_id()); + + EXPECT_EQ(floc_id(), FlocId::ReadFromPrefs(&prefs_)); +} + +class FlocIdProviderUnitTestLastFlocVersionMismatch + : public FlocIdProviderSimpleFeatureParamUnitTest { + public: + void InitializeFlocPrefs() override { + const base::Time kFourDaysBeforeStart = + base::Time::Now() - base::TimeDelta::FromDays(4); + const base::Time kThreeDaysBeforeStart = + base::Time::Now() - base::TimeDelta::FromDays(3); + const base::Time kLastComputeTime = + base::Time::Now() - base::TimeDelta::FromHours(12); + + // Create a floc with version finch_config_version 0, that is different + // from the current version 1. + FlocId floc_id = + FlocIdTester::Create(123, kFourDaysBeforeStart, kThreeDaysBeforeStart, + 0, 999, kLastComputeTime); + floc_id.SaveToPrefs(&prefs_); + } +}; + +TEST_F(FlocIdProviderUnitTestLastFlocVersionMismatch, + ImmediateComputeOnInitialSetupReady) { + const base::Time kFourDaysBeforeStart = + base::Time::Now() - base::TimeDelta::FromDays(4); + const base::Time kThreeDaysBeforeStart = + base::Time::Now() - base::TimeDelta::FromDays(3); + const base::Time kLastComputeTime = + base::Time::Now() - base::TimeDelta::FromHours(12); + + FlocId initial_invalid_floc_id = + FlocIdTester::Create(base::nullopt, kFourDaysBeforeStart, + kThreeDaysBeforeStart, 0, 999, kLastComputeTime); + + // Initially the floc is invalidated as the version mismatches, but other + // fields remains unchanged. The invalidation is also written to the prefs. No + // computation has occurred for this session. + EXPECT_EQ(floc_id(), initial_invalid_floc_id); + EXPECT_EQ(FlocId::ReadFromPrefs(&prefs_), initial_invalid_floc_id); + EXPECT_FALSE(floc_computation_in_progress()); + EXPECT_FALSE(floc_computation_scheduled()); + EXPECT_EQ(0u, floc_id_provider_->compute_floc_completed_count()); + + const base::Time kTwoDaysBeforeStart = + base::Time::Now() - base::TimeDelta::FromDays(2); + + AddHistoryEntriesForDomains({"foo.com"}, kTwoDaysBeforeStart); + + // Turn on sync-history. This should trigger the computation. + test_sync_service_->SetTransportState( + syncer::SyncService::TransportState::ACTIVE); + test_sync_service_->FireStateChanged(); + + EXPECT_TRUE(floc_computation_in_progress()); + EXPECT_FALSE(floc_computation_scheduled()); + + task_environment_.RunUntilIdle(); + + EXPECT_FALSE(floc_computation_in_progress()); + EXPECT_TRUE(floc_computation_scheduled()); + + // Expect a compute, an event logging and an update to the local prefs. + EXPECT_EQ(1u, floc_id_provider_->compute_floc_completed_count()); + EXPECT_EQ(floc_id(), FlocId(FlocId::SimHashHistory({"foo.com"}), + kTwoDaysBeforeStart, kTwoDaysBeforeStart, 0)); + + EXPECT_EQ(1u, fake_user_event_service_->GetRecordedUserEvents().size()); + const sync_pb::UserEventSpecifics_FlocIdComputed& event = + fake_user_event_service_->GetRecordedUserEvents()[0] + .floc_id_computed_event(); + EXPECT_EQ(FlocId::SimHashHistory({"foo.com"}), event.floc_id()); + + EXPECT_EQ(floc_id(), FlocId::ReadFromPrefs(&prefs_)); } } // namespace federated_learning
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index dd46c834d9..d5a5f37d 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -2591,7 +2591,7 @@ { "name": "exo-pointer-lock", "owners": [ "hollingum@google.com" ], - "expiry_milestone": 88 + "expiry_milestone": 95 }, { "name": "expanded-tab-strip",
diff --git a/chrome/browser/incognito/interstitial/android/java/res/layout/incognito_interstitial_bottom_sheet_view.xml b/chrome/browser/incognito/interstitial/android/java/res/layout/incognito_interstitial_bottom_sheet_view.xml index c91807cbc..26fc76e 100644 --- a/chrome/browser/incognito/interstitial/android/java/res/layout/incognito_interstitial_bottom_sheet_view.xml +++ b/chrome/browser/incognito/interstitial/android/java/res/layout/incognito_interstitial_bottom_sheet_view.xml
@@ -33,6 +33,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" + android:focusable="true" android:gravity="center_vertical" android:textAppearance="@style/TextAppearance.TextMedium.Secondary" android:text="@string/incognito_interstitial_message"
diff --git a/chrome/browser/pdf/pdf_extension_test.cc b/chrome/browser/pdf/pdf_extension_test.cc index 25d5875..3118283 100644 --- a/chrome/browser/pdf/pdf_extension_test.cc +++ b/chrome/browser/pdf/pdf_extension_test.cc
@@ -93,7 +93,7 @@ #include "pdf/pdf_features.h" #include "services/network/public/cpp/features.h" #include "testing/gmock/include/gmock/gmock.h" -#include "third_party/blink/public/common/context_menu_data/media_type.h" +#include "third_party/blink/public/mojom/context_menu/context_menu_data.mojom.h" #include "ui/accessibility/ax_action_data.h" #include "ui/accessibility/ax_enum_util.h" #include "ui/accessibility/ax_enums.mojom.h" @@ -1681,7 +1681,7 @@ context_menu_filter->get_params(); // Validate the context menu params for selection. - EXPECT_EQ(blink::ContextMenuDataMediaType::kPlugin, params.media_type); + EXPECT_EQ(blink::mojom::ContextMenuDataMediaType::kPlugin, params.media_type); std::string selected_text = base::UTF16ToUTF8(params.selection_text); base::ReplaceChars(selected_text, "\r", "", &selected_text); EXPECT_EQ(kExepectedPDFSelection, selected_text);
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 25803f34..e7769ba 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -343,7 +343,6 @@ #include "chromeos/audio/audio_devices_pref_handler_impl.h" #include "chromeos/components/account_manager/account_manager.h" #include "chromeos/components/local_search_service/search_metrics_reporter.h" -#include "chromeos/components/local_search_service/search_metrics_reporter_sync.h" #include "chromeos/components/quick_answers/public/cpp/quick_answers_prefs.h" #include "chromeos/constants/chromeos_switches.h" #include "chromeos/network/fast_transition_observer.h" @@ -423,6 +422,15 @@ // Deprecated 10/2019 const char kDisplayRotationAcceleratorDialogHasBeenAccepted[] = "settings.a11y.display_rotation_accelerator_dialog_has_been_accepted"; + +// Deprecated 12/2020 +const char kLocalSearchServiceSyncMetricsDailySample[] = + "local_search_service_sync.metrics.daily_sample"; +const char kLocalSearchServiceSyncMetricsCrosSettingsCount[] = + "local_search_service_sync.metrics.cros_settings_count"; +const char kLocalSearchServiceSyncMetricsHelpAppCount[] = + "local_search_service_sync.metrics.help_app_count"; + #endif // BUILDFLAG(IS_CHROMEOS_ASH) // Deprecated 11/2019 @@ -540,6 +548,11 @@ registry->RegisterDictionaryPref(kRegisteredSupervisedUserAllowlists); registry->RegisterIntegerPref(kSupervisedUsersNextId, 0); registry->RegisterStringPref(kFirstRunTrialGroup, std::string()); + + registry->RegisterInt64Pref(kLocalSearchServiceSyncMetricsDailySample, 0); + registry->RegisterIntegerPref(kLocalSearchServiceSyncMetricsHelpAppCount, 0); + registry->RegisterIntegerPref(kLocalSearchServiceSyncMetricsCrosSettingsCount, + 0); #endif // BUILDFLAG(IS_CHROMEOS_ASH) #if !defined(OS_ANDROID) @@ -740,9 +753,6 @@ chromeos::language_prefs::RegisterPrefs(registry); chromeos::local_search_service::SearchMetricsReporter:: RegisterLocalStatePrefs(registry); - // TODO(crbug/1137560): Remove the Sync version later after LSS is sandboxed. - chromeos::local_search_service::SearchMetricsReporterSync:: - RegisterLocalStatePrefs(registry); chromeos::login::SecurityTokenSessionController::RegisterLocalStatePrefs( registry); chromeos::MultiProfileUserController::RegisterPrefs(registry); @@ -1155,6 +1165,9 @@ // Added 12/2020. local_state->ClearPref(kFirstRunTrialGroup); + local_state->ClearPref(kLocalSearchServiceSyncMetricsDailySample); + local_state->ClearPref(kLocalSearchServiceSyncMetricsCrosSettingsCount); + local_state->ClearPref(kLocalSearchServiceSyncMetricsHelpAppCount); #endif // BUILDFLAG(IS_CHROMEOS_ASH) #if !defined(OS_ANDROID)
diff --git a/chrome/browser/renderer_context_menu/context_menu_content_type_unittest.cc b/chrome/browser/renderer_context_menu/context_menu_content_type_unittest.cc index f42834988..38079ca 100644 --- a/chrome/browser/renderer_context_menu/context_menu_content_type_unittest.cc +++ b/chrome/browser/renderer_context_menu/context_menu_content_type_unittest.cc
@@ -27,7 +27,7 @@ content::ContextMenuParams CreateParams(int contexts) { content::ContextMenuParams rv; rv.is_editable = false; - rv.media_type = blink::ContextMenuDataMediaType::kNone; + rv.media_type = blink::mojom::ContextMenuDataMediaType::kNone; rv.page_url = GURL("http://test.page/"); static const base::string16 selected_text = base::ASCIIToUTF16("sel"); @@ -44,17 +44,17 @@ if (contexts & MenuItem::IMAGE) { rv.src_url = GURL("http://test.image/"); - rv.media_type = blink::ContextMenuDataMediaType::kImage; + rv.media_type = blink::mojom::ContextMenuDataMediaType::kImage; } if (contexts & MenuItem::VIDEO) { rv.src_url = GURL("http://test.video/"); - rv.media_type = blink::ContextMenuDataMediaType::kVideo; + rv.media_type = blink::mojom::ContextMenuDataMediaType::kVideo; } if (contexts & MenuItem::AUDIO) { rv.src_url = GURL("http://test.audio/"); - rv.media_type = blink::ContextMenuDataMediaType::kAudio; + rv.media_type = blink::mojom::ContextMenuDataMediaType::kAudio; } if (contexts & MenuItem::FRAME)
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc index b0577d5..aa1a27f 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -153,7 +153,7 @@ #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" #include "third_party/blink/public/common/context_menu_data/edit_flags.h" #include "third_party/blink/public/common/context_menu_data/input_field_type.h" -#include "third_party/blink/public/common/context_menu_data/media_type.h" +#include "third_party/blink/public/mojom/context_menu/context_menu_data.mojom.h" #include "third_party/blink/public/mojom/frame/media_player_action.mojom.h" #include "third_party/blink/public/public_buildflags.h" #include "third_party/metrics_proto/omnibox_input_type.pb.h" @@ -227,10 +227,10 @@ using base::UserMetricsAction; using blink::ContextMenuDataEditFlags; -using blink::ContextMenuDataMediaType; using blink::WebContextMenuData; using blink::WebString; using blink::WebURL; +using blink::mojom::ContextMenuDataMediaType; using content::BrowserContext; using content::ChildProcessSecurityPolicy; using content::DownloadManager;
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc index db4d41c..4425979a 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
@@ -85,9 +85,9 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" -#include "third_party/blink/public/common/context_menu_data/media_type.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/common/input/web_input_event.h" +#include "third_party/blink/public/mojom/context_menu/context_menu_data.mojom.h" #include "third_party/blink/public/mojom/loader/resource_load_info.mojom.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/emoji/emoji_panel_helper.h" @@ -134,7 +134,7 @@ const GURL& unfiltered_url, const GURL& url) { return CreateContextMenu(unfiltered_url, url, base::string16(), - blink::ContextMenuDataMediaType::kNone, + blink::mojom::ContextMenuDataMediaType::kNone, ui::MENU_SOURCE_NONE); } @@ -144,13 +144,13 @@ const GURL& url) { return CreateContextMenuInWebContents( web_contents, unfiltered_url, url, base::string16(), - blink::ContextMenuDataMediaType::kNone, ui::MENU_SOURCE_NONE); + blink::mojom::ContextMenuDataMediaType::kNone, ui::MENU_SOURCE_NONE); } std::unique_ptr<TestRenderViewContextMenu> CreateContextMenuMediaTypeImage( const GURL& url) { return CreateContextMenu(GURL(), url, base::string16(), - blink::ContextMenuDataMediaType::kImage, + blink::mojom::ContextMenuDataMediaType::kImage, ui::MENU_SOURCE_NONE); } @@ -158,7 +158,7 @@ const GURL& unfiltered_url, const GURL& url, const base::string16& link_text, - blink::ContextMenuDataMediaType media_type, + blink::mojom::ContextMenuDataMediaType media_type, ui::MenuSourceType source_type) { return CreateContextMenuInWebContents( browser()->tab_strip_model()->GetActiveWebContents(), unfiltered_url, @@ -170,7 +170,7 @@ const GURL& unfiltered_url, const GURL& url, const base::string16& link_text, - blink::ContextMenuDataMediaType media_type, + blink::mojom::ContextMenuDataMediaType media_type, ui::MenuSourceType source_type) { content::ContextMenuParams params; params.media_type = media_type; @@ -336,7 +336,7 @@ content::ContextMenuParams params; params.page_url = page_url; params.frame_url = frame->GetLastCommittedURL(); - params.media_type = blink::ContextMenuDataMediaType::kPlugin; + params.media_type = blink::mojom::ContextMenuDataMediaType::kPlugin; params.media_flags |= blink::WebContextMenuData::kMediaCanRotate; auto menu = std::make_unique<TestRenderViewContextMenu>(frame, params); menu->Init(); @@ -377,7 +377,7 @@ content::ContextMenuParams params; params.page_url = page_url; params.frame_url = frame->GetLastCommittedURL(); - params.media_type = blink::ContextMenuDataMediaType::kPlugin; + params.media_type = blink::mojom::ContextMenuDataMediaType::kPlugin; TestRenderViewContextMenu menu(frame, params); menu.Init(); @@ -413,7 +413,7 @@ std::unique_ptr<TestRenderViewContextMenu> menu3 = CreateContextMenu( GURL("http://www.google.com/"), GURL("http://www.google.com/"), - base::ASCIIToUTF16(""), blink::ContextMenuDataMediaType::kNone, + base::ASCIIToUTF16(""), blink::mojom::ContextMenuDataMediaType::kNone, ui::MENU_SOURCE_TOUCH); EXPECT_TRUE(menu3->IsCommandIdVisible(IDC_CONTENT_CONTEXT_COPYLINKTEXT)); @@ -675,7 +675,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, ContextMenuForCanvas) { content::ContextMenuParams params; - params.media_type = blink::ContextMenuDataMediaType::kCanvas; + params.media_type = blink::mojom::ContextMenuDataMediaType::kCanvas; TestRenderViewContextMenu menu( browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(), @@ -748,8 +748,8 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, CopyLinkTextMouse) { std::unique_ptr<TestRenderViewContextMenu> menu = CreateContextMenu( GURL("http://www.google.com/"), GURL("http://www.google.com/"), - base::ASCIIToUTF16("Google"), blink::ContextMenuDataMediaType::kNone, - ui::MENU_SOURCE_MOUSE); + base::ASCIIToUTF16("Google"), + blink::mojom::ContextMenuDataMediaType::kNone, ui::MENU_SOURCE_MOUSE); ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_COPYLINKTEXT)); } @@ -757,7 +757,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, CopyLinkTextTouchNoText) { std::unique_ptr<TestRenderViewContextMenu> menu = CreateContextMenu( GURL("http://www.google.com/"), GURL("http://www.google.com/"), - base::ASCIIToUTF16(""), blink::ContextMenuDataMediaType::kNone, + base::ASCIIToUTF16(""), blink::mojom::ContextMenuDataMediaType::kNone, ui::MENU_SOURCE_TOUCH); ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_COPYLINKTEXT)); @@ -766,8 +766,8 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, CopyLinkTextTouchTextOnly) { std::unique_ptr<TestRenderViewContextMenu> menu = CreateContextMenu( GURL("http://www.google.com/"), GURL("http://www.google.com/"), - base::ASCIIToUTF16("Google"), blink::ContextMenuDataMediaType::kNone, - ui::MENU_SOURCE_TOUCH); + base::ASCIIToUTF16("Google"), + blink::mojom::ContextMenuDataMediaType::kNone, ui::MENU_SOURCE_TOUCH); ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_COPYLINKTEXT)); } @@ -775,8 +775,8 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, CopyLinkTextTouchTextImage) { std::unique_ptr<TestRenderViewContextMenu> menu = CreateContextMenu( GURL("http://www.google.com/"), GURL("http://www.google.com/"), - base::ASCIIToUTF16("Google"), blink::ContextMenuDataMediaType::kImage, - ui::MENU_SOURCE_TOUCH); + base::ASCIIToUTF16("Google"), + blink::mojom::ContextMenuDataMediaType::kImage, ui::MENU_SOURCE_TOUCH); ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_COPYLINKTEXT)); } @@ -1519,7 +1519,7 @@ menu_observer.WaitForMenuOpenAndClose(); ASSERT_EQ(menu_observer.params().media_type, - blink::ContextMenuDataMediaType::kImage); + blink::mojom::ContextMenuDataMediaType::kImage); ASSERT_EQ(menu_observer.params().src_url.path(), image_path_); ASSERT_FALSE(menu_observer.params().has_image_contents); @@ -1562,7 +1562,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, ContextMenuForVideoNotInPictureInPicture) { content::ContextMenuParams params; - params.media_type = blink::ContextMenuDataMediaType::kVideo; + params.media_type = blink::mojom::ContextMenuDataMediaType::kVideo; params.media_flags |= blink::WebContextMenuData::kMediaCanPictureInPicture; TestRenderViewContextMenu menu( @@ -1577,7 +1577,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, ContextMenuForVideoInPictureInPicture) { content::ContextMenuParams params; - params.media_type = blink::ContextMenuDataMediaType::kVideo; + params.media_type = blink::mojom::ContextMenuDataMediaType::kVideo; params.media_flags |= blink::WebContextMenuData::kMediaCanPictureInPicture; params.media_flags |= blink::WebContextMenuData::kMediaPictureInPicture; @@ -1599,7 +1599,7 @@ CreateContextMenuInWebContents( web_contents.get(), GURL("http://www.google.com/"), GURL("http://www.google.com/"), base::ASCIIToUTF16("Google"), - blink::ContextMenuDataMediaType::kNone, ui::MENU_SOURCE_MOUSE); + blink::mojom::ContextMenuDataMediaType::kNone, ui::MENU_SOURCE_MOUSE); } IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, GifImageShare) {
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc index 1144e1e6..2aff1bdf 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc
@@ -54,7 +54,7 @@ static content::ContextMenuParams CreateParams(int contexts) { content::ContextMenuParams rv; rv.is_editable = false; - rv.media_type = blink::ContextMenuDataMediaType::kNone; + rv.media_type = blink::mojom::ContextMenuDataMediaType::kNone; rv.page_url = GURL("http://test.page/"); static const base::char16 selected_text[] = { 's', 'e', 'l', 0 }; @@ -69,17 +69,17 @@ if (contexts & MenuItem::IMAGE) { rv.src_url = GURL("http://test.image/"); - rv.media_type = blink::ContextMenuDataMediaType::kImage; + rv.media_type = blink::mojom::ContextMenuDataMediaType::kImage; } if (contexts & MenuItem::VIDEO) { rv.src_url = GURL("http://test.video/"); - rv.media_type = blink::ContextMenuDataMediaType::kVideo; + rv.media_type = blink::mojom::ContextMenuDataMediaType::kVideo; } if (contexts & MenuItem::AUDIO) { rv.src_url = GURL("http://test.audio/"); - rv.media_type = blink::ContextMenuDataMediaType::kAudio; + rv.media_type = blink::mojom::ContextMenuDataMediaType::kAudio; } if (contexts & MenuItem::FRAME)
diff --git a/chrome/browser/resources/chromeos/accessibility/braille_ime/manifest.json b/chrome/browser/resources/chromeos/accessibility/braille_ime/manifest.json index 6db39d7d..2db0d28 100644 --- a/chrome/browser/resources/chromeos/accessibility/braille_ime/manifest.json +++ b/chrome/browser/resources/chromeos/accessibility/braille_ime/manifest.json
@@ -16,11 +16,9 @@ "input_components": [ { "name": "Braille Keyboard", - "type": "ime", "id": "braille", "indicator": "\u2803\u2817\u2807", // Unicode of 'brl' in English (and many other) braille codes. - "language": ["None"], - "description": "Braille hardware keyboard" + "language": ["None"] } ] }
diff --git a/chrome/browser/resources/chromeos/input_method/cangjie_manifest.json b/chrome/browser/resources/chromeos/input_method/cangjie_manifest.json index d1dee84..b5afe48 100644 --- a/chrome/browser/resources/chromeos/input_method/cangjie_manifest.json +++ b/chrome/browser/resources/chromeos/input_method/cangjie_manifest.json
@@ -14,10 +14,8 @@ "input_components": [ { "name": "__MSG_inputmethod_cangjie__", - "type": "ime", "id": "zh-hant-t-i0-cangjie-1987", "indicator": "\u5009", - "description": "Cangjie", "language": [ "zh-TW", "zh"
diff --git a/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json b/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json index 50507dbc..44765ef 100644 --- a/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json +++ b/chrome/browser/resources/chromeos/input_method/google_xkb_manifest.json
@@ -43,9 +43,7 @@ "input_components": [ { "name": "__MSG_keyboard_us__", - "type": "ime", "id": "xkb:us::eng", - "description": "", "language": [ "en", "en-US", @@ -59,10 +57,8 @@ }, { "name": "__MSG_keyboard_indonesian__", - "type": "ime", "id": "xkb:us::ind", "indicator": "ID", - "description": "", "language": [ "id" ], @@ -73,10 +69,8 @@ }, { "name": "__MSG_keyboard_filipino__", - "type": "ime", "id": "xkb:us::fil", "indicator": "FIL", - "description": "", "language": [ "fil" ], @@ -87,10 +81,8 @@ }, { "name": "__MSG_keyboard_malay__", - "type": "ime", "id": "xkb:us::msa", "indicator": "MS", - "description": "", "language": [ "ms" ], @@ -101,10 +93,8 @@ }, { "name": "__MSG_keyboard_us_international__", - "type": "ime", "id": "xkb:us:intl:eng", "indicator": "INTL", - "description": "", "language": [ "en", "en-US" @@ -116,10 +106,8 @@ }, { "name": "__MSG_keyboard_us_international_pc__", - "type": "ime", "id": "xkb:us:intl_pc:eng", "indicator": "INTL", - "description": "", "language": [ "en", "en-US" @@ -131,10 +119,8 @@ }, { "name": "__MSG_keyboard_netherlands__", - "type": "ime", "id": "xkb:us:intl:nld", "indicator": "NLD", - "description": "", "language": [ "nl" ], @@ -145,10 +131,8 @@ }, { "name": "__MSG_keyboard_netherlands_us_international_pc__", - "type": "ime", "id": "xkb:us:intl_pc:nld", "indicator": "NLD", - "description": "", "language": [ "nl" ], @@ -159,10 +143,8 @@ }, { "name": "__MSG_keyboard_us_extended__", - "type": "ime", "id": "xkb:us:altgr-intl:eng", "indicator": "EXTD", - "description": "", "language": [ "en", "en-US" @@ -174,10 +156,8 @@ }, { "name": "__MSG_keyboard_us_dvorak__", - "type": "ime", "id": "xkb:us:dvorak:eng", "indicator": "DV", - "description": "", "language": [ "en", "en-US" @@ -189,10 +169,8 @@ }, { "name": "__MSG_keyboard_us_dvp__", - "type": "ime", "id": "xkb:us:dvp:eng", "indicator": "DVP", - "description": "", "language": [ "en", "en-US" @@ -204,10 +182,8 @@ }, { "name": "__MSG_keyboard_us_colemak__", - "type": "ime", "id": "xkb:us:colemak:eng", "indicator": "CO", - "description": "", "language": [ "en", "en-US" @@ -219,10 +195,8 @@ }, { "name": "__MSG_keyboard_us_workman__", - "type": "ime", "id": "xkb:us:workman:eng", "indicator": "WM", - "description": "", "language": [ "en", "en-US" @@ -234,10 +208,8 @@ }, { "name": "__MSG_keyboard_us_workman_international__", - "type": "ime", "id": "xkb:us:workman-intl:eng", "indicator": "WMI", - "description": "", "language": [ "en", "en-US" @@ -249,9 +221,7 @@ }, { "name": "__MSG_keyboard_belgian_dutch__", - "type": "ime", "id": "xkb:be::nld", - "description": "", "language": [ "nl" ], @@ -262,9 +232,7 @@ }, { "name": "__MSG_keyboard_french__", - "type": "ime", "id": "xkb:fr::fra", - "description": "", "language": [ "fr", "fr-FR" @@ -276,9 +244,7 @@ }, { "name": "__MSG_keyboard_french_bepo__", - "type": "ime", "id": "xkb:fr:bepo:fra", - "description": "", "language": [ "fr", "fr-FR" @@ -290,9 +256,7 @@ }, { "name": "__MSG_keyboard_belgian_french__", - "type": "ime", "id": "xkb:be::fra", - "description": "", "language": [ "fr" ], @@ -303,9 +267,7 @@ }, { "name": "__MSG_keyboard_faroese__", - "type": "ime", "id": "xkb:fo::fao", - "description": "", "language": [ "fo" ], @@ -316,9 +278,7 @@ }, { "name": "__MSG_keyboard_canadian_french__", - "type": "ime", "id": "xkb:ca::fra", - "description": "", "language": [ "fr", "fr-CA" @@ -330,9 +290,7 @@ }, { "name": "__MSG_keyboard_swiss_french__", - "type": "ime", "id": "xkb:ch:fr:fra", - "description": "", "language": [ "fr", "fr-CH" @@ -344,9 +302,7 @@ }, { "name": "__MSG_keyboard_canadian_multilingual__", - "type": "ime", "id": "xkb:ca:multix:fra", - "description": "", "language": [ "fr", "fr-CA" @@ -358,9 +314,7 @@ }, { "name": "__MSG_keyboard_german__", - "type": "ime", "id": "xkb:de::ger", - "description": "", "language": [ "de", "de-AT", @@ -374,10 +328,8 @@ }, { "name": "__MSG_keyboard_german_neo_2__", - "type": "ime", "id": "xkb:de:neo:ger", "indicator": "NEO", - "description": "", "language": [ "de", "de-AT", @@ -391,9 +343,7 @@ }, { "name": "__MSG_keyboard_belgian_german__", - "type": "ime", "id": "xkb:be::ger", - "description": "", "language": [ "de" ], @@ -404,9 +354,7 @@ }, { "name": "__MSG_keyboard_swiss__", - "type": "ime", "id": "xkb:ch::ger", - "description": "", "language": [ "de", "de-CH" @@ -418,10 +366,8 @@ }, { "name": "__MSG_keyboard_japanese__", - "type": "ime", "id": "xkb:jp::jpn", "indicator": "JA", - "description": "", "language": [ "ja" ], @@ -432,9 +378,7 @@ }, { "name": "__MSG_keyboard_russian__", - "type": "ime", "id": "xkb:ru::rus", - "description": "", "language": [ "ru" ], @@ -445,9 +389,7 @@ }, { "name": "__MSG_keyboard_russian_phonetic__", - "type": "ime", "id": "xkb:ru:phonetic:rus", - "description": "", "language": [ "ru" ], @@ -458,9 +400,7 @@ }, { "name": "__MSG_keyboard_brazilian__", - "type": "ime", "id": "xkb:br::por", - "description": "", "language": [ "pt-BR", "pt" @@ -472,10 +412,8 @@ }, { "name": "__MSG_keyboard_portuguese_us_international__", - "type": "ime", "id": "xkb:us:intl:por", "indicator": "INTL", - "description": "", "language": [ "pt-BR" ], @@ -486,10 +424,8 @@ }, { "name": "__MSG_keyboard_portuguese_us_international_pc__", - "type": "ime", "id": "xkb:us:intl_pc:por", "indicator": "INTL", - "description": "", "language": [ "pt-BR" ], @@ -500,9 +436,7 @@ }, { "name": "__MSG_keyboard_bulgarian__", - "type": "ime", "id": "xkb:bg::bul", - "description": "", "language": [ "bg" ], @@ -513,9 +447,7 @@ }, { "name": "__MSG_keyboard_bulgarian_phonetic__", - "type": "ime", "id": "xkb:bg:phonetic:bul", - "description": "", "language": [ "bg" ], @@ -526,9 +458,7 @@ }, { "name": "__MSG_keyboard_canadian_english__", - "type": "ime", "id": "xkb:ca:eng:eng", - "description": "", "language": [ "en", "en-CA" @@ -540,9 +470,7 @@ }, { "name": "__MSG_keyboard_czech__", - "type": "ime", "id": "xkb:cz::cze", - "description": "", "language": [ "cs" ], @@ -553,10 +481,8 @@ }, { "name": "__MSG_keyboard_czech_qwerty__", - "type": "ime", "id": "xkb:cz:qwerty:cze", "indicator": "CS", - "description": "", "language": [ "cs" ], @@ -567,9 +493,7 @@ }, { "name": "__MSG_keyboard_estonian__", - "type": "ime", "id": "xkb:ee::est", - "description": "", "language": [ "et" ], @@ -580,9 +504,7 @@ }, { "name": "__MSG_keyboard_spanish__", - "type": "ime", "id": "xkb:es::spa", - "description": "", "language": [ "es", "es-ES" @@ -594,10 +516,8 @@ }, { "name": "__MSG_keyboard_catalan__", - "type": "ime", "id": "xkb:es:cat:cat", "indicator": "CAT", - "description": "", "language": [ "ca" ], @@ -608,9 +528,7 @@ }, { "name": "__MSG_keyboard_danish__", - "type": "ime", "id": "xkb:dk::dan", - "description": "", "language": [ "da" ], @@ -621,9 +539,7 @@ }, { "name": "__MSG_keyboard_greek__", - "type": "ime", "id": "xkb:gr::gre", - "description": "", "language": [ "el" ], @@ -634,9 +550,7 @@ }, { "name": "__MSG_keyboard_hebrew__", - "type": "ime", "id": "xkb:il::heb", - "description": "", "language": [ "he" ], @@ -647,10 +561,8 @@ }, { "name": "__MSG_keyboard_latin_american__", - "type": "ime", "id": "xkb:latam::spa", "indicator": "LA", - "description": "", "language": [ "es", "es-419" @@ -662,9 +574,7 @@ }, { "name": "__MSG_keyboard_lithuanian__", - "type": "ime", "id": "xkb:lt::lit", - "description": "", "language": [ "lt" ], @@ -675,9 +585,7 @@ }, { "name": "__MSG_keyboard_latvian__", - "type": "ime", "id": "xkb:lv:apostrophe:lav", - "description": "", "language": [ "lv" ], @@ -688,9 +596,7 @@ }, { "name": "__MSG_keyboard_croatian__", - "type": "ime", "id": "xkb:hr::scr", - "description": "", "language": [ "hr" ], @@ -701,9 +607,7 @@ }, { "name": "__MSG_keyboard_uk__", - "type": "ime", "id": "xkb:gb:extd:eng", - "description": "", "language": [ "en", "en-GB" @@ -715,10 +619,8 @@ }, { "name": "__MSG_keyboard_uk_dvorak__", - "type": "ime", "id": "xkb:gb:dvorak:eng", "indicator": "DV", - "description": "", "language": [ "en", "en-GB" @@ -730,9 +632,7 @@ }, { "name": "__MSG_keyboard_finnish__", - "type": "ime", "id": "xkb:fi::fin", - "description": "", "language": [ "fi" ], @@ -743,9 +643,7 @@ }, { "name": "__MSG_keyboard_hungarian__", - "type": "ime", "id": "xkb:hu::hun", - "description": "", "language": [ "hu" ], @@ -756,9 +654,7 @@ }, { "name": "__MSG_keyboard_hungarian_qwerty__", - "type": "ime", "id": "xkb:hu:qwerty:hun", - "description": "", "language": [ "hu" ], @@ -769,9 +665,7 @@ }, { "name": "__MSG_keyboard_italian__", - "type": "ime", "id": "xkb:it::ita", - "description": "", "language": [ "it", "it-IT" @@ -783,9 +677,7 @@ }, { "name": "__MSG_keyboard_icelandic__", - "type": "ime", "id": "xkb:is::ice", - "description": "", "language": [ "is" ], @@ -796,9 +688,7 @@ }, { "name": "__MSG_keyboard_norwegian__", - "type": "ime", "id": "xkb:no::nob", - "description": "", "language": [ "nb", "nn", @@ -811,9 +701,7 @@ }, { "name": "__MSG_keyboard_polish__", - "type": "ime", "id": "xkb:pl::pol", - "description": "", "language": [ "pl" ], @@ -824,9 +712,7 @@ }, { "name": "__MSG_keyboard_portuguese__", - "type": "ime", "id": "xkb:pt::por", - "description": "", "language": [ "pt-PT", "pt" @@ -838,9 +724,7 @@ }, { "name": "__MSG_keyboard_romanian__", - "type": "ime", "id": "xkb:ro::rum", - "description": "", "language": [ "ro" ], @@ -851,9 +735,7 @@ }, { "name": "__MSG_keyboard_romanian_standard__", - "type": "ime", "id": "xkb:ro:std:rum", - "description": "", "language": [ "ro" ], @@ -864,9 +746,7 @@ }, { "name": "__MSG_keyboard_swedish__", - "type": "ime", "id": "xkb:se::swe", - "description": "", "language": [ "sv" ], @@ -877,9 +757,7 @@ }, { "name": "__MSG_keyboard_slovak__", - "type": "ime", "id": "xkb:sk::slo", - "description": "", "language": [ "sk" ], @@ -890,9 +768,7 @@ }, { "name": "__MSG_keyboard_slovenian__", - "type": "ime", "id": "xkb:si::slv", - "description": "", "language": [ "sl" ], @@ -903,9 +779,7 @@ }, { "name": "__MSG_keyboard_serbian__", - "type": "ime", "id": "xkb:rs::srp", - "description": "", "language": [ "sr" ], @@ -916,9 +790,7 @@ }, { "name": "__MSG_keyboard_turkish__", - "type": "ime", "id": "xkb:tr::tur", - "description": "", "language": [ "tr" ], @@ -929,9 +801,7 @@ }, { "name": "__MSG_keyboard_turkish_f__", - "type": "ime", "id": "xkb:tr:f:tur", - "description": "", "language": [ "tr" ], @@ -942,9 +812,7 @@ }, { "name": "__MSG_keyboard_ukrainian__", - "type": "ime", "id": "xkb:ua::ukr", - "description": "", "language": [ "uk" ], @@ -955,9 +823,7 @@ }, { "name": "__MSG_keyboard_belarusian__", - "type": "ime", "id": "xkb:by::bel", - "description": "", "language": [ "be" ], @@ -968,9 +834,7 @@ }, { "name": "__MSG_keyboard_armenian_phonetic__", - "type": "ime", "id": "xkb:am:phonetic:arm", - "description": "", "language": [ "hy" ], @@ -981,9 +845,7 @@ }, { "name": "__MSG_keyboard_georgian__", - "type": "ime", "id": "xkb:ge::geo", - "description": "", "language": [ "ka" ], @@ -994,9 +856,7 @@ }, { "name": "__MSG_keyboard_mongolian__", - "type": "ime", "id": "xkb:mn::mon", - "description": "", "language": [ "mn" ], @@ -1007,9 +867,7 @@ }, { "name": "__MSG_keyboard_irish__", - "type": "ime", "id": "xkb:ie::ga", - "description": "", "language": [ "ga" ], @@ -1020,9 +878,7 @@ }, { "name": "__MSG_keyboard_maltese__", - "type": "ime", "id": "xkb:mt::mlt", - "description": "", "language": [ "mt" ], @@ -1033,9 +889,7 @@ }, { "name": "__MSG_keyboard_macedonian__", - "type": "ime", "id": "xkb:mk::mkd", - "description": "", "language": [ "mk" ], @@ -1046,9 +900,7 @@ }, { "name": "__MSG_keyboard_kazakh__", - "type": "ime", "id": "xkb:kz::kaz", - "description": "", "language": [ "kk" ], @@ -1059,10 +911,8 @@ }, { "name": "__MSG_inputmethod_pinyin__", - "type": "ime", "id": "zh-t-i0-pinyin", "indicator": "\u62fc", - "description": "Pinyin", "language": [ "zh-CN", "zh" @@ -1074,10 +924,8 @@ }, { "name": "__MSG_inputmethod_traditional_pinyin__", - "type": "ime", "id": "zh-hant-t-i0-pinyin", "indicator": "\u62fc", - "description": "Pinyin for Tranditional Chinese", "language": [ "zh-TW", "zh" @@ -1089,10 +937,8 @@ }, { "name": "__MSG_inputmethod_cangjie__", - "type": "ime", "id": "zh-hant-t-i0-cangjie-1987", "indicator": "\u5009", - "description": "Cangjie", "language": [ "zh-TW", "zh" @@ -1103,10 +949,8 @@ }, { "name": "__MSG_inputmethod_quick__", - "type": "ime", "id": "zh-hant-t-i0-cangjie-1987-x-m0-simplified", "indicator": "\u901f", - "description": "Quick", "language": [ "zh-TW", "zh" @@ -1117,10 +961,8 @@ }, { "name": "__MSG_inputmethod_cantonese__", - "type": "ime", "id": "yue-hant-t-i0-und", "indicator": "\u7CA4", - "description": "Cantonese", "language": [ "zh-TW" ], @@ -1130,10 +972,8 @@ }, { "name": "__MSG_inputmethod_wubi__", - "type": "ime", "id": "zh-t-i0-wubi-1986", "indicator": "\u4e94", - "description": "Wubi", "language": [ "zh-CN", "zh" @@ -1144,10 +984,8 @@ }, { "name": "__MSG_inputmethod_array__", - "type": "ime", "id": "zh-hant-t-i0-array-1992", "indicator": "\u884c\u5217", - "description": "Array", "language": [ "zh-TW", "zh" @@ -1158,10 +996,8 @@ }, { "name": "__MSG_inputmethod_dayi__", - "type": "ime", "id": "zh-hant-t-i0-dayi-1988", "indicator": "\u5927\u6613", - "description": "Dayi", "language": [ "zh-TW", "zh" @@ -1172,10 +1008,8 @@ }, { "name": "__MSG_inputmethod_zhuyin__", - "type": "ime", "id": "zh-hant-t-i0-und", "indicator": "\u6CE8", - "description": "Zhuyin", "language": [ "zh-TW", "zh" @@ -1187,9 +1021,7 @@ }, { "name": "__MSG_transliteration_am__", - "type": "ime", "id": "am-t-i0-und", - "description": "Amharic", "language": "am", "layouts": [ "us" @@ -1197,9 +1029,7 @@ }, { "name": "__MSG_transliteration_ar__", - "type": "ime", "id": "ar-t-i0-und", - "description": "Arabic", "language": "ar", "layouts": [ "us" @@ -1207,9 +1037,7 @@ }, { "name": "__MSG_transliteration_bn__", - "type": "ime", "id": "bn-t-i0-und", - "description": "Bengali", "language": "bn", "layouts": [ "us" @@ -1217,9 +1045,7 @@ }, { "name": "__MSG_transliteration_el__", - "type": "ime", "id": "el-t-i0-und", - "description": "Greek", "language": "el", "layouts": [ "us" @@ -1227,9 +1053,7 @@ }, { "name": "__MSG_transliteration_fa__", - "type": "ime", "id": "fa-t-i0-und", - "description": "Persian", "language": "fa", "layouts": [ "us" @@ -1237,9 +1061,7 @@ }, { "name": "__MSG_transliteration_gu__", - "type": "ime", "id": "gu-t-i0-und", - "description": "Gujarati", "language": "gu", "layouts": [ "us" @@ -1247,9 +1069,7 @@ }, { "name": "__MSG_transliteration_he__", - "type": "ime", "id": "he-t-i0-und", - "description": "Hebrew", "language": "he", "layouts": [ "us" @@ -1257,9 +1077,7 @@ }, { "name": "__MSG_transliteration_hi__", - "type": "ime", "id": "hi-t-i0-und", - "description": "Hindi", "language": "hi", "layouts": [ "us" @@ -1267,9 +1085,7 @@ }, { "name": "__MSG_transliteration_kn__", - "type": "ime", "id": "kn-t-i0-und", - "description": "Kannada", "language": "kn", "layouts": [ "us" @@ -1277,9 +1093,7 @@ }, { "name": "__MSG_transliteration_ml__", - "type": "ime", "id": "ml-t-i0-und", - "description": "Malayalam", "language": "ml", "layouts": [ "us" @@ -1287,9 +1101,7 @@ }, { "name": "__MSG_transliteration_mr__", - "type": "ime", "id": "mr-t-i0-und", - "description": "Marathi", "language": "mr", "layouts": [ "us" @@ -1297,9 +1109,7 @@ }, { "name": "__MSG_transliteration_ne__", - "type": "ime", "id": "ne-t-i0-und", - "description": "Nepali", "language": "ne", "layouts": [ "us" @@ -1307,9 +1117,7 @@ }, { "name": "__MSG_transliteration_or__", - "type": "ime", "id": "or-t-i0-und", - "description": "Oriya", "language": "or", "layouts": [ "us" @@ -1317,9 +1125,7 @@ }, { "name": "__MSG_transliteration_pa__", - "type": "ime", "id": "pa-t-i0-und", - "description": "Punjabi", "language": "pa", "layouts": [ "us" @@ -1327,9 +1133,7 @@ }, { "name": "__MSG_transliteration_sa__", - "type": "ime", "id": "sa-t-i0-und", - "description": "Sanskrit", "language": "sa", "layouts": [ "us" @@ -1337,9 +1141,7 @@ }, { "name": "__MSG_transliteration_sr__", - "type": "ime", "id": "sr-t-i0-und", - "description": "Serbian", "language": "sr", "layouts": [ "us" @@ -1347,9 +1149,7 @@ }, { "name": "__MSG_transliteration_ta__", - "type": "ime", "id": "ta-t-i0-und", - "description": "Tamil", "language": "ta", "layouts": [ "us" @@ -1357,9 +1157,7 @@ }, { "name": "__MSG_transliteration_te__", - "type": "ime", "id": "te-t-i0-und", - "description": "Telugu", "language": "te", "layouts": [ "us" @@ -1367,9 +1165,7 @@ }, { "name": "__MSG_transliteration_ti__", - "type": "ime", "id": "ti-t-i0-und", - "description": "Tigrinya", "language": "ti", "layouts": [ "us" @@ -1377,9 +1173,7 @@ }, { "name": "__MSG_transliteration_ur__", - "type": "ime", "id": "ur-t-i0-und", - "description": "Urdu", "language": "ur", "layouts": [ "us" @@ -1387,10 +1181,8 @@ }, { "name": "__MSG_inputmethod_hangul__", - "type": "ime", "id": "ko-t-i0-und", "indicator": "\ud55c", - "description": "Korean input method.", "language": "ko", "layouts": [ "us" @@ -1399,10 +1191,8 @@ }, { "name": "__MSG_inputmethod_mozc_us__", - "type": "ime", "id": "nacl_mozc_us", "indicator": "\u3042", - "description": "Japanese input method.", "language": "ja", "layouts": [ "us" @@ -1411,10 +1201,8 @@ }, { "name": "__MSG_inputmethod_mozc_jp__", - "type": "ime", "id": "nacl_mozc_jp", "indicator": "\u3042", - "description": "Japanese input method.", "language": "ja", "layouts": [ "jp" @@ -1423,9 +1211,7 @@ }, { "name": "__MSG_keyboard_bengali_phonetic__", - "type": "ime", "id": "vkd_bn_phone", - "description": "", "language": [ "bn" ], @@ -1435,9 +1221,7 @@ }, { "name": "__MSG_keyboard_gujarati_phonetic__", - "type": "ime", "id": "vkd_gu_phone", - "description": "", "language": [ "gu" ], @@ -1447,9 +1231,7 @@ }, { "name": "__MSG_keyboard_devanagari_phonetic__", - "type": "ime", "id": "vkd_deva_phone", - "description": "", "language": [ "hi", "mr" @@ -1460,9 +1242,7 @@ }, { "name": "__MSG_keyboard_kannada_phonetic__", - "type": "ime", "id": "vkd_kn_phone", - "description": "", "language": [ "kn" ], @@ -1472,9 +1252,7 @@ }, { "name": "__MSG_keyboard_malayalam_phonetic__", - "type": "ime", "id": "vkd_ml_phone", - "description": "", "language": [ "ml" ], @@ -1484,9 +1262,7 @@ }, { "name": "__MSG_keyboard_tamil_inscript__", - "type": "ime", "id": "vkd_ta_inscript", - "description": "", "language": [ "ta" ], @@ -1496,9 +1272,7 @@ }, { "name": "__MSG_keyboard_tamil_phonetic__", - "type": "ime", "id": "vkd_ta_phone", - "description": "", "language": [ "ta" ], @@ -1508,9 +1282,7 @@ }, { "name": "__MSG_keyboard_tamil_tamil99__", - "type": "ime", "id": "vkd_ta_tamil99", - "description": "", "language": [ "ta" ], @@ -1520,9 +1292,7 @@ }, { "name": "__MSG_keyboard_tamil_typewriter__", - "type": "ime", "id": "vkd_ta_typewriter", - "description": "", "language": [ "ta" ], @@ -1532,9 +1302,7 @@ }, { "name": "__MSG_keyboard_tamil_itrans__", - "type": "ime", "id": "vkd_ta_itrans", - "description": "", "language": [ "ta" ], @@ -1544,9 +1312,7 @@ }, { "name": "__MSG_keyboard_telugu_phonetic__", - "type": "ime", "id": "vkd_te_phone", - "description": "", "language": [ "te" ], @@ -1556,9 +1322,7 @@ }, { "name": "__MSG_keyboard_ethiopic__", - "type": "ime", "id": "vkd_ethi", - "description": "", "language": [ "am" ], @@ -1568,9 +1332,7 @@ }, { "name": "__MSG_keyboard_thai_kedmanee__", - "type": "ime", "id": "vkd_th", - "description": "", "language": [ "th" ], @@ -1580,9 +1342,7 @@ }, { "name": "__MSG_keyboard_thai_pattachote__", - "type": "ime", "id": "vkd_th_pattajoti", - "description": "", "language": [ "th" ], @@ -1592,9 +1352,7 @@ }, { "name": "__MSG_keyboard_thai_tis__", - "type": "ime", "id": "vkd_th_tis", - "description": "", "language": [ "th" ], @@ -1604,9 +1362,7 @@ }, { "name": "__MSG_keyboard_persian__", - "type": "ime", "id": "vkd_fa", - "description": "", "language": [ "fa" ], @@ -1616,9 +1372,7 @@ }, { "name": "__MSG_keyboard_vietnamese_tcvn__", - "type": "ime", "id": "vkd_vi_tcvn", - "description": "", "language": [ "vi" ], @@ -1628,9 +1382,7 @@ }, { "name": "__MSG_keyboard_vietnamese_telex__", - "type": "ime", "id": "vkd_vi_telex", - "description": "", "language": [ "vi" ], @@ -1640,9 +1392,7 @@ }, { "name": "__MSG_keyboard_vietnamese_viqr__", - "type": "ime", "id": "vkd_vi_viqr", - "description": "", "language": [ "vi" ], @@ -1652,9 +1402,7 @@ }, { "name": "__MSG_keyboard_vietnamese_vni__", - "type": "ime", "id": "vkd_vi_vni", - "description": "", "language": [ "vi" ], @@ -1664,9 +1412,7 @@ }, { "name": "__MSG_keyboard_arabic__", - "type": "ime", "id": "vkd_ar", - "description": "", "language": [ "ar" ], @@ -1676,9 +1422,7 @@ }, { "name": "__MSG_keyboard_lao__", - "type": "ime", "id": "vkd_lo", - "description": "", "language": [ "lo" ], @@ -1688,9 +1432,7 @@ }, { "name": "__MSG_keyboard_nepali_inscript__", - "type": "ime", "id": "vkd_ne_inscript", - "description": "", "language": [ "ne" ], @@ -1700,9 +1442,7 @@ }, { "name": "__MSG_keyboard_nepali_phonetic__", - "type": "ime", "id": "vkd_ne_phone", - "description": "", "language": [ "ne" ], @@ -1712,9 +1452,7 @@ }, { "name": "__MSG_keyboard_khmer__", - "type": "ime", "id": "vkd_km", - "description": "", "language": [ "km" ], @@ -1724,9 +1462,7 @@ }, { "name": "__MSG_keyboard_myanmar__", - "type": "ime", "id": "vkd_my", - "description": "", "language": [ "my" ], @@ -1736,9 +1472,7 @@ }, { "name": "__MSG_keyboard_sinhala__", - "type": "ime", "id": "vkd_si", - "description": "", "language": [ "si" ], @@ -1748,9 +1482,7 @@ }, { "name": "__MSG_keyboard_soranikurdish_en__", - "type": "ime", "id": "vkd_ckb_en", - "description": "Sorani Kurdish - English-based", "language": [ "ckb" ], @@ -1760,9 +1492,7 @@ }, { "name": "__MSG_keyboard_soranikurdish_ar__", - "type": "ime", "id": "vkd_ckb_ar", - "description": "Sorani Kurdish - Arabic-based", "language": [ "ckb" ], @@ -1772,9 +1502,7 @@ }, { "name": "__MSG_keyboard_myanmar_myansan__", - "type": "ime", "id": "vkd_my_myansan", - "description": "", "language": [ "my" ], @@ -1784,9 +1512,7 @@ }, { "name": "__MSG_keyboard_russian_phonetic_aatseel__", - "type": "ime", "id": "vkd_ru_phone_aatseel", - "description": "", "language": [ "ru" ], @@ -1796,15 +1522,173 @@ }, { "name": "__MSG_keyboard_russian_phonetic_yazhert__", - "type": "ime", "id": "vkd_ru_phone_yazhert", - "description": "", "language": [ "ru" ], "layouts": [ "us" ] + }, + { + "name": "Dutch with US keyboard", + "id": "experimental_layout-us_lang-nl", + "language": [ + "nl" + ], + "layouts": [ + "us" + ] + }, + { + "name": "Spanish (Spain) with US keyboard", + "id": "experimental_layout-us_lang-es-ES", + "language": [ + "es-ES" + ], + "layouts": [ + "us" + ] + }, + { + "name": "Swedish with US keyboard", + "id": "experimental_layout-us_lang-sv", + "language": [ + "sv" + ], + "layouts": [ + "us" + ] + }, + { + "name": "French (France) with US keyboard", + "id": "experimental_layout-us_lang-fr-FR", + "language": [ + "fr-FR" + ], + "layouts": [ + "us" + ] + }, + { + "name": "French (Canada) with US keyboard", + "id": "experimental_layout-us_lang-fr-CA", + "language": [ + "fr-CA" + ], + "layouts": [ + "us" + ] + }, + { + "name": "Dutch with UK keyboard", + "id": "experimental_layout-gb(extd)_lang-nl", + "language": [ + "nl" + ], + "layouts": [ + "gb(extd)" + ] + }, + { + "name": "Spanish (Spain) with UK keyboard", + "id": "experimental_layout-gb(extd)_lang-es-ES", + "language": [ + "es-ES" + ], + "layouts": [ + "gb(extd)" + ] + }, + { + "name": "Swedish with UK keyboard", + "id": "experimental_layout-gb(extd)_lang-sv", + "language": [ + "sv" + ], + "layouts": [ + "gb(extd)" + ] + }, + { + "name": "French (France) with UK keyboard", + "id": "experimental_layout-gb(extd)_lang-fr-FR", + "language": [ + "fr-FR" + ], + "layouts": [ + "gb(extd)" + ] + }, + { + "name": "Swedish with Norwegian keyboard", + "id": "experimental_layout-no_lang-sv", + "language": [ + "sv" + ], + "layouts": [ + "no" + ] + }, + { + "name": "Danish with Norwegian keyboard", + "id": "experimental_layout-no_lang-da", + "language": [ + "da" + ], + "layouts": [ + "no" + ] + }, + { + "name": "Norwegian with Swedish keyboard", + "id": "experimental_layout-se_lang-no", + "language": [ + "no" + ], + "layouts": [ + "se" + ] + }, + { + "name": "Danish with Swedish keyboard", + "id": "experimental_layout-se_lang-da", + "language": [ + "da" + ], + "layouts": [ + "se" + ] + }, + { + "name": "Norwegian with Danish keyboard", + "id": "experimental_layout-dk_lang-no", + "language": [ + "no" + ], + "layouts": [ + "dk" + ] + }, + { + "name": "Swedish with Danish keyboard", + "id": "experimental_layout-dk_lang-sv", + "language": [ + "sv" + ], + "layouts": [ + "dk" + ] + }, + { + "name": "Catalan with Spanish keyboard", + "id": "experimental_layout-es_lang-ca", + "language": [ + "ca" + ], + "layouts": [ + "es" + ] } ], "manifest_version": 2,
diff --git a/chrome/browser/resources/chromeos/input_method/hangul_manifest.json b/chrome/browser/resources/chromeos/input_method/hangul_manifest.json index f6216de..4260fb0 100644 --- a/chrome/browser/resources/chromeos/input_method/hangul_manifest.json +++ b/chrome/browser/resources/chromeos/input_method/hangul_manifest.json
@@ -21,10 +21,8 @@ "input_components": [ { "name": "__MSG_inputmethod_Hangul_2_Set__", - "type": "ime", "id": "hangul_2set", "indicator": "\ud55c", - "description": "", "language": "ko", "layouts": [ "us" @@ -33,10 +31,8 @@ }, { "name": "__MSG_inputmethod_Hangul_3_Set_390__", - "type": "ime", "id": "hangul_3set390", "indicator": "\ud55c", - "description": "", "language": "ko", "layouts": [ "us" @@ -45,10 +41,8 @@ }, { "name": "__MSG_inputmethod_Hangul_3_Set_Final__", - "type": "ime", "id": "hangul_3setfinal", "indicator": "\ud55c", - "description": "", "language": "ko", "layouts": [ "us" @@ -57,10 +51,8 @@ }, { "name": "__MSG_inputmethod_Hangul_3_Set_No_Shift__", - "type": "ime", "id": "hangul_3setnoshift", "indicator": "\ud55c", - "description": "", "language": "ko", "layouts": [ "us" @@ -69,10 +61,8 @@ }, { "name": "__MSG_inputmethod_Hangul_Romaja__", - "type": "ime", "id": "hangul_romaja", "indicator": "\ud55c", - "description": "", "language": "ko", "layouts": [ "us" @@ -81,10 +71,8 @@ }, { "name": "__MSG_inputmethod_Hangul_Ahnmatae__", - "type": "ime", "id": "hangul_ahnmatae", "indicator": "\ud55c", - "description": "", "language": "ko", "layouts": [ "us"
diff --git a/chrome/browser/resources/chromeos/input_method/m17n_manifest.json b/chrome/browser/resources/chromeos/input_method/m17n_manifest.json index 145235ff..8a764ec 100644 --- a/chrome/browser/resources/chromeos/input_method/m17n_manifest.json +++ b/chrome/browser/resources/chromeos/input_method/m17n_manifest.json
@@ -16,9 +16,7 @@ "input_components": [ { "name": "__MSG_keyboard_bengali_phonetic__", - "type": "ime", "id": "vkd_bn_phone", - "description": "", "language": "bn", "layouts": [ "us" @@ -26,9 +24,7 @@ }, { "name": "__MSG_keyboard_gujarati_phonetic__", - "type": "ime", "id": "vkd_gu_phone", - "description": "", "language": "gu", "layouts": [ "us" @@ -36,9 +32,7 @@ }, { "name": "__MSG_keyboard_devanagari_phonetic__", - "type": "ime", "id": "vkd_deva_phone", - "description": "", "language": [ "hi", "mr" @@ -49,9 +43,7 @@ }, { "name": "__MSG_keyboard_kannada_phonetic__", - "type": "ime", "id": "vkd_kn_phone", - "description": "", "language": "kn", "layouts": [ "us" @@ -59,9 +51,7 @@ }, { "name": "__MSG_keyboard_malayalam_phonetic__", - "type": "ime", "id": "vkd_ml_phone", - "description": "", "language": "ml", "layouts": [ "us" @@ -69,9 +59,7 @@ }, { "name": "__MSG_keyboard_tamil_inscript__", - "type": "ime", "id": "vkd_ta_inscript", - "description": "", "language": "ta", "layouts": [ "us" @@ -79,9 +67,7 @@ }, { "name": "__MSG_keyboard_tamil_phonetic__", - "type": "ime", "id": "vkd_ta_phone", - "description": "", "language": "ta", "layouts": [ "us" @@ -89,9 +75,7 @@ }, { "name": "__MSG_keyboard_tamil_tamil99__", - "type": "ime", "id": "vkd_ta_tamil99", - "description": "", "language": "ta", "layouts": [ "us" @@ -99,9 +83,7 @@ }, { "name": "__MSG_keyboard_tamil_typewriter__", - "type": "ime", "id": "vkd_ta_typewriter", - "description": "", "language": "ta", "layouts": [ "us" @@ -109,9 +91,7 @@ }, { "name": "__MSG_keyboard_tamil_itrans__", - "type": "ime", "id": "vkd_ta_itrans", - "description": "", "language": "ta", "layouts": [ "us" @@ -119,9 +99,7 @@ }, { "name": "__MSG_keyboard_telugu_phonetic__", - "type": "ime", "id": "vkd_te_phone", - "description": "", "language": "te", "layouts": [ "us" @@ -129,9 +107,7 @@ }, { "name": "__MSG_keyboard_ethiopic__", - "type": "ime", "id": "vkd_ethi", - "description": "", "language": "am", "layouts": [ "us" @@ -139,9 +115,7 @@ }, { "name": "__MSG_keyboard_thai_kedmanee__", - "type": "ime", "id": "vkd_th", - "description": "", "language": "th", "layouts": [ "us" @@ -149,9 +123,7 @@ }, { "name": "__MSG_keyboard_thai_pattachote__", - "type": "ime", "id": "vkd_th_pattajoti", - "description": "", "language": "th", "layouts": [ "us" @@ -159,9 +131,7 @@ }, { "name": "__MSG_keyboard_thai_tis__", - "type": "ime", "id": "vkd_th_tis", - "description": "", "language": "th", "layouts": [ "us" @@ -169,9 +139,7 @@ }, { "name": "__MSG_keyboard_persian__", - "type": "ime", "id": "vkd_fa", - "description": "", "language": "fa", "layouts": [ "us" @@ -179,9 +147,7 @@ }, { "name": "__MSG_keyboard_vietnamese_tcvn__", - "type": "ime", "id": "vkd_vi_tcvn", - "description": "", "language": "vi", "layouts": [ "us" @@ -189,9 +155,7 @@ }, { "name": "__MSG_keyboard_vietnamese_telex__", - "type": "ime", "id": "vkd_vi_telex", - "description": "", "language": "vi", "layouts": [ "us" @@ -199,9 +163,7 @@ }, { "name": "__MSG_keyboard_vietnamese_viqr__", - "type": "ime", "id": "vkd_vi_viqr", - "description": "", "language": "vi", "layouts": [ "us" @@ -209,9 +171,7 @@ }, { "name": "__MSG_keyboard_vietnamese_vni__", - "type": "ime", "id": "vkd_vi_vni", - "description": "", "language": "vi", "layouts": [ "us" @@ -219,9 +179,7 @@ }, { "name": "__MSG_keyboard_arabic__", - "type": "ime", "id": "vkd_ar", - "description": "", "language": "ar", "layouts": [ "us"
diff --git a/chrome/browser/resources/chromeos/input_method/mozc_manifest.json b/chrome/browser/resources/chromeos/input_method/mozc_manifest.json index dc29e90..cbc27740 100644 --- a/chrome/browser/resources/chromeos/input_method/mozc_manifest.json +++ b/chrome/browser/resources/chromeos/input_method/mozc_manifest.json
@@ -17,10 +17,8 @@ "input_components": [ { "name": "__MSG_inputmethod_mozc_us__", - "type": "ime", "id": "nacl_mozc_us", "indicator": "\u3042", - "description": "Japanese input method.", "language": "ja", "layouts": [ "us" @@ -28,10 +26,8 @@ }, { "name": "__MSG_inputmethod_mozc_jp__", - "type": "ime", "id": "nacl_mozc_jp", "indicator": "\u3042", - "description": "Japanese input method.", "language": "ja", "layouts": [ "jp"
diff --git a/chrome/browser/resources/chromeos/input_method/pinyin_manifest.json b/chrome/browser/resources/chromeos/input_method/pinyin_manifest.json index f6fc4c0..c0b0a9e 100644 --- a/chrome/browser/resources/chromeos/input_method/pinyin_manifest.json +++ b/chrome/browser/resources/chromeos/input_method/pinyin_manifest.json
@@ -15,10 +15,8 @@ "input_components": [ { "name": "__MSG_inputmethod_pinyin__", - "type": "ime", "id": "zh-t-i0-pinyin", "indicator": "\u62fc", - "description": "Pinyin", "language": [ "zh-CN", "zh"
diff --git a/chrome/browser/resources/chromeos/input_method/xkb_manifest.json b/chrome/browser/resources/chromeos/input_method/xkb_manifest.json index ca18e77..9a11003 100644 --- a/chrome/browser/resources/chromeos/input_method/xkb_manifest.json +++ b/chrome/browser/resources/chromeos/input_method/xkb_manifest.json
@@ -19,9 +19,7 @@ "input_components": [ { "name": "__MSG_keyboard_us__", - "type": "ime", "id": "xkb:us::eng", - "description": "", "language": [ "en", "en-US", @@ -35,9 +33,7 @@ }, { "name": "__MSG_keyboard_us__", - "type": "ime", "id": "xkb:us::ind", - "description": "", "language": [ "id" ], @@ -48,9 +44,7 @@ }, { "name": "__MSG_keyboard_us__", - "type": "ime", "id": "xkb:us::fil", - "description": "", "language": [ "fil" ], @@ -61,9 +55,7 @@ }, { "name": "__MSG_keyboard_us__", - "type": "ime", "id": "xkb:us::msa", - "description": "", "language": [ "ms" ], @@ -74,10 +66,8 @@ }, { "name": "__MSG_keyboard_us_international__", - "type": "ime", "id": "xkb:us:intl:eng", "indicator": "INTL", - "description": "", "language": [ "en", "en-US" @@ -89,10 +79,8 @@ }, { "name": "__MSG_keyboard_netherlands__", - "type": "ime", "id": "xkb:us:intl:nld", "indicator": "NLD", - "description": "", "language": [ "nl" ], @@ -103,10 +91,8 @@ }, { "name": "__MSG_keyboard_us_extended__", - "type": "ime", "id": "xkb:us:altgr-intl:eng", "indicator": "EXTD", - "description": "", "language": [ "en", "en-US" @@ -118,10 +104,8 @@ }, { "name": "__MSG_keyboard_us_dvorak__", - "type": "ime", "id": "xkb:us:dvorak:eng", "indicator": "DV", - "description": "", "language": [ "en", "en-US" @@ -133,10 +117,8 @@ }, { "name": "__MSG_keyboard_us_dvp__", - "type": "ime", "id": "xkb:us:dvp:eng", "indicator": "DVP", - "description": "", "language": [ "en", "en-US" @@ -148,10 +130,8 @@ }, { "name": "__MSG_keyboard_us_colemak__", - "type": "ime", "id": "xkb:us:colemak:eng", "indicator": "CO", - "description": "", "language": [ "en", "en-US" @@ -163,10 +143,8 @@ }, { "name": "__MSG_keyboard_us_workman__", - "type": "ime", "id": "xkb:us:workman:eng", "indicator": "WM", - "description": "", "language": [ "en", "en-US" @@ -178,10 +156,8 @@ }, { "name": "__MSG_keyboard_us_workman_international__", - "type": "ime", "id": "xkb:us:workman-intl:eng", "indicator": "WMI", - "description": "", "language": [ "en", "en-US" @@ -193,9 +169,7 @@ }, { "name": "__MSG_keyboard_belgian__", - "type": "ime", "id": "xkb:be::nld", - "description": "", "language": [ "nl" ], @@ -206,9 +180,7 @@ }, { "name": "__MSG_keyboard_french__", - "type": "ime", "id": "xkb:fr::fra", - "description": "", "language": [ "fr", "fr-FR" @@ -220,9 +192,7 @@ }, { "name": "__MSG_keyboard_belgian__", - "type": "ime", "id": "xkb:be::fra", - "description": "", "language": [ "fr" ], @@ -233,9 +203,7 @@ }, { "name": "__MSG_keyboard_canadian_french__", - "type": "ime", "id": "xkb:ca::fra", - "description": "", "language": [ "fr", "fr-CA" @@ -247,9 +215,7 @@ }, { "name": "__MSG_keyboard_swiss_french__", - "type": "ime", "id": "xkb:ch:fr:fra", - "description": "", "language": [ "fr", "fr-CH" @@ -261,9 +227,7 @@ }, { "name": "__MSG_keyboard_canadian_multilingual__", - "type": "ime", "id": "xkb:ca:multix:fra", - "description": "", "language": [ "fr", "fr-CA" @@ -275,9 +239,7 @@ }, { "name": "__MSG_keyboard_german__", - "type": "ime", "id": "xkb:de::ger", - "description": "", "language": [ "de", "de-DE" @@ -289,10 +251,8 @@ }, { "name": "__MSG_keyboard_german_neo_2__", - "type": "ime", "id": "xkb:de:neo:ger", "indicator": "NEO", - "description": "", "language": [ "de", "de-DE" @@ -304,9 +264,7 @@ }, { "name": "__MSG_keyboard_belgian__", - "type": "ime", "id": "xkb:be::ger", - "description": "", "language": [ "de" ], @@ -317,9 +275,7 @@ }, { "name": "__MSG_keyboard_swiss__", - "type": "ime", "id": "xkb:ch::ger", - "description": "", "language": [ "de", "de-CH" @@ -331,10 +287,8 @@ }, { "name": "__MSG_keyboard_japanese__", - "type": "ime", "id": "xkb:jp::jpn", "indicator": "JA", - "description": "", "language": [ "ja" ], @@ -345,9 +299,7 @@ }, { "name": "__MSG_keyboard_russian__", - "type": "ime", "id": "xkb:ru::rus", - "description": "", "language": [ "ru" ], @@ -358,9 +310,7 @@ }, { "name": "__MSG_keyboard_russian_phonetic__", - "type": "ime", "id": "xkb:ru:phonetic:rus", - "description": "", "language": [ "ru" ], @@ -371,9 +321,7 @@ }, { "name": "__MSG_keyboard_brazilian__", - "type": "ime", "id": "xkb:br::por", - "description": "", "language": [ "pt-BR", "pt" @@ -385,10 +333,8 @@ }, { "name": "__MSG_keyboard_us_international__", - "type": "ime", "id": "xkb:us:intl:por", "indicator": "INTL", - "description": "", "language": [ "pt-BR" ], @@ -399,9 +345,7 @@ }, { "name": "__MSG_keyboard_bulgarian__", - "type": "ime", "id": "xkb:bg::bul", - "description": "", "language": [ "bg" ], @@ -412,9 +356,7 @@ }, { "name": "__MSG_keyboard_bulgarian_phonetic__", - "type": "ime", "id": "xkb:bg:phonetic:bul", - "description": "", "language": [ "bg" ], @@ -425,9 +367,7 @@ }, { "name": "__MSG_keyboard_canadian_english__", - "type": "ime", "id": "xkb:ca:eng:eng", - "description": "", "language": [ "en", "en-CA" @@ -439,9 +379,7 @@ }, { "name": "__MSG_keyboard_czech__", - "type": "ime", "id": "xkb:cz::cze", - "description": "", "language": [ "cs" ], @@ -452,10 +390,8 @@ }, { "name": "__MSG_keyboard_czech_qwerty__", - "type": "ime", "id": "xkb:cz:qwerty:cze", "indicator": "CS", - "description": "", "language": [ "cs" ], @@ -466,9 +402,7 @@ }, { "name": "__MSG_keyboard_estonian__", - "type": "ime", "id": "xkb:ee::est", - "description": "", "language": [ "et" ], @@ -479,9 +413,7 @@ }, { "name": "__MSG_keyboard_spanish__", - "type": "ime", "id": "xkb:es::spa", - "description": "", "language": [ "es", "es-ES" @@ -493,10 +425,8 @@ }, { "name": "__MSG_keyboard_catalan__", - "type": "ime", "id": "xkb:es:cat:cat", "indicator": "CAT", - "description": "", "language": [ "ca" ], @@ -507,9 +437,7 @@ }, { "name": "__MSG_keyboard_danish__", - "type": "ime", "id": "xkb:dk::dan", - "description": "", "language": [ "da" ], @@ -520,9 +448,7 @@ }, { "name": "__MSG_keyboard_greek__", - "type": "ime", "id": "xkb:gr::gre", - "description": "", "language": [ "el" ], @@ -533,9 +459,7 @@ }, { "name": "__MSG_keyboard_hebrew__", - "type": "ime", "id": "xkb:il::heb", - "description": "", "language": [ "he" ], @@ -546,10 +470,8 @@ }, { "name": "__MSG_keyboard_latin_american__", - "type": "ime", "id": "xkb:latam::spa", "indicator": "LA", - "description": "", "language": [ "es", "es-419" @@ -561,9 +483,7 @@ }, { "name": "__MSG_keyboard_lithuanian__", - "type": "ime", "id": "xkb:lt::lit", - "description": "", "language": [ "lt" ], @@ -574,9 +494,7 @@ }, { "name": "__MSG_keyboard_latvian__", - "type": "ime", "id": "xkb:lv:apostrophe:lav", - "description": "", "language": [ "lv" ], @@ -587,9 +505,7 @@ }, { "name": "__MSG_keyboard_croatian__", - "type": "ime", "id": "xkb:hr::scr", - "description": "", "language": [ "hr" ], @@ -600,9 +516,7 @@ }, { "name": "__MSG_keyboard_uk__", - "type": "ime", "id": "xkb:gb:extd:eng", - "description": "", "language": [ "en", "en-GB" @@ -614,10 +528,8 @@ }, { "name": "__MSG_keyboard_uk_dvorak__", - "type": "ime", "id": "xkb:gb:dvorak:eng", "indicator": "DV", - "description": "", "language": [ "en", "en-GB" @@ -629,9 +541,7 @@ }, { "name": "__MSG_keyboard_finnish__", - "type": "ime", "id": "xkb:fi::fin", - "description": "", "language": [ "fi" ], @@ -642,9 +552,7 @@ }, { "name": "__MSG_keyboard_hungarian__", - "type": "ime", "id": "xkb:hu::hun", - "description": "", "language": [ "hu" ], @@ -655,9 +563,7 @@ }, { "name": "__MSG_keyboard_italian__", - "type": "ime", "id": "xkb:it::ita", - "description": "", "language": [ "it", "it-IT" @@ -669,9 +575,7 @@ }, { "name": "__MSG_keyboard_icelandic__", - "type": "ime", "id": "xkb:is::ice", - "description": "", "language": [ "is" ], @@ -682,9 +586,7 @@ }, { "name": "__MSG_keyboard_norwegian__", - "type": "ime", "id": "xkb:no::nob", - "description": "", "language": [ "nb", "nn", @@ -697,9 +599,7 @@ }, { "name": "__MSG_keyboard_polish__", - "type": "ime", "id": "xkb:pl::pol", - "description": "", "language": [ "pl" ], @@ -710,9 +610,7 @@ }, { "name": "__MSG_keyboard_portuguese__", - "type": "ime", "id": "xkb:pt::por", - "description": "", "language": [ "pt-PT", "pt" @@ -724,9 +622,7 @@ }, { "name": "__MSG_keyboard_romanian__", - "type": "ime", "id": "xkb:ro::rum", - "description": "", "language": [ "ro" ], @@ -737,9 +633,7 @@ }, { "name": "__MSG_keyboard_swedish__", - "type": "ime", "id": "xkb:se::swe", - "description": "", "language": [ "sv" ], @@ -750,9 +644,7 @@ }, { "name": "__MSG_keyboard_slovak__", - "type": "ime", "id": "xkb:sk::slo", - "description": "", "language": [ "sk" ], @@ -763,9 +655,7 @@ }, { "name": "__MSG_keyboard_slovenian__", - "type": "ime", "id": "xkb:si::slv", - "description": "", "language": [ "sl" ], @@ -776,9 +666,7 @@ }, { "name": "__MSG_keyboard_serbian__", - "type": "ime", "id": "xkb:rs::srp", - "description": "", "language": [ "sr" ], @@ -789,9 +677,7 @@ }, { "name": "__MSG_keyboard_turkish__", - "type": "ime", "id": "xkb:tr::tur", - "description": "", "language": [ "tr" ], @@ -802,9 +688,7 @@ }, { "name": "__MSG_keyboard_ukrainian__", - "type": "ime", "id": "xkb:ua::ukr", - "description": "", "language": [ "uk" ], @@ -815,9 +699,7 @@ }, { "name": "__MSG_keyboard_belarusian__", - "type": "ime", "id": "xkb:by::bel", - "description": "", "language": [ "be" ], @@ -828,9 +710,7 @@ }, { "name": "__MSG_keyboard_armenian_phonetic__", - "type": "ime", "id": "xkb:am:phonetic:arm", - "description": "", "language": [ "hy" ], @@ -841,9 +721,7 @@ }, { "name": "__MSG_keyboard_georgian__", - "type": "ime", "id": "xkb:ge::geo", - "description": "", "language": [ "ka" ], @@ -854,9 +732,7 @@ }, { "name": "__MSG_keyboard_mongolian__", - "type": "ime", "id": "xkb:mn::mon", - "description": "", "language": [ "mn" ], @@ -867,9 +743,7 @@ }, { "name": "__MSG_keyboard_irish__", - "type": "ime", "id": "xkb:ie::ga", - "description": "", "language": [ "ga" ],
diff --git a/chrome/browser/resources/chromeos/input_method/zhuyin_manifest.json b/chrome/browser/resources/chromeos/input_method/zhuyin_manifest.json index ebbde26..b7ed5609 100644 --- a/chrome/browser/resources/chromeos/input_method/zhuyin_manifest.json +++ b/chrome/browser/resources/chromeos/input_method/zhuyin_manifest.json
@@ -15,10 +15,8 @@ "input_components": [ { "name": "__MSG_inputmethod_zhuyin__", - "type": "ime", "id": "zh-hant-t-i0-und", "indicator": "\u6CE8", - "description": "Zhuyin", "language": [ "zh-TW", "zh"
diff --git a/chrome/browser/sync/test/integration/single_client_user_events_sync_test.cc b/chrome/browser/sync/test/integration/single_client_user_events_sync_test.cc index 39c580a..db01ad1a 100644 --- a/chrome/browser/sync/test/integration/single_client_user_events_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_user_events_sync_test.cc
@@ -17,7 +17,7 @@ #include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/user_events_helper.h" #include "chrome/browser/sync/user_event_service_factory.h" -#include "chrome/common/chrome_features.h" +#include "components/federated_learning/features/features.h" #include "components/sync/protocol/user_event_specifics.pb.h" #include "components/sync_user_events/user_event_service.h" #include "content/public/test/browser_test.h" @@ -42,7 +42,8 @@ // logged right after sync gets enabled, and could mess up with the test // expectations. The scenario when the floc-event-logging is enabled is // tested separately. - feature_list_.InitAndDisableFeature(features::kFlocIdComputedEventLogging); + feature_list_.InitAndDisableFeature( + federated_learning::kFlocIdComputedEventLogging); } ~SingleClientUserEventsSyncTest() override = default; @@ -243,7 +244,8 @@ public: SingleClientUserEventsSyncTestFlocEventLoggingEnabled() { feature_list_.Reset(); - feature_list_.InitAndEnableFeature(features::kFlocIdComputedEventLogging); + feature_list_.InitAndEnableFeature( + federated_learning::kFlocIdComputedEventLogging); } };
diff --git a/chrome/browser/sync/test/integration/two_client_user_events_sync_test.cc b/chrome/browser/sync/test/integration/two_client_user_events_sync_test.cc index a164bc7..9e905f6c 100644 --- a/chrome/browser/sync/test/integration/two_client_user_events_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_user_events_sync_test.cc
@@ -11,7 +11,7 @@ #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "chrome/browser/sync/test/integration/user_events_helper.h" #include "chrome/browser/sync/user_event_service_factory.h" -#include "chrome/common/chrome_features.h" +#include "components/federated_learning/features/features.h" #include "components/sync/protocol/user_event_specifics.pb.h" #include "components/sync_user_events/user_event_service.h" #include "content/public/test/browser_test.h" @@ -31,7 +31,8 @@ // logged right after sync gets enabled, and could mess up with the test // expectations. The scenario when the floc-event-logging is enabled is // tested separately. - feature_list_.InitAndDisableFeature(features::kFlocIdComputedEventLogging); + feature_list_.InitAndDisableFeature( + federated_learning::kFlocIdComputedEventLogging); } ~TwoClientUserEventsSyncTest() override = default;
diff --git a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc index cb50552f8..fbd7580 100644 --- a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc +++ b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc
@@ -65,7 +65,7 @@ #include "services/network/test/test_url_loader_factory.h" #include "testing/gmock/include/gmock/gmock.h" #include "third_party/blink/public/common/context_menu_data/edit_flags.h" -#include "third_party/blink/public/common/context_menu_data/media_type.h" +#include "third_party/blink/public/mojom/context_menu/context_menu_data.mojom.h" #include "ui/base/page_transition_types.h" #include "url/gurl.h" @@ -373,7 +373,7 @@ TestRenderViewContextMenu* CreateContextMenu() { content::ContextMenuParams params; - params.media_type = blink::ContextMenuDataMediaType::kNone; + params.media_type = blink::mojom::ContextMenuDataMediaType::kNone; params.x = 0; params.y = 0; params.has_image_contents = true;
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 32c61bbd..549167e 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -1478,14 +1478,14 @@ "webui/settings/settings_startup_pages_handler.h", "webui/settings/settings_ui.cc", "webui/settings/settings_ui.h", + "webui/settings/settings_utils.cc", + "webui/settings/settings_utils.h", "webui/settings/shared_settings_localized_strings_provider.cc", "webui/settings/shared_settings_localized_strings_provider.h", "webui/settings/site_settings_handler.cc", "webui/settings/site_settings_handler.h", "webui/settings/site_settings_helper.cc", "webui/settings/site_settings_helper.h", - "webui/settings_utils.cc", - "webui/settings_utils.h", "webui/signin/login_ui_service.cc", "webui/signin/login_ui_service.h", "webui/signin/login_ui_service_factory.cc", @@ -3130,7 +3130,7 @@ "views/tab_contents/chrome_web_contents_view_delegate_views_mac.mm", "webui/help/version_updater_mac.h", "webui/help/version_updater_mac.mm", - "webui/settings_utils_mac.mm", + "webui/settings/settings_utils_mac.mm", "window_sizer/window_sizer_mac.mm", ] @@ -3232,7 +3232,7 @@ "webui/conflicts/conflicts_ui.h", "webui/settings/chrome_cleanup_handler_win.cc", "webui/settings/chrome_cleanup_handler_win.h", - "webui/settings_utils_win.cc", + "webui/settings/settings_utils_win.cc", "webui/version/version_handler_win.cc", "webui/version/version_handler_win.h", "webui/version/version_util_win.cc", @@ -3301,7 +3301,7 @@ "views/status_icons/status_icon_linux_wrapper.h", "webui/help/version_updater_basic.cc", "webui/help/version_updater_basic.h", - "webui/settings_utils_linux.cc", + "webui/settings/settings_utils_linux.cc", ] deps += [ "//ui/base:wm_role_names",
diff --git a/chrome/browser/ui/android/context_menu_helper.cc b/chrome/browser/ui/android/context_menu_helper.cc index c39cc64a..d3aa0b4 100644 --- a/chrome/browser/ui/android/context_menu_helper.cc +++ b/chrome/browser/ui/android/context_menu_helper.cc
@@ -21,7 +21,7 @@ #include "content/public/browser/context_menu_params.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" -#include "third_party/blink/public/common/context_menu_data/media_type.h" +#include "third_party/blink/public/mojom/context_menu/context_menu_data.mojom.h" #include "ui/android/view_android.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/size.h"
diff --git a/chrome/browser/ui/views/sharing/sharing_browsertest.cc b/chrome/browser/ui/views/sharing/sharing_browsertest.cc index d7df306..f7ada35 100644 --- a/chrome/browser/ui/views/sharing/sharing_browsertest.cc +++ b/chrome/browser/ui/views/sharing/sharing_browsertest.cc
@@ -33,7 +33,7 @@ #include "components/sync_device_info/device_info.h" #include "content/public/test/browser_test_utils.h" #include "net/dns/mock_host_resolver.h" -#include "third_party/blink/public/common/context_menu_data/media_type.h" +#include "third_party/blink/public/mojom/context_menu/context_menu_data.mojom.h" void FakeWebPushSender::SendMessage(const std::string& fcm_token, crypto::ECPrivateKey* vapid_key, @@ -165,7 +165,7 @@ base::StringPiece selection_text) { content::ContextMenuParams params; params.selection_text = base::ASCIIToUTF16(selection_text); - params.media_type = blink::ContextMenuDataMediaType::kNone; + params.media_type = blink::mojom::ContextMenuDataMediaType::kNone; params.unfiltered_link_url = url; params.link_url = url; params.src_url = url;
diff --git a/chrome/browser/ui/webui/chrome_untrusted_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_untrusted_web_ui_controller_factory.cc index 6a59cda5..8c3a909 100644 --- a/chrome/browser/ui/webui/chrome_untrusted_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_untrusted_web_ui_controller_factory.cc
@@ -13,9 +13,12 @@ #include "ui/webui/webui_config.h" #include "url/gurl.h" -#if BUILDFLAG(IS_CHROMEOS_ASH) && !defined(OFFICIAL_BUILD) +#if BUILDFLAG(IS_CHROMEOS_ASH) +#include "chrome/browser/chromeos/web_applications/terminal_ui.h" +#if !defined(OFFICIAL_BUILD) #include "chromeos/components/sample_system_web_app_ui/untrusted_sample_system_web_app_ui.h" -#endif +#endif // !defined(OFFICIAL_BUILD) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) using WebUIConfigList = std::vector<std::pair<std::string, std::unique_ptr<ui::WebUIConfig>>>; @@ -38,10 +41,13 @@ ALLOW_UNUSED_LOCAL(register_config); // Register WebUIConfigs below. -#if BUILDFLAG(IS_CHROMEOS_ASH) && !defined(OFFICIAL_BUILD) +#if BUILDFLAG(IS_CHROMEOS_ASH) + register_config(std::make_unique<TerminalUIConfig>()); +#if !defined(OFFICIAL_BUILD) register_config( std::make_unique<chromeos::UntrustedSampleSystemWebAppUIConfig>()); -#endif +#endif // !defined(OFFICIAL_BUILD) +#endif // BUILDFLAG(IS_CHROMEOS_ASH) return config_list; }
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index 2b2f606..7918d21bf 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -66,7 +66,7 @@ #include "chrome/browser/ui/webui/predictors/predictors_ui.h" #include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h" #include "chrome/browser/ui/webui/settings/settings_ui.h" -#include "chrome/browser/ui/webui/settings_utils.h" +#include "chrome/browser/ui/webui/settings/settings_utils.h" #include "chrome/browser/ui/webui/signin_internals_ui.h" #include "chrome/browser/ui/webui/sync_internals/sync_internals_ui.h" #include "chrome/browser/ui/webui/translate_internals/translate_internals_ui.h"
diff --git a/chrome/browser/ui/webui/settings/font_handler.cc b/chrome/browser/ui/webui/settings/font_handler.cc index 22ff301..26ae033e 100644 --- a/chrome/browser/ui/webui/settings/font_handler.cc +++ b/chrome/browser/ui/webui/settings/font_handler.cc
@@ -21,7 +21,7 @@ #include "content/public/browser/web_ui.h" #if defined(OS_MAC) -#include "chrome/browser/ui/webui/settings_utils.h" +#include "chrome/browser/ui/webui/settings/settings_utils.h" #endif namespace settings {
diff --git a/chrome/browser/ui/webui/settings/native_certificates_handler.cc b/chrome/browser/ui/webui/settings/native_certificates_handler.cc index 9da3cdf..e377bd9 100644 --- a/chrome/browser/ui/webui/settings/native_certificates_handler.cc +++ b/chrome/browser/ui/webui/settings/native_certificates_handler.cc
@@ -7,7 +7,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/metrics/user_metrics.h" -#include "chrome/browser/ui/webui/settings_utils.h" +#include "chrome/browser/ui/webui/settings/settings_utils.h" #include "content/public/browser/web_ui.h" namespace settings {
diff --git a/chrome/browser/ui/webui/settings/on_startup_handler.cc b/chrome/browser/ui/webui/settings/on_startup_handler.cc index b00c3db..3d1bbd91 100644 --- a/chrome/browser/ui/webui/settings/on_startup_handler.cc +++ b/chrome/browser/ui/webui/settings/on_startup_handler.cc
@@ -11,7 +11,7 @@ #include "base/check_op.h" #include "chrome/browser/extensions/settings_api_helpers.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/webui/settings_utils.h" +#include "chrome/browser/ui/webui/settings/settings_utils.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_ui.h" #include "extensions/browser/extension_system.h"
diff --git a/chrome/browser/ui/webui/settings/settings_startup_pages_handler.cc b/chrome/browser/ui/webui/settings/settings_startup_pages_handler.cc index 4e299369..ca1f479 100644 --- a/chrome/browser/ui/webui/settings/settings_startup_pages_handler.cc +++ b/chrome/browser/ui/webui/settings/settings_startup_pages_handler.cc
@@ -12,7 +12,7 @@ #include "base/bind.h" #include "chrome/browser/prefs/session_startup_pref.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/webui/settings_utils.h" +#include "chrome/browser/ui/webui/settings/settings_utils.h" #include "chrome/common/pref_names.h" #include "content/public/browser/web_ui.h" #include "url/gurl.h"
diff --git a/chrome/browser/ui/webui/settings_utils.cc b/chrome/browser/ui/webui/settings/settings_utils.cc similarity index 93% rename from chrome/browser/ui/webui/settings_utils.cc rename to chrome/browser/ui/webui/settings/settings_utils.cc index 4347b44..9475bca 100644 --- a/chrome/browser/ui/webui/settings_utils.cc +++ b/chrome/browser/ui/webui/settings/settings_utils.cc
@@ -2,8 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/webui/settings_utils.h" +#include "chrome/browser/ui/webui/settings/settings_utils.h" +#include "build/build_config.h" #include "chrome/browser/extensions/extension_tab_util.h" #include "chrome/grit/theme_resources.h" #include "components/url_formatter/url_fixer.h"
diff --git a/chrome/browser/ui/webui/settings_utils.h b/chrome/browser/ui/webui/settings/settings_utils.h similarity index 86% rename from chrome/browser/ui/webui/settings_utils.h rename to chrome/browser/ui/webui/settings/settings_utils.h index fe166ec..1ee1bb2 100644 --- a/chrome/browser/ui/webui/settings_utils.h +++ b/chrome/browser/ui/webui/settings/settings_utils.h
@@ -2,12 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_UTILS_H_ -#define CHROME_BROWSER_UI_WEBUI_SETTINGS_UTILS_H_ +#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_UTILS_H_ +#define CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_UTILS_H_ #include <string> #include "base/macros.h" +#include "build/build_config.h" #include "ui/base/resource/scale_factor.h" class GURL; @@ -50,4 +51,4 @@ } // namespace settings_utils -#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_UTILS_H_ +#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_UTILS_H_
diff --git a/chrome/browser/ui/webui/settings_utils_linux.cc b/chrome/browser/ui/webui/settings/settings_utils_linux.cc similarity index 97% rename from chrome/browser/ui/webui/settings_utils_linux.cc rename to chrome/browser/ui/webui/settings/settings_utils_linux.cc index 0276b92..f46cb3e 100644 --- a/chrome/browser/ui/webui/settings_utils_linux.cc +++ b/chrome/browser/ui/webui/settings/settings_utils_linux.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/webui/settings_utils.h" +#include "chrome/browser/ui/webui/settings/settings_utils.h" #include <stddef.h> @@ -89,8 +89,7 @@ // Detect, and if possible, start the appropriate proxy config utility. On // failure to do so, show the Linux proxy config URL in a new tab instead. -void DetectAndStartProxyConfigUtil(int render_process_id, - int render_view_id) { +void DetectAndStartProxyConfigUtil(int render_process_id, int render_view_id) { base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, base::BlockingType::MAY_BLOCK); std::unique_ptr<base::Environment> env(base::Environment::Create());
diff --git a/chrome/browser/ui/webui/settings_utils_mac.mm b/chrome/browser/ui/webui/settings/settings_utils_mac.mm similarity index 76% rename from chrome/browser/ui/webui/settings_utils_mac.mm rename to chrome/browser/ui/webui/settings/settings_utils_mac.mm index 0611e97..d6fdaaf 100644 --- a/chrome/browser/ui/webui/settings_utils_mac.mm +++ b/chrome/browser/ui/webui/settings/settings_utils_mac.mm
@@ -4,7 +4,7 @@ #import <Cocoa/Cocoa.h> -#include "chrome/browser/ui/webui/settings_utils.h" +#include "chrome/browser/ui/webui/settings/settings_utils.h" #include "base/logging.h" #include "base/mac/mac_logging.h" @@ -35,19 +35,19 @@ namespace settings_utils { void ShowNetworkProxySettings(content::WebContents* web_contents) { - NSArray* itemsToOpen = [NSArray arrayWithObject:[NSURL fileURLWithPath: - @"/System/Library/PreferencePanes/Network.prefPane"]]; + NSArray* itemsToOpen = [NSArray + arrayWithObject:[NSURL fileURLWithPath:@"/System/Library/PreferencePanes/" + @"Network.prefPane"]]; const char* proxyPrefCommand = "Proxies"; base::mac::ScopedAEDesc<> openParams; - OSStatus status = AECreateDesc('ptru', - proxyPrefCommand, - strlen(proxyPrefCommand), - openParams.OutPointer()); + OSStatus status = + AECreateDesc('ptru', proxyPrefCommand, strlen(proxyPrefCommand), + openParams.OutPointer()); OSSTATUS_LOG_IF(ERROR, status != noErr, status) << "Failed to create open params"; - LSLaunchURLSpec launchSpec = { 0 }; + LSLaunchURLSpec launchSpec = {0}; launchSpec.itemURLs = (CFArrayRef)itemsToOpen; launchSpec.passThruParams = openParams; launchSpec.launchFlags = kLSLaunchAsync | kLSLaunchDontAddToRecents; @@ -56,11 +56,10 @@ void ShowManageSSLCertificates(content::WebContents* web_contents) { NSString* const kKeychainBundleId = @"com.apple.keychainaccess"; - [[NSWorkspace sharedWorkspace] - launchAppWithBundleIdentifier:kKeychainBundleId - options:0L - additionalEventParamDescriptor:nil - launchIdentifier:nil]; + [[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier:kKeychainBundleId + options:0L + additionalEventParamDescriptor:nil + launchIdentifier:nil]; } void ValidateSavedFonts(PrefService* prefs) {
diff --git a/chrome/browser/ui/webui/settings_utils_unittest.cc b/chrome/browser/ui/webui/settings/settings_utils_unittest.cc similarity index 94% rename from chrome/browser/ui/webui/settings_utils_unittest.cc rename to chrome/browser/ui/webui/settings/settings_utils_unittest.cc index 477cbf1..e4b6f4c 100644 --- a/chrome/browser/ui/webui/settings_utils_unittest.cc +++ b/chrome/browser/ui/webui/settings/settings_utils_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/webui/settings_utils.h" +#include "chrome/browser/ui/webui/settings/settings_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h"
diff --git a/chrome/browser/ui/webui/settings_utils_win.cc b/chrome/browser/ui/webui/settings/settings_utils_win.cc similarity index 98% rename from chrome/browser/ui/webui/settings_utils_win.cc rename to chrome/browser/ui/webui/settings/settings_utils_win.cc index 18d908eb..3dbc4c2 100644 --- a/chrome/browser/ui/webui/settings_utils_win.cc +++ b/chrome/browser/ui/webui/settings/settings_utils_win.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/webui/settings_utils.h" +#include "chrome/browser/ui/webui/settings/settings_utils.h" #include <windows.h> #include <shellapi.h>
diff --git a/chrome/browser/ui/webui/settings/system_handler.cc b/chrome/browser/ui/webui/settings/system_handler.cc index e6bd10d..1c56b8e 100644 --- a/chrome/browser/ui/webui/settings/system_handler.cc +++ b/chrome/browser/ui/webui/settings/system_handler.cc
@@ -10,7 +10,7 @@ #include "base/metrics/user_metrics_action.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/gpu/gpu_mode_manager.h" -#include "chrome/browser/ui/webui/settings_utils.h" +#include "chrome/browser/ui/webui/settings/settings_utils.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_data_source.h"
diff --git a/chrome/browser/web_applications/system_web_app_manager.cc b/chrome/browser/web_applications/system_web_app_manager.cc index aa1b2334..ddf8cd48 100644 --- a/chrome/browser/web_applications/system_web_app_manager.cc +++ b/chrome/browser/web_applications/system_web_app_manager.cc
@@ -58,7 +58,6 @@ #include "chrome/browser/chromeos/web_applications/os_settings_web_app_info.h" #include "chrome/browser/chromeos/web_applications/print_management_web_app_info.h" #include "chrome/browser/chromeos/web_applications/scanning_system_web_app_info.h" -#include "chrome/browser/chromeos/web_applications/terminal_source.h" #include "chrome/browser/chromeos/web_applications/terminal_system_web_app_info.h" #include "chrome/browser/web_applications/components/web_app_id_constants.h" #include "chromeos/components/camera_app_ui/url_constants.h" @@ -458,15 +457,6 @@ // trial names. Ideally, construct them from some static const char*. #endif // DCHECK_IS_ON() -#if BUILDFLAG(IS_CHROMEOS_ASH) - // Set up terminal data source. Terminal source is needed for install. - // TODO(crbug.com/1080384): Move once chrome-untrusted has WebUIControllers. - if (SystemWebAppManager::IsAppEnabled(SystemAppType::TERMINAL)) { - content::URLDataSource::Add(profile_, - TerminalSource::ForTerminal(profile_)); - } -#endif // BUILDFLAG(IS_CHROMEOS_ASH) - std::vector<ExternalInstallOptions> install_options_list; const bool should_force_install_apps = ShouldForceInstallApps(); if (should_force_install_apps) {
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 013f45c..b391599 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-master-1608374575-799ca6e7dd99bf829770e0fae450259047134228.profdata +chrome-mac-master-1608529993-82d6d40e289e60063d3bd5c2eebe97dc9bb53838.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 732900f..c66c365 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-master-1608163120-4986bcffa849ffffd428f29082c0e0792a369cda.profdata +chrome-win32-master-1608508387-56780dae3832c65bafd36e4cfe96756ad3b86eef.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index f6f58a1..41d839e0 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-master-1608366709-04c75f5dea3220c85227eec575768650c19be6b2.profdata +chrome-win64-master-1608508387-093abbef3f1d2d94b454a0cdd869bb44780245e6.profdata
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc index 7e138216..33b93446 100644 --- a/chrome/common/chrome_features.cc +++ b/chrome/common/chrome_features.cc
@@ -392,29 +392,6 @@ base::FEATURE_ENABLED_BY_DEFAULT}; #endif -// Enables or disables the FlocIdComputed event logging, which happens when a -// floc id is first computed for a browsing session or is refreshed due to a -// long period of time has passed since the last computation. -const base::Feature kFlocIdComputedEventLogging{ - "FlocIdComputedEventLogging", base::FEATURE_ENABLED_BY_DEFAULT}; - -// If enabled, the sim-hash floc computed from history will be further encoded -// based on the sorting-lsh. -const base::Feature kFlocIdSortingLshBasedComputation{ - "FlocIdSortingLshBasedComputation", base::FEATURE_DISABLED_BY_DEFAULT}; - -// The main floc feature for all the subsidiary control and setting params. It's -// controlling the floc update rate, and the minimum history domain size -// required. -// TODO(yaoxia): merge other floc features into this one. -const base::Feature kFederatedLearningOfCohorts{ - "FederatedLearningOfCohorts", base::FEATURE_ENABLED_BY_DEFAULT}; -constexpr base::FeatureParam<base::TimeDelta> kFlocIdScheduledUpdateInterval{ - &kFederatedLearningOfCohorts, "update_interval", - base::TimeDelta::FromDays(7)}; -constexpr base::FeatureParam<int> kFlocIdMinimumHistoryDomainSizeRequired{ - &kFederatedLearningOfCohorts, "minimum_history_domain_size_required", 3}; - // Enables Focus Mode which brings up a PWA-like window look. const base::Feature kFocusMode{"FocusMode", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h index 28c6dc1a..ee33fee 100644 --- a/chrome/common/chrome_features.h +++ b/chrome/common/chrome_features.h
@@ -269,19 +269,6 @@ #endif COMPONENT_EXPORT(CHROME_FEATURES) -extern const base::Feature kFlocIdComputedEventLogging; - -COMPONENT_EXPORT(CHROME_FEATURES) -extern const base::Feature kFlocIdSortingLshBasedComputation; - -COMPONENT_EXPORT(CHROME_FEATURES) -extern const base::Feature kFederatedLearningOfCohorts; -COMPONENT_EXPORT(CHROME_FEATURES) -extern const base::FeatureParam<base::TimeDelta> kFlocIdScheduledUpdateInterval; -COMPONENT_EXPORT(CHROME_FEATURES) -extern const base::FeatureParam<int> kFlocIdMinimumHistoryDomainSizeRequired; - -COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kFocusMode; #if defined(OS_WIN)
diff --git a/chrome/common/cloud_print/cloud_print_helpers.cc b/chrome/common/cloud_print/cloud_print_helpers.cc index 5a86eb1..52d2c53f3 100644 --- a/chrome/common/cloud_print/cloud_print_helpers.cc +++ b/chrome/common/cloud_print/cloud_print_helpers.cc
@@ -234,8 +234,8 @@ return post_data; } -std::string GetCloudPrintAuthHeader(const std::string& auth_token) { - return base::StringPrintf("Authorization: OAuth %s", auth_token.c_str()); +std::string GetCloudPrintAuthHeaderValue(const std::string& auth_token) { + return base::StringPrintf("OAuth %s", auth_token.c_str()); } } // namespace cloud_print
diff --git a/chrome/common/cloud_print/cloud_print_helpers.h b/chrome/common/cloud_print/cloud_print_helpers.h index 904f934..569feae 100644 --- a/chrome/common/cloud_print/cloud_print_helpers.h +++ b/chrome/common/cloud_print/cloud_print_helpers.h
@@ -78,8 +78,8 @@ const std::string& proxy_tag_prefix, const std::string& tags_hash_tag_name); -// Get the cloud print auth header from |auth_token|. -std::string GetCloudPrintAuthHeader(const std::string& auth_token); +// Get the cloud print auth header value from |auth_token|. +std::string GetCloudPrintAuthHeaderValue(const std::string& auth_token); } // namespace cloud_print
diff --git a/chrome/common/cloud_print/cloud_print_helpers_unittest.cc b/chrome/common/cloud_print/cloud_print_helpers_unittest.cc index cfd1b65..3c0e3e53 100644 --- a/chrome/common/cloud_print/cloud_print_helpers_unittest.cc +++ b/chrome/common/cloud_print/cloud_print_helpers_unittest.cc
@@ -122,10 +122,9 @@ std::string("__test__tagshash"))); } -TEST(CloudPrintHelpersTest, GetCloudPrintAuthHeader) { +TEST(CloudPrintHelpersTest, GetCloudPrintAuthHeaderValue) { std::string test_auth("testauth"); - EXPECT_EQ("Authorization: OAuth testauth", - GetCloudPrintAuthHeader(test_auth)); + EXPECT_EQ("OAuth testauth", GetCloudPrintAuthHeaderValue(test_auth)); } } // namespace cloud_print
diff --git a/chrome/common/extensions/api/input_ime/input_components_handler.cc b/chrome/common/extensions/api/input_ime/input_components_handler.cc index c8e6c7f..50b33154 100644 --- a/chrome/common/extensions/api/input_ime/input_components_handler.cc +++ b/chrome/common/extensions/api/input_ime/input_components_handler.cc
@@ -23,12 +23,7 @@ namespace keys = manifest_keys; namespace errors = manifest_errors; -InputComponentInfo::InputComponentInfo() - : type(INPUT_COMPONENT_TYPE_NONE), - shortcut_alt(false), - shortcut_ctrl(false), - shortcut_shift(false) { -} +InputComponentInfo::InputComponentInfo() = default; InputComponentInfo::InputComponentInfo(const InputComponentInfo& other) = default; @@ -63,17 +58,11 @@ for (size_t i = 0; i < list_value->GetSize(); ++i) { const base::DictionaryValue* module_value = NULL; std::string name_str; - InputComponentType type; std::string id_str; - std::string description_str; std::set<std::string> languages; std::set<std::string> layouts; - std::string shortcut_keycode_str; GURL input_view_url; GURL options_page_url; - bool shortcut_alt = false; - bool shortcut_ctrl = false; - bool shortcut_shift = false; if (!list_value->GetDictionary(i, &module_value)) { *error = base::ASCIIToUTF16(errors::kInvalidInputComponents); @@ -87,34 +76,11 @@ return false; } - // Get input_components[i].type. - std::string type_str; - if (module_value->GetString(keys::kType, &type_str)) { - if (type_str == "ime") { - type = INPUT_COMPONENT_TYPE_IME; - } else { - *error = ErrorUtils::FormatErrorMessageUTF16( - errors::kInvalidInputComponentType, base::NumberToString(i)); - return false; - } - } else { - *error = ErrorUtils::FormatErrorMessageUTF16( - errors::kInvalidInputComponentType, base::NumberToString(i)); - return false; - } - // Get input_components[i].id. if (!module_value->GetString(keys::kId, &id_str)) { id_str = ""; } - // Get input_components[i].description. - if (!module_value->GetString(keys::kDescription, &description_str)) { - *error = ErrorUtils::FormatErrorMessageUTF16( - errors::kInvalidInputComponentDescription, base::NumberToString(i)); - return false; - } - // Get input_components[i].language. // Both string and list of string are allowed to be compatibile with old // input_ime manifest specification. @@ -150,39 +116,6 @@ } } - if (module_value->HasKey(keys::kShortcutKey)) { - const base::DictionaryValue* shortcut_value = NULL; - if (!module_value->GetDictionary(keys::kShortcutKey, - &shortcut_value)) { - *error = ErrorUtils::FormatErrorMessageUTF16( - errors::kInvalidInputComponentShortcutKey, base::NumberToString(i)); - return false; - } - - // Get input_components[i].shortcut_keycode. - if (!shortcut_value->GetString(keys::kKeycode, &shortcut_keycode_str)) { - *error = ErrorUtils::FormatErrorMessageUTF16( - errors::kInvalidInputComponentShortcutKeycode, - base::NumberToString(i)); - return false; - } - - // Get input_components[i].shortcut_alt. - if (!shortcut_value->GetBoolean(keys::kAltKey, &shortcut_alt)) { - shortcut_alt = false; - } - - // Get input_components[i].shortcut_ctrl. - if (!shortcut_value->GetBoolean(keys::kCtrlKey, &shortcut_ctrl)) { - shortcut_ctrl = false; - } - - // Get input_components[i].shortcut_shift. - if (!shortcut_value->GetBoolean(keys::kShiftKey, &shortcut_shift)) { - shortcut_shift = false; - } - } - // Get input_components[i].input_view_url. // Note: 'input_view' is optional in manifest. std::string input_view_str; @@ -212,16 +145,10 @@ info->input_components.push_back(InputComponentInfo()); info->input_components.back().name = name_str; - info->input_components.back().type = type; info->input_components.back().id = id_str; - info->input_components.back().description = description_str; info->input_components.back().languages = languages; info->input_components.back().layouts.insert(layouts.begin(), layouts.end()); - info->input_components.back().shortcut_keycode = shortcut_keycode_str; - info->input_components.back().shortcut_alt = shortcut_alt; - info->input_components.back().shortcut_ctrl = shortcut_ctrl; - info->input_components.back().shortcut_shift = shortcut_shift; info->input_components.back().options_page_url = options_page_url; info->input_components.back().input_view_url = input_view_url; }
diff --git a/chrome/common/extensions/api/input_ime/input_components_handler.h b/chrome/common/extensions/api/input_ime/input_components_handler.h index 671c5ec..79c64b5 100644 --- a/chrome/common/extensions/api/input_ime/input_components_handler.h +++ b/chrome/common/extensions/api/input_ime/input_components_handler.h
@@ -18,12 +18,6 @@ class Extension; -enum InputComponentType { - INPUT_COMPONENT_TYPE_NONE = -1, - INPUT_COMPONENT_TYPE_IME, - INPUT_COMPONENT_TYPE_COUNT -}; - struct InputComponentInfo { // Define out of line constructor/destructor to please Clang. InputComponentInfo(); @@ -31,15 +25,9 @@ ~InputComponentInfo(); std::string name; - InputComponentType type; std::string id; - std::string description; std::set<std::string> languages; std::set<std::string> layouts; - std::string shortcut_keycode; - bool shortcut_alt; - bool shortcut_ctrl; - bool shortcut_shift; GURL options_page_url; GURL input_view_url; };
diff --git a/chrome/common/extensions/docs/examples/api/input.ime/basic/manifest.json b/chrome/common/extensions/docs/examples/api/input.ime/basic/manifest.json index e21aec1..b0a06d7e 100644 --- a/chrome/common/extensions/docs/examples/api/input.ime/basic/manifest.json +++ b/chrome/common/extensions/docs/examples/api/input.ime/basic/manifest.json
@@ -12,9 +12,7 @@ "input_components": [ { "name": "Test IME", - "type": "ime", "id": "test", - "description": "Test IME", // A user visible description "language": "en-US", // The primary language this IME is used for "layouts": ["us::eng"] // The supported keyboard layouts for this IME }
diff --git a/chrome/common/webui_url_constants.cc b/chrome/common/webui_url_constants.cc index 5ad9a18..015f492 100644 --- a/chrome/common/webui_url_constants.cc +++ b/chrome/common/webui_url_constants.cc
@@ -289,6 +289,7 @@ const char kChromeUISmbCredentialsURL[] = "chrome://smb-credentials-dialog/"; const char kChromeUISysInternalsHost[] = "sys-internals"; const char kChromeUIUntrustedCroshURL[] = "chrome-untrusted://crosh/"; +const char kChromeUIUntrustedTerminalHost[] = "terminal"; const char kChromeUIUntrustedTerminalURL[] = "chrome-untrusted://terminal/"; const char kChromeUIUserImageHost[] = "userimage"; const char kChromeUIUserImageURL[] = "chrome://userimage/";
diff --git a/chrome/common/webui_url_constants.h b/chrome/common/webui_url_constants.h index 5fba9fa34..e5c9666 100644 --- a/chrome/common/webui_url_constants.h +++ b/chrome/common/webui_url_constants.h
@@ -281,6 +281,7 @@ extern const char kChromeUISmbShareURL[]; extern const char kChromeUISysInternalsHost[]; extern const char kChromeUIUntrustedCroshURL[]; +extern const char kChromeUIUntrustedTerminalHost[]; extern const char kChromeUIUntrustedTerminalURL[]; extern const char kChromeUIUrgentPasswordExpiryNotificationHost[]; extern const char kChromeUIUrgentPasswordExpiryNotificationUrl[];
diff --git a/chrome/service/cloud_print/cloud_print_auth.cc b/chrome/service/cloud_print/cloud_print_auth.cc index 09fdf66..3fcdd94 100644 --- a/chrome/service/cloud_print/cloud_print_auth.cc +++ b/chrome/service/cloud_print/cloud_print_auth.cc
@@ -217,10 +217,10 @@ return CloudPrintURLFetcher::STOP_PROCESSING; } -std::string CloudPrintAuth::GetAuthHeader() { +std::string CloudPrintAuth::GetAuthHeaderValue() { DCHECK(!client_login_token_.empty()); std::string header; - header = "Authorization: GoogleLogin auth="; + header = "GoogleLogin auth="; header += client_login_token_; return header; }
diff --git a/chrome/service/cloud_print/cloud_print_auth.h b/chrome/service/cloud_print/cloud_print_auth.h index 143b2cb..cdb7a2c6 100644 --- a/chrome/service/cloud_print/cloud_print_auth.h +++ b/chrome/service/cloud_print/cloud_print_auth.h
@@ -82,7 +82,7 @@ const base::Value& json_data, bool succeeded) override; CloudPrintURLFetcher::ResponseAction OnRequestAuthError() override; - std::string GetAuthHeader() override; + std::string GetAuthHeaderValue() override; private: friend class base::RefCountedThreadSafe<CloudPrintAuth>; @@ -119,4 +119,3 @@ } // namespace cloud_print #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_AUTH_H_ -
diff --git a/chrome/service/cloud_print/cloud_print_connector.cc b/chrome/service/cloud_print/cloud_print_connector.cc index 0e7090e..0d13a95 100644 --- a/chrome/service/cloud_print/cloud_print_connector.cc +++ b/chrome/service/cloud_print/cloud_print_connector.cc
@@ -204,7 +204,7 @@ return CloudPrintURLFetcher::STOP_PROCESSING; } -std::string CloudPrintConnector::GetAuthHeader() { +std::string CloudPrintConnector::GetAuthHeaderValue() { return GetCloudPrintAuthHeaderFromStore(); }
diff --git a/chrome/service/cloud_print/cloud_print_connector.h b/chrome/service/cloud_print/cloud_print_connector.h index 791bafd2..82ea8b61 100644 --- a/chrome/service/cloud_print/cloud_print_connector.h +++ b/chrome/service/cloud_print/cloud_print_connector.h
@@ -107,7 +107,7 @@ const base::Value& json_data, bool succeeded) override; CloudPrintURLFetcher::ResponseAction OnRequestAuthError() override; - std::string GetAuthHeader() override; + std::string GetAuthHeaderValue() override; // Begin response handlers CloudPrintURLFetcher::ResponseAction HandlePrinterListResponse( @@ -212,4 +212,3 @@ } // namespace cloud_print #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_CONNECTOR_H_ -
diff --git a/chrome/service/cloud_print/cloud_print_service_helpers.cc b/chrome/service/cloud_print/cloud_print_service_helpers.cc index 894222f..f4dd34c 100644 --- a/chrome/service/cloud_print/cloud_print_service_helpers.cc +++ b/chrome/service/cloud_print/cloud_print_service_helpers.cc
@@ -93,7 +93,7 @@ LOG(ERROR) << "CP_PROXY: Missing OAuth token for request"; return std::string(); } - return GetCloudPrintAuthHeader(token_store->token()); + return GetCloudPrintAuthHeaderValue(token_store->token()); } } // namespace cloud_print
diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher.cc b/chrome/service/cloud_print/cloud_print_url_fetcher.cc index 541a5536..d923deaf 100644 --- a/chrome/service/cloud_print/cloud_print_url_fetcher.cc +++ b/chrome/service/cloud_print/cloud_print_url_fetcher.cc
@@ -296,7 +296,10 @@ void CloudPrintURLFetcher::SetupRequestHeaders() { request_->ClearExtraRequestHeaders(); - std::string headers = delegate_->GetAuthHeader(); + std::string auth_header_value = delegate_->GetAuthHeaderValue(); + if (!auth_header_value.empty()) { + request_->AddExtraRequestHeader("Authorization", auth_header_value); + } request_->AddExtraRequestHeader(kChromeCloudPrintProxyHeaderName, kChromeCloudPrintProxyHeaderValue); if (!additional_accept_header_.empty()) {
diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher.h b/chrome/service/cloud_print/cloud_print_url_fetcher.h index 0dec8cd..a66ce7fd 100644 --- a/chrome/service/cloud_print/cloud_print_url_fetcher.h +++ b/chrome/service/cloud_print/cloud_print_url_fetcher.h
@@ -106,7 +106,7 @@ // Authentication information may change between retries. // CloudPrintURLFetcher will request auth info before sending any request. - virtual std::string GetAuthHeader() = 0; + virtual std::string GetAuthHeaderValue() = 0; protected: virtual ~Delegate() {}
diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc index 1329d62..a0523ac9 100644 --- a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc +++ b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc
@@ -114,7 +114,9 @@ return CloudPrintURLFetcher::STOP_PROCESSING; } - std::string GetAuthHeader() override { return std::string(); } + std::string GetAuthHeaderValue() override { return auth_header_; } + + void SetAuthHeaderValue(const std::string& value) { auth_header_ = value; } scoped_refptr<base::SingleThreadTaskRunner> io_task_runner() { return io_task_runner_; @@ -143,6 +145,7 @@ base::test::SingleThreadTaskEnvironment task_environment_{ base::test::SingleThreadTaskEnvironment::MainThreadType::IO}; scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; + std::string auth_header_; int max_retries_; Time start_time_; scoped_refptr<TestCloudPrintURLFetcher> fetcher_; @@ -182,10 +185,12 @@ void SetHandleRawData(bool handle_raw_data) { handle_raw_data_ = handle_raw_data; } + void SetExpectedData(const std::string& data) { expected_data_ = data; } private: bool handle_raw_response_; bool handle_raw_data_; + std::string expected_data_; }; // Version of CloudPrintURLFetcherTest that tests overload protection. @@ -278,6 +283,9 @@ // We should never get here if we returned true in HandleRawResponse EXPECT_FALSE(handle_raw_response_); if (handle_raw_data_) { + if (!expected_data_.empty()) { + EXPECT_EQ(expected_data_, data); + } std::move(quit_run_loop_).Run(); return CloudPrintURLFetcher::STOP_PROCESSING; } @@ -352,6 +360,19 @@ run_loop_.Run(); } +TEST_F(CloudPrintURLFetcherBasicTest, AuthorizationHeader) { + const char kAuthHeaderValue[] = "OAuth abcdefg"; + net::EmbeddedTestServer test_server; + SetAuthHeaderValue(kAuthHeaderValue); + test_server.AddDefaultHandlers(base::FilePath(kDocRoot)); + ASSERT_TRUE(test_server.Start()); + + SetHandleRawData(true); + SetExpectedData(kAuthHeaderValue); + CreateFetcher(test_server.GetURL("/echoheader?Authorization"), 0); + run_loop_.Run(); +} + TEST_F(CloudPrintURLFetcherOverloadTest, Protect) { net::EmbeddedTestServer test_server; test_server.AddDefaultHandlers(base::FilePath(kDocRoot));
diff --git a/chrome/service/cloud_print/cloud_print_wipeout.cc b/chrome/service/cloud_print/cloud_print_wipeout.cc index 09f0ef6..96ae45f 100644 --- a/chrome/service/cloud_print/cloud_print_wipeout.cc +++ b/chrome/service/cloud_print/cloud_print_wipeout.cc
@@ -66,8 +66,8 @@ return CloudPrintURLFetcher::STOP_PROCESSING; } -std::string CloudPrintWipeout::GetAuthHeader() { - return GetCloudPrintAuthHeader(auth_token_); +std::string CloudPrintWipeout::GetAuthHeaderValue() { + return GetCloudPrintAuthHeaderValue(auth_token_); } } // namespace cloud_print
diff --git a/chrome/service/cloud_print/cloud_print_wipeout.h b/chrome/service/cloud_print/cloud_print_wipeout.h index 1e17f75..686df4e 100644 --- a/chrome/service/cloud_print/cloud_print_wipeout.h +++ b/chrome/service/cloud_print/cloud_print_wipeout.h
@@ -42,7 +42,7 @@ bool succeeded) override; void OnRequestGiveUp() override; CloudPrintURLFetcher::ResponseAction OnRequestAuthError() override; - std::string GetAuthHeader() override; + std::string GetAuthHeaderValue() override; private: void UnregisterNextPrinter(); @@ -66,4 +66,3 @@ } // namespace cloud_print #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_WIPEOUT_H_ -
diff --git a/chrome/service/cloud_print/job_status_updater.cc b/chrome/service/cloud_print/job_status_updater.cc index 99e3583..fd6ade9 100644 --- a/chrome/service/cloud_print/job_status_updater.cc +++ b/chrome/service/cloud_print/job_status_updater.cc
@@ -115,7 +115,7 @@ return CloudPrintURLFetcher::STOP_PROCESSING; } -std::string JobStatusUpdater::GetAuthHeader() { +std::string JobStatusUpdater::GetAuthHeaderValue() { return GetCloudPrintAuthHeaderFromStore(); }
diff --git a/chrome/service/cloud_print/job_status_updater.h b/chrome/service/cloud_print/job_status_updater.h index dfa4d77..ca5cb99 100644 --- a/chrome/service/cloud_print/job_status_updater.h +++ b/chrome/service/cloud_print/job_status_updater.h
@@ -52,7 +52,7 @@ const base::Value& json_data, bool succeeded) override; CloudPrintURLFetcher::ResponseAction OnRequestAuthError() override; - std::string GetAuthHeader() override; + std::string GetAuthHeaderValue() override; base::Time start_time() const { return start_time_;
diff --git a/chrome/service/cloud_print/printer_job_handler.cc b/chrome/service/cloud_print/printer_job_handler.cc index 7d1a567..f38a0630 100644 --- a/chrome/service/cloud_print/printer_job_handler.cc +++ b/chrome/service/cloud_print/printer_job_handler.cc
@@ -204,7 +204,7 @@ return CloudPrintURLFetcher::STOP_PROCESSING; } -std::string PrinterJobHandler::GetAuthHeader() { +std::string PrinterJobHandler::GetAuthHeaderValue() { return GetCloudPrintAuthHeaderFromStore(); }
diff --git a/chrome/service/cloud_print/printer_job_handler.h b/chrome/service/cloud_print/printer_job_handler.h index 4b42f80..9120a35 100644 --- a/chrome/service/cloud_print/printer_job_handler.h +++ b/chrome/service/cloud_print/printer_job_handler.h
@@ -131,7 +131,7 @@ bool succeeded) override; void OnRequestGiveUp() override; CloudPrintURLFetcher::ResponseAction OnRequestAuthError() override; - std::string GetAuthHeader() override; + std::string GetAuthHeaderValue() override; // JobStatusUpdater::Delegate implementation bool OnJobCompleted(JobStatusUpdater* updater) override;
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 9e9e526..c4ce2aa3 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -4712,9 +4712,9 @@ "../browser/ui/webui/settings/settings_cookies_view_handler_unittest.cc", "../browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc", "../browser/ui/webui/settings/settings_security_key_handler_unittest.cc", + "../browser/ui/webui/settings/settings_utils_unittest.cc", "../browser/ui/webui/settings/site_settings_handler_unittest.cc", "../browser/ui/webui/settings/site_settings_helper_unittest.cc", - "../browser/ui/webui/settings_utils_unittest.cc", "../browser/ui/webui/signin/login_ui_service_unittest.cc", "../browser/ui/webui/sync_internals/sync_internals_message_handler_unittest.cc", "../browser/ui/webui/tab_search/tab_search_page_handler_unittest.cc",
diff --git a/chrome/test/data/extensions/api_test/input_ime/manifest.json b/chrome/test/data/extensions/api_test/input_ime/manifest.json index 1382a2b..57a742e 100644 --- a/chrome/test/data/extensions/api_test/input_ime/manifest.json +++ b/chrome/test/data/extensions/api_test/input_ime/manifest.json
@@ -10,11 +10,8 @@ "permissions": [ "input" ], "input_components": [{ "name": "Test IME", - "type": "ime", "id": "test", - "description": "Test", // A user visible description "language": "en", // The primary language this IME is used for "layouts": ["us::eng"] }] } -
diff --git a/chrome/test/data/extensions/api_test/input_method/ime_menu2/manifest.json b/chrome/test/data/extensions/api_test/input_method/ime_menu2/manifest.json index fda6bfaf..157d335 100644 --- a/chrome/test/data/extensions/api_test/input_method/ime_menu2/manifest.json +++ b/chrome/test/data/extensions/api_test/input_method/ime_menu2/manifest.json
@@ -13,18 +13,13 @@ ], "input_components": [{ "name": "Test IME", - "type": "ime", "id": "test", - "description": "Test", "language": "en", "layouts": ["us::eng"] }, { "name": "Test IME2", - "type": "ime", "id": "test2", - "description": "Test", "language": "en", "layouts": ["us::eng"] }] } -
diff --git a/chrome/test/data/extensions/api_test/input_method/typing/manifest.json b/chrome/test/data/extensions/api_test/input_method/typing/manifest.json index 8fdea462..3fd6cfae 100644 --- a/chrome/test/data/extensions/api_test/input_method/typing/manifest.json +++ b/chrome/test/data/extensions/api_test/input_method/typing/manifest.json
@@ -10,11 +10,8 @@ "permissions": [ "input", "inputMethodPrivate" ], "input_components": [{ "name": "Test IME", - "type": "ime", "id": "test", - "description": "Test", "language": "en", "layouts": ["us::eng"] }] } -
diff --git a/chrome/test/data/extensions/input_ime/manifest.json b/chrome/test/data/extensions/input_ime/manifest.json index 39a477f..cfd9db4 100644 --- a/chrome/test/data/extensions/input_ime/manifest.json +++ b/chrome/test/data/extensions/input_ime/manifest.json
@@ -10,25 +10,18 @@ }, "input_components": [{ "name": "IdentityIME", - "type": "ime", "id": "IdentityIME", - "description": "Works as IME but do nothing", "language": "en", "layouts": ["us::eng"] },{ "name": "ToUpperIME", - "type": "ime", "id": "ToUpperIME", - "description": "Convert given key character to upper case.", "language": "en", "layouts": ["us::eng"] },{ "name": "APIArgumentIME", - "type": "ime", "id": "APIArgumentIME", - "description": "Send back argument into Chrome.", "language": "en", "layouts": ["us::eng"] }] } -
diff --git a/chromeos/components/local_search_service/BUILD.gn b/chromeos/components/local_search_service/BUILD.gn index c01d5ef..395eb7f 100644 --- a/chromeos/components/local_search_service/BUILD.gn +++ b/chromeos/components/local_search_service/BUILD.gn
@@ -10,8 +10,6 @@ "content_extraction_utils.h", "index.cc", "index.h", - "index_sync.cc", - "index_sync.h", "inverted_index.cc", "inverted_index.h", "inverted_index_search.cc", @@ -24,8 +22,6 @@ "pref_names.h", "search_metrics_reporter.cc", "search_metrics_reporter.h", - "search_metrics_reporter_sync.cc", - "search_metrics_reporter_sync.h", "search_utils.cc", "search_utils.h", "shared_structs.cc", @@ -47,19 +43,6 @@ ] } -source_set("local_search_service_sync") { - sources = [ - "local_search_service_sync.cc", - "local_search_service_sync.h", - "local_search_service_sync_factory.cc", - "local_search_service_sync_factory.h", - ] - deps = [ - ":local_search_service", - "//components/keyed_service/content:content", - ] -} - source_set("local_search_service_provider") { sources = [ "local_search_service_provider_for_testing.cc", @@ -75,31 +58,6 @@ ] } -source_set("local_search_service_proxy") { - sources = [ - "index_sync_proxy.cc", - "index_sync_proxy.h", - "local_search_service_sync_proxy.cc", - "local_search_service_sync_proxy.h", - "local_search_service_sync_proxy_factory.cc", - "local_search_service_sync_proxy_factory.h", - ] - - deps = [ - "//base:i18n", - "//cc", - ] - - public_deps = [ - ":local_search_service", - ":local_search_service_sync", - "//base", - "//chromeos/components/local_search_service/public/mojom", - "//components/keyed_service/content:content", - "//components/prefs", - ] -} - source_set("test_support") { testonly = true @@ -124,10 +82,7 @@ "linear_map_search_unittest.cc", "local_search_service_provider_unittest.cc", "local_search_service_proxy_unittest.cc", - "local_search_service_sync_proxy_unittest.cc", - "local_search_service_sync_unittest.cc", "local_search_service_unittest.cc", - "search_metrics_reporter_sync_unittest.cc", "search_metrics_reporter_unittest.cc", "search_utils_unittest.cc", ] @@ -135,7 +90,6 @@ deps = [ ":local_search_service", ":local_search_service_provider", - ":local_search_service_proxy", ":test_support", "//base/test:test_support", "//chromeos/components/local_search_service/public/cpp:cpp",
diff --git a/chromeos/components/local_search_service/index.h b/chromeos/components/local_search_service/index.h index 0f8d91b..27d819f4 100644 --- a/chromeos/components/local_search_service/index.h +++ b/chromeos/components/local_search_service/index.h
@@ -27,6 +27,12 @@ void SetReporterRemote( mojo::PendingRemote<mojom::SearchMetricsReporter> reporter_remote); + void SetSearchParams(const SearchParams& search_params) { + search_params_ = search_params; + } + + SearchParams GetSearchParamsForTesting() const { return search_params_; } + protected: // Logs daily search metrics if |reporter_remote_| is bound. Also logs // other UMA metrics (number results and search latency). @@ -37,6 +43,7 @@ // Logs number of documents in the index. void MaybeLogIndexSize(uint64_t index_size); + SearchParams search_params_; IndexId index_id_; private:
diff --git a/chromeos/components/local_search_service/index_sync.cc b/chromeos/components/local_search_service/index_sync.cc deleted file mode 100644 index b914138..0000000 --- a/chromeos/components/local_search_service/index_sync.cc +++ /dev/null
@@ -1,84 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/components/local_search_service/index_sync.h" - -#include <utility> - -#include "base/metrics/histogram_functions.h" -#include "components/prefs/pref_service.h" - -namespace chromeos { -namespace local_search_service { - -namespace { - -void LogIndexIdAndBackendType(const std::string& histogram_prefix, - Backend backend) { - base::UmaHistogramEnumeration(histogram_prefix + ".Backend", backend); -} - -std::string IndexIdBasedHistogramPrefix(IndexId index_id) { - const std::string prefix = "LocalSearchService."; - switch (index_id) { - case IndexId::kCrosSettings: - return prefix + "CrosSettings"; - case IndexId::kHelpApp: - return prefix + "HelpApp"; - } -} - -} // namespace -IndexSync::IndexSync(IndexId index_id, - Backend backend, - PrefService* local_state) { - histogram_prefix_ = IndexIdBasedHistogramPrefix(index_id); - DCHECK(!histogram_prefix_.empty()); - LogIndexIdAndBackendType(histogram_prefix_, backend); - - // TODO(jiameng): consider enforcing this to be non-nullable. - if (!local_state) { - return; - } - - reporter_ = std::make_unique<SearchMetricsReporterSync>(local_state); - DCHECK(reporter_); - reporter_->SetIndexId(index_id); -} - -IndexSync::~IndexSync() = default; - -void IndexSync::MaybeLogSearchResultsStatsSync(ResponseStatus status, - size_t num_results, - base::TimeDelta latency) { - if (reporter_) - reporter_->OnSearchPerformed(); - - base::UmaHistogramEnumeration(histogram_prefix_ + ".ResponseStatus", status); - if (status == ResponseStatus::kSuccess) { - // Only logs number of results and latency if search is a success. - base::UmaHistogramCounts100(histogram_prefix_ + ".NumberResults", - num_results); - base::UmaHistogramTimes(histogram_prefix_ + ".SearchLatency", latency); - } -} - -void IndexSync::MaybeLogIndexSizeSync() { - const uint64_t index_size = GetSizeSync(); - if (index_size != 0u) { - base::UmaHistogramCounts10000(histogram_prefix_ + ".NumberDocuments", - index_size); - } -} - -void IndexSync::SetSearchParams(const SearchParams& search_params) { - search_params_ = search_params; -} - -SearchParams IndexSync::GetSearchParamsForTesting() { - return search_params_; -} - -} // namespace local_search_service -} // namespace chromeos
diff --git a/chromeos/components/local_search_service/index_sync.h b/chromeos/components/local_search_service/index_sync.h deleted file mode 100644 index 85934a9..0000000 --- a/chromeos/components/local_search_service/index_sync.h +++ /dev/null
@@ -1,88 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_INDEX_SYNC_H_ -#define CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_INDEX_SYNC_H_ - -#include <map> -#include <memory> -#include <string> -#include <vector> - -#include "base/macros.h" -#include "base/memory/weak_ptr.h" -#include "base/optional.h" -#include "base/strings/string16.h" -#include "base/time/time.h" -#include "chromeos/components/local_search_service/search_metrics_reporter_sync.h" -#include "chromeos/components/local_search_service/shared_structs.h" - -class PrefService; - -namespace chromeos { -namespace local_search_service { - -// A local search service IndexSync. -// It is the client-facing API for search and indexing. It can be implemented -// with different backends that provide actual data storage/indexing/search -// functions. -class IndexSync { - public: - IndexSync(IndexId index_id, Backend backend, PrefService* local_state); - virtual ~IndexSync(); - - IndexSync(const IndexSync&) = delete; - IndexSync& operator=(const IndexSync&) = delete; - - // Returns number of data items. - virtual uint64_t GetSizeSync() = 0; - - // Adds or updates data. - // IDs of data should not be empty. - virtual void AddOrUpdateSync(const std::vector<Data>& data) = 0; - - // Deletes data with |ids| and returns number of items deleted. - // If an id doesn't exist in the Index, no operation will be done. - // IDs should not be empty. - virtual uint32_t DeleteSync(const std::vector<std::string>& ids) = 0; - - // Clears all data in the index. - virtual void ClearIndexSync() = 0; - - // Returns matching results for a given query. - // Zero |max_results| means no max. - // Search behaviour depends on the implementation. - virtual ResponseStatus FindSync(const base::string16& query, - uint32_t max_results, - std::vector<Result>* results) = 0; - - // Logs daily search metrics if |reporter_| is non-null. Also logs other - // UMA metrics (number results and search latency). - // Each implementation of this class should call this method at the end of - // Find. - void MaybeLogSearchResultsStatsSync(ResponseStatus status, - size_t num_results, - base::TimeDelta latency); - - // Logs number of documents in the index if the index is not empty. - // Each implementation of this class should call this method at the end of - // Find. - void MaybeLogIndexSizeSync(); - - void SetSearchParams(const SearchParams& search_params); - SearchParams GetSearchParamsForTesting(); - - protected: - SearchParams search_params_; - - private: - std::string histogram_prefix_; - std::unique_ptr<SearchMetricsReporterSync> reporter_; - base::WeakPtrFactory<IndexSync> weak_ptr_factory_{this}; -}; - -} // namespace local_search_service -} // namespace chromeos - -#endif // CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_INDEX_SYNC_H_
diff --git a/chromeos/components/local_search_service/index_sync_proxy.cc b/chromeos/components/local_search_service/index_sync_proxy.cc deleted file mode 100644 index 1b11bd7..0000000 --- a/chromeos/components/local_search_service/index_sync_proxy.cc +++ /dev/null
@@ -1,59 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/components/local_search_service/index_sync_proxy.h" - -#include "base/optional.h" -#include "chromeos/components/local_search_service/index_sync.h" - -namespace chromeos { -namespace local_search_service { - -IndexSyncProxy::IndexSyncProxy(IndexSync* index) : index_(index) { - DCHECK(index_); -} - -IndexSyncProxy::~IndexSyncProxy() = default; - -void IndexSyncProxy::BindReceiver( - mojo::PendingReceiver<mojom::IndexSyncProxy> receiver) { - receivers_.Add(this, std::move(receiver)); -} - -void IndexSyncProxy::GetSize(GetSizeCallback callback) { - const uint64_t num_items = index_->GetSizeSync(); - std::move(callback).Run(num_items); -} - -void IndexSyncProxy::AddOrUpdate(const std::vector<Data>& data, - AddOrUpdateCallback callback) { - index_->AddOrUpdateSync(data); - std::move(callback).Run(); -} - -void IndexSyncProxy::Delete(const std::vector<std::string>& ids, - DeleteCallback callback) { - const uint64_t num_deleted = index_->DeleteSync(ids); - std::move(callback).Run(num_deleted); -} - -void IndexSyncProxy::Find(const base::string16& query, - uint32_t max_results, - FindCallback callback) { - std::vector<Result> results; - ResponseStatus status = index_->FindSync(query, max_results, &results); - if (status != ResponseStatus::kSuccess) { - std::move(callback).Run(status, base::nullopt); - } else { - std::move(callback).Run(status, std::move(results)); - } -} - -void IndexSyncProxy::ClearIndex(ClearIndexCallback callback) { - index_->ClearIndexSync(); - std::move(callback).Run(); -} - -} // namespace local_search_service -} // namespace chromeos
diff --git a/chromeos/components/local_search_service/index_sync_proxy.h b/chromeos/components/local_search_service/index_sync_proxy.h deleted file mode 100644 index a8b47d6..0000000 --- a/chromeos/components/local_search_service/index_sync_proxy.h +++ /dev/null
@@ -1,46 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_INDEX_SYNC_PROXY_H_ -#define CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_INDEX_SYNC_PROXY_H_ - -#include <vector> - -#include "base/strings/string16.h" -#include "chromeos/components/local_search_service/public/mojom/local_search_service_proxy.mojom.h" -#include "mojo/public/cpp/bindings/pending_receiver.h" -#include "mojo/public/cpp/bindings/receiver_set.h" - -namespace chromeos { -namespace local_search_service { - -class IndexSync; - -class IndexSyncProxy : public mojom::IndexSyncProxy { - public: - explicit IndexSyncProxy(IndexSync* index); - ~IndexSyncProxy() override; - - void BindReceiver(mojo::PendingReceiver<mojom::IndexSyncProxy> receiver); - - // mojom::IndexSyncProxy: - void GetSize(GetSizeCallback callback) override; - void AddOrUpdate(const std::vector<Data>& data, - AddOrUpdateCallback callback) override; - void Delete(const std::vector<std::string>& ids, - DeleteCallback callback) override; - void Find(const base::string16& query, - uint32_t max_results, - FindCallback callback) override; - void ClearIndex(ClearIndexCallback callback) override; - - private: - IndexSync* const index_; - mojo::ReceiverSet<mojom::IndexSyncProxy> receivers_; -}; - -} // namespace local_search_service -} // namespace chromeos - -#endif // CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_INDEX_SYNC_PROXY_H_
diff --git a/chromeos/components/local_search_service/inverted_index_search.cc b/chromeos/components/local_search_service/inverted_index_search.cc index 71093472..d510d64d 100644 --- a/chromeos/components/local_search_service/inverted_index_search.cc +++ b/chromeos/components/local_search_service/inverted_index_search.cc
@@ -78,10 +78,8 @@ } // namespace -InvertedIndexSearch::InvertedIndexSearch(IndexId index_id, - PrefService* local_state) - : IndexSync(index_id, Backend::kInvertedIndex, local_state), - Index(index_id, Backend::kInvertedIndex), +InvertedIndexSearch::InvertedIndexSearch(IndexId index_id) + : Index(index_id, Backend::kInvertedIndex), inverted_index_(std::make_unique<InvertedIndex>()), blocking_task_runner_(base::ThreadPool::CreateSequencedTaskRunner( {base::TaskPriority::BEST_EFFORT, base::MayBlock(), @@ -91,82 +89,6 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } -uint64_t InvertedIndexSearch::GetSizeSync() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return inverted_index_->NumberDocuments(); -} - -void InvertedIndexSearch::AddOrUpdateSync( - const std::vector<local_search_service::Data>& data) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(!data.empty()); - ++num_queued_index_updates_; - base::PostTaskAndReplyWithResult( - blocking_task_runner_.get(), FROM_HERE, - base::BindOnce(&ExtractDocumentsContent, data), - base::BindOnce(&InvertedIndexSearch::FinalizeAddOrUpdateSync, - weak_ptr_factory_.GetWeakPtr())); -} - -uint32_t InvertedIndexSearch::DeleteSync(const std::vector<std::string>& ids) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(!ids.empty()); - - if (num_queued_index_updates_ == 0) { - // We can remove the documents immediately as there is no earlier - // index-modifying operation. - inverted_index_->RemoveDocuments(ids); - MaybeBuildInvertedIndex(); - return ids.size(); - } - - // If there is an earlier index-modifying operation, Delete should wait until - // the other operations are complete. Delete is queued and we create a no-op - // to run on the same |blocking_task_runner_|. - ++num_queued_index_updates_; - blocking_task_runner_->PostTaskAndReply( - FROM_HERE, base::DoNothing(), - base::BindOnce(&InvertedIndexSearch::FinalizeDeleteSync, - weak_ptr_factory_.GetWeakPtr(), ids)); - - return ids.size(); -} - -void InvertedIndexSearch::ClearIndexSync() { - inverted_index_->ClearInvertedIndex(); -} - -ResponseStatus InvertedIndexSearch::FindSync(const base::string16& query, - uint32_t max_results, - std::vector<Result>* results) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - const base::TimeTicks start = base::TimeTicks::Now(); - DCHECK(results); - results->clear(); - if (query.empty()) { - const ResponseStatus status = ResponseStatus::kEmptyQuery; - MaybeLogSearchResultsStatsSync(status, 0u, base::TimeDelta()); - return status; - } - if (GetSizeSync() == 0u) { - const ResponseStatus status = ResponseStatus::kEmptyIndex; - MaybeLogSearchResultsStatsSync(status, 0u, base::TimeDelta()); - return status; - } - - *results = inverted_index_->FindMatchingDocumentsApproximately( - GetTokenizedQuery(query), search_params_.prefix_threshold, - search_params_.fuzzy_threshold); - - if (results->size() > max_results && max_results > 0u) - results->resize(max_results); - - const base::TimeTicks end = base::TimeTicks::Now(); - const ResponseStatus status = ResponseStatus::kSuccess; - MaybeLogSearchResultsStatsSync(status, results->size(), end - start); - return status; -} - void InvertedIndexSearch::GetSize(GetSizeCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); std::move(callback).Run(inverted_index_->NumberDocuments()); @@ -253,22 +175,6 @@ return doc_with_freq; } -void InvertedIndexSearch::FinalizeAddOrUpdateSync( - const ExtractedContent& documents) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - --num_queued_index_updates_; - inverted_index_->AddDocuments(documents); - MaybeBuildInvertedIndex(); -} - -void InvertedIndexSearch::FinalizeDeleteSync( - const std::vector<std::string>& ids) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - --num_queued_index_updates_; - inverted_index_->RemoveDocuments(ids); - MaybeBuildInvertedIndex(); -} - void InvertedIndexSearch::FinalizeAddOrUpdate( AddOrUpdateCallback callback, const ExtractedContent& documents) {
diff --git a/chromeos/components/local_search_service/inverted_index_search.h b/chromeos/components/local_search_service/inverted_index_search.h index 3d8c9193..f5a357c8 100644 --- a/chromeos/components/local_search_service/inverted_index_search.h +++ b/chromeos/components/local_search_service/inverted_index_search.h
@@ -15,7 +15,6 @@ #include "base/sequenced_task_runner.h" #include "base/strings/string16.h" #include "chromeos/components/local_search_service/index.h" -#include "chromeos/components/local_search_service/index_sync.h" #include "chromeos/components/local_search_service/shared_structs.h" namespace chromeos { @@ -25,34 +24,14 @@ // An implementation of Index. // A search via the inverted index backend with TF-IDF based document ranking. -class InvertedIndexSearch : public IndexSync, public Index { +class InvertedIndexSearch : public Index { public: - InvertedIndexSearch(IndexId index_id, PrefService* local_state); + explicit InvertedIndexSearch(IndexId index_id); ~InvertedIndexSearch() override; InvertedIndexSearch(const InvertedIndexSearch&) = delete; InvertedIndexSearch& operator=(const InvertedIndexSearch&) = delete; - // IndexSync overrides: - uint64_t GetSizeSync() override; - // TODO(jiameng): we always build the index after documents are updated. May - // revise this strategy if there is a different use case. - void AddOrUpdateSync(const std::vector<Data>& data) override; - // TODO(jiameng): we always build the index after documents are deleted. May - // revise this strategy if there is a different use case. - // TODO(jiameng): for inverted index, the Delete function returns |ids| size, - // and not actual number of documents deleted. This would change in the next - // cl when these operations become async. - uint32_t DeleteSync(const std::vector<std::string>& ids) override; - void ClearIndexSync() override; - // Returns matching results for a given query by approximately matching the - // query with terms in the documents. Documents are ranked by TF-IDF scores. - // Scores in results are positive but not guaranteed to be in any particular - // range. - ResponseStatus FindSync(const base::string16& query, - uint32_t max_results, - std::vector<Result>* results) override; - // Index overrides: // GetSize is only accurate if the index has done updating. void GetSize(GetSizeCallback callback) override; @@ -73,14 +52,6 @@ const base::string16& term) const; private: - void FinalizeAddOrUpdateSync( - const std::vector<std::pair<std::string, std::vector<Token>>>& documents); - - // FinalizeDeleteSync is called if Delete cannot be immediately done because - // there's another index updating operation before it, i.e. - // |num_queued_index_updates_| is not zero. - void FinalizeDeleteSync(const std::vector<std::string>& ids); - void FinalizeAddOrUpdate( AddOrUpdateCallback callback, const std::vector<std::pair<std::string, std::vector<Token>>>& documents);
diff --git a/chromeos/components/local_search_service/inverted_index_search_unittest.cc b/chromeos/components/local_search_service/inverted_index_search_unittest.cc index 7de51d9..205c96b9 100644 --- a/chromeos/components/local_search_service/inverted_index_search_unittest.cc +++ b/chromeos/components/local_search_service/inverted_index_search_unittest.cc
@@ -126,8 +126,7 @@ class InvertedIndexSearchTest : public testing::Test { public: void SetUp() override { - search_ = std::make_unique<InvertedIndexSearch>(IndexId::kCrosSettings, - nullptr /* local_state */); + search_ = std::make_unique<InvertedIndexSearch>(IndexId::kCrosSettings); } void Wait() { task_environment_.RunUntilIdle(); } @@ -138,292 +137,6 @@ base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED}; }; -TEST_F(InvertedIndexSearchTest, AddSync) { - const std::map<std::string, std::vector<ContentWithId>> data_to_register = { - {"id1", - {{"cid_1", "This is a help wi-fi article"}, - {"cid_2", "Another help help wi-fi"}}}, - {"id2", {{"cid_3", "help article on wi-fi"}}}}; - - const std::vector<Data> data = CreateTestData(data_to_register); - search_->AddOrUpdateSync(data); - Wait(); - EXPECT_EQ(search_->GetSizeSync(), 2u); - - { - // "network" does not exist in the index. - const TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("network")); - EXPECT_TRUE(doc_with_freq.empty()); - } - - { - // "help" exists in the index. - const TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("help")); - EXPECT_EQ(doc_with_freq.size(), 2u); - EXPECT_EQ(doc_with_freq[0].first, "id1"); - EXPECT_EQ(doc_with_freq[0].second, 3u); - EXPECT_EQ(doc_with_freq[1].first, "id2"); - EXPECT_EQ(doc_with_freq[1].second, 1u); - } - - { - // "wifi" exists in the index but "wi-fi" doesn't because of normalization. - TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("wifi")); - EXPECT_EQ(doc_with_freq.size(), 2u); - EXPECT_EQ(doc_with_freq[0].first, "id1"); - EXPECT_EQ(doc_with_freq[0].second, 2u); - EXPECT_EQ(doc_with_freq[1].first, "id2"); - EXPECT_EQ(doc_with_freq[1].second, 1u); - - doc_with_freq = search_->FindTermForTesting(base::UTF8ToUTF16("wi-fi")); - EXPECT_TRUE(doc_with_freq.empty()); - - // "WiFi" doesn't exist because the index stores normalized word. - doc_with_freq = search_->FindTermForTesting(base::UTF8ToUTF16("WiFi")); - EXPECT_TRUE(doc_with_freq.empty()); - } - - { - // "this" does not exist in the index because it's a stopword - const TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("this")); - EXPECT_TRUE(doc_with_freq.empty()); - } -} - -TEST_F(InvertedIndexSearchTest, UpdateSync) { - const std::map<std::string, std::vector<ContentWithId>> data_to_register = { - {"id1", - {{"cid_1", "This is a help wi-fi article"}, - {"cid_2", "Another help help wi-fi"}}}, - {"id2", {{"cid_3", "help article on wi-fi"}}}}; - - const std::vector<Data> data = CreateTestData(data_to_register); - search_->AddOrUpdateSync(data); - Wait(); - EXPECT_EQ(search_->GetSizeSync(), 2u); - - const std::map<std::string, std::vector<ContentWithId>> data_to_update = { - {"id1", - {{"cid_1", "This is a help bluetooth article"}, - {"cid_2", "Google Playstore Google Music"}}}, - {"id3", {{"cid_3", "Google Map"}}}}; - - const std::vector<Data> updated_data = CreateTestData(data_to_update); - search_->AddOrUpdateSync(updated_data); - Wait(); - EXPECT_EQ(search_->GetSizeSync(), 3u); - - { - const TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("bluetooth")); - EXPECT_EQ(doc_with_freq.size(), 1u); - EXPECT_EQ(doc_with_freq[0].first, "id1"); - EXPECT_EQ(doc_with_freq[0].second, 1u); - } - - { - const TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("wifi")); - EXPECT_EQ(doc_with_freq.size(), 1u); - EXPECT_EQ(doc_with_freq[0].first, "id2"); - EXPECT_EQ(doc_with_freq[0].second, 1u); - } - - { - const TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("google")); - EXPECT_EQ(doc_with_freq.size(), 2u); - EXPECT_EQ(doc_with_freq[0].first, "id1"); - EXPECT_EQ(doc_with_freq[0].second, 2u); - EXPECT_EQ(doc_with_freq[1].first, "id3"); - EXPECT_EQ(doc_with_freq[1].second, 1u); - } -} - -TEST_F(InvertedIndexSearchTest, DeleteSync) { - const std::map<std::string, std::vector<ContentWithId>> data_to_register = { - {"id1", - {{"cid_1", "This is a help wi-fi article"}, - {"cid_2", "Another help help wi-fi"}}}, - {"id2", {{"cid_3", "help article on wi-fi"}}}}; - - const std::vector<Data> data = CreateTestData(data_to_register); - search_->AddOrUpdateSync(data); - Wait(); - EXPECT_EQ(search_->GetSizeSync(), 2u); - - EXPECT_EQ(search_->DeleteSync({"id1", "id3"}), 2u); - Wait(); - - { - const TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("wifi")); - EXPECT_EQ(doc_with_freq.size(), 1u); - EXPECT_EQ(doc_with_freq[0].first, "id2"); - EXPECT_EQ(doc_with_freq[0].second, 1u); - } -} - -TEST_F(InvertedIndexSearchTest, ClearIndexSync) { - const std::map<std::string, std::vector<ContentWithId>> data_to_register = { - {"id1", - {{"cid_1", "This is a help wi-fi article"}, - {"cid_2", "Another help help wi-fi"}}}, - {"id2", {{"cid_3", "help article on wi-fi"}}}}; - - const std::vector<Data> data = CreateTestData(data_to_register); - - search_->AddOrUpdateSync(data); - Wait(); - EXPECT_EQ(search_->GetSizeSync(), 2u); - - search_->ClearIndexSync(); - Wait(); - EXPECT_EQ(search_->GetSizeSync(), 0u); -} - -TEST_F(InvertedIndexSearchTest, FindSync) { - const std::map<std::string, std::vector<WeightedContentWithId>> - data_to_register = {{"id1", - {{"cid_1", "This is a help wi-fi article", 0.8}, - {"cid_2", "Another help help wi-fi", 0.6}}}, - {"id2", {{"cid_3", "help article on wi-fi", 0.6}}}}; - const std::vector<Data> data = CreateTestData(data_to_register); - - // Nothing has been added to the index. - std::vector<Result> results; - EXPECT_EQ(search_->FindSync(base::UTF8ToUTF16("network"), /*max_results=*/10, - &results), - ResponseStatus::kEmptyIndex); - EXPECT_TRUE(results.empty()); - - // Data is added and then deleted from index, making the index empty. - search_->AddOrUpdateSync(data); - Wait(); - EXPECT_EQ(search_->GetSizeSync(), 2u); - EXPECT_EQ(search_->DeleteSync({"id1", "id2"}), 2u); - Wait(); - EXPECT_EQ(search_->GetSizeSync(), 0u); - - EXPECT_EQ(search_->FindSync(base::UTF8ToUTF16("network"), /*max_results=*/10, - &results), - ResponseStatus::kEmptyIndex); - EXPECT_TRUE(results.empty()); - - // Index is populated again, but query is empty. - search_->AddOrUpdateSync(data); - Wait(); - EXPECT_EQ(search_->GetSizeSync(), 2u); - - EXPECT_EQ( - search_->FindSync(base::UTF8ToUTF16(""), /*max_results=*/10, &results), - ResponseStatus::kEmptyQuery); - EXPECT_TRUE(results.empty()); - - // No document is found for a given query. - EXPECT_EQ(search_->FindSync(base::UTF8ToUTF16("networkstuff"), - /*max_results=*/10, &results), - ResponseStatus::kSuccess); - EXPECT_TRUE(results.empty()); - - { - // A document is found. - // Query's case is normalized. - EXPECT_EQ(search_->FindSync(base::UTF8ToUTF16("ANOTHER networkstuff"), - /*max_results=*/10, &results), - ResponseStatus::kSuccess); - EXPECT_EQ(results.size(), 1u); - - // "another" only exists in "id1". - const float expected_score = - TfIdfScore(/*num_docs=*/2, - /*num_docs_with_term=*/1, - /*weighted_num_term_occurrence_in_doc=*/0.6, - /*doc_length=*/7); - CheckResult(results[0], "id1", expected_score, - /*expected_number_positions=*/1); - } - - { - // Two documents are found. - EXPECT_EQ(search_->FindSync(base::UTF8ToUTF16("another help"), - /*max_results=*/10, &results), - ResponseStatus::kSuccess); - EXPECT_EQ(results.size(), 2u); - - // "id1" score comes from both "another" and "help". - const float expected_score_id1 = - TfIdfScore(/*num_docs=*/2, - /*num_docs_with_term=*/1, - /*weighted_num_term_occurrence_in_doc=*/0.6, - /*doc_length=*/7) + - TfIdfScore(/*num_docs=*/2, - /*num_docs_with_term=*/2, - /*weighted_num_term_occurrence_in_doc=*/0.8 + 0.6 * 2, - /*doc_length=*/7); - // "id2" score comes "help". - const float expected_score_id2 = - TfIdfScore(/*num_docs=*/2, - /*num_docs_with_term=*/2, - /*weighted_num_term_occurrence_in_doc=*/0.6, - /*doc_length=*/3); - - EXPECT_GE(expected_score_id1, expected_score_id2); - CheckResult(results[0], "id1", expected_score_id1, - /*expected_number_positions=*/4); - CheckResult(results[1], "id2", expected_score_id2, - /*expected_number_positions=*/1); - } - - { - // Same as above, but max number of results is set to 1. - EXPECT_EQ(search_->FindSync(base::UTF8ToUTF16("another help"), - /*max_results=*/1, &results), - ResponseStatus::kSuccess); - EXPECT_EQ(results.size(), 1u); - EXPECT_EQ(results[0].id, "id1"); - } - - { - // Same as above, but set max_results to 0, meaning no max. - EXPECT_EQ(search_->FindSync(base::UTF8ToUTF16("another help"), - /*max_results=*/0, &results), - ResponseStatus::kSuccess); - EXPECT_EQ(results.size(), 2u); - } -} - -TEST_F(InvertedIndexSearchTest, SequenceOfDeletesSync) { - const std::map<std::string, std::vector<ContentWithId>> data_to_register = { - {"id1", - {{"cid_1", "This is a help wi-fi article"}, - {"cid_2", "Another help help wi-fi"}}}, - {"id2", {{"cid_3", "help article on wi-fi"}}}}; - - const std::vector<Data> data = CreateTestData(data_to_register); - search_->AddOrUpdateSync(data); - - const std::map<std::string, std::vector<ContentWithId>> data_to_update = { - {"id1", - {{"cid_1", "This is a help bluetooth article"}, - {"cid_2", "Google Playstore Google Music"}}}, - {"id3", {{"cid_3", "Google Map"}}}}; - - const std::vector<Data> updated_data = CreateTestData(data_to_update); - search_->AddOrUpdateSync(updated_data); - - EXPECT_EQ(search_->DeleteSync({"id1"}), 1u); - EXPECT_EQ(search_->DeleteSync({"id2", "id3"}), 2u); - - // Force all operations to complete. - Wait(); - EXPECT_EQ(search_->GetSizeSync(), 0u); -} - TEST_F(InvertedIndexSearchTest, Add) { const std::map<std::string, std::vector<ContentWithId>> data_to_register = { {"id1",
diff --git a/chromeos/components/local_search_service/linear_map_search.cc b/chromeos/components/local_search_service/linear_map_search.cc index defc6606..557e473 100644 --- a/chromeos/components/local_search_service/linear_map_search.cc +++ b/chromeos/components/local_search_service/linear_map_search.cc
@@ -14,7 +14,6 @@ #include "chromeos/components/local_search_service/search_utils.h" #include "chromeos/components/string_matching/fuzzy_tokenized_string_match.h" #include "chromeos/components/string_matching/tokenized_string.h" -#include "components/prefs/pref_service.h" namespace chromeos { namespace local_search_service { @@ -80,70 +79,11 @@ } // namespace -LinearMapSearch::LinearMapSearch(IndexId index_id, PrefService* local_state) - : IndexSync(index_id, Backend::kLinearMap, local_state), - Index(index_id, Backend::kLinearMap) {} +LinearMapSearch::LinearMapSearch(IndexId index_id) + : Index(index_id, Backend::kLinearMap) {} LinearMapSearch::~LinearMapSearch() = default; -uint64_t LinearMapSearch::GetSizeSync() { - return data_.size(); -} - -void LinearMapSearch::AddOrUpdateSync( - const std::vector<local_search_service::Data>& data) { - for (const auto& item : data) { - const auto& id = item.id; - DCHECK(!id.empty()); - - UpdateData(id, item.contents, &data_); - } - - MaybeLogIndexSizeSync(); -} - -uint32_t LinearMapSearch::DeleteSync(const std::vector<std::string>& ids) { - uint32_t num_deleted = 0u; - for (const auto& id : ids) { - DCHECK(!id.empty()); - num_deleted += data_.erase(id); - } - - MaybeLogIndexSizeSync(); - return num_deleted; -} - -void LinearMapSearch::ClearIndexSync() { - data_.clear(); -} - -ResponseStatus LinearMapSearch::FindSync(const base::string16& query, - uint32_t max_results, - std::vector<Result>* results) { - const base::TimeTicks start = base::TimeTicks::Now(); - DCHECK(results); - results->clear(); - - if (query.empty()) { - const ResponseStatus status = ResponseStatus::kEmptyQuery; - MaybeLogSearchResultsStatsSync(status, 0u, base::TimeDelta()); - return status; - } - - if (data_.empty()) { - const ResponseStatus status = ResponseStatus::kEmptyIndex; - MaybeLogSearchResultsStatsSync(status, 0u, base::TimeDelta()); - return status; - } - - *results = GetSearchResults(query, max_results); - - const base::TimeTicks end = base::TimeTicks::Now(); - const ResponseStatus status = ResponseStatus::kSuccess; - MaybeLogSearchResultsStatsSync(status, results->size(), end - start); - return status; -} - void LinearMapSearch::GetSize(GetSizeCallback callback) { std::move(callback).Run(data_.size()); }
diff --git a/chromeos/components/local_search_service/linear_map_search.h b/chromeos/components/local_search_service/linear_map_search.h index 2b87062..fb21234 100644 --- a/chromeos/components/local_search_service/linear_map_search.h +++ b/chromeos/components/local_search_service/linear_map_search.h
@@ -13,11 +13,8 @@ #include "base/macros.h" #include "base/strings/string16.h" #include "chromeos/components/local_search_service/index.h" -#include "chromeos/components/local_search_service/index_sync.h" #include "chromeos/components/local_search_service/shared_structs.h" -class PrefService; - namespace chromeos { namespace string_matching { @@ -38,26 +35,14 @@ // A search backend that linearly scans all documents in the storage and finds // documents that match the input query. Search is done by matching query with // documents' search tags. -class LinearMapSearch : public IndexSync, public Index { +class LinearMapSearch : public Index { public: - LinearMapSearch(IndexId index_id, PrefService* local_state); + explicit LinearMapSearch(IndexId index_id); ~LinearMapSearch() override; LinearMapSearch(const LinearMapSearch&) = delete; LinearMapSearch& operator=(const LinearMapSearch&) = delete; - // IndexSync overrides: - uint64_t GetSizeSync() override; - void AddOrUpdateSync(const std::vector<Data>& data) override; - uint32_t DeleteSync(const std::vector<std::string>& ids) override; - void ClearIndexSync() override; - // For each data in the index, we return the 1st search tag that matches - // the query (i.e. above the threshold). Client should put the most - // important search tag first when registering the data in the index. - ResponseStatus FindSync(const base::string16& query, - uint32_t max_results, - std::vector<Result>* results) override; - // Index overrides: void GetSize(GetSizeCallback callback) override; void AddOrUpdate(const std::vector<Data>& data,
diff --git a/chromeos/components/local_search_service/linear_map_search_unittest.cc b/chromeos/components/local_search_service/linear_map_search_unittest.cc index 59c9182c..27bc1a0 100644 --- a/chromeos/components/local_search_service/linear_map_search_unittest.cc +++ b/chromeos/components/local_search_service/linear_map_search_unittest.cc
@@ -32,44 +32,8 @@ EXPECT_DOUBLE_EQ(actual.fuzzy_threshold, expected.fuzzy_threshold); } -void FindAndCheckResults(LinearMapSearch* index, - std::string query, - int32_t max_results, - ResponseStatus expected_status, - const std::vector<ResultWithIds>& expected_results) { - DCHECK(index); - - std::vector<Result> results; - auto status = - index->FindSync(base::UTF8ToUTF16(query), max_results, &results); - - EXPECT_EQ(status, expected_status); - - if (!results.empty()) { - // If results are returned, check size and values match the expected. - EXPECT_EQ(results.size(), expected_results.size()); - for (size_t i = 0; i < results.size(); ++i) { - EXPECT_EQ(results[i].id, expected_results[i].first); - EXPECT_EQ(results[i].positions.size(), expected_results[i].second.size()); - - for (size_t j = 0; j < results[i].positions.size(); ++j) { - EXPECT_EQ(results[i].positions[j].content_id, - expected_results[i].second[j]); - } - // Scores should be non-increasing. - if (i < results.size() - 1) { - EXPECT_GE(results[i].score, results[i + 1].score); - } - } - return; - } - - // If no results are returned, expected ids should be empty. - EXPECT_TRUE(expected_results.empty()); -} - -void GetSizeAndCheckResultsWithCallback(LinearMapSearch* index, - uint32_t expectd_num_items) { +void GetSizeAndCheckResults(LinearMapSearch* index, + uint32_t expectd_num_items) { bool callback_done = false; uint32_t num_items = 0; index->GetSize(base::BindOnce( @@ -82,8 +46,7 @@ EXPECT_EQ(num_items, expectd_num_items); } -void AddOrUpdateWithCallback(LinearMapSearch* index, - const std::vector<Data>& data) { +void AddOrUpdate(LinearMapSearch* index, const std::vector<Data>& data) { bool callback_done = false; index->AddOrUpdate( data, base::BindOnce([](bool* callback_done) { *callback_done = true; }, @@ -108,12 +71,11 @@ EXPECT_EQ(num_deleted, expect_num_deleted); } -void FindAndCheckResultsWithCallback( - LinearMapSearch* index, - std::string query, - int32_t max_results, - ResponseStatus expected_status, - const std::vector<ResultWithIds>& expected_results) { +void FindAndCheckResults(LinearMapSearch* index, + std::string query, + int32_t max_results, + ResponseStatus expected_status, + const std::vector<ResultWithIds>& expected_results) { DCHECK(index); bool callback_done = false; ResponseStatus status; @@ -162,8 +124,7 @@ class LinearMapSearchTest : public testing::Test { void SetUp() override { - index_ = std::make_unique<LinearMapSearch>(IndexId::kCrosSettings, - nullptr /* local_state */); + index_ = std::make_unique<LinearMapSearch>(IndexId::kCrosSettings); } protected: @@ -198,8 +159,10 @@ const std::map<std::string, std::vector<ContentWithId>> data_to_register = { {"id1", {{"tag1", "Wi-Fi"}}}, {"id2", {{"tag2", "famous"}}}}; std::vector<Data> data = CreateTestData(data_to_register); - index_->AddOrUpdateSync(data); - EXPECT_EQ(index_->GetSizeSync(), 2u); + + AddOrUpdate(index_.get(), data); + GetSizeAndCheckResults(index_.get(), 2u); + { SearchParams search_params; search_params.relevance_threshold = 0.0; @@ -236,8 +199,9 @@ {"id1", {{"tag1", "abcde"}, {"tag2", "Wi-Fi"}}}, {"id2", {{"tag3", "wifi"}}}}; std::vector<Data> data = CreateTestData(data_to_register); - index_->AddOrUpdateSync(data); - EXPECT_EQ(index_->GetSizeSync(), 2u); + AddOrUpdate(index_.get(), data); + GetSizeAndCheckResults(index_.get(), 2u); + SearchParams search_params; search_params.relevance_threshold = 0.3; index_->SetSearchParams(search_params); @@ -264,8 +228,8 @@ std::vector<Data> data = CreateTestData(data_to_register); EXPECT_EQ(data.size(), 2u); - index_->AddOrUpdateSync(data); - EXPECT_EQ(index_->GetSizeSync(), 2u); + AddOrUpdate(index_.get(), data); + GetSizeAndCheckResults(index_.get(), 2u); // Find result with query "id1". It returns an exact match. const std::vector<ResultWithIds> expected_results = {{"id1", {"cid1"}}}; @@ -283,115 +247,14 @@ std::vector<Data> data = CreateTestData(data_to_register); EXPECT_EQ(data.size(), 2u); - index_->AddOrUpdateSync(data); - EXPECT_EQ(index_->GetSizeSync(), 2u); - - index_->ClearIndexSync(); - EXPECT_EQ(index_->GetSizeSync(), 0u); -} - -TEST_F(LinearMapSearchTest, RelevanceThresholdCallback) { - const std::map<std::string, std::vector<ContentWithId>> data_to_register = { - {"id1", {{"tag1", "Wi-Fi"}}}, {"id2", {{"tag2", "famous"}}}}; - std::vector<Data> data = CreateTestData(data_to_register); - - AddOrUpdateWithCallback(index_.get(), data); - GetSizeAndCheckResultsWithCallback(index_.get(), 2u); - - { - SearchParams search_params; - search_params.relevance_threshold = 0.0; - index_->SetSearchParams(search_params); - - const std::vector<ResultWithIds> expected_results = {{"id1", {"tag1"}}, - {"id2", {"tag2"}}}; - FindAndCheckResultsWithCallback(index_.get(), "wifi", - /*max_results=*/-1, - ResponseStatus::kSuccess, expected_results); - } - { - SearchParams search_params; - search_params.relevance_threshold = 0.3; - index_->SetSearchParams(search_params); - - const std::vector<ResultWithIds> expected_results = {{"id1", {"tag1"}}}; - FindAndCheckResultsWithCallback(index_.get(), "wifi", - /*max_results=*/-1, - ResponseStatus::kSuccess, expected_results); - } - { - SearchParams search_params; - search_params.relevance_threshold = 0.9; - index_->SetSearchParams(search_params); - - FindAndCheckResultsWithCallback(index_.get(), "wifi", - /*max_results=*/-1, - ResponseStatus::kSuccess, {}); - } -} - -TEST_F(LinearMapSearchTest, MaxResultsCallback) { - const std::map<std::string, std::vector<ContentWithId>> data_to_register = { - {"id1", {{"tag1", "abcde"}, {"tag2", "Wi-Fi"}}}, - {"id2", {{"tag3", "wifi"}}}}; - std::vector<Data> data = CreateTestData(data_to_register); - AddOrUpdateWithCallback(index_.get(), data); - GetSizeAndCheckResultsWithCallback(index_.get(), 2u); - - SearchParams search_params; - search_params.relevance_threshold = 0.3; - index_->SetSearchParams(search_params); - - { - const std::vector<ResultWithIds> expected_results = {{"id2", {"tag3"}}, - {"id1", {"tag2"}}}; - FindAndCheckResultsWithCallback(index_.get(), "wifi", - /*max_results=*/-1, - ResponseStatus::kSuccess, expected_results); - } - { - const std::vector<ResultWithIds> expected_results = {{"id2", {"tag3"}}}; - FindAndCheckResultsWithCallback(index_.get(), "wifi", - /*max_results=*/1, ResponseStatus::kSuccess, - expected_results); - } -} - -TEST_F(LinearMapSearchTest, ResultFoundCallback) { - const std::map<std::string, std::vector<ContentWithId>> data_to_register = { - {"id1", {{"cid1", "id1"}, {"cid2", "tag1a"}, {"cid3", "tag1b"}}}, - {"xyz", {{"cid4", "xyz"}}}}; - std::vector<Data> data = CreateTestData(data_to_register); - EXPECT_EQ(data.size(), 2u); - - AddOrUpdateWithCallback(index_.get(), data); - GetSizeAndCheckResultsWithCallback(index_.get(), 2u); - - // Find result with query "id1". It returns an exact match. - const std::vector<ResultWithIds> expected_results = {{"id1", {"cid1"}}}; - FindAndCheckResultsWithCallback(index_.get(), "id1", - /*max_results=*/-1, ResponseStatus::kSuccess, - expected_results); - FindAndCheckResultsWithCallback(index_.get(), "abc", - /*max_results=*/-1, ResponseStatus::kSuccess, - {}); -} - -TEST_F(LinearMapSearchTest, ClearIndexCallback) { - const std::map<std::string, std::vector<ContentWithId>> data_to_register = { - {"id1", {{"cid1", "id1"}, {"cid2", "tag1a"}, {"cid3", "tag1b"}}}, - {"xyz", {{"cid4", "xyz"}}}}; - std::vector<Data> data = CreateTestData(data_to_register); - EXPECT_EQ(data.size(), 2u); - - AddOrUpdateWithCallback(index_.get(), data); - GetSizeAndCheckResultsWithCallback(index_.get(), 2u); + AddOrUpdate(index_.get(), data); + GetSizeAndCheckResults(index_.get(), 2u); bool callback_done = false; index_->ClearIndex(base::BindOnce( [](bool* callback_done) { *callback_done = true; }, &callback_done)); ASSERT_TRUE(callback_done); - GetSizeAndCheckResultsWithCallback(index_.get(), 0u); + GetSizeAndCheckResults(index_.get(), 0u); } TEST_F(LinearMapSearchTest, UpdateDocuments) { @@ -401,8 +264,8 @@ std::vector<Data> data = CreateTestData(data_to_register); EXPECT_EQ(data.size(), 2u); - AddOrUpdateWithCallback(index_.get(), data); - GetSizeAndCheckResultsWithCallback(index_.get(), 2u); + AddOrUpdate(index_.get(), data); + GetSizeAndCheckResults(index_.get(), 2u); const std::map<std::string, std::vector<ContentWithId>> update_data_to_register = {{"id1", @@ -415,7 +278,7 @@ EXPECT_EQ(update_data.size(), 3u); UpdateDocumentsAndCheckResults(index_.get(), update_data, 1u); - GetSizeAndCheckResultsWithCallback(index_.get(), 1u); + GetSizeAndCheckResults(index_.get(), 1u); } } // namespace local_search_service
diff --git a/chromeos/components/local_search_service/local_search_service.cc b/chromeos/components/local_search_service/local_search_service.cc index 88463358..6804c783 100644 --- a/chromeos/components/local_search_service/local_search_service.cc +++ b/chromeos/components/local_search_service/local_search_service.cc
@@ -23,17 +23,15 @@ auto it = indices_.find(index_id); if (it == indices_.end()) { switch (backend) { - // TODO(thanhdng): Remove |local_state| when IndexSync is removed. case Backend::kLinearMap: it = indices_ - .emplace(index_id, std::make_unique<LinearMapSearch>( - index_id, /*local_state*/ nullptr)) + .emplace(index_id, std::make_unique<LinearMapSearch>(index_id)) .first; break; case Backend::kInvertedIndex: it = indices_ - .emplace(index_id, std::make_unique<InvertedIndexSearch>( - index_id, /*local_state*/ nullptr)) + .emplace(index_id, + std::make_unique<InvertedIndexSearch>(index_id)) .first; } if (!it->second) {
diff --git a/chromeos/components/local_search_service/local_search_service_sync.cc b/chromeos/components/local_search_service/local_search_service_sync.cc deleted file mode 100644 index 9ddea234..0000000 --- a/chromeos/components/local_search_service/local_search_service_sync.cc +++ /dev/null
@@ -1,45 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/components/local_search_service/local_search_service_sync.h" - -#include <utility> - -#include "chromeos/components/local_search_service/inverted_index_search.h" -#include "chromeos/components/local_search_service/linear_map_search.h" - -namespace chromeos { -namespace local_search_service { - -LocalSearchServiceSync::LocalSearchServiceSync() = default; - -LocalSearchServiceSync::~LocalSearchServiceSync() = default; - -IndexSync* LocalSearchServiceSync::GetIndexSync(IndexId index_id, - Backend backend, - PrefService* local_state) { - auto it = indices_.find(index_id); - if (it == indices_.end()) { - switch (backend) { - case Backend::kLinearMap: - it = indices_ - .emplace(index_id, std::make_unique<LinearMapSearch>( - index_id, local_state)) - .first; - break; - case Backend::kInvertedIndex: - it = indices_ - .emplace(index_id, std::make_unique<InvertedIndexSearch>( - index_id, local_state)) - .first; - } - } - DCHECK(it != indices_.end()); - DCHECK(it->second); - - return it->second.get(); -} - -} // namespace local_search_service -} // namespace chromeos
diff --git a/chromeos/components/local_search_service/local_search_service_sync.h b/chromeos/components/local_search_service/local_search_service_sync.h deleted file mode 100644 index ecd5f29..0000000 --- a/chromeos/components/local_search_service/local_search_service_sync.h +++ /dev/null
@@ -1,43 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_LOCAL_SEARCH_SERVICE_SYNC_H_ -#define CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_LOCAL_SEARCH_SERVICE_SYNC_H_ - -#include <map> -#include <memory> - -#include "base/macros.h" -#include "chromeos/components/local_search_service/shared_structs.h" -#include "components/keyed_service/core/keyed_service.h" - -class PrefService; - -namespace chromeos { - -namespace local_search_service { - -class IndexSync; - -// LocalSearchServiceSync creates and owns content-specific Indices. Clients can -// call it |GetIndexSync| method to get an IndexSync for a given index id. -class LocalSearchServiceSync : public KeyedService { - public: - LocalSearchServiceSync(); - ~LocalSearchServiceSync() override; - LocalSearchServiceSync(const LocalSearchServiceSync&) = delete; - LocalSearchServiceSync& operator=(const LocalSearchServiceSync&) = delete; - - IndexSync* GetIndexSync(IndexId index_id, - Backend backend, - PrefService* local_state); - - private: - std::map<IndexId, std::unique_ptr<IndexSync>> indices_; -}; - -} // namespace local_search_service -} // namespace chromeos - -#endif // CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_LOCAL_SEARCH_SERVICE_SYNC_H_
diff --git a/chromeos/components/local_search_service/local_search_service_sync_factory.cc b/chromeos/components/local_search_service/local_search_service_sync_factory.cc deleted file mode 100644 index 875f9dd..0000000 --- a/chromeos/components/local_search_service/local_search_service_sync_factory.cc +++ /dev/null
@@ -1,43 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/components/local_search_service/local_search_service_sync_factory.h" - -#include "chromeos/components/local_search_service/local_search_service_sync.h" -#include "components/keyed_service/content/browser_context_dependency_manager.h" - -namespace chromeos { -namespace local_search_service { - -LocalSearchServiceSync* LocalSearchServiceSyncFactory::GetForBrowserContext( - content::BrowserContext* context) { - return static_cast<LocalSearchServiceSync*>( - LocalSearchServiceSyncFactory::GetInstance()->GetServiceForBrowserContext( - context, true /* create */)); -} - -LocalSearchServiceSyncFactory* LocalSearchServiceSyncFactory::GetInstance() { - return base::Singleton<LocalSearchServiceSyncFactory>::get(); -} - -LocalSearchServiceSyncFactory::LocalSearchServiceSyncFactory() - : BrowserContextKeyedServiceFactory( - "LocalSearchServiceSync", - BrowserContextDependencyManager::GetInstance()) {} - -LocalSearchServiceSyncFactory::~LocalSearchServiceSyncFactory() = default; - -content::BrowserContext* LocalSearchServiceSyncFactory::GetBrowserContextToUse( - content::BrowserContext* context) const { - // The service should exist in incognito mode. - return context; -} - -KeyedService* LocalSearchServiceSyncFactory::BuildServiceInstanceFor( - content::BrowserContext* /* context */) const { - return new LocalSearchServiceSync(); -} - -} // namespace local_search_service -} // namespace chromeos
diff --git a/chromeos/components/local_search_service/local_search_service_sync_factory.h b/chromeos/components/local_search_service/local_search_service_sync_factory.h deleted file mode 100644 index 24a3ca4..0000000 --- a/chromeos/components/local_search_service/local_search_service_sync_factory.h +++ /dev/null
@@ -1,45 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_LOCAL_SEARCH_SERVICE_SYNC_FACTORY_H_ -#define CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_LOCAL_SEARCH_SERVICE_SYNC_FACTORY_H_ - -#include "base/macros.h" -#include "base/memory/singleton.h" -#include "components/keyed_service/content/browser_context_keyed_service_factory.h" - -namespace chromeos { - -namespace local_search_service { - -class LocalSearchServiceSync; - -class LocalSearchServiceSyncFactory : public BrowserContextKeyedServiceFactory { - public: - static LocalSearchServiceSync* GetForBrowserContext( - content::BrowserContext* context); - - static LocalSearchServiceSyncFactory* GetInstance(); - - private: - friend struct base::DefaultSingletonTraits<LocalSearchServiceSyncFactory>; - - LocalSearchServiceSyncFactory(); - ~LocalSearchServiceSyncFactory() override; - - LocalSearchServiceSyncFactory(const LocalSearchServiceSyncFactory&) = delete; - LocalSearchServiceSyncFactory& operator=( - const LocalSearchServiceSyncFactory&) = delete; - - // BrowserContextKeyedServiceFactory overrides. - content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const override; - KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const override; -}; - -} // namespace local_search_service -} // namespace chromeos - -#endif // CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_LOCAL_SEARCH_SERVICE_SYNC_FACTORY_H_
diff --git a/chromeos/components/local_search_service/local_search_service_sync_proxy.cc b/chromeos/components/local_search_service/local_search_service_sync_proxy.cc deleted file mode 100644 index 4cc82a6..0000000 --- a/chromeos/components/local_search_service/local_search_service_sync_proxy.cc +++ /dev/null
@@ -1,50 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/components/local_search_service/local_search_service_sync_proxy.h" - -#include "chromeos/components/local_search_service/index_sync_proxy.h" -#include "chromeos/components/local_search_service/local_search_service_sync.h" -#include "chromeos/components/local_search_service/shared_structs.h" -#include "components/prefs/pref_service.h" - -namespace chromeos { -namespace local_search_service { - -LocalSearchServiceSyncProxy::LocalSearchServiceSyncProxy( - local_search_service::LocalSearchServiceSync* local_search_service) - : service_(local_search_service) { - DCHECK(service_); -} - -LocalSearchServiceSyncProxy::~LocalSearchServiceSyncProxy() = default; - -void LocalSearchServiceSyncProxy::GetIndex( - IndexId index_id, - Backend backend, - mojo::PendingReceiver<mojom::IndexSyncProxy> index_receiver) { - GetIndex(index_id, backend, nullptr, std::move(index_receiver)); -} - -void LocalSearchServiceSyncProxy::GetIndex( - IndexId index_id, - Backend backend, - PrefService* local_state, - mojo::PendingReceiver<mojom::IndexSyncProxy> index_receiver) { - auto it = indices_.find(index_id); - if (it == indices_.end()) { - IndexSync* index = service_->GetIndexSync(index_id, backend, local_state); - it = indices_.emplace(index_id, std::make_unique<IndexSyncProxy>(index)) - .first; - } - it->second->BindReceiver(std::move(index_receiver)); -} - -void LocalSearchServiceSyncProxy::BindReceiver( - mojo::PendingReceiver<mojom::LocalSearchServiceSyncProxy> receiver) { - receivers_.Add(this, std::move(receiver)); -} - -} // namespace local_search_service -} // namespace chromeos
diff --git a/chromeos/components/local_search_service/local_search_service_sync_proxy.h b/chromeos/components/local_search_service/local_search_service_sync_proxy.h deleted file mode 100644 index f534987..0000000 --- a/chromeos/components/local_search_service/local_search_service_sync_proxy.h +++ /dev/null
@@ -1,66 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_LOCAL_SEARCH_SERVICE_SYNC_PROXY_H_ -#define CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_LOCAL_SEARCH_SERVICE_SYNC_PROXY_H_ - -#include <map> - -#include "chromeos/components/local_search_service/public/mojom/local_search_service_proxy.mojom.h" -#include "components/keyed_service/core/keyed_service.h" -#include "mojo/public/cpp/bindings/pending_receiver.h" -#include "mojo/public/cpp/bindings/receiver_set.h" - -class PrefService; - -namespace chromeos { -namespace local_search_service { - -class LocalSearchServiceSync; -class IndexSyncProxy; -enum class IndexId; -enum class Backend; - -class LocalSearchServiceSyncProxy : public mojom::LocalSearchServiceSyncProxy, - public KeyedService { - public: - explicit LocalSearchServiceSyncProxy( - LocalSearchServiceSync* local_search_service); - ~LocalSearchServiceSyncProxy() override; - - LocalSearchServiceSyncProxy(const LocalSearchServiceSyncProxy&) = delete; - LocalSearchServiceSyncProxy& operator=(const LocalSearchServiceSyncProxy) = - delete; - - // mojom::LocalSearchServiceSyncProxy: - void GetIndex( - IndexId index_id, - Backend backend, - mojo::PendingReceiver<mojom::IndexSyncProxy> index_receiver) override; - - void BindReceiver( - mojo::PendingReceiver<mojom::LocalSearchServiceSyncProxy> receiver); - - // The version below allows an out-of-process client to directly obtain an - // Index using their own delegate that runs in C++. - // 1. Client's delegate obtains LocalSearchServicProxy from - // LocalSearchServiceSyncProxyFactory. - // 2. Client's delegate calls GetIndex to obtain an Index and binds the - // IndexSyncProxy remote - // to the IndexSyncProxy implementation. - void GetIndex(IndexId index_id, - Backend backend, - PrefService* local_state, - mojo::PendingReceiver<mojom::IndexSyncProxy> index_receiver); - - private: - LocalSearchServiceSync* const service_; - mojo::ReceiverSet<mojom::LocalSearchServiceSyncProxy> receivers_; - std::map<IndexId, std::unique_ptr<IndexSyncProxy>> indices_; -}; - -} // namespace local_search_service -} // namespace chromeos - -#endif // CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_LOCAL_SEARCH_SERVICE_SYNC_PROXY_H_
diff --git a/chromeos/components/local_search_service/local_search_service_sync_proxy_factory.cc b/chromeos/components/local_search_service/local_search_service_sync_proxy_factory.cc deleted file mode 100644 index 31717777..0000000 --- a/chromeos/components/local_search_service/local_search_service_sync_proxy_factory.cc +++ /dev/null
@@ -1,55 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/components/local_search_service/local_search_service_sync_proxy_factory.h" - -#include "chromeos/components/local_search_service/local_search_service_sync_factory.h" -#include "chromeos/components/local_search_service/local_search_service_sync_proxy.h" -#include "components/keyed_service/content/browser_context_dependency_manager.h" - -namespace chromeos { -namespace local_search_service { - -// static -LocalSearchServiceSyncProxy* -LocalSearchServiceSyncProxyFactory::GetForBrowserContext( - content::BrowserContext* context) { - return static_cast<LocalSearchServiceSyncProxy*>( - LocalSearchServiceSyncProxyFactory::GetInstance() - ->GetServiceForBrowserContext(context, /*create=*/true)); -} - -// static -LocalSearchServiceSyncProxyFactory* -LocalSearchServiceSyncProxyFactory::GetInstance() { - static base::NoDestructor<LocalSearchServiceSyncProxyFactory> instance; - return instance.get(); -} - -LocalSearchServiceSyncProxyFactory::LocalSearchServiceSyncProxyFactory() - : BrowserContextKeyedServiceFactory( - "LocalSearchServiceSyncProxy", - BrowserContextDependencyManager::GetInstance()) { - DependsOn(LocalSearchServiceSyncFactory::GetInstance()); -} - -LocalSearchServiceSyncProxyFactory::~LocalSearchServiceSyncProxyFactory() = - default; - -content::BrowserContext* -LocalSearchServiceSyncProxyFactory::GetBrowserContextToUse( - content::BrowserContext* context) const { - // The service should exist in incognito mode. - return context; -} - -KeyedService* LocalSearchServiceSyncProxyFactory::BuildServiceInstanceFor( - content::BrowserContext* context) const { - DCHECK(context); - return new LocalSearchServiceSyncProxy( - LocalSearchServiceSyncFactory::GetForBrowserContext(context)); -} - -} // namespace local_search_service -} // namespace chromeos
diff --git a/chromeos/components/local_search_service/local_search_service_sync_proxy_factory.h b/chromeos/components/local_search_service/local_search_service_sync_proxy_factory.h deleted file mode 100644 index ebb34f5..0000000 --- a/chromeos/components/local_search_service/local_search_service_sync_proxy_factory.h +++ /dev/null
@@ -1,44 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_LOCAL_SEARCH_SERVICE_SYNC_PROXY_FACTORY_H_ -#define CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_LOCAL_SEARCH_SERVICE_SYNC_PROXY_FACTORY_H_ - -#include "base/no_destructor.h" -#include "components/keyed_service/content/browser_context_keyed_service_factory.h" - -namespace chromeos { -namespace local_search_service { - -class LocalSearchServiceSyncProxy; - -class LocalSearchServiceSyncProxyFactory - : public BrowserContextKeyedServiceFactory { - public: - static LocalSearchServiceSyncProxy* GetForBrowserContext( - content::BrowserContext* context); - static LocalSearchServiceSyncProxyFactory* GetInstance(); - - LocalSearchServiceSyncProxyFactory( - const LocalSearchServiceSyncProxyFactory&) = delete; - LocalSearchServiceSyncProxyFactory& operator=( - const LocalSearchServiceSyncProxyFactory&) = delete; - - private: - friend class base::NoDestructor<LocalSearchServiceSyncProxyFactory>; - - LocalSearchServiceSyncProxyFactory(); - ~LocalSearchServiceSyncProxyFactory() override; - - // BrowserContextKeyedServiceFactory: - content::BrowserContext* GetBrowserContextToUse( - content::BrowserContext* context) const override; - KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const override; -}; - -} // namespace local_search_service -} // namespace chromeos - -#endif // CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_LOCAL_SEARCH_SERVICE_SYNC_PROXY_FACTORY_H_
diff --git a/chromeos/components/local_search_service/local_search_service_sync_proxy_unittest.cc b/chromeos/components/local_search_service/local_search_service_sync_proxy_unittest.cc deleted file mode 100644 index c697b10..0000000 --- a/chromeos/components/local_search_service/local_search_service_sync_proxy_unittest.cc +++ /dev/null
@@ -1,57 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/components/local_search_service/local_search_service_sync_proxy.h" - -#include "base/bind.h" -#include "base/run_loop.h" -#include "base/test/task_environment.h" -#include "chromeos/components/local_search_service/index_sync_proxy.h" -#include "chromeos/components/local_search_service/local_search_service_sync.h" -#include "chromeos/components/local_search_service/public/mojom/types.mojom.h" -#include "mojo/public/cpp/bindings/remote.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace chromeos { -namespace local_search_service { - -class LocalSearchServiceSyncProxyTest : public testing::Test { - public: - LocalSearchServiceSyncProxyTest() { - service_proxy_ = std::make_unique<LocalSearchServiceSyncProxy>(&service_); - service_proxy_->BindReceiver(service_remote_.BindNewPipeAndPassReceiver()); - } - - protected: - mojo::Remote<mojom::LocalSearchServiceSyncProxy> service_remote_; - - private: - base::test::TaskEnvironment task_environment_; - - LocalSearchServiceSync service_; - std::unique_ptr<LocalSearchServiceSyncProxy> service_proxy_; -}; - -TEST_F(LocalSearchServiceSyncProxyTest, GetIndex) { - mojo::Remote<mojom::IndexSyncProxy> index_remote; - service_remote_->GetIndex(IndexId::kCrosSettings, Backend::kLinearMap, - index_remote.BindNewPipeAndPassReceiver()); - base::RunLoop().RunUntilIdle(); - - // Check that IndexRemote is bound. - bool callback_done = false; - uint64_t num_items; - index_remote->GetSize(base::BindOnce( - [](bool* callback_done, uint64_t* num_items, uint64_t size) { - *callback_done = true; - *num_items = size; - }, - &callback_done, &num_items)); - base::RunLoop().RunUntilIdle(); - ASSERT_TRUE(callback_done); - EXPECT_EQ(num_items, 0U); -} - -} // namespace local_search_service -} // namespace chromeos
diff --git a/chromeos/components/local_search_service/local_search_service_sync_unittest.cc b/chromeos/components/local_search_service/local_search_service_sync_unittest.cc deleted file mode 100644 index e0749481..0000000 --- a/chromeos/components/local_search_service/local_search_service_sync_unittest.cc +++ /dev/null
@@ -1,46 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <map> -#include <set> -#include <sstream> -#include <string> -#include <utility> -#include <vector> - -#include "base/test/task_environment.h" -#include "chromeos/components/local_search_service/index_sync.h" -#include "chromeos/components/local_search_service/local_search_service_sync.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace chromeos { -namespace local_search_service { - -class LocalSearchServiceSyncTest : public testing::Test { - protected: - LocalSearchServiceSync service_; - base::test::TaskEnvironment task_environment_{ - base::test::TaskEnvironment::MainThreadType::DEFAULT, - base::test::TaskEnvironment::ThreadPoolExecutionMode::QUEUED}; -}; - -TEST_F(LocalSearchServiceSyncTest, GetLinearMapSearch) { - IndexSync* const index = service_.GetIndexSync( - IndexId::kCrosSettings, Backend::kLinearMap, nullptr /* local_state */); - CHECK(index); - - EXPECT_EQ(index->GetSizeSync(), 0u); -} - -TEST_F(LocalSearchServiceSyncTest, GetInvertedIndexSearch) { - IndexSync* const index = - service_.GetIndexSync(IndexId::kCrosSettings, Backend::kInvertedIndex, - nullptr /* local_state */); - CHECK(index); - - EXPECT_EQ(index->GetSizeSync(), 0u); -} - -} // namespace local_search_service -} // namespace chromeos
diff --git a/chromeos/components/local_search_service/public/mojom/BUILD.gn b/chromeos/components/local_search_service/public/mojom/BUILD.gn index 67f479b..8bc64fc 100644 --- a/chromeos/components/local_search_service/public/mojom/BUILD.gn +++ b/chromeos/components/local_search_service/public/mojom/BUILD.gn
@@ -8,7 +8,6 @@ sources = [ "index.mojom", "local_search_service.mojom", - "local_search_service_proxy.mojom", "types.mojom", ]
diff --git a/chromeos/components/local_search_service/public/mojom/local_search_service.mojom b/chromeos/components/local_search_service/public/mojom/local_search_service.mojom index 440afa24..7bbff72 100644 --- a/chromeos/components/local_search_service/public/mojom/local_search_service.mojom +++ b/chromeos/components/local_search_service/public/mojom/local_search_service.mojom
@@ -6,7 +6,17 @@ import "chromeos/components/local_search_service/public/mojom/index.mojom"; import "chromeos/components/local_search_service/public/mojom/types.mojom"; -import "chromeos/components/local_search_service/public/mojom/local_search_service_proxy.mojom"; + +enum IndexId { + kCrosSettings = 0, + kHelpApp = 1 + // Add new client IDs here. +}; + +enum Backend { + kLinearMap = 0, + kInvertedIndex = 1 +}; // Interface that helps to log daily search requests to UMA. interface SearchMetricsReporter {
diff --git a/chromeos/components/local_search_service/public/mojom/local_search_service_proxy.mojom b/chromeos/components/local_search_service/public/mojom/local_search_service_proxy.mojom deleted file mode 100644 index c2cfc3e..0000000 --- a/chromeos/components/local_search_service/public/mojom/local_search_service_proxy.mojom +++ /dev/null
@@ -1,59 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -module chromeos.local_search_service.mojom; - -import "chromeos/components/local_search_service/public/mojom/types.mojom"; -import "mojo/public/mojom/base/string16.mojom"; - -enum IndexId { - kCrosSettings = 0, - kHelpApp = 1 - // Add new client IDs here. -}; - -enum Backend { - kLinearMap = 0, - kInvertedIndex = 1 -}; - -// LocalSearchServiceSyncProxy creates and owns content-specific IndexProxies. -// Clients can call |GetIndex| to get an IndexSyncProxy for a given index id. -interface LocalSearchServiceSyncProxy { - // A client can call this function to bind an IndexSyncProxy for |index_id|. - // If the Index isn't created when this function is called, LocalSearchService - // will create one. - // Note, there should be one primary client that is the owner of the data and - // can read/write the data to the Index. The other clients should only use - // the Index for query search. - GetIndex(IndexId index_id, Backend backend, - pending_receiver<IndexSyncProxy> index_receiver); -}; - -// A proxy to a local search service Index. -// An Index has a registry of searchable data, which can be updated. It also -// runs a search function to find matching items for a given query. -// Each Index can serve multiple clients, but only one client (the primary -// client) that owns the data should be allowed to modify the Index. -interface IndexSyncProxy { - // Returns number of data items. - GetSize() => (uint64 num_items); - - // Adds or updates data and callbacks upon completion. - // Only the primary client should be allowed to do this operation. - AddOrUpdate(array<Data> data) => (); - - // Deletes data with |ids| and returns the number of items deleted. - // If an id doesn't exist in the Index, no operation will be done. - // Only the primary client should be allowed to do this operation. - Delete(array<string> ids) => (uint32 num_deleted); - - // Takes an asynchronous search request call and returns results and status - // code via a callback. |results| will be null if there is an error. - Find(mojo_base.mojom.String16 query, uint32 max_results) - => (ResponseStatus status, array<Result>? results); - - // Clears all data stored by the index. - ClearIndex() => (); -};
diff --git a/chromeos/components/local_search_service/public/mojom/types_mojom_traits.h b/chromeos/components/local_search_service/public/mojom/types_mojom_traits.h index 9eb9341..87b10e80 100644 --- a/chromeos/components/local_search_service/public/mojom/types_mojom_traits.h +++ b/chromeos/components/local_search_service/public/mojom/types_mojom_traits.h
@@ -6,7 +6,7 @@ #define CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_PUBLIC_MOJOM_TYPES_MOJOM_TRAITS_H_ #include "base/strings/string16.h" -#include "chromeos/components/local_search_service/public/mojom/local_search_service_proxy.mojom-shared.h" +#include "chromeos/components/local_search_service/public/mojom/local_search_service.mojom-shared.h" #include "chromeos/components/local_search_service/public/mojom/types.mojom-shared.h" #include "chromeos/components/local_search_service/shared_structs.h" #include "mojo/public/cpp/bindings/struct_traits.h"
diff --git a/chromeos/components/local_search_service/search_metrics_reporter_sync.cc b/chromeos/components/local_search_service/search_metrics_reporter_sync.cc deleted file mode 100644 index 5d41053..0000000 --- a/chromeos/components/local_search_service/search_metrics_reporter_sync.cc +++ /dev/null
@@ -1,134 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/components/local_search_service/search_metrics_reporter_sync.h" - -#include "base/check_op.h" -#include "base/metrics/histogram_functions.h" -#include "base/metrics/histogram_macros.h" -#include "chromeos/components/local_search_service/pref_names.h" -#include "components/prefs/pref_registry_simple.h" -#include "components/prefs/pref_service.h" - -namespace chromeos { -namespace local_search_service { -namespace { - -// Interval for asking metrics::DailyEvent to check whether a day has passed. -constexpr base::TimeDelta kCheckDailyEventInternal = - base::TimeDelta::FromMinutes(30); - -// Prefs corresponding to IndexId values. -constexpr std::array<const char*, SearchMetricsReporterSync::kNumberIndexIds> - kDailyCountPrefs = { - prefs::kLocalSearchServiceSyncMetricsCrosSettingsCount, - prefs::kLocalSearchServiceSyncMetricsHelpAppCount, -}; - -// Histograms corresponding to IndexId values. -constexpr std::array<const char*, SearchMetricsReporterSync::kNumberIndexIds> - kDailyCountHistograms = { - SearchMetricsReporterSync::kCrosSettingsName, - SearchMetricsReporterSync::kHelpAppName, -}; - -} // namespace - -constexpr char SearchMetricsReporterSync::kDailyEventIntervalName[]; -constexpr char SearchMetricsReporterSync::kCrosSettingsName[]; -constexpr char SearchMetricsReporterSync::kHelpAppName[]; - -constexpr int SearchMetricsReporterSync::kNumberIndexIds; - -// This class is needed since metrics::DailyEvent requires taking ownership -// of its observers. It just forwards events to SearchMetricsReporter. -class SearchMetricsReporterSync::DailyEventObserver - : public metrics::DailyEvent::Observer { - public: - explicit DailyEventObserver(SearchMetricsReporterSync* reporter) - : reporter_(reporter) { - DCHECK(reporter_); - } - - ~DailyEventObserver() override = default; - DailyEventObserver(const DailyEventObserver&) = delete; - DailyEventObserver& operator=(const DailyEventObserver&) = delete; - - // metrics::DailyEvent::Observer: - void OnDailyEvent(metrics::DailyEvent::IntervalType type) override { - reporter_->ReportDailyMetrics(type); - } - - private: - SearchMetricsReporterSync* reporter_; // Not owned. -}; - -// static: -void SearchMetricsReporterSync::RegisterLocalStatePrefs( - PrefRegistrySimple* registry) { - metrics::DailyEvent::RegisterPref( - registry, prefs::kLocalSearchServiceSyncMetricsDailySample); - for (const char* daily_count_pref : kDailyCountPrefs) { - registry->RegisterIntegerPref(daily_count_pref, 0); - } -} - -SearchMetricsReporterSync::SearchMetricsReporterSync( - PrefService* local_state_pref_service) - : pref_service_(local_state_pref_service), - daily_event_(std::make_unique<metrics::DailyEvent>( - pref_service_, - prefs::kLocalSearchServiceSyncMetricsDailySample, - kDailyEventIntervalName)) { - for (size_t i = 0; i < kDailyCountPrefs.size(); ++i) { - daily_counts_[i] = pref_service_->GetInteger(kDailyCountPrefs[i]); - } - - daily_event_->AddObserver(std::make_unique<DailyEventObserver>(this)); - daily_event_->CheckInterval(); - timer_.Start(FROM_HERE, kCheckDailyEventInternal, daily_event_.get(), - &metrics::DailyEvent::CheckInterval); -} - -SearchMetricsReporterSync::~SearchMetricsReporterSync() = default; - -void SearchMetricsReporterSync::SetIndexId(IndexId index_id) { - DCHECK(!index_id_); - index_id_ = index_id; - DCHECK_LT(static_cast<size_t>(index_id), kDailyCountPrefs.size()); -} - -void SearchMetricsReporterSync::OnSearchPerformed() { - DCHECK(index_id_); - const size_t index = static_cast<size_t>(*index_id_); - const char* daily_count_pref = kDailyCountPrefs[index]; - ++daily_counts_[index]; - pref_service_->SetInteger(daily_count_pref, daily_counts_[index]); -} - -void SearchMetricsReporterSync::ReportDailyMetricsForTesting( - metrics::DailyEvent::IntervalType type) { - ReportDailyMetrics(type); -} - -void SearchMetricsReporterSync::ReportDailyMetrics( - metrics::DailyEvent::IntervalType type) { - if (!index_id_) - return; - - // Don't send metrics on first run or if the clock is changed. - if (type == metrics::DailyEvent::IntervalType::DAY_ELAPSED) { - const size_t index = static_cast<size_t>(*index_id_); - base::UmaHistogramCounts1000(kDailyCountHistograms[index], - daily_counts_[index]); - } - - for (size_t i = 0; i < kDailyCountPrefs.size(); ++i) { - daily_counts_[i] = 0; - pref_service_->SetInteger(kDailyCountPrefs[i], 0); - } -} - -} // namespace local_search_service -} // namespace chromeos
diff --git a/chromeos/components/local_search_service/search_metrics_reporter_sync.h b/chromeos/components/local_search_service/search_metrics_reporter_sync.h deleted file mode 100644 index 76866343..0000000 --- a/chromeos/components/local_search_service/search_metrics_reporter_sync.h +++ /dev/null
@@ -1,87 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_SEARCH_METRICS_REPORTER_SYNC_H_ -#define CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_SEARCH_METRICS_REPORTER_SYNC_H_ - -#include <array> -#include <memory> -#include <string> - -#include "base/macros.h" -#include "base/optional.h" -#include "base/timer/timer.h" -#include "chromeos/components/local_search_service/shared_structs.h" -#include "components/metrics/daily_event.h" - -class PrefRegistrySimple; -class PrefService; - -namespace chromeos { -namespace local_search_service { - -// SearchMetricsReporter logs daily search requests to UMA. -class SearchMetricsReporterSync { - public: - static constexpr int kNumberIndexIds = - static_cast<int>(IndexId::kMaxValue) + 1; - - // A histogram recorded in UMA, showing reasons why daily metrics are - // reported. - static constexpr char kDailyEventIntervalName[] = - "LocalSearchService.MetricsDailyEventInterval"; - - // Histogram names of daily counts, one for each IndexId. - static constexpr char kCrosSettingsName[] = - "LocalSearchService.CrosSettings.DailySearch"; - static constexpr char kHelpAppName[] = - "LocalSearchService.HelpApp.DailySearch"; - - // Registers prefs used by SearchMetricsReporter in |registry|. - static void RegisterLocalStatePrefs(PrefRegistrySimple* registry); - - // RegisterLocalStatePrefs() must be called before instantiating this class. - explicit SearchMetricsReporterSync(PrefService* local_state_pref_service); - ~SearchMetricsReporterSync(); - - SearchMetricsReporterSync(const SearchMetricsReporterSync&) = delete; - SearchMetricsReporterSync& operator=(const SearchMetricsReporterSync&) = - delete; - - // Sets |index_id_|. - void SetIndexId(IndexId index_id); - - // Increments number of searches for |index_id_|. Should only - // be called after |SetIndexId| is called. - void OnSearchPerformed(); - - // Calls ReportDailyMetrics directly. - void ReportDailyMetricsForTesting(metrics::DailyEvent::IntervalType type); - - private: - class DailyEventObserver; - - // Called by DailyEventObserver whenever a day has elapsed according to - // |daily_event_|. - void ReportDailyMetrics(metrics::DailyEvent::IntervalType type); - - // Used as an index into |daily_counts_| for counting searches. - base::Optional<IndexId> index_id_; - - PrefService* pref_service_; // Not owned. - - std::unique_ptr<metrics::DailyEvent> daily_event_; - - // Instructs |daily_event_| to check if a day has passed. - base::RepeatingTimer timer_; - - // Daily count for each index id. Ordered by IndexId values. - // Initial values will be loaded from prefs service. - std::array<int, kNumberIndexIds> daily_counts_; -}; - -} // namespace local_search_service -} // namespace chromeos - -#endif // CHROMEOS_COMPONENTS_LOCAL_SEARCH_SERVICE_SEARCH_METRICS_REPORTER_SYNC_H_
diff --git a/chromeos/components/local_search_service/search_metrics_reporter_sync_unittest.cc b/chromeos/components/local_search_service/search_metrics_reporter_sync_unittest.cc deleted file mode 100644 index d9e4b498..0000000 --- a/chromeos/components/local_search_service/search_metrics_reporter_sync_unittest.cc +++ /dev/null
@@ -1,119 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chromeos/components/local_search_service/search_metrics_reporter_sync.h" - -#include <memory> - -#include "base/macros.h" -#include "base/test/metrics/histogram_tester.h" -#include "base/test/task_environment.h" -#include "chromeos/components/local_search_service/pref_names.h" -#include "chromeos/components/local_search_service/shared_structs.h" -#include "components/metrics/daily_event.h" -#include "components/prefs/testing_pref_service.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace chromeos { -namespace local_search_service { - -class SearchMetricsReporterSyncTest : public testing::Test { - public: - SearchMetricsReporterSyncTest() = default; - ~SearchMetricsReporterSyncTest() override = default; - - void SetUp() override { - SearchMetricsReporterSync::RegisterLocalStatePrefs( - pref_service_.registry()); - } - - void TearDown() override { reporter_.reset(); } - - protected: - void SetReporter(IndexId index_id) { - reporter_ = std::make_unique<SearchMetricsReporterSync>(&pref_service_); - reporter_->SetIndexId(index_id); - } - - // Notifies |reporter_| that a search is performed. - void SendOnSearchPerformed() { reporter_->OnSearchPerformed(); } - - // Instructs |reporter_| to report daily metrics for reason |type|. - void TriggerDailyEvent(metrics::DailyEvent::IntervalType type) { - reporter_->ReportDailyMetricsForTesting(type); - } - - // Instructs |reporter_| to report daily metrics due to the passage of a day - // and verifies that it reports one sample with each of the passed values. - void TriggerDailyEventAndVerifyHistograms(const std::string& histogram_name, - int expected_count) { - base::HistogramTester histogram_tester; - - TriggerDailyEvent(metrics::DailyEvent::IntervalType::DAY_ELAPSED); - histogram_tester.ExpectUniqueSample(histogram_name, expected_count, 1); - } - - base::test::TaskEnvironment task_environment_; - TestingPrefServiceSimple pref_service_; - std::unique_ptr<SearchMetricsReporterSync> reporter_; -}; - -TEST_F(SearchMetricsReporterSyncTest, CountAndReportEvents) { - SetReporter(IndexId::kCrosSettings); - SendOnSearchPerformed(); - SendOnSearchPerformed(); - SendOnSearchPerformed(); - TriggerDailyEventAndVerifyHistograms( - SearchMetricsReporterSync::kCrosSettingsName, 3); - - // The next day, another two searches. - SendOnSearchPerformed(); - SendOnSearchPerformed(); - TriggerDailyEventAndVerifyHistograms( - SearchMetricsReporterSync::kCrosSettingsName, 2); -} - -TEST_F(SearchMetricsReporterSyncTest, LoadInitialCountsFromPrefs) { - // Create a new reporter and check that it loads its initial event counts from - // prefs. - pref_service_.SetInteger( - prefs::kLocalSearchServiceSyncMetricsCrosSettingsCount, 2); - SetReporter(IndexId::kCrosSettings); - - TriggerDailyEventAndVerifyHistograms( - SearchMetricsReporterSync::kCrosSettingsName, 2); - - // The previous report should've cleared the prefs, so a new reporter should - // start out at zero. - TriggerDailyEventAndVerifyHistograms( - SearchMetricsReporterSync::kCrosSettingsName, 0); -} - -TEST_F(SearchMetricsReporterSyncTest, IgnoreDailyEventFirstRun) { - SetReporter(IndexId::kCrosSettings); - // metrics::DailyEvent notifies observers immediately on first run. Histograms - // shouldn't be sent in this case. - base::HistogramTester tester; - TriggerDailyEvent(metrics::DailyEvent::IntervalType::FIRST_RUN); - tester.ExpectTotalCount(SearchMetricsReporterSync::kCrosSettingsName, 0); -} - -TEST_F(SearchMetricsReporterSyncTest, IgnoreDailyEventClockChanged) { - SetReporter(IndexId::kCrosSettings); - SendOnSearchPerformed(); - - // metrics::DailyEvent notifies observers if it sees that the system clock has - // jumped back. Histograms shouldn't be sent in this case. - base::HistogramTester tester; - TriggerDailyEvent(metrics::DailyEvent::IntervalType::CLOCK_CHANGED); - tester.ExpectTotalCount(SearchMetricsReporterSync::kCrosSettingsName, 0); - - // The existing stats should be cleared when the clock change notification is - // received, so the next report should only contain zeros. - TriggerDailyEventAndVerifyHistograms( - SearchMetricsReporterSync::kCrosSettingsName, 0); -} - -} // namespace local_search_service -} // namespace chromeos
diff --git a/chromeos/services/assistant/BUILD.gn b/chromeos/services/assistant/BUILD.gn index 680d850..7334fd360 100644 --- a/chromeos/services/assistant/BUILD.gn +++ b/chromeos/services/assistant/BUILD.gn
@@ -124,6 +124,7 @@ "//chromeos/resources", "//chromeos/services/assistant/proxy", "//chromeos/services/assistant/public/cpp/migration", + "//chromeos/services/assistant/public/cpp/migration", "//chromeos/services/libassistant", "//chromeos/services/network_config/public/mojom", "//chromeos/strings", @@ -234,10 +235,6 @@ "//testing/gmock", "//testing/gtest", ] - - if (enable_cros_libassistant) { - deps += [ "//chromeos/services/assistant/public/cpp/migration" ] - } } buildflag_header("buildflags") {
diff --git a/chromeos/services/assistant/assistant_manager_service_impl_unittest.cc b/chromeos/services/assistant/assistant_manager_service_impl_unittest.cc index 13d4b23d..a95b9b3b 100644 --- a/chromeos/services/assistant/assistant_manager_service_impl_unittest.cc +++ b/chromeos/services/assistant/assistant_manager_service_impl_unittest.cc
@@ -196,13 +196,6 @@ } void Stop() override { service_->Unbind(); } - void SetInitializeCallback( - base::OnceCallback<void(assistant_client::AssistantManager*, - assistant_client::AssistantManagerInternal*)> - callback) override { - service_->service_controller().SetInitializeCallback(std::move(callback)); - } - private: FakeLibassistantService* service_; };
diff --git a/chromeos/services/assistant/libassistant_service_host_impl.cc b/chromeos/services/assistant/libassistant_service_host_impl.cc index 3d443b9d..68a2d4d 100644 --- a/chromeos/services/assistant/libassistant_service_host_impl.cc +++ b/chromeos/services/assistant/libassistant_service_host_impl.cc
@@ -32,13 +32,5 @@ libassistant_service_ = nullptr; } -void LibassistantServiceHostImpl::SetInitializeCallback( - base::OnceCallback<void(assistant_client::AssistantManager*, - assistant_client::AssistantManagerInternal*)> - callback) { - DCHECK_NE(libassistant_service_, nullptr); - libassistant_service_->SetInitializeCallback(std::move(callback)); -} - } // namespace assistant } // namespace chromeos
diff --git a/chromeos/services/assistant/libassistant_service_host_impl.h b/chromeos/services/assistant/libassistant_service_host_impl.h index 3d3e4a5..eb115ff1 100644 --- a/chromeos/services/assistant/libassistant_service_host_impl.h +++ b/chromeos/services/assistant/libassistant_service_host_impl.h
@@ -14,12 +14,6 @@ } // namespace assistant_client namespace chromeos { -namespace libassistant { -class LibassistantService; -} // namespace libassistant -} // namespace chromeos - -namespace chromeos { namespace assistant { class AssistantManagerServiceDelegate; @@ -36,10 +30,6 @@ void Launch( mojo::PendingReceiver<LibassistantServiceMojom> receiver) override; void Stop() override; - void SetInitializeCallback( - base::OnceCallback<void(assistant_client::AssistantManager*, - assistant_client::AssistantManagerInternal*)>) - override; private: // Owned by |AssistantManagerServiceImpl| which also owns |this|. @@ -47,8 +37,7 @@ // Owned by |AssistantManagerServiceImpl| which also owns |this|. AssistantManagerServiceDelegate* const delegate_; - std::unique_ptr<chromeos::libassistant::LibassistantService> - libassistant_service_; + std::unique_ptr<LibassistantServiceMojom> libassistant_service_; }; } // namespace assistant
diff --git a/chromeos/services/assistant/proxy/assistant_proxy.cc b/chromeos/services/assistant/proxy/assistant_proxy.cc index 6cee87f..a3feb582 100644 --- a/chromeos/services/assistant/proxy/assistant_proxy.cc +++ b/chromeos/services/assistant/proxy/assistant_proxy.cc
@@ -28,8 +28,8 @@ libassistant_service_host_ = host; LaunchLibassistantService(); - service_controller_proxy_ = - std::make_unique<ServiceControllerProxy>(host, BindServiceController()); + service_controller_proxy_ = std::make_unique<ServiceControllerProxy>( + background_task_runner(), BindServiceController()); } void AssistantProxy::LaunchLibassistantService() {
diff --git a/chromeos/services/assistant/proxy/libassistant_service_host.h b/chromeos/services/assistant/proxy/libassistant_service_host.h index 6191d37d..7097cff5 100644 --- a/chromeos/services/assistant/proxy/libassistant_service_host.h +++ b/chromeos/services/assistant/proxy/libassistant_service_host.h
@@ -9,11 +9,6 @@ #include "mojo/public/cpp/bindings/pending_receiver.h" -namespace assistant_client { -class AssistantManager; -class AssistantManagerInternal; -} // namespace assistant_client - namespace chromeos { namespace libassistant { namespace mojom { @@ -41,18 +36,9 @@ // |Stop| is called. virtual void Launch( mojo::PendingReceiver<LibassistantServiceMojom> receiver) = 0; - // Stop the mojom service. - virtual void Stop() = 0; - // Set a callback to initialize |AssistantManager| and - // |AssistantManagerInternal|. This callback will be invoked before - // AssistantManager::Start() is called. This is temporary until we've migrated - // all initialization code to the mojom service. - virtual void SetInitializeCallback( - base::OnceCallback< - void(assistant_client::AssistantManager*, - assistant_client::AssistantManagerInternal*)>) = 0; + virtual void Stop() = 0; }; } // namespace assistant
diff --git a/chromeos/services/assistant/proxy/service_controller_proxy.cc b/chromeos/services/assistant/proxy/service_controller_proxy.cc index 8390fc7..0dc1660 100644 --- a/chromeos/services/assistant/proxy/service_controller_proxy.cc +++ b/chromeos/services/assistant/proxy/service_controller_proxy.cc
@@ -11,7 +11,6 @@ #include "chromeos/assistant/internal/cros_display_connection.h" #include "chromeos/assistant/internal/internal_util.h" #include "chromeos/constants/chromeos_features.h" -#include "chromeos/services/assistant/proxy/libassistant_service_host.h" #include "chromeos/services/assistant/public/cpp/features.h" #include "chromeos/services/assistant/public/cpp/migration/assistant_manager_service_delegate.h" #include "chromeos/services/assistant/public/cpp/migration/libassistant_v1_api.h" @@ -37,25 +36,6 @@ constexpr char kServersideOpenAppExperimentId[] = "39651593"; constexpr char kServersideResponseProcessingV2ExperimentId[] = "1793869"; -struct StartArguments { - StartArguments() = default; - StartArguments(StartArguments&&) = default; - StartArguments& operator=(StartArguments&&) = default; - ~StartArguments() = default; - - assistant_client::ActionModule* action_module; - assistant_client::FuchsiaApiDelegate* fuchsia_api_delegate; - assistant_client::AssistantManagerDelegate* assistant_manager_delegate; - assistant_client::ConversationStateListener* conversation_state_listener; - assistant_client::DeviceStateListener* device_state_listener; - CrosDisplayConnection* display_connection; - std::string libassistant_config; - std::string locale; - std::string locale_override; - bool spoken_feedback_enabled; - ServiceControllerProxy::AuthTokens auth_tokens; -}; - void FillServerExperimentIds(std::vector<std::string>* server_experiment_ids) { if (base::FeatureList::IsEnabled(kChromeOSAssistantDogfood)) { server_experiment_ids->emplace_back(kServersideDogfoodExperimentId); @@ -78,59 +58,17 @@ } } -void SetInternalOptions( - assistant_client::AssistantManagerInternal* assistant_manager_internal, - const std::string& locale, - bool spoken_feedback_enabled) { - auto* internal_options = - assistant_manager_internal->CreateDefaultInternalOptions(); - SetAssistantOptions(internal_options, locale, spoken_feedback_enabled); - - internal_options->SetClientControlEnabled( - assistant::features::IsRoutinesEnabled()); - - if (!features::IsVoiceMatchDisabled()) - internal_options->EnableRequireVoiceMatchVerification(); - - assistant_manager_internal->SetOptions(*internal_options, [](bool success) { - DVLOG(2) << "set options: " << success; - }); -} - -// TODO(b/171748795): This should all be migrated to the mojom service, which -// should be responsible for the complete creation of the Libassistant -// objects. -// Note: this method will be called from the mojom (background) thread. -void InitializeAssistantManager( - StartArguments arguments, - assistant_client::AssistantManager* assistant_manager, - assistant_client::AssistantManagerInternal* assistant_manager_internal) { - SetInternalOptions(assistant_manager_internal, arguments.locale, - arguments.spoken_feedback_enabled); - assistant_manager_internal->SetDisplayConnection( - arguments.display_connection); - assistant_manager_internal->SetLocaleOverride(arguments.locale_override); - assistant_manager_internal->RegisterActionModule(arguments.action_module); - assistant_manager_internal->SetAssistantManagerDelegate( - arguments.assistant_manager_delegate); - assistant_manager_internal->GetFuchsiaApiHelperOrDie()->SetFuchsiaApiDelegate( - arguments.fuchsia_api_delegate); - assistant_manager->AddConversationStateListener( - arguments.conversation_state_listener); - assistant_manager->AddDeviceStateListener(arguments.device_state_listener); - SetServerExperiments(assistant_manager_internal); - assistant_manager->SetAuthTokens(arguments.auth_tokens); -} - } // namespace ServiceControllerProxy::ServiceControllerProxy( - LibassistantServiceHost* host, + scoped_refptr<base::SingleThreadTaskRunner> background_task_runner, mojo::PendingRemote<chromeos::libassistant::mojom::ServiceController> client) - : host_(host), + : background_task_runner_(std::move(background_task_runner)), service_controller_remote_(std::move(client)), state_observer_receiver_(this) { + DCHECK(background_task_runner_); + service_controller_remote_->AddAndFireStateObserver( state_observer_receiver_.BindNewPipeAndPassRemote()); } @@ -154,31 +92,24 @@ DCHECK_EQ(state_, State::kStopped); state_ = State::kStarting; - pending_display_connection_ = std::make_unique<CrosDisplayConnection>( - event_observer, /*feedback_ui_enabled=*/true, - assistant::features::IsMediaSessionIntegrationEnabled()); - // The mojom service will create the |AssistantManager|. service_controller_remote_->Start(libassistant_config); - // We need to initialize the |AssistantManager| once it's created and before - // it's started, so we register a callback to do just that. + // We need to finalize (and start) the |AssistantManager| once it's created, + // so we have to store all the required arguments for that. StartArguments arguments; arguments.action_module = action_module; arguments.fuchsia_api_delegate = fuchsia_api_delegate; arguments.assistant_manager_delegate = assistant_manager_delegate; arguments.conversation_state_listener = conversation_state_listener; arguments.device_state_listener = device_state_listener; - arguments.display_connection = pending_display_connection_.get(); + arguments.event_observer = event_observer; arguments.locale = locale; arguments.locale_override = locale_override; arguments.spoken_feedback_enabled = spoken_feedback_enabled; arguments.auth_tokens = auth_tokens; - - host_->SetInitializeCallback( - base::BindOnce(InitializeAssistantManager, std::move(arguments))); - - on_start_done_callback_ = std::move(done_callback); + arguments.done_callback = std::move(done_callback); + pending_start_argument_ = std::move(arguments); } void ServiceControllerProxy::Stop() { @@ -195,8 +126,21 @@ void ServiceControllerProxy::UpdateInternalOptions( const std::string& locale, bool spoken_feedback_enabled) { - SetInternalOptions(assistant_manager_internal(), locale, - spoken_feedback_enabled); + // NOTE: this method is called on multiple threads, it needs to be + // thread-safe. + auto* internal_options = + assistant_manager_internal()->CreateDefaultInternalOptions(); + SetAssistantOptions(internal_options, locale, spoken_feedback_enabled); + + internal_options->SetClientControlEnabled( + assistant::features::IsRoutinesEnabled()); + + if (!features::IsVoiceMatchDisabled()) + internal_options->EnableRequireVoiceMatchVerification(); + + assistant_manager_internal()->SetOptions(*internal_options, [](bool success) { + DVLOG(2) << "set options: " << success; + }); } void ServiceControllerProxy::SetAuthTokens(const AuthTokens& tokens) { @@ -237,13 +181,45 @@ } void ServiceControllerProxy::FinishCreatingAssistant() { - DCHECK(on_start_done_callback_.has_value()); - DCHECK_NE(pending_display_connection_, nullptr); + // TODO(b/171748795): This should all be migrated to the mojom service, which + // should be responsible for the complete creation of the Libassistant + // objects. + DCHECK(pending_start_argument_.has_value()); + + auto arguments = std::move(pending_start_argument_.value()); + + display_connection_ = std::make_unique<CrosDisplayConnection>( + arguments.event_observer, /*feedback_ui_enabled=*/true, + assistant::features::IsMediaSessionIntegrationEnabled()); + + UpdateInternalOptions(arguments.locale, arguments.spoken_feedback_enabled); + + assistant_manager_internal()->SetDisplayConnection(display_connection()); + assistant_manager_internal()->SetLocaleOverride(arguments.locale_override); + assistant_manager_internal()->RegisterActionModule(arguments.action_module); + assistant_manager_internal()->SetAssistantManagerDelegate( + arguments.assistant_manager_delegate); + assistant_manager_internal() + ->GetFuchsiaApiHelperOrDie() + ->SetFuchsiaApiDelegate(arguments.fuchsia_api_delegate); + assistant_manager()->AddConversationStateListener( + arguments.conversation_state_listener); + assistant_manager()->AddDeviceStateListener(arguments.device_state_listener); + SetServerExperiments(assistant_manager_internal()); + SetAuthTokens(arguments.auth_tokens); + + assistant_manager()->Start(); state_ = State::kStarted; - display_connection_ = std::move(pending_display_connection_); - std::move(on_start_done_callback_.value()).Run(); + std::move(arguments.done_callback).Run(); } +ServiceControllerProxy::StartArguments::StartArguments() = default; +ServiceControllerProxy::StartArguments::StartArguments(StartArguments&&) = + default; +ServiceControllerProxy::StartArguments& +ServiceControllerProxy::StartArguments::operator=(StartArguments&&) = default; +ServiceControllerProxy::StartArguments::~StartArguments() = default; + } // namespace assistant } // namespace chromeos
diff --git a/chromeos/services/assistant/proxy/service_controller_proxy.h b/chromeos/services/assistant/proxy/service_controller_proxy.h index 83a1a2b..d98f1a1 100644 --- a/chromeos/services/assistant/proxy/service_controller_proxy.h +++ b/chromeos/services/assistant/proxy/service_controller_proxy.h
@@ -11,7 +11,9 @@ #include <vector> #include "base/check.h" +#include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" +#include "base/single_thread_task_runner.h" #include "chromeos/services/libassistant/public/mojom/service_controller.mojom.h" #include "mojo/public/cpp/bindings/remote.h" @@ -32,7 +34,6 @@ class AssistantEventObserver; class CrosDisplayConnection; -class LibassistantServiceHost; // Component managing the lifecycle of Libassistant, // exposing methods to start/stop and configure Libassistant. @@ -42,7 +43,7 @@ using AuthTokens = std::vector<std::pair<std::string, std::string>>; ServiceControllerProxy( - LibassistantServiceHost* host, + scoped_refptr<base::SingleThreadTaskRunner> background_task_runner, mojo::PendingRemote<chromeos::libassistant::mojom::ServiceController> client); @@ -51,6 +52,8 @@ ~ServiceControllerProxy() override; // Can not be invoked before Start() has finished. + // Both LibAssistant and Chrome threads may access |display_connection|. + // |display_connection| is thread safe. CrosDisplayConnection* display_connection() { DCHECK(display_connection_); return display_connection_.get(); @@ -109,6 +112,25 @@ // Can not be invoked before Start() has finished. assistant_client::AssistantManagerInternal* assistant_manager_internal(); + struct StartArguments { + StartArguments(); + StartArguments(StartArguments&&); + StartArguments& operator=(StartArguments&&); + ~StartArguments(); + assistant_client::ActionModule* action_module; + assistant_client::FuchsiaApiDelegate* fuchsia_api_delegate; + assistant_client::AssistantManagerDelegate* assistant_manager_delegate; + assistant_client::ConversationStateListener* conversation_state_listener; + assistant_client::DeviceStateListener* device_state_listener; + AssistantEventObserver* event_observer; + std::string libassistant_config; + std::string locale; + std::string locale_override; + bool spoken_feedback_enabled; + AuthTokens auth_tokens; + base::OnceClosure done_callback; + }; + void FinishCreatingAssistant(); // libassistant::mojom::StateObserver implementation: @@ -119,22 +141,20 @@ // Used internally for consistency checks. State state_ = State::kStopped; - // Owned by |AssistantManagerServiceImpl| which (indirectly) also owns us. - LibassistantServiceHost* const host_; + scoped_refptr<base::SingleThreadTaskRunner> background_task_runner_; mojo::Remote<chromeos::libassistant::mojom::ServiceController> service_controller_remote_; mojo::Receiver<chromeos::libassistant::mojom::StateObserver> state_observer_receiver_; - // Callback passed to Start(). Will be invoked once the Libassistant service - // has started. - base::Optional<base::OnceClosure> on_start_done_callback_; + // Arguments passed to the last Start() call. + // Used to finish starting Libassistant after the Libassistant mojom service + // signals it has created the required objects. + // Unset once we've finished starting. + base::Optional<StartArguments> pending_start_argument_; std::unique_ptr<CrosDisplayConnection> display_connection_; - // Populated when we're starting but not started yet, so after Start() has - // been called but before the mojom service signalled it has started. - std::unique_ptr<CrosDisplayConnection> pending_display_connection_; base::WeakPtrFactory<ServiceControllerProxy> weak_factory_{this}; };
diff --git a/chromeos/services/assistant/test_support/fake_service_controller.cc b/chromeos/services/assistant/test_support/fake_service_controller.cc index 235d54ba..6feaaff 100644 --- a/chromeos/services/assistant/test_support/fake_service_controller.cc +++ b/chromeos/services/assistant/test_support/fake_service_controller.cc
@@ -4,7 +4,6 @@ #include "chromeos/services/assistant/test_support/fake_service_controller.h" -#include "chromeos/services/assistant/public/cpp/migration/libassistant_v1_api.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos { @@ -36,10 +35,6 @@ state_observers_.Clear(); } -void FakeServiceController::SetInitializeCallback(InitializeCallback callback) { - initialize_callback_ = std::move(callback); -} - void FakeServiceController::BlockStartCalls() { // This lock will be release in |UnblockStartCalls|. start_mutex_.lock(); @@ -55,12 +50,6 @@ // Will block if |BlockStartCalls| was invoked. std::lock_guard<std::mutex> lock(start_mutex_); - if (initialize_callback_) { - std::move(initialize_callback_) - .Run(LibassistantV1Api::Get()->assistant_manager(), - LibassistantV1Api::Get()->assistant_manager_internal()); - } - SetState(State::kStarted); }
diff --git a/chromeos/services/assistant/test_support/fake_service_controller.h b/chromeos/services/assistant/test_support/fake_service_controller.h index 9dc561a..59f2bae 100644 --- a/chromeos/services/assistant/test_support/fake_service_controller.h +++ b/chromeos/services/assistant/test_support/fake_service_controller.h
@@ -12,11 +12,6 @@ #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote_set.h" -namespace assistant_client { -class AssistantManager; -class AssistantManagerInternal; -} // namespace assistant_client - namespace chromeos { namespace assistant { @@ -26,9 +21,6 @@ class FakeServiceController : public libassistant::mojom::ServiceController { public: using State = libassistant::mojom::ServiceState; - using InitializeCallback = - base::OnceCallback<void(assistant_client::AssistantManager*, - assistant_client::AssistantManagerInternal*)>; FakeServiceController(); FakeServiceController(FakeServiceController&) = delete; @@ -47,8 +39,6 @@ pending_receiver); void Unbind(); - void SetInitializeCallback(InitializeCallback callback); - // Call this to block any call to |Start|. The observers will not be invoked // as long as the start call is blocked. Unblock these calls using // |UnblockStartCalls|. This is not enabled by default, so unless you call @@ -71,8 +61,6 @@ // Config passed to LibAssistant when it was started. std::string libassistant_config_; - InitializeCallback initialize_callback_; - State state_ = State::kStopped; mojo::Receiver<libassistant::mojom::ServiceController> receiver_; mojo::RemoteSet<libassistant::mojom::StateObserver> state_observers_;
diff --git a/chromeos/services/libassistant/libassistant_service.cc b/chromeos/services/libassistant/libassistant_service.cc index 481fb6d..6bf0ea1 100644 --- a/chromeos/services/libassistant/libassistant_service.cc +++ b/chromeos/services/libassistant/libassistant_service.cc
@@ -29,9 +29,5 @@ service_controller_->Bind(std::move(receiver)); } -void LibassistantService::SetInitializeCallback(InitializeCallback callback) { - service_controller().SetInitializeCallback(std::move(callback)); -} - } // namespace libassistant } // namespace chromeos
diff --git a/chromeos/services/libassistant/libassistant_service.h b/chromeos/services/libassistant/libassistant_service.h index 38c5c05..fed2dfa 100644 --- a/chromeos/services/libassistant/libassistant_service.h +++ b/chromeos/services/libassistant/libassistant_service.h
@@ -12,8 +12,6 @@ #include "mojo/public/cpp/bindings/receiver.h" namespace assistant_client { -class AssistantManager; -class AssistantManagerInternal; class PlatformApi; } // namespace assistant_client @@ -31,10 +29,6 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) LibassistantService : public mojom::LibassistantService { public: - using InitializeCallback = - base::OnceCallback<void(assistant_client::AssistantManager*, - assistant_client::AssistantManagerInternal*)>; - explicit LibassistantService( mojo::PendingReceiver<mojom::LibassistantService> receiver, assistant_client::PlatformApi* platform_api, @@ -43,11 +37,7 @@ LibassistantService& operator=(LibassistantService&) = delete; ~LibassistantService() override; - void SetInitializeCallback(InitializeCallback callback); - private: - ServiceController& service_controller() { return *service_controller_; } - // mojom::LibassistantService implementation: void BindServiceController( mojo::PendingReceiver<mojom::ServiceController> receiver) override;
diff --git a/chromeos/services/libassistant/service_controller.cc b/chromeos/services/libassistant/service_controller.cc index 24a235e..68ceb36 100644 --- a/chromeos/services/libassistant/service_controller.cc +++ b/chromeos/services/libassistant/service_controller.cc
@@ -32,10 +32,6 @@ receiver_.Bind(std::move(receiver)); } -void ServiceController::SetInitializeCallback(InitializeCallback callback) { - initialize_callback_ = std::move(callback); -} - void ServiceController::Start(const std::string& libassistant_config) { if (state_ != ServiceState::kStopped) return; @@ -47,13 +43,6 @@ libassistant_v1_api_ = std::make_unique<assistant::LibassistantV1Api>( assistant_manager_.get(), assistant_manager_internal_); - if (initialize_callback_) { - std::move(initialize_callback_) - .Run(assistant_manager(), assistant_manager_internal()); - } - - assistant_manager()->Start(); - SetStateAndInformObservers(ServiceState::kStarted); for (auto& observer : assistant_manager_observers_) {
diff --git a/chromeos/services/libassistant/service_controller.h b/chromeos/services/libassistant/service_controller.h index c93bfba..26ffd61 100644 --- a/chromeos/services/libassistant/service_controller.h +++ b/chromeos/services/libassistant/service_controller.h
@@ -43,10 +43,6 @@ class COMPONENT_EXPORT(LIBASSISTANT_SERVICE) ServiceController : public mojom::ServiceController { public: - using InitializeCallback = - base::OnceCallback<void(assistant_client::AssistantManager*, - assistant_client::AssistantManagerInternal*)>; - ServiceController(assistant::AssistantManagerServiceDelegate* delegate, assistant_client::PlatformApi* platform_api); ServiceController(ServiceController&) = delete; @@ -55,12 +51,6 @@ void Bind(mojo::PendingReceiver<mojom::ServiceController> receiver); - // Set a callback to initialize |AssistantManager| and - // |AssistantManagerInternal|. This callback will be invoked before - // AssistantManager::Start() is called. This is temporary until we've migrated - // all initialization code to this class. - void SetInitializeCallback(InitializeCallback callback); - // mojom::ServiceController implementation: void Start(const std::string& libassistant_config) override; void Stop() override; @@ -87,9 +77,6 @@ // Owned by |AssistantManagerServiceImpl| which indirectly owns us. assistant_client::PlatformApi* const platform_api_; - // Callback called to initialize |AssistantManager| before it's started. - InitializeCallback initialize_callback_; - std::unique_ptr<assistant_client::AssistantManager> assistant_manager_; assistant_client::AssistantManagerInternal* assistant_manager_internal_ = nullptr;
diff --git a/components/federated_learning/BUILD.gn b/components/federated_learning/BUILD.gn index 4187df0..e47f5ed 100644 --- a/components/federated_learning/BUILD.gn +++ b/components/federated_learning/BUILD.gn
@@ -4,6 +4,8 @@ static_library("federated_learning") { sources = [ + "features/features.cc", + "features/features.h", "floc_constants.cc", "floc_constants.h", "floc_id.cc",
diff --git a/components/federated_learning/features/features.cc b/components/federated_learning/features/features.cc new file mode 100644 index 0000000..0ca6994f --- /dev/null +++ b/components/federated_learning/features/features.cc
@@ -0,0 +1,36 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/federated_learning/features/features.h" + +#include "base/feature_list.h" + +namespace federated_learning { + +// Enables or disables the FlocIdComputed event logging, which happens when a +// floc id is first computed for a browsing session or is refreshed due to a +// long period of time has passed since the last computation. +const base::Feature kFlocIdComputedEventLogging{ + "FlocIdComputedEventLogging", base::FEATURE_ENABLED_BY_DEFAULT}; + +// If enabled, the sim-hash floc computed from history will be further encoded +// based on the sorting-lsh. +const base::Feature kFlocIdSortingLshBasedComputation{ + "FlocIdSortingLshBasedComputation", base::FEATURE_DISABLED_BY_DEFAULT}; + +// The main floc feature for all the subsidiary control and setting params. It's +// controlling the floc update rate, and the minimum history domain size +// required. +// TODO(yaoxia): merge other floc features into this one. +const base::Feature kFederatedLearningOfCohorts{ + "FederatedLearningOfCohorts", base::FEATURE_ENABLED_BY_DEFAULT}; +constexpr base::FeatureParam<base::TimeDelta> kFlocIdScheduledUpdateInterval{ + &kFederatedLearningOfCohorts, "update_interval", + base::TimeDelta::FromDays(7)}; +constexpr base::FeatureParam<int> kFlocIdMinimumHistoryDomainSizeRequired{ + &kFederatedLearningOfCohorts, "minimum_history_domain_size_required", 3}; +constexpr base::FeatureParam<int> kFlocIdFinchConfigVersion{ + &kFederatedLearningOfCohorts, "finch_config_version", 1}; + +} // namespace federated_learning
diff --git a/components/federated_learning/features/features.h b/components/federated_learning/features/features.h new file mode 100644 index 0000000..3ceafe5 --- /dev/null +++ b/components/federated_learning/features/features.h
@@ -0,0 +1,23 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_FEDERATED_LEARNING_FEATURES_FEATURES_H_ +#define COMPONENTS_FEDERATED_LEARNING_FEATURES_FEATURES_H_ + +#include "base/feature_list.h" + +namespace federated_learning { + +extern const base::Feature kFlocIdComputedEventLogging; + +extern const base::Feature kFlocIdSortingLshBasedComputation; + +extern const base::Feature kFederatedLearningOfCohorts; +extern const base::FeatureParam<base::TimeDelta> kFlocIdScheduledUpdateInterval; +extern const base::FeatureParam<int> kFlocIdMinimumHistoryDomainSizeRequired; +extern const base::FeatureParam<int> kFlocIdFinchConfigVersion; + +} // namespace federated_learning + +#endif // COMPONENTS_FEDERATED_LEARNING_FEATURES_FEATURES_H_ \ No newline at end of file
diff --git a/components/federated_learning/floc_constants.cc b/components/federated_learning/floc_constants.cc index d3a37c9..2ea147bd 100644 --- a/components/federated_learning/floc_constants.cc +++ b/components/federated_learning/floc_constants.cc
@@ -19,16 +19,19 @@ const char kFlocIdValuePrefKey[] = "federated_learning.floc_id.value"; const char kFlocIdHistoryBeginTimePrefKey[] = - "federated_learning.floc_id_.history_begin_time"; + "federated_learning.floc_id.history_begin_time"; const char kFlocIdHistoryEndTimePrefKey[] = - "federated_learning.floc_id_.history_end_time"; + "federated_learning.floc_id.history_end_time"; + +const char kFlocIdFinchConfigVersionPrefKey[] = + "federated_learning.floc_id.finch_config_version"; const char kFlocIdSortingLshVersionPrefKey[] = - "federated_learning.floc_id_.sorting_lsh_version"; + "federated_learning.floc_id.sorting_lsh_version"; const char kFlocIdComputeTimePrefKey[] = - "federated_learning.floc_id_.compute_time"; + "federated_learning.floc_id.compute_time"; const char kManifestFlocComponentFormatKey[] = "floc_component_format";
diff --git a/components/federated_learning/floc_constants.h b/components/federated_learning/floc_constants.h index f5c50c7..69ad524 100644 --- a/components/federated_learning/floc_constants.h +++ b/components/federated_learning/floc_constants.h
@@ -17,6 +17,7 @@ extern const char kFlocIdValuePrefKey[]; extern const char kFlocIdHistoryBeginTimePrefKey[]; extern const char kFlocIdHistoryEndTimePrefKey[]; +extern const char kFlocIdFinchConfigVersionPrefKey[]; extern const char kFlocIdSortingLshVersionPrefKey[]; extern const char kFlocIdComputeTimePrefKey[]; extern const char kManifestFlocComponentFormatKey[];
diff --git a/components/federated_learning/floc_id.cc b/components/federated_learning/floc_id.cc index 6bb6376..549b955 100644 --- a/components/federated_learning/floc_id.cc +++ b/components/federated_learning/floc_id.cc
@@ -6,6 +6,7 @@ #include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" +#include "components/federated_learning/features/features.h" #include "components/federated_learning/floc_constants.h" #include "components/federated_learning/sim_hash.h" #include "components/prefs/pref_registry_simple.h" @@ -13,20 +14,15 @@ namespace federated_learning { -namespace { - -// Domain one-hot + sim hash + sorting-lsh (behind a feature flag) -const uint32_t kChromeFlocIdVersion = 1; - -} // namespace - // static uint64_t FlocId::SimHashHistory( const std::unordered_set<std::string>& domains) { return SimHashStrings(domains, kMaxNumberOfBitsInFloc); } -FlocId::FlocId() = default; +FlocId::FlocId() + : finch_config_version_(kFlocIdFinchConfigVersion.Get()), + compute_time_(base::Time::Now()) {} FlocId::FlocId(uint64_t id, base::Time history_begin_time, @@ -35,7 +31,9 @@ : id_(id), history_begin_time_(history_begin_time), history_end_time_(history_end_time), - sorting_lsh_version_(sorting_lsh_version) {} + finch_config_version_(kFlocIdFinchConfigVersion.Get()), + sorting_lsh_version_(sorting_lsh_version), + compute_time_(base::Time::Now()) {} FlocId::FlocId(const FlocId& id) = default; @@ -52,7 +50,9 @@ bool FlocId::operator==(const FlocId& other) const { return id_ == other.id_ && history_begin_time_ == other.history_begin_time_ && history_end_time_ == other.history_end_time_ && - sorting_lsh_version_ == other.sorting_lsh_version_; + finch_config_version_ == other.finch_config_version_ && + sorting_lsh_version_ == other.sorting_lsh_version_ && + compute_time_ == other.compute_time_; } bool FlocId::operator!=(const FlocId& other) const { @@ -62,8 +62,10 @@ std::string FlocId::ToStringForJsApi() const { DCHECK(id_.has_value()); + // TODO(yaoxia): consider returning the version part even when floc is + // invalid. return base::StrCat({base::NumberToString(id_.value()), ".", - base::NumberToString(kChromeFlocIdVersion), ".", + base::NumberToString(finch_config_version_), ".", base::NumberToString(sorting_lsh_version_)}); } @@ -72,6 +74,7 @@ registry->RegisterUint64Pref(kFlocIdValuePrefKey, 0); registry->RegisterTimePref(kFlocIdHistoryBeginTimePrefKey, base::Time()); registry->RegisterTimePref(kFlocIdHistoryEndTimePrefKey, base::Time()); + registry->RegisterUint64Pref(kFlocIdFinchConfigVersionPrefKey, 0); registry->RegisterUint64Pref(kFlocIdSortingLshVersionPrefKey, 0); registry->RegisterTimePref(kFlocIdComputeTimePrefKey, base::Time()); } @@ -79,35 +82,49 @@ void FlocId::SaveToPrefs(PrefService* prefs) { if (!id_.has_value()) { prefs->ClearPref(kFlocIdValuePrefKey); - return; + } else { + prefs->SetUint64(kFlocIdValuePrefKey, id_.value()); } - prefs->SetUint64(kFlocIdValuePrefKey, id_.value()); prefs->SetTime(kFlocIdHistoryBeginTimePrefKey, history_begin_time_); prefs->SetTime(kFlocIdHistoryEndTimePrefKey, history_end_time_); + prefs->SetUint64(kFlocIdFinchConfigVersionPrefKey, finch_config_version_); prefs->SetUint64(kFlocIdSortingLshVersionPrefKey, sorting_lsh_version_); + prefs->SetTime(kFlocIdComputeTimePrefKey, compute_time_); +} + +void FlocId::InvalidateIdAndSaveToPrefs(PrefService* prefs) { + id_.reset(); + prefs->ClearPref(kFlocIdValuePrefKey); } // static FlocId FlocId::ReadFromPrefs(PrefService* prefs) { - if (!prefs->HasPrefPath(kFlocIdValuePrefKey)) - return FlocId(); + base::Optional<uint64_t> id; + if (prefs->HasPrefPath(kFlocIdValuePrefKey)) + id = prefs->GetUint64(kFlocIdValuePrefKey); - return FlocId(prefs->GetUint64(kFlocIdValuePrefKey), - prefs->GetTime(kFlocIdHistoryBeginTimePrefKey), + return FlocId(id, prefs->GetTime(kFlocIdHistoryBeginTimePrefKey), prefs->GetTime(kFlocIdHistoryEndTimePrefKey), - prefs->GetUint64(kFlocIdSortingLshVersionPrefKey)); + prefs->GetUint64(kFlocIdFinchConfigVersionPrefKey), + prefs->GetUint64(kFlocIdSortingLshVersionPrefKey), + prefs->GetTime(kFlocIdComputeTimePrefKey)); } -// static -void FlocId::SaveComputeTimeToPrefs(base::Time compute_time, - PrefService* prefs) { - prefs->SetTime(kFlocIdComputeTimePrefKey, compute_time); -} - -// static -base::Time FlocId::ReadComputeTimeFromPrefs(PrefService* prefs) { - return prefs->GetTime(kFlocIdComputeTimePrefKey); +FlocId::FlocId(base::Optional<uint64_t> id, + base::Time history_begin_time, + base::Time history_end_time, + uint32_t finch_config_version, + uint32_t sorting_lsh_version, + base::Time compute_time) + : id_(id), + history_begin_time_(history_begin_time), + history_end_time_(history_end_time), + finch_config_version_(finch_config_version), + sorting_lsh_version_(sorting_lsh_version), + compute_time_(compute_time) { + // If the floc is never computed, the id should be invalid. + DCHECK(!compute_time.is_null() || !id.has_value()); } } // namespace federated_learning
diff --git a/components/federated_learning/floc_id.h b/components/federated_learning/floc_id.h index bf7e4ab..eea295a6 100644 --- a/components/federated_learning/floc_id.h +++ b/components/federated_learning/floc_id.h
@@ -28,8 +28,13 @@ static uint64_t SimHashHistory( const std::unordered_set<std::string>& domains); + // Create a newly computed but invalid floc (which implies permission errors, + // insufficient eligible history, or blocked floc). The + // |finch_config_version_| and the |compute_time_| will be set to the current. FlocId(); + // Create a newly computed and valid floc. The |finch_config_version_| and + // the |compute_time_| will be set to the current. explicit FlocId(uint64_t id, base::Time history_begin_time, base::Time history_end_time, @@ -43,27 +48,49 @@ bool operator==(const FlocId& other) const; bool operator!=(const FlocId& other) const; + // True if the |id_| is successfully computed and hasn't been invalidated + // since the last computation. Note that an invalid FlocId still often has a + // legitimate compute time and finch config version, unless it's read from a + // fresh profile prefs. bool IsValid() const; - // The id, followed by the chrome floc version, followed by the async floc - // component versions (i.e. model and sorting-lsh). This is the format to be - // exposed to the JS API. Precondition: |id_| must be valid. + // Dot-separated string of floc, finch config version, and sorting-lsh + // version. This is the format to be exposed to the JS API. Precondition: + // |id_| must be valid. std::string ToStringForJsApi() const; base::Time history_begin_time() const { return history_begin_time_; } base::Time history_end_time() const { return history_end_time_; } + uint32_t finch_config_version() const { return finch_config_version_; } + + uint32_t sorting_lsh_version() const { return sorting_lsh_version_; } + + base::Time compute_time() const { return compute_time_; } + static void RegisterPrefs(PrefRegistrySimple* registry); void SaveToPrefs(PrefService* prefs); static FlocId ReadFromPrefs(PrefService* prefs); - static void SaveComputeTimeToPrefs(base::Time compute_time, - PrefService* prefs); - static base::Time ReadComputeTimeFromPrefs(PrefService* prefs); + // Reset |id_| and clear the prefs corresponding to the id. This assumes the + // current floc is already in sync with the prefs and we don't need to save + // other unaffected field. + void InvalidateIdAndSaveToPrefs(PrefService* prefs); private: + friend class FlocIdTester; + + // Create a floc with stated params. This will only be used to create a floc + // read from prefs. + explicit FlocId(base::Optional<uint64_t> id, + base::Time history_begin_time, + base::Time history_end_time, + uint32_t finch_config_version, + uint32_t sorting_lsh_version, + base::Time compute_time); + base::Optional<uint64_t> id_; // The time range of the actual history used to compute the floc. This should @@ -71,8 +98,16 @@ base::Time history_begin_time_; base::Time history_end_time_; + // The kFlocIdFinchConfigVersion feature param. When floc is loaded from + // prefs, this could be different from the current feature param state. + uint32_t finch_config_version_ = 0; + // The main version (i.e. 1st int) of the sorting lsh component version. uint32_t sorting_lsh_version_ = 0; + + // The time when the floc was computed. compute_time_.is_null() means the + // floc has never been computed before, and implies |id_| is also invalid. + base::Time compute_time_; }; } // namespace federated_learning
diff --git a/components/federated_learning/floc_id_unittest.cc b/components/federated_learning/floc_id_unittest.cc index 8c61c08..27c4bca 100644 --- a/components/federated_learning/floc_id_unittest.cc +++ b/components/federated_learning/floc_id_unittest.cc
@@ -4,6 +4,9 @@ #include "components/federated_learning/floc_id.h" +#include "base/test/scoped_feature_list.h" +#include "base/test/task_environment.h" +#include "components/federated_learning/features/features.h" #include "components/federated_learning/floc_constants.h" #include "components/prefs/testing_pref_service.h" #include "testing/gtest/include/gtest/gtest.h" @@ -14,13 +17,24 @@ const base::Time kTime1 = base::Time::FromTimeT(1); const base::Time kTime2 = base::Time::FromTimeT(2); -TEST(FlocIdTest, IsValid) { +class FlocIdUnitTest : public testing::Test { + public: + FlocIdUnitTest() + : task_environment_(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} + + ~FlocIdUnitTest() override = default; + + protected: + base::test::SingleThreadTaskEnvironment task_environment_; +}; + +TEST_F(FlocIdUnitTest, IsValid) { EXPECT_FALSE(FlocId().IsValid()); EXPECT_TRUE(FlocId(0, kTime0, kTime0, 0).IsValid()); EXPECT_TRUE(FlocId(0, kTime1, kTime2, 1).IsValid()); } -TEST(FlocIdTest, Comparison) { +TEST_F(FlocIdUnitTest, Comparison) { EXPECT_EQ(FlocId(), FlocId()); EXPECT_EQ(FlocId(0, kTime0, kTime0, 0), FlocId(0, kTime0, kTime0, 0)); @@ -33,59 +47,76 @@ EXPECT_NE(FlocId(0, kTime0, kTime0, 0), FlocId(0, kTime0, kTime0, 1)); } -TEST(FlocIdTest, ToStringForJsApi) { +TEST_F(FlocIdUnitTest, ToStringForJsApi) { EXPECT_EQ("0.1.0", FlocId(0, kTime0, kTime0, 0).ToStringForJsApi()); EXPECT_EQ("12345.1.0", FlocId(12345, kTime0, kTime0, 0).ToStringForJsApi()); EXPECT_EQ("12345.1.2", FlocId(12345, kTime1, kTime1, 2).ToStringForJsApi()); + + base::test::ScopedFeatureList feature_list; + feature_list.InitAndEnableFeatureWithParameters( + kFederatedLearningOfCohorts, {{"finch_config_version", "99"}}); + + EXPECT_EQ("0.99.0", FlocId(0, kTime0, kTime0, 0).ToStringForJsApi()); + EXPECT_EQ("12345.99.0", FlocId(12345, kTime0, kTime0, 0).ToStringForJsApi()); + EXPECT_EQ("12345.99.2", FlocId(12345, kTime1, kTime1, 2).ToStringForJsApi()); } -TEST(FlocIdTest, ReadFromPrefs_DefaultInvalid) { +TEST_F(FlocIdUnitTest, ReadFromPrefs_DefaultInvalid) { TestingPrefServiceSimple prefs; FlocId::RegisterPrefs(prefs.registry()); FlocId floc_id = FlocId::ReadFromPrefs(&prefs); - EXPECT_FALSE(floc_id.IsValid()); - base::Time compute_time = FlocId::ReadComputeTimeFromPrefs(&prefs); - EXPECT_TRUE(compute_time.is_null()); + EXPECT_FALSE(floc_id.IsValid()); + EXPECT_TRUE(floc_id.history_begin_time().is_null()); + EXPECT_TRUE(floc_id.history_end_time().is_null()); + EXPECT_EQ(0u, floc_id.finch_config_version()); + EXPECT_EQ(0u, floc_id.sorting_lsh_version()); + EXPECT_TRUE(floc_id.compute_time().is_null()); } -TEST(FlocIdTest, ReadFromPrefs_SavedInvalid) { +TEST_F(FlocIdUnitTest, ReadFromPrefs_SavedInvalid) { TestingPrefServiceSimple prefs; FlocId::RegisterPrefs(prefs.registry()); prefs.ClearPref(kFlocIdValuePrefKey); prefs.SetTime(kFlocIdHistoryBeginTimePrefKey, base::Time::FromTimeT(1)); prefs.SetTime(kFlocIdHistoryEndTimePrefKey, base::Time::FromTimeT(2)); - prefs.SetUint64(kFlocIdSortingLshVersionPrefKey, 2); + prefs.SetUint64(kFlocIdFinchConfigVersionPrefKey, 3); + prefs.SetUint64(kFlocIdSortingLshVersionPrefKey, 4); + prefs.SetTime(kFlocIdComputeTimePrefKey, base::Time::FromTimeT(5)); FlocId floc_id = FlocId::ReadFromPrefs(&prefs); EXPECT_FALSE(floc_id.IsValid()); - - prefs.SetTime(kFlocIdComputeTimePrefKey, base::Time()); - base::Time compute_time = FlocId::ReadComputeTimeFromPrefs(&prefs); - EXPECT_TRUE(compute_time.is_null()); + EXPECT_EQ(base::Time::FromTimeT(1), floc_id.history_begin_time()); + EXPECT_EQ(base::Time::FromTimeT(2), floc_id.history_end_time()); + EXPECT_EQ(3u, floc_id.finch_config_version()); + EXPECT_EQ(4u, floc_id.sorting_lsh_version()); + EXPECT_EQ(base::Time::FromTimeT(5), floc_id.compute_time()); } -TEST(FlocIdTest, ReadFromPrefs_SavedValid) { +TEST_F(FlocIdUnitTest, ReadFromPrefs_SavedValid) { TestingPrefServiceSimple prefs; FlocId::RegisterPrefs(prefs.registry()); prefs.SetUint64(kFlocIdValuePrefKey, 123); prefs.SetTime(kFlocIdHistoryBeginTimePrefKey, base::Time::FromTimeT(1)); prefs.SetTime(kFlocIdHistoryEndTimePrefKey, base::Time::FromTimeT(2)); - prefs.SetUint64(kFlocIdSortingLshVersionPrefKey, 2); + prefs.SetUint64(kFlocIdFinchConfigVersionPrefKey, 3); + prefs.SetUint64(kFlocIdSortingLshVersionPrefKey, 4); + prefs.SetTime(kFlocIdComputeTimePrefKey, base::Time::FromTimeT(5)); FlocId floc_id = FlocId::ReadFromPrefs(&prefs); - EXPECT_EQ(floc_id, - FlocId(123, base::Time::FromTimeT(1), base::Time::FromTimeT(2), 2)); - - prefs.SetTime(kFlocIdComputeTimePrefKey, base::Time::FromTimeT(3)); - base::Time compute_time = FlocId::ReadComputeTimeFromPrefs(&prefs); - EXPECT_EQ(compute_time, base::Time::FromTimeT(3)); + EXPECT_TRUE(floc_id.IsValid()); + EXPECT_EQ(base::Time::FromTimeT(1), floc_id.history_begin_time()); + EXPECT_EQ(base::Time::FromTimeT(2), floc_id.history_end_time()); + EXPECT_EQ(3u, floc_id.finch_config_version()); + EXPECT_EQ(4u, floc_id.sorting_lsh_version()); + EXPECT_EQ(base::Time::FromTimeT(5), floc_id.compute_time()); + EXPECT_EQ("123.3.4", floc_id.ToStringForJsApi()); } -TEST(FlocIdTest, SaveToPrefs_InvalidFloc) { +TEST_F(FlocIdUnitTest, SaveToPrefs_InvalidFloc) { TestingPrefServiceSimple prefs; FlocId::RegisterPrefs(prefs.registry()); @@ -93,41 +124,64 @@ floc_id.SaveToPrefs(&prefs); EXPECT_FALSE(prefs.HasPrefPath(kFlocIdValuePrefKey)); - EXPECT_FALSE(prefs.HasPrefPath(kFlocIdHistoryBeginTimePrefKey)); - EXPECT_FALSE(prefs.HasPrefPath(kFlocIdHistoryEndTimePrefKey)); - EXPECT_FALSE(prefs.HasPrefPath(kFlocIdSortingLshVersionPrefKey)); + EXPECT_TRUE(prefs.HasPrefPath(kFlocIdHistoryBeginTimePrefKey)); + EXPECT_TRUE(prefs.HasPrefPath(kFlocIdHistoryEndTimePrefKey)); + EXPECT_TRUE(prefs.HasPrefPath(kFlocIdFinchConfigVersionPrefKey)); + EXPECT_TRUE(prefs.HasPrefPath(kFlocIdSortingLshVersionPrefKey)); + EXPECT_TRUE(prefs.HasPrefPath(kFlocIdComputeTimePrefKey)); EXPECT_EQ(0u, prefs.GetUint64(kFlocIdValuePrefKey)); EXPECT_TRUE(prefs.GetTime(kFlocIdHistoryBeginTimePrefKey).is_null()); EXPECT_TRUE(prefs.GetTime(kFlocIdHistoryEndTimePrefKey).is_null()); + EXPECT_EQ(1u, prefs.GetUint64(kFlocIdFinchConfigVersionPrefKey)); EXPECT_EQ(0u, prefs.GetUint64(kFlocIdSortingLshVersionPrefKey)); - - FlocId::SaveComputeTimeToPrefs(base::Time(), &prefs); - EXPECT_TRUE(prefs.GetTime(kFlocIdComputeTimePrefKey).is_null()); + EXPECT_EQ(base::Time::Now(), prefs.GetTime(kFlocIdComputeTimePrefKey)); } -TEST(FlocIdTest, SaveToPrefs_ValidFloc) { +TEST_F(FlocIdUnitTest, SaveToPrefs_ValidFloc) { TestingPrefServiceSimple prefs; FlocId::RegisterPrefs(prefs.registry()); FlocId floc_id = - FlocId(123, base::Time::FromTimeT(1), base::Time::FromTimeT(2), 2); + FlocId(123, base::Time::FromTimeT(1), base::Time::FromTimeT(2), 3); floc_id.SaveToPrefs(&prefs); EXPECT_TRUE(prefs.HasPrefPath(kFlocIdValuePrefKey)); EXPECT_TRUE(prefs.HasPrefPath(kFlocIdHistoryBeginTimePrefKey)); EXPECT_TRUE(prefs.HasPrefPath(kFlocIdHistoryEndTimePrefKey)); + EXPECT_TRUE(prefs.HasPrefPath(kFlocIdFinchConfigVersionPrefKey)); EXPECT_TRUE(prefs.HasPrefPath(kFlocIdSortingLshVersionPrefKey)); + EXPECT_TRUE(prefs.HasPrefPath(kFlocIdComputeTimePrefKey)); EXPECT_EQ(123u, prefs.GetUint64(kFlocIdValuePrefKey)); EXPECT_EQ(base::Time::FromTimeT(1), prefs.GetTime(kFlocIdHistoryBeginTimePrefKey)); EXPECT_EQ(base::Time::FromTimeT(2), prefs.GetTime(kFlocIdHistoryEndTimePrefKey)); - EXPECT_EQ(2u, prefs.GetUint64(kFlocIdSortingLshVersionPrefKey)); + EXPECT_EQ(1u, prefs.GetUint64(kFlocIdFinchConfigVersionPrefKey)); + EXPECT_EQ(3u, prefs.GetUint64(kFlocIdSortingLshVersionPrefKey)); + EXPECT_EQ(base::Time::Now(), prefs.GetTime(kFlocIdComputeTimePrefKey)); +} - FlocId::SaveComputeTimeToPrefs(base::Time::FromTimeT(3), &prefs); - EXPECT_EQ(base::Time::FromTimeT(3), prefs.GetTime(kFlocIdComputeTimePrefKey)); +TEST_F(FlocIdUnitTest, InvalidateIdAndSaveToPrefs) { + TestingPrefServiceSimple prefs; + FlocId::RegisterPrefs(prefs.registry()); + + FlocId floc_id = + FlocId(123, base::Time::FromTimeT(1), base::Time::FromTimeT(2), 3); + floc_id.SaveToPrefs(&prefs); + + floc_id.InvalidateIdAndSaveToPrefs(&prefs); + EXPECT_FALSE(floc_id.IsValid()); + EXPECT_FALSE(prefs.HasPrefPath(kFlocIdValuePrefKey)); + + EXPECT_EQ(base::Time::FromTimeT(1), + prefs.GetTime(kFlocIdHistoryBeginTimePrefKey)); + EXPECT_EQ(base::Time::FromTimeT(2), + prefs.GetTime(kFlocIdHistoryEndTimePrefKey)); + EXPECT_EQ(1u, prefs.GetUint64(kFlocIdFinchConfigVersionPrefKey)); + EXPECT_EQ(3u, prefs.GetUint64(kFlocIdSortingLshVersionPrefKey)); + EXPECT_EQ(base::Time::Now(), prefs.GetTime(kFlocIdComputeTimePrefKey)); } } // namespace federated_learning
diff --git a/components/password_manager/core/browser/password_store.cc b/components/password_manager/core/browser/password_store.cc index 98fc858..6bdd6ab 100644 --- a/components/password_manager/core/browser/password_store.cc +++ b/components/password_manager/core/browser/password_store.cc
@@ -18,6 +18,7 @@ #include "base/memory/ptr_util.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" +#include "base/ranges/algorithm.h" #include "base/stl_util.h" #include "base/strings/string16.h" #include "base/task/post_task.h" @@ -700,6 +701,13 @@ return AddLoginImpl(form, error); } +bool PasswordStore::AddCompromisedCredentialsSync( + base::span<const CompromisedCredentials> issues) { + return base::ranges::all_of(issues, [this](const auto& issue) { + return AddCompromisedCredentialsImpl(issue); + }); +} + PasswordStoreChangeList PasswordStore::UpdateLoginSync( const PasswordForm& form, UpdateLoginError* error) {
diff --git a/components/password_manager/core/browser/password_store.h b/components/password_manager/core/browser/password_store.h index 509d777..c589c32 100644 --- a/components/password_manager/core/browser/password_store.h +++ b/components/password_manager/core/browser/password_store.h
@@ -582,6 +582,8 @@ // PasswordStoreSync: PasswordStoreChangeList AddLoginSync(const PasswordForm& form, AddLoginError* error) override; + bool AddCompromisedCredentialsSync( + base::span<const CompromisedCredentials> issues) override; PasswordStoreChangeList UpdateLoginSync(const PasswordForm& form, UpdateLoginError* error) override; PasswordStoreChangeList RemoveLoginSync(const PasswordForm& form) override; @@ -655,6 +657,7 @@ private: FRIEND_TEST_ALL_PREFIXES(PasswordStoreTest, UpdatePasswordsStoredForAffiliatedWebsites); + FRIEND_TEST_ALL_PREFIXES(PasswordStoreTest, AddCompromisedCredentialsSync); using LoginsResult = std::vector<std::unique_ptr<PasswordForm>>; using LoginsTask = base::OnceCallback<LoginsResult()>;
diff --git a/components/password_manager/core/browser/password_store_sync.h b/components/password_manager/core/browser/password_store_sync.h index c2e94207..d06da7d0 100644 --- a/components/password_manager/core/browser/password_store_sync.h +++ b/components/password_manager/core/browser/password_store_sync.h
@@ -20,6 +20,7 @@ namespace password_manager { +struct CompromisedCredentials; struct PasswordForm; using PrimaryKeyToFormMap = std::map<int, std::unique_ptr<PasswordForm>>; @@ -130,6 +131,12 @@ const PasswordForm& form, AddLoginError* error = nullptr) = 0; + // Synchronous implementation to add compromised credentials. Operation will + // be terminated if any insertion into the database fails. Returns whether + // operation was successful. + virtual bool AddCompromisedCredentialsSync( + base::span<const CompromisedCredentials> issues) = 0; + // Synchronous implementation to update the given login. virtual PasswordStoreChangeList UpdateLoginSync( const PasswordForm& form,
diff --git a/components/password_manager/core/browser/password_store_unittest.cc b/components/password_manager/core/browser/password_store_unittest.cc index 6da2d33..75a2a195 100644 --- a/components/password_manager/core/browser/password_store_unittest.cc +++ b/components/password_manager/core/browser/password_store_unittest.cc
@@ -1797,4 +1797,53 @@ } #endif // !defined(OS_ANDROID) +TEST_F(PasswordStoreTest, AddCompromisedCredentialsSync) { + scoped_refptr<PasswordStoreImpl> store = CreatePasswordStore(); + store->Init(/*prefs=*/nullptr); + + constexpr PasswordFormData kTestCredential = { + PasswordForm::Scheme::kHtml, + kTestWebRealm1, + kTestWebOrigin1, + "", + L"", + L"username_element_1", + L"password_element_1", + L"username", + L"", + kTestLastUsageTime, + 1, + }; + + std::unique_ptr<PasswordForm> test_form = + FillPasswordFormWithData(kTestCredential); + + const std::vector<CompromisedCredentials> compromised_credentials = { + CompromisedCredentials(test_form->signon_realm, test_form->username_value, + base::Time(), CompromiseType::kLeaked, + IsMuted(false)), + CompromisedCredentials(test_form->signon_realm, test_form->username_value, + base::Time(), CompromiseType::kReused, + IsMuted(false))}; + + AddLoginError add_login_error = AddLoginError::kDbError; + store->ScheduleTask(base::BindOnce(IgnoreResult(&PasswordStore::AddLoginSync), + store, *test_form, &add_login_error)); + store->ScheduleTask(base::BindOnce( + IgnoreResult(&PasswordStore::AddCompromisedCredentialsSync), store, + compromised_credentials)); + + WaitForPasswordStore(); + EXPECT_EQ(add_login_error, AddLoginError::kNone); + + MockCompromisedCredentialsConsumer consumer; + EXPECT_CALL(consumer, + OnGetCompromisedCredentials(UnorderedElementsAre( + compromised_credentials[0], compromised_credentials[1]))); + store->GetAllCompromisedCredentials(&consumer); + WaitForPasswordStore(); + + store->ShutdownOnUIThread(); +} + } // namespace password_manager
diff --git a/components/password_manager/core/browser/sync/password_sync_bridge_unittest.cc b/components/password_manager/core/browser/sync/password_sync_bridge_unittest.cc index efe95fd..4c8845a 100644 --- a/components/password_manager/core/browser/sync/password_sync_bridge_unittest.cc +++ b/components/password_manager/core/browser/sync/password_sync_bridge_unittest.cc
@@ -15,6 +15,7 @@ #include "base/test/metrics/histogram_tester.h" #include "base/test/mock_callback.h" #include "build/build_config.h" +#include "components/password_manager/core/browser/insecure_credentials_table.h" #include "components/password_manager/core/browser/password_form.h" #include "components/password_manager/core/browser/password_store_sync.h" #include "components/sync/base/client_tag_hash.h" @@ -225,6 +226,10 @@ AddLoginSync, (const PasswordForm&, AddLoginError*), (override)); + MOCK_METHOD(bool, + AddCompromisedCredentialsSync, + (base::span<const CompromisedCredentials>), + (override)); MOCK_METHOD(PasswordStoreChangeList, UpdateLoginSync, (const PasswordForm&, UpdateLoginError*),
diff --git a/components/performance_manager/service_worker_context_adapter.cc b/components/performance_manager/service_worker_context_adapter.cc index 1cf14d0..c70d49c 100644 --- a/components/performance_manager/service_worker_context_adapter.cc +++ b/components/performance_manager/service_worker_context_adapter.cc
@@ -184,7 +184,7 @@ void ServiceWorkerContextAdapter::StartWorkerForScope( const GURL& scope, StartWorkerCallback info_callback, - base::OnceClosure failure_callback) { + StartWorkerFailureCallback failure_callback) { NOTIMPLEMENTED(); }
diff --git a/components/performance_manager/service_worker_context_adapter.h b/components/performance_manager/service_worker_context_adapter.h index d925abc9..619bc3b 100644 --- a/components/performance_manager/service_worker_context_adapter.h +++ b/components/performance_manager/service_worker_context_adapter.h
@@ -74,9 +74,10 @@ void CheckOfflineCapability(const GURL& url, CheckOfflineCapabilityCallback callback) override; void ClearAllServiceWorkersForTest(base::OnceClosure callback) override; - void StartWorkerForScope(const GURL& scope, - StartWorkerCallback info_callback, - base::OnceClosure failure_callback) override; + void StartWorkerForScope( + const GURL& scope, + StartWorkerCallback info_callback, + StartWorkerFailureCallback failure_callback) override; void StartServiceWorkerAndDispatchMessage( const GURL& scope, blink::TransferableMessage message,
diff --git a/components/policy/core/common/policy_map_unittest.cc b/components/policy/core/common/policy_map_unittest.cc index 838bddf..645f4e8 100644 --- a/components/policy/core/common/policy_map_unittest.cc +++ b/components/policy/core/common/policy_map_unittest.cc
@@ -143,8 +143,9 @@ map.AddError( kTestPolicyName1, IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM, {base::UTF8ToUTF16("SomeSource"), base::UTF8ToUTF16("SomeDestination")}); - EXPECT_EQ(base::UTF8ToUTF16("1234\n5678\nYour administrator has blocked " - "sharing from SomeSource to SomeDestination"), + EXPECT_EQ(base::UTF8ToUTF16( + "1234\n5678\nSharing from SomeSource to SomeDestination has " + "been blocked by administrator policy"), entry1->GetLocalizedErrors(lookup)); EXPECT_EQ(base::UTF8ToUTF16("1357\nThis policy is deprecated. You should use " "the SomeNewPolicy policy instead."), @@ -185,8 +186,9 @@ entry1->AddWarning( IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM, {base::UTF8ToUTF16("SomeSource"), base::UTF8ToUTF16("SomeDestination")}); - EXPECT_EQ(base::UTF8ToUTF16("1234\n5678\nYour administrator has blocked " - "sharing from SomeSource to SomeDestination"), + EXPECT_EQ(base::UTF8ToUTF16( + "1234\n5678\nSharing from SomeSource to SomeDestination has " + "been blocked by administrator policy"), entry1->GetLocalizedWarnings(lookup)); EXPECT_EQ(base::UTF8ToUTF16("1357\nThis policy is deprecated. You should use " "the SomeNewPolicy policy instead."),
diff --git a/components/policy_strings.grdp b/components/policy_strings.grdp index ec5464e..eefcf3c 100644 --- a/components/policy_strings.grdp +++ b/components/policy_strings.grdp
@@ -580,10 +580,10 @@ <!-- Strings for Data Leak Prevention --> <message name="IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_PASTE" desc="A toast informing the user that paste is blocked."> - Pasting from <ph name="ORIGIN_NAME">$1<ex>corp.google.com</ex></ph> to this location is blocked by your administrator + Pasting from <ph name="ORIGIN_NAME">$1<ex>corp.google.com</ex></ph> to this location is blocked by administrator policy </message> <message name="IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM" desc="A toast informing the user that sharing clipboard data to VMs is blocked."> - Your administrator has blocked sharing from <ph name="ORIGIN_NAME">$1<ex>corp.google.com</ex></ph> to <ph name="VM_NAME">$2<ex>Linux</ex></ph> + Sharing from <ph name="ORIGIN_NAME">$1<ex>corp.google.com</ex></ph> to <ph name="VM_NAME">$2<ex>Linux</ex></ph> has been blocked by administrator policy </message> <message name="IDS_POLICY_DLP_ANDROID_APPS" desc="Name shown for ARC in data leak prevention toasts."> Android apps
diff --git a/components/policy_strings_grdp/IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM.png.sha1 b/components/policy_strings_grdp/IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM.png.sha1 index 61838f2..0890c9d8 100644 --- a/components/policy_strings_grdp/IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM.png.sha1 +++ b/components/policy_strings_grdp/IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM.png.sha1
@@ -1 +1 @@ -dc8420bbab243a1ccc2442778128a5ff7ae2fa9c \ No newline at end of file +8a2da7751f973875a5dfda424fb28dcb144f0245 \ No newline at end of file
diff --git a/components/policy_strings_grdp/IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_PASTE.png.sha1 b/components/policy_strings_grdp/IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_PASTE.png.sha1 index d5d99c9e..ed31586 100644 --- a/components/policy_strings_grdp/IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_PASTE.png.sha1 +++ b/components/policy_strings_grdp/IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_PASTE.png.sha1
@@ -1 +1 @@ -311127f5b9c8e964067c9805ae7f86d559ec2a6d \ No newline at end of file +fe3d68be47b248f88fca191a4de1c0ecf97995af \ No newline at end of file
diff --git a/components/renderer_context_menu/context_menu_content_type.cc b/components/renderer_context_menu/context_menu_content_type.cc index 35d7542..8fbc5d0 100644 --- a/components/renderer_context_menu/context_menu_content_type.cc +++ b/components/renderer_context_menu/context_menu_content_type.cc
@@ -10,7 +10,7 @@ #include "printing/buildflags/buildflags.h" #include "third_party/blink/public/common/context_menu_data/input_field_type.h" -using blink::ContextMenuDataMediaType; +using blink::mojom::ContextMenuDataMediaType; using content::WebContents; namespace {
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 247233f..42f70e7 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -2143,7 +2143,9 @@ } bool RenderWidgetHostViewAura::ShouldVirtualKeyboardOverlayContent() const { - RenderFrameHostImpl* frame = GetFocusedFrame(); + // overlaycontent flag can only be set from main frame. + RenderFrameHostImpl* frame = + host()->delegate()->GetFrameTree()->GetMainFrame(); if (!frame) return false; @@ -2152,13 +2154,18 @@ void RenderWidgetHostViewAura::NotifyVirtualKeyboardOverlayRect( const gfx::Rect& keyboard_rect) { - RenderFrameHostImpl* frame = GetFocusedFrame(); + // geometrychange event can only be fired on main frame and not focused frame + // which could be an iframe. + RenderFrameHostImpl* frame = + host()->delegate()->GetFrameTree()->GetMainFrame(); if (!frame) return; frame->NotifyVirtualKeyboardOverlayRect(keyboard_rect); } bool RenderWidgetHostViewAura::FocusedFrameHasStickyActivation() const { + // Unless user has interacted with the iframe, we shouldn't be displaying VK + // or fire geometrychange event. RenderFrameHostImpl* frame = GetFocusedFrame(); if (!frame) return false;
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc index ea1a4a31..a9a4ebc6 100644 --- a/content/browser/service_worker/service_worker_context_wrapper.cc +++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -100,13 +100,14 @@ registration->ActivateWaitingVersionWhenReady(); } -void DidStartWorker(scoped_refptr<ServiceWorkerVersion> version, - ServiceWorkerContext::StartWorkerCallback info_callback, - base::OnceClosure error_callback, - blink::ServiceWorkerStatusCode start_worker_status) { +void DidStartWorker( + scoped_refptr<ServiceWorkerVersion> version, + ServiceWorkerContext::StartWorkerCallback info_callback, + ServiceWorkerContext::StartWorkerFailureCallback error_callback, + blink::ServiceWorkerStatusCode start_worker_status) { DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId()); if (start_worker_status != blink::ServiceWorkerStatusCode::kOk) { - std::move(error_callback).Run(); + std::move(error_callback).Run(start_worker_status); return; } EmbeddedWorkerInstance* instance = version->embedded_worker(); @@ -117,12 +118,12 @@ void FoundRegistrationForStartWorker( ServiceWorkerContext::StartWorkerCallback info_callback, - base::OnceClosure failure_callback, + ServiceWorkerContext::StartWorkerFailureCallback failure_callback, blink::ServiceWorkerStatusCode service_worker_status, scoped_refptr<ServiceWorkerRegistration> registration) { DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId()); if (service_worker_status != blink::ServiceWorkerStatusCode::kOk) { - std::move(failure_callback).Run(); + std::move(failure_callback).Run(service_worker_status); return; } @@ -138,7 +139,7 @@ // However, if the installation is rejected, the installing version can go // away by the time we reach here from DidFindRegistrationForFindImpl. if (!version_ptr) { - std::move(failure_callback).Run(); + std::move(failure_callback).Run(service_worker_status); return; } @@ -744,7 +745,7 @@ void ServiceWorkerContextWrapper::StartWorkerForScope( const GURL& scope, StartWorkerCallback info_callback, - base::OnceClosure failure_callback) { + StartWorkerFailureCallback failure_callback) { DCHECK_CURRENTLY_ON(GetCoreThreadId()); FindRegistrationForScopeImpl( scope, /*include_installing_version=*/true,
diff --git a/content/browser/service_worker/service_worker_context_wrapper.h b/content/browser/service_worker/service_worker_context_wrapper.h index 8ba0741..38f56fa 100644 --- a/content/browser/service_worker/service_worker_context_wrapper.h +++ b/content/browser/service_worker/service_worker_context_wrapper.h
@@ -179,9 +179,10 @@ CheckOfflineCapabilityCallback callback) override; void ClearAllServiceWorkersForTest(base::OnceClosure callback) override; - void StartWorkerForScope(const GURL& scope, - StartWorkerCallback info_callback, - base::OnceClosure failure_callback) override; + void StartWorkerForScope( + const GURL& scope, + StartWorkerCallback info_callback, + StartWorkerFailureCallback failure_callback) override; void StartServiceWorkerAndDispatchMessage( const GURL& scope, blink::TransferableMessage message,
diff --git a/content/browser/service_worker/service_worker_fetch_dispatcher.cc b/content/browser/service_worker/service_worker_fetch_dispatcher.cc index f6c1279..f33e173 100644 --- a/content/browser/service_worker/service_worker_fetch_dispatcher.cc +++ b/content/browser/service_worker/service_worker_fetch_dispatcher.cc
@@ -354,7 +354,10 @@ ServiceWorkerVersion* version) : receiver_(this, std::move(receiver)), fetch_dispatcher_(fetch_dispatcher), - version_(version) {} + version_(version) { + receiver_.set_disconnect_handler(base::BindOnce( + &ResponseCallback::OnDisconnected, base::Unretained(this))); + } ~ResponseCallback() override { DCHECK(fetch_event_id_.has_value()); } @@ -363,6 +366,15 @@ fetch_event_id_ = id; } + void OnDisconnected() { + version_->FinishRequest(fetch_event_id_.value(), /*was_handled=*/false); + // HandleResponse() is not needed to be called here because + // OnFetchEventFinished() should be called with an error code when + // disconnecting without response, and it lets the request failed. + + // Do not add code here because FinishRequest() removes `this`. + } + // Implements blink::mojom::ServiceWorkerFetchResponseCallback. void OnResponse( blink::mojom::FetchAPIResponsePtr response,
diff --git a/content/browser/service_worker/service_worker_fetch_dispatcher_browsertest.cc b/content/browser/service_worker/service_worker_fetch_dispatcher_browsertest.cc index aab6acc..5836c0a 100644 --- a/content/browser/service_worker/service_worker_fetch_dispatcher_browsertest.cc +++ b/content/browser/service_worker/service_worker_fetch_dispatcher_browsertest.cc
@@ -241,9 +241,8 @@ // This is the timeout case that the lifetime of a fetch event is shorter than // the response finishes. ServiceWorkerFetchDispatcher::OnFetchEventFinished is // called first. -// Disabled due to flakes; see https://crbug.com/1156091. IN_PROC_BROWSER_TEST_F(ServiceWorkerFetchDispatcherBrowserTest, - DISABLED_FetchEventTimeout) { + FetchEventTimeout) { StartServerAndNavigateToSetup(); ServiceWorkerVersion* version = CreateVersion();
diff --git a/content/browser/service_worker/service_worker_offline_capability_check_browsertest.cc b/content/browser/service_worker/service_worker_offline_capability_check_browsertest.cc index 0c67759..a6331b34 100644 --- a/content/browser/service_worker/service_worker_offline_capability_check_browsertest.cc +++ b/content/browser/service_worker/service_worker_offline_capability_check_browsertest.cc
@@ -647,16 +647,9 @@ // Sites with a service worker are identified as supporting offline capability // only when it returns a valid response in the offline mode. -#if defined(OS_WIN) || defined(OS_MAC) -// Flaky on Win7: https://crbug.com/1156081 -// Flaky on Mac: https://crbug.com/1156626 -#define MAYBE_CheckOfflineCapability DISABLED_CheckOfflineCapability -#else -#define MAYBE_CheckOfflineCapability CheckOfflineCapability -#endif IN_PROC_BROWSER_TEST_F(ServiceWorkerOfflineCapabilityCheckBrowserTest, - MAYBE_CheckOfflineCapability) { + CheckOfflineCapability) { EXPECT_TRUE(NavigateToURL(shell(), embedded_test_server()->GetURL( "/service_worker/create_service_worker.html")));
diff --git a/content/browser/service_worker/service_worker_process_browsertest.cc b/content/browser/service_worker/service_worker_process_browsertest.cc index e2dc734..af2e3ac 100644 --- a/content/browser/service_worker/service_worker_process_browsertest.cc +++ b/content/browser/service_worker/service_worker_process_browsertest.cc
@@ -208,10 +208,11 @@ worker_process_id = process_id; loop.Quit(); }), - base::BindLambdaForTesting([&loop]() { - ASSERT_FALSE(true) << "start worker failed"; - loop.Quit(); - }))); + base::BindLambdaForTesting( + [&loop](blink::ServiceWorkerStatusCode status_code) { + ASSERT_FALSE(true) << "start worker failed"; + loop.Quit(); + }))); loop.Run(); // The page and service worker should be in the same process.
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc index 9488312..6bf206b 100644 --- a/content/browser/service_worker/service_worker_version.cc +++ b/content/browser/service_worker/service_worker_version.cc
@@ -483,12 +483,6 @@ switch (running_status()) { case EmbeddedWorkerStatus::STARTING: case EmbeddedWorkerStatus::RUNNING: { - // Endpoint isn't available after calling StopWorker(). This needs to be - // set here without waiting until the worker is actually stopped because - // subsequent StartWorker() may read the flag to decide whether an event - // can be dispatched or not. - is_endpoint_ready_ = false; - // EmbeddedWorkerInstance::Stop() may synchronously call // ServiceWorkerVersion::OnStopped() and destroy |this|. This protection // avoids it. @@ -540,6 +534,19 @@ // But when activation is happening and this worker needs to be terminated // asap, it'll be terminated. will_be_terminated = needs_to_be_terminated_asap_; + + if (!will_be_terminated) { + // When the worker is being kept alive due to devtools, it's important to + // set the service worker's idle delay back to the default value rather + // than zero. Otherwise, the service worker might see that it has no work + // and immediately send a RequestTermination() back to the browser again, + // repeating this over and over. In the non-devtools case, it's + // necessarily being kept alive due to an inflight request, and will only + // send a RequestTermination() once that request settles (which is the + // intended behavior). + endpoint()->SetIdleDelay(base::TimeDelta::FromSeconds( + blink::mojom::kServiceWorkerDefaultIdleDelayInSeconds)); + } } if (will_be_terminated) { @@ -1223,6 +1230,12 @@ script_url_.spec(), "Version Status", VersionStatusToString(status_)); + // Endpoint isn't available after calling EmbeddedWorkerInstance::Stop(). + // This needs to be set here without waiting until the worker is actually + // stopped because subsequent StartWorker() may read the flag to decide + // whether an event can be dispatched or not. + is_endpoint_ready_ = false; + // Shorten the interval so stalling in stopped can be fixed quickly. Once the // worker stops, the timer is disabled. The interval will be reset to normal // when the worker starts up again.
diff --git a/content/browser/service_worker/service_worker_version_unittest.cc b/content/browser/service_worker/service_worker_version_unittest.cc index b3239d0..c304e37 100644 --- a/content/browser/service_worker/service_worker_version_unittest.cc +++ b/content/browser/service_worker/service_worker_version_unittest.cc
@@ -482,6 +482,35 @@ EXPECT_EQ(EmbeddedWorkerStatus::RUNNING, version_->running_status()); } +TEST_F(ServiceWorkerVersionTest, RequestTerminationWithDevToolsAttached) { + auto* service_worker = + helper_->AddNewPendingServiceWorker<FakeServiceWorker>(helper_.get()); + + version_->SetDevToolsAttached(true); + + base::Optional<blink::ServiceWorkerStatusCode> status; + base::RunLoop run_loop; + version_->StartWorker( + ServiceWorkerMetrics::EventType::UNKNOWN, + ReceiveServiceWorkerStatus(&status, run_loop.QuitClosure())); + run_loop.Run(); + EXPECT_EQ(blink::ServiceWorkerStatusCode::kOk, status.value()); + EXPECT_EQ(EmbeddedWorkerStatus::RUNNING, version_->running_status()); + + // Idle delay is not set at this point. The renderer process uses the default + // value. + EXPECT_FALSE(service_worker->idle_delay().has_value()); + + // If OnRequestTermination() is called when DevTools is attached, then the + // worker's idle timeout is set to the default value forcefully because the + // worker needs to be running until DevTools is detached even if there's no + // inflight event. + version_->OnRequestTermination(); + service_worker->FlushForTesting(); + EXPECT_EQ(blink::mojom::kServiceWorkerDefaultIdleDelayInSeconds, + service_worker->idle_delay()->InSeconds()); +} + // Test that update isn't triggered for a non-stale worker. TEST_F(ServiceWorkerVersionTest, StaleUpdate_FreshWorker) { version_->SetStatus(ServiceWorkerVersion::ACTIVATED);
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn index ef8ea1e..bf2ec8b9 100644 --- a/content/common/BUILD.gn +++ b/content/common/BUILD.gn
@@ -179,7 +179,6 @@ "//ui/accessibility", "//ui/accessibility/mojom", "//ui/base/cursor:cursor_base", - "//ui/base/cursor/mojom:cursor_type", "//ui/events/ipc", ] deps = [ @@ -234,6 +233,7 @@ "//third_party/boringssl", "//third_party/icu", "//ui/base", + "//ui/base/cursor/mojom:cursor_type", "//ui/base/ime", "//ui/display", "//ui/events/blink", @@ -534,10 +534,6 @@ cpp = "::blink::VisualProperties" }, { - mojom = "content.mojom.WebCursor" - cpp = "::content::WebCursor" - }, - { mojom = "content.mojom.WebPopupType" cpp = "::blink::WebPopupType" }, @@ -545,7 +541,6 @@ traits_headers = [ "//cc/input/touch_action.h", - "//content/common/cursors/webcursor.h", "//content/common/frame_replication_state.h", "//content/common/input/synthetic_pinch_gesture_params.h", "//content/common/input/synthetic_pointer_action_list_params.h", @@ -588,7 +583,6 @@ "//services/network/public/cpp", "//third_party/blink/public/common", "//ui/accessibility", - "//ui/base/cursor:cursor_base", "//ui/base/ime:text_input_types", "//ui/events/blink", "//ui/gfx/ipc",
diff --git a/content/common/content_param_traits_macros.h b/content/common/content_param_traits_macros.h index cf07c972..c462f48 100644 --- a/content/common/content_param_traits_macros.h +++ b/content/common/content_param_traits_macros.h
@@ -22,7 +22,6 @@ #include "third_party/blink/public/common/input/web_input_event.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/mojom/loader/resource_load_info.mojom.h" -#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h" #include "ui/base/ime/text_input_type.h" #include "ui/gfx/gpu_memory_buffer.h" #include "ui/gfx/ipc/geometry/gfx_param_traits.h" @@ -45,9 +44,6 @@ network::mojom::ContentSecurityPolicySource::kMaxValue) IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::ContentSecurityPolicyType, network::mojom::ContentSecurityPolicyType::kMaxValue) -IPC_ENUM_TRAITS_MIN_MAX_VALUE(ui::mojom::CursorType, - ui::mojom::CursorType::kNull, - ui::mojom::CursorType::kMaxValue) IPC_ENUM_TRAITS_MAX_VALUE(content::PageVisibilityState, content::PageVisibilityState::kMaxValue)
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h index f0690df..9c2d4d20 100644 --- a/content/common/frame_messages.h +++ b/content/common/frame_messages.h
@@ -88,8 +88,8 @@ blink::mojom::FrameOwnerElementType::kMaxValue) IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::AdFrameType, blink::mojom::AdFrameType::kMaxValue) -IPC_ENUM_TRAITS_MAX_VALUE(blink::ContextMenuDataMediaType, - blink::ContextMenuDataMediaType::kLast) +IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::ContextMenuDataMediaType, + blink::mojom::ContextMenuDataMediaType::kMaxValue) IPC_ENUM_TRAITS_MAX_VALUE(blink::ContextMenuDataInputFieldType, blink::ContextMenuDataInputFieldType::kMaxValue) IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::ScrollbarMode,
diff --git a/content/public/browser/service_worker_context.h b/content/public/browser/service_worker_context.h index 37bbafe..8db242d 100644 --- a/content/public/browser/service_worker_context.h +++ b/content/public/browser/service_worker_context.h
@@ -14,6 +14,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/service_worker_external_request_result.h" #include "content/public/browser/service_worker_running_info.h" +#include "third_party/blink/public/common/service_worker/service_worker_status_code.h" #include "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom-forward.h" #include "third_party/blink/public/mojom/service_worker/service_worker_registration_options.mojom-forward.h" #include "url/gurl.h" @@ -89,6 +90,9 @@ using StartWorkerCallback = base::OnceCallback< void(int64_t version_id, int process_id, int thread_id)>; + using StartWorkerFailureCallback = + base::OnceCallback<void(blink::ServiceWorkerStatusCode status_code)>; + static content::BrowserThread::ID GetCoreThreadId(); // Returns true if |url| is within the service worker |scope|. @@ -230,14 +234,16 @@ // Starts the active worker of the registration for the given |scope|. If // there is no active worker, starts the installing worker. // |info_callback| is passed information about the started worker if - // successful, otherwise |failure_callback| is called. + // successful, otherwise |failure_callback| is passed information about the + // error. // // Must be called on the core thread, and the callback is called on that // thread. There is no guarantee about whether the callback is called // synchronously or asynchronously. - virtual void StartWorkerForScope(const GURL& scope, - StartWorkerCallback info_callback, - base::OnceClosure failure_callback) = 0; + virtual void StartWorkerForScope( + const GURL& scope, + StartWorkerCallback info_callback, + StartWorkerFailureCallback failure_callback) = 0; // Starts the active worker of the registration for the given |scope| and // dispatches the given |message| to the service worker. |result_callback|
diff --git a/content/public/common/untrustworthy_context_menu_params.cc b/content/public/common/untrustworthy_context_menu_params.cc index f3b15a4..c3ed3fe 100644 --- a/content/public/common/untrustworthy_context_menu_params.cc +++ b/content/public/common/untrustworthy_context_menu_params.cc
@@ -14,7 +14,7 @@ render_widget_id(kCurrentRenderWidget) {} UntrustworthyContextMenuParams::UntrustworthyContextMenuParams() - : media_type(blink::ContextMenuDataMediaType::kNone), + : media_type(blink::mojom::ContextMenuDataMediaType::kNone), x(0), y(0), has_image_contents(false),
diff --git a/content/public/common/untrustworthy_context_menu_params.h b/content/public/common/untrustworthy_context_menu_params.h index 58ad86d..a70e97f2 100644 --- a/content/public/common/untrustworthy_context_menu_params.h +++ b/content/public/common/untrustworthy_context_menu_params.h
@@ -54,7 +54,7 @@ ~UntrustworthyContextMenuParams(); // This is the type of Context Node that the context menu was invoked on. - blink::ContextMenuDataMediaType media_type; + blink::mojom::ContextMenuDataMediaType media_type; // These values represent the coordinates of the mouse when the context menu // was invoked. Coords are relative to the associated RenderView's origin.
diff --git a/content/public/test/fake_service_worker_context.cc b/content/public/test/fake_service_worker_context.cc index f2446ff..45257b5 100644 --- a/content/public/test/fake_service_worker_context.cc +++ b/content/public/test/fake_service_worker_context.cc
@@ -93,7 +93,7 @@ void FakeServiceWorkerContext::StartWorkerForScope( const GURL& scope, ServiceWorkerContext::StartWorkerCallback info_callback, - base::OnceClosure failure_callback) { + ServiceWorkerContext::StartWorkerFailureCallback failure_callback) { NOTREACHED(); } void FakeServiceWorkerContext::StartServiceWorkerForNavigationHint(
diff --git a/content/public/test/fake_service_worker_context.h b/content/public/test/fake_service_worker_context.h index 7611e6a..560ff20f 100644 --- a/content/public/test/fake_service_worker_context.h +++ b/content/public/test/fake_service_worker_context.h
@@ -66,7 +66,8 @@ void StartWorkerForScope( const GURL& scope, ServiceWorkerContext::StartWorkerCallback info_callback, - base::OnceClosure failure_callback) override; + ServiceWorkerContext::StartWorkerFailureCallback failure_callback) + override; void StartServiceWorkerAndDispatchMessage( const GURL& scope, blink::TransferableMessage message,
diff --git a/content/shell/browser/shell_web_contents_view_delegate_mac.mm b/content/shell/browser/shell_web_contents_view_delegate_mac.mm index 5bf15982..6f38cadc 100644 --- a/content/shell/browser/shell_web_contents_view_delegate_mac.mm +++ b/content/shell/browser/shell_web_contents_view_delegate_mac.mm
@@ -109,7 +109,7 @@ [menu setDelegate:delegate]; [menu setAutoenablesItems:NO]; - if (params.media_type == blink::ContextMenuDataMediaType::kNone && + if (params.media_type == blink::mojom::ContextMenuDataMediaType::kNone && !has_link && !has_selection && !params_.is_editable) { BOOL back_menu_enabled = web_contents_->GetController().CanGoBack() ? YES : NO;
diff --git a/docs/testing/web_platform_tests.md b/docs/testing/web_platform_tests.md index eb166a1..a7b48f1 100644 --- a/docs/testing/web_platform_tests.md +++ b/docs/testing/web_platform_tests.md
@@ -139,8 +139,9 @@ **Note**: A significant downside of `wpt_internal` is that your tests may be broken by upstream changes to the resources scripts (e.g. `testharness.js`), as `wpt_internal` does not use the forked version of `testharness.js` used by all -other non-`external/wpt` tests. Use of [WPT-NOTIFY](#wpt_notify) is recommended -to ensure you are notified of breakages. +other non-`external/wpt` tests. Use of [new failure +notifications](#new-failure-notifications) is recommended to ensure you are +notified of breakages. ## Running tests @@ -200,19 +201,24 @@ - If the importer starts misbehaving, it can be disabled by landing a [CL to skip the update step](https://crrev.com/c/1961906/). -### WPT-NOTIFY +### New failure notifications Test owners can elect to have the importer automatically file bugs against a component when imported changes introduce failures. This includes new tests that fail in Chromium, as well as new failures introduced to an existing test. To -opt-in to this functionality, create an `OWNERS` file in the appropriate -`external/wpt/` subdirectory that contains the `WPT-NOTIFY` tag. For example, -`external/wpt/css/css-grid/OWNERS` looks like: +opt-in to this functionality, create an `DIR_METADATA` file in the appropriate +`external/wpt/` subdirectory that contains at least `wpt.notify` and +`monorail.component` fields. For example, `external/wpt/css/css-grid/DIR_METADATA` +looks like: ``` -# TEAM: layout-dev@chromium.org -# COMPONENT: Blink>Layout>Grid -# WPT-NOTIFY: true +monorail { + component: "Blink>Layout>Grid" +} +team_email: "layout-dev@chromium.org" +wpt { + notify: YES +} ``` When a test under `external/wpt/css/css-grid/` newly fails in a WPT import, the @@ -220,8 +226,8 @@ in [crbug.com][https://crbug.com], with details of which test failed and the output. -Note that we are considering making WPT-NOTIFY opt-out instead of opt-in: see -https://crbug.com/845232 +Note that we are considering making the notifications opt-out instead of +opt-in: see https://crbug.com/845232 ### Skipped tests (and how to re-enable them)
diff --git a/extensions/browser/api/display_source/display_source_api.cc b/extensions/browser/api/display_source/display_source_api.cc index 201cf0f..322bb80a 100644 --- a/extensions/browser/api/display_source/display_source_api.cc +++ b/extensions/browser/api/display_source/display_source_api.cc
@@ -34,11 +34,12 @@ return RespondNow(Error(kErrorNotSupported)); } - auto success_callback = base::Bind( + auto success_callback = base::BindOnce( &DisplaySourceGetAvailableSinksFunction::OnGetSinksCompleted, this); - auto failure_callback = base::Bind( + auto failure_callback = base::BindOnce( &DisplaySourceGetAvailableSinksFunction::OnGetSinksFailed, this); - delegate->GetAvailableSinks(success_callback, failure_callback); + delegate->GetAvailableSinks(std::move(success_callback), + std::move(failure_callback)); return RespondLater(); } @@ -76,13 +77,13 @@ return RespondNow(Error(kErrorNotSupported)); } - auto success_callback = base::Bind( + auto success_callback = base::BindOnce( &DisplaySourceRequestAuthenticationFunction::OnRequestAuthCompleted, this); - auto failure_callback = base::Bind( + auto failure_callback = base::BindOnce( &DisplaySourceRequestAuthenticationFunction::OnRequestAuthFailed, this); - delegate->RequestAuthentication(params->sink_id, success_callback, - failure_callback); + delegate->RequestAuthentication(params->sink_id, std::move(success_callback), + std::move(failure_callback)); return RespondLater(); }
diff --git a/extensions/browser/api/display_source/display_source_apitestbase.cc b/extensions/browser/api/display_source/display_source_apitestbase.cc index a230c35..86da1e7 100644 --- a/extensions/browser/api/display_source/display_source_apitestbase.cc +++ b/extensions/browser/api/display_source/display_source_apitestbase.cc
@@ -45,18 +45,18 @@ : nullptr; } - void GetAvailableSinks(const SinkInfoListCallback& sinks_callback, - const StringCallback& failure_callback) override; + void GetAvailableSinks(SinkInfoListCallback sinks_callback, + FailureCallback failure_callback) override; void RequestAuthentication(int sink_id, - const AuthInfoCallback& auth_info_callback, - const StringCallback& failure_callback) override; + AuthInfoCallback auth_info_callback, + FailureCallback failure_callback) override; void Connect(int sink_id, const DisplaySourceAuthInfo& auth_info, - const StringCallback& failure_callback) override; + FailureCallback failure_callback) override; - void Disconnect(const StringCallback& failure_callback) override; + void Disconnect(FailureCallback failure_callback) override; void StartWatchingAvailableSinks() override; @@ -71,8 +71,7 @@ void SendMessage(const std::string& message) override; - void SetMessageReceivedCallback( - const StringCallback& callback) override; + void SetMessageReceivedCallback(RepeatingMessageCallback callback) override; private: void AddSink(DisplaySourceSinkInfo sink, @@ -97,7 +96,7 @@ DisplaySourceSinkInfoList sinks_; DisplaySourceSinkInfo* active_sink_; std::map<int, std::pair<AuthenticationMethod, std::string>> auth_infos_; - StringCallback message_received_cb_; + RepeatingMessageCallback message_received_cb_; struct Message { enum Direction { @@ -298,27 +297,27 @@ } void MockDisplaySourceConnectionDelegate::GetAvailableSinks( - const SinkInfoListCallback& sinks_callback, - const StringCallback& failure_callback) { - sinks_callback.Run(sinks_); + SinkInfoListCallback sinks_callback, + FailureCallback failure_callback) { + std::move(sinks_callback).Run(sinks_); } void MockDisplaySourceConnectionDelegate::RequestAuthentication( int sink_id, - const AuthInfoCallback& auth_info_callback, - const StringCallback& failure_callback) { + AuthInfoCallback auth_info_callback, + FailureCallback failure_callback) { DisplaySourceAuthInfo info; auto it = auth_infos_.find(sink_id); ASSERT_NE(it, auth_infos_.end()); info.method = it->second.first; - auth_info_callback.Run(info); + std::move(auth_info_callback).Run(info); } void MockDisplaySourceConnectionDelegate::Connect( int sink_id, const DisplaySourceAuthInfo& auth_info, - const StringCallback& failure_callback) { + FailureCallback failure_callback) { auto it = auth_infos_.find(sink_id); ASSERT_NE(it, auth_infos_.end()); ASSERT_EQ(it->second.first, auth_info.method); @@ -345,7 +344,7 @@ } void MockDisplaySourceConnectionDelegate::Disconnect( - const StringCallback& failure_callback) { + FailureCallback failure_callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); CHECK(active_sink_); ASSERT_EQ(active_sink_->state, SINK_STATE_CONNECTED); @@ -389,8 +388,8 @@ } void MockDisplaySourceConnectionDelegate::SetMessageReceivedCallback( - const StringCallback& callback) { - message_received_cb_ = callback; + RepeatingMessageCallback callback) { + message_received_cb_ = std::move(callback); } void MockDisplaySourceConnectionDelegate::AddSink( @@ -528,7 +527,7 @@ content::GetUIThreadTaskRunner({})->PostTask( FROM_HERE, base::BindOnce(&MockDisplaySourceConnectionDelegate::Disconnect, - base::Unretained(this), StringCallback())); + base::Unretained(this), FailureCallback())); return; }
diff --git a/extensions/browser/api/display_source/display_source_connection_delegate.h b/extensions/browser/api/display_source/display_source_connection_delegate.h index ce6e5cd..8e7789c 100644 --- a/extensions/browser/api/display_source/display_source_connection_delegate.h +++ b/extensions/browser/api/display_source/display_source_connection_delegate.h
@@ -22,10 +22,13 @@ // 'chrome.displaySource' API. class DisplaySourceConnectionDelegate : public KeyedService { public: - using AuthInfoCallback = base::Callback<void(const DisplaySourceAuthInfo&)>; - using StringCallback = base::Callback<void(const std::string&)>; + using AuthInfoCallback = + base::OnceCallback<void(const DisplaySourceAuthInfo&)>; + using RepeatingMessageCallback = + base::RepeatingCallback<void(const std::string&)>; + using FailureCallback = base::OnceCallback<void(const std::string&)>; using SinkInfoListCallback = - base::Callback<void(const DisplaySourceSinkInfoList&)>; + base::OnceCallback<void(const DisplaySourceSinkInfoList&)>; const static int kInvalidSinkId = -1; @@ -49,7 +52,7 @@ // Connection object. // If an error occurs 'Observer::OnConnectionError' is invoked. virtual void SetMessageReceivedCallback( - const StringCallback& callback) = 0; + RepeatingMessageCallback callback) = 0; protected: Connection(); @@ -94,27 +97,26 @@ virtual Connection* connection() = 0; // Queries the list of currently available sinks. - virtual void GetAvailableSinks(const SinkInfoListCallback& sinks_callback, - const StringCallback& failure_callback) = 0; + virtual void GetAvailableSinks(SinkInfoListCallback sinks_callback, + FailureCallback failure_callback) = 0; // Queries the authentication method required by the sink for connection. // If the used authentication method requires authentication data to be // visible on the sink's display (e.g. PIN) the implementation should // request the sink to show it. - virtual void RequestAuthentication( - int sink_id, - const AuthInfoCallback& auth_info_callback, - const StringCallback& failure_callback) = 0; + virtual void RequestAuthentication(int sink_id, + AuthInfoCallback auth_info_callback, + FailureCallback failure_callback) = 0; // Connects to a sink by given id and auth info. virtual void Connect(int sink_id, const DisplaySourceAuthInfo& auth_info, - const StringCallback& failure_callback) = 0; + FailureCallback failure_callback) = 0; // Disconnects the current connection to sink, the 'failure_callback' // is called if an error has occurred or if there is no established // connection. - virtual void Disconnect(const StringCallback& failure_callback) = 0; + virtual void Disconnect(FailureCallback failure_callback) = 0; // Implementation should start watching the available sinks updates. virtual void StartWatchingAvailableSinks() = 0;
diff --git a/extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.cc b/extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.cc index f65a7a56..66a0a12 100644 --- a/extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.cc +++ b/extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.cc
@@ -115,8 +115,8 @@ DCHECK(!write_buffers_.empty()); last_send_code_ = rtp_socket_->Write( write_buffers_.front().get(), write_buffers_.front()->size(), - base::Bind(&WiFiDisplayMediaServiceImpl::OnSent, - weak_factory_.GetWeakPtr())); + base::BindOnce(&WiFiDisplayMediaServiceImpl::OnSent, + weak_factory_.GetWeakPtr())); if (last_send_code_ != net::ERR_IO_PENDING) OnSent(last_send_code_); }
diff --git a/extensions/browser/api/display_source/wifi_display/wifi_display_session_service_impl.cc b/extensions/browser/api/display_source/wifi_display/wifi_display_session_service_impl.cc index bed921b..986227b 100644 --- a/extensions/browser/api/display_source/wifi_display/wifi_display_session_service_impl.cc +++ b/extensions/browser/api/display_source/wifi_display/wifi_display_session_service_impl.cc
@@ -51,8 +51,8 @@ DCHECK(!client_); client_.Bind(std::move(client)); client_.set_disconnect_handler( - base::Bind(&WiFiDisplaySessionServiceImpl::OnClientConnectionError, - weak_factory_.GetWeakPtr())); + base::BindOnce(&WiFiDisplaySessionServiceImpl::OnClientConnectionError, + weak_factory_.GetWeakPtr())); } void WiFiDisplaySessionServiceImpl::Connect(int32_t sink_id, @@ -80,9 +80,10 @@ auth_info.method = static_cast<AuthenticationMethod>(auth_method); auth_info.data = std::unique_ptr<std::string>(new std::string(auth_data)); } - auto on_error = base::Bind(&WiFiDisplaySessionServiceImpl::OnConnectFailed, - weak_factory_.GetWeakPtr(), sink_id); - delegate_->Connect(sink_id, auth_info, on_error); + auto on_error = + base::BindOnce(&WiFiDisplaySessionServiceImpl::OnConnectFailed, + weak_factory_.GetWeakPtr(), sink_id); + delegate_->Connect(sink_id, auth_info, std::move(on_error)); sink_id_ = sink_id; sink_state_ = found->state; DCHECK(sink_state_ == SINK_STATE_CONNECTING); @@ -105,9 +106,10 @@ DCHECK(found->state == SINK_STATE_CONNECTED || found->state == SINK_STATE_CONNECTING); - auto on_error = base::Bind(&WiFiDisplaySessionServiceImpl::OnDisconnectFailed, - weak_factory_.GetWeakPtr(), sink_id_); - delegate_->Disconnect(on_error); + auto on_error = + base::BindOnce(&WiFiDisplaySessionServiceImpl::OnDisconnectFailed, + weak_factory_.GetWeakPtr(), sink_id_); + delegate_->Disconnect(std::move(on_error)); } void WiFiDisplaySessionServiceImpl::SendMessage(const std::string& message) { @@ -153,8 +155,9 @@ if (actual_state == SINK_STATE_CONNECTED) { auto connection = delegate_->connection(); DCHECK(connection); - auto on_message = base::Bind(&WiFiDisplaySessionServiceImpl::OnSinkMessage, - weak_factory_.GetWeakPtr()); + auto on_message = + base::BindRepeating(&WiFiDisplaySessionServiceImpl::OnSinkMessage, + weak_factory_.GetWeakPtr()); connection->SetMessageReceivedCallback(on_message); client_->OnConnected(connection->GetLocalAddress(), connection->GetSinkAddress());
diff --git a/extensions/browser/service_worker_task_queue.cc b/extensions/browser/service_worker_task_queue.cc index e3d1c89..26ceb0c 100644 --- a/extensions/browser/service_worker_task_queue.cc +++ b/extensions/browser/service_worker_task_queue.cc
@@ -174,7 +174,8 @@ } void ServiceWorkerTaskQueue::DidStartWorkerFail( - const SequencedContextId& context_id) { + const SequencedContextId& context_id, + blink::ServiceWorkerStatusCode status_code) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!IsCurrentSequence(context_id.first.extension_id(), context_id.second)) { // This can happen is when the registration got unregistered right before we @@ -190,7 +191,8 @@ DCHECK(worker_state); if (g_test_observer) { g_test_observer->DidStartWorkerFail(context_id.first.extension_id(), - worker_state->pending_tasks_.size()); + worker_state->pending_tasks_.size(), + status_code); } worker_state->pending_tasks_.clear(); // TODO(https://crbug/1062936): Needs more thought: extension would be in
diff --git a/extensions/browser/service_worker_task_queue.h b/extensions/browser/service_worker_task_queue.h index 4c00c37..440d6ece 100644 --- a/extensions/browser/service_worker_task_queue.h +++ b/extensions/browser/service_worker_task_queue.h
@@ -19,6 +19,7 @@ #include "extensions/browser/service_worker/worker_id.h" #include "extensions/common/activation_sequence.h" #include "extensions/common/extension_id.h" +#include "third_party/blink/public/common/service_worker/service_worker_status_code.h" #include "url/gurl.h" namespace content { @@ -131,8 +132,10 @@ // registered. virtual void OnActivateExtension(const ExtensionId& extension_id, bool will_register_service_worker) {} - virtual void DidStartWorkerFail(const ExtensionId& extension_id, - size_t num_pending_tasks) {} + virtual void DidStartWorkerFail( + const ExtensionId& extension_id, + size_t num_pending_tasks, + blink::ServiceWorkerStatusCode status_code) {} private: DISALLOW_COPY_AND_ASSIGN(TestObserver); @@ -161,7 +164,8 @@ int64_t version_id, int process_id, int thread_id); - void DidStartWorkerFail(const SequencedContextId& context_id); + void DidStartWorkerFail(const SequencedContextId& context_id, + blink::ServiceWorkerStatusCode status_code); // The following three methods retrieve, store, and remove information // about Service Worker registration of SW based background pages:
diff --git a/extensions/common/manifest_constants.cc b/extensions/common/manifest_constants.cc index 2bd0c34ef..e45815a 100644 --- a/extensions/common/manifest_constants.cc +++ b/extensions/common/manifest_constants.cc
@@ -17,7 +17,6 @@ const char kActionDefaultPopup[] = "default_popup"; const char kActionDefaultState[] = "default_state"; const char kActionDefaultTitle[] = "default_title"; -const char kAltKey[] = "altKey"; const char kApp[] = "app"; const char kAppDisplayMode[] = "app.display_mode"; const char kAppIconColor[] = "app.icon_color"; @@ -41,7 +40,6 @@ const char kContentSecurityPolicy_SandboxedPagesPath[] = "content_security_policy.sandbox"; const char kConvertedFromUserScript[] = "converted_from_user_script"; -const char kCtrlKey[] = "ctrlKey"; const char kCurrentLocale[] = "current_locale"; const char kDefaultLocale[] = "default_locale"; const char kDescription[] = "description"; @@ -75,7 +73,6 @@ const char kInputView[] = "input_view"; const char kIsolation[] = "app.isolation"; const char kKey[] = "key"; -const char kKeycode[] = "keyCode"; const char kKiosk[] = "kiosk"; const char kKioskAlwaysUpdate[] = "kiosk.always_update"; const char kKioskEnabled[] = "kiosk_enabled"; @@ -137,8 +134,6 @@ "chrome_settings_overrides.search_provider.alternate_urls"; const char kSharedModuleAllowlist[] = "allowlist"; const char kSharedModuleLegacyAllowlist[] = "whitelist"; -const char kShiftKey[] = "shiftKey"; -const char kShortcutKey[] = "shortcutKey"; const char kShortName[] = "short_name"; const char kSignature[] = "signature"; const char kSockets[] = "sockets"; @@ -168,7 +163,6 @@ const char kTtsVoicesLang[] = "lang"; const char kTtsVoicesRemote[] = "remote"; const char kTtsVoicesVoiceName[] = "voice_name"; -const char kType[] = "type"; const char kUpdateURL[] = "update_url"; const char kUrlHandlers[] = "url_handlers"; const char kUrlHandlerTitle[] = "title"; @@ -454,18 +448,10 @@ "Invalid value for 'import[*].minimum_version'."; const char kInvalidInputComponents[] = "Invalid value for 'input_components'"; -const char kInvalidInputComponentDescription[] = - "Invalid value for 'input_components[*].description"; const char kInvalidInputComponentLayoutName[] = "Invalid value for 'input_components[*].layouts[*]"; const char kInvalidInputComponentName[] = "Invalid value for 'input_components[*].name"; -const char kInvalidInputComponentShortcutKey[] = - "Invalid value for 'input_components[*].shortcutKey"; -const char kInvalidInputComponentShortcutKeycode[] = - "Invalid value for 'input_components[*].shortcutKey.keyCode"; -const char kInvalidInputComponentType[] = - "Invalid value for 'input_components[*].type"; const char kInvalidInputView[] = "Invalid value for 'input_view'."; const char kInvalidIsolation[] =
diff --git a/extensions/common/manifest_constants.h b/extensions/common/manifest_constants.h index 64b0332..fabc5c1d4 100644 --- a/extensions/common/manifest_constants.h +++ b/extensions/common/manifest_constants.h
@@ -19,7 +19,6 @@ extern const char kActionDefaultPopup[]; extern const char kActionDefaultState[]; extern const char kActionDefaultTitle[]; -extern const char kAltKey[]; extern const char kApp[]; extern const char kAppDisplayMode[]; extern const char kAppIconColor[]; @@ -43,7 +42,6 @@ extern const char kContentSecurityPolicy_IsolatedWorldPath[]; extern const char kContentSecurityPolicy_SandboxedPagesPath[]; extern const char kConvertedFromUserScript[]; -extern const char kCtrlKey[]; extern const char kCurrentLocale[]; extern const char kDefaultLocale[]; extern const char kDescription[]; @@ -77,7 +75,6 @@ extern const char kInputView[]; extern const char kIsolation[]; extern const char kKey[]; -extern const char kKeycode[]; extern const char kKiosk[]; extern const char kKioskAlwaysUpdate[]; extern const char kKioskEnabled[]; @@ -139,8 +136,6 @@ extern const char kSettingsOverrideAlternateUrls[]; extern const char kSharedModuleAllowlist[]; extern const char kSharedModuleLegacyAllowlist[]; -extern const char kShiftKey[]; -extern const char kShortcutKey[]; extern const char kShortName[]; extern const char kSignature[]; extern const char kSockets[]; @@ -170,7 +165,6 @@ extern const char kTtsVoicesLang[]; extern const char kTtsVoicesRemote[]; extern const char kTtsVoicesVoiceName[]; -extern const char kType[]; extern const char kUpdateURL[]; extern const char kUrlHandlers[]; extern const char kUrlHandlerTitle[]; @@ -356,12 +350,8 @@ extern const char kInvalidImportId[]; extern const char kInvalidImportVersion[]; extern const char kInvalidInputComponents[]; -extern const char kInvalidInputComponentDescription[]; extern const char kInvalidInputComponentLayoutName[]; extern const char kInvalidInputComponentName[]; -extern const char kInvalidInputComponentShortcutKey[]; -extern const char kInvalidInputComponentShortcutKeycode[]; -extern const char kInvalidInputComponentType[]; extern const char kInvalidInputView[]; extern const char kInvalidIsolation[]; extern const char kInvalidIsolationValue[];
diff --git a/ios/chrome/browser/bookmarks/managed_bookmark_service_factory.mm b/ios/chrome/browser/bookmarks/managed_bookmark_service_factory.mm index 017b6ec1..7db037ec 100644 --- a/ios/chrome/browser/bookmarks/managed_bookmark_service_factory.mm +++ b/ios/chrome/browser/bookmarks/managed_bookmark_service_factory.mm
@@ -26,16 +26,15 @@ if (!auth_service) return std::string(); + ChromeIdentity* identity = auth_service->GetAuthenticatedIdentity(); + if (!identity) + return std::string(); + ios::ChromeIdentityService* identity_service = ios::GetChromeBrowserProvider()->GetChromeIdentityService(); if (!identity_service) return std::string(); - identity_service->WaitUntilCacheIsPopulated(); - ChromeIdentity* identity = auth_service->GetAuthenticatedIdentity(); - if (!identity) - return std::string(); - return base::SysNSStringToUTF8( identity_service->GetCachedHostedDomainForIdentity(identity)); }
diff --git a/ios/chrome/browser/browser_state/chrome_browser_state_removal_controller.mm b/ios/chrome/browser/browser_state/chrome_browser_state_removal_controller.mm index 8c5408f..2f5b8f76 100644 --- a/ios/chrome/browser/browser_state/chrome_browser_state_removal_controller.mm +++ b/ios/chrome/browser/browser_state/chrome_browser_state_removal_controller.mm
@@ -64,10 +64,9 @@ // Returns the email's domain of the identity associated with |gaia_id|. std::string GetDomainForGaiaId(const std::string& gaia_id) { - ios::ChromeIdentityService* identity_service = - ios::GetChromeBrowserProvider()->GetChromeIdentityService(); - identity_service->WaitUntilCacheIsPopulated(); - ChromeIdentity* identity = identity_service->GetIdentityWithGaiaID(gaia_id); + ChromeIdentity* identity = ios::GetChromeBrowserProvider() + ->GetChromeIdentityService() + ->GetIdentityWithGaiaID(gaia_id); if (![identity userEmail]) return std::string(); return gaia::ExtractDomainName(
diff --git a/ios/chrome/browser/credential_provider/credential_provider_service.mm b/ios/chrome/browser/credential_provider/credential_provider_service.mm index ff22d4a3..3c96320e 100644 --- a/ios/chrome/browser/credential_provider/credential_provider_service.mm +++ b/ios/chrome/browser/credential_provider/credential_provider_service.mm
@@ -145,7 +145,6 @@ password_store_->AddObserver(this); DCHECK(authentication_service_); - authentication_service_->WaitUntilCacheIsPopulated(); UpdateAccountValidationId(); if (identity_manager_) {
diff --git a/ios/chrome/browser/policy/reporting/profile_report_generator_ios.mm b/ios/chrome/browser/policy/reporting/profile_report_generator_ios.mm index 26dc4db..cbaf954 100644 --- a/ios/chrome/browser/policy/reporting/profile_report_generator_ios.mm +++ b/ios/chrome/browser/policy/reporting/profile_report_generator_ios.mm
@@ -39,10 +39,8 @@ void ProfileReportGeneratorIOS::GetSigninUserInfo( enterprise_management::ChromeUserProfileInfo* report) { - AuthenticationService* authentication_service = - AuthenticationServiceFactory::GetForBrowserState(browser_state_); - authentication_service->WaitUntilCacheIsPopulated(); - if (!authentication_service->IsAuthenticated()) { + if (!AuthenticationServiceFactory::GetForBrowserState(browser_state_) + ->IsAuthenticated()) { return; }
diff --git a/ios/chrome/browser/signin/authentication_service.h b/ios/chrome/browser/signin/authentication_service.h index dacaf27..9f8da56 100644 --- a/ios/chrome/browser/signin/authentication_service.h +++ b/ios/chrome/browser/signin/authentication_service.h
@@ -73,8 +73,6 @@ // Returns true if the user is signed in. // While the AuthenticationService is in background, this will reload the // credentials to ensure the value is up to date. - // This methods needs the identity cache to be populated. - // WaitUntilCacheIsPopulated() needs to be called before. virtual bool IsAuthenticated() const; // Returns true if the user is signed in and the identity is considered @@ -84,15 +82,9 @@ // Retrieves the identity of the currently authenticated user or |nil| if // either the user is not authenticated, or is authenticated through // ClientLogin. - // This methods needs the identity cache to be populated. - // WaitUntilCacheIsPopulated() needs to be called before. // Virtual for testing. virtual ChromeIdentity* GetAuthenticatedIdentity() const; - // Blocks until the identity cache is populated. This method is an helper for - // ChromeIdentityService::WaitUntilCacheIsPopulated(). - virtual void WaitUntilCacheIsPopulated() const; - // Signs |identity| in to Chrome with |hosted_domain| as its hosted domain, // pauses sync and logs |identity| in to http://google.com. // Virtual for testing.
diff --git a/ios/chrome/browser/signin/authentication_service.mm b/ios/chrome/browser/signin/authentication_service.mm index a1231d2..4b439ca2 100644 --- a/ios/chrome/browser/signin/authentication_service.mm +++ b/ios/chrome/browser/signin/authentication_service.mm
@@ -108,16 +108,10 @@ HandleForgottenIdentity(nil, true /* should_prompt */); - ios::ChromeIdentityService* identity_service = - ios::GetChromeBrowserProvider()->GetChromeIdentityService(); - identity_service->RunAfterCacheIsPopulated(base::BindOnce( - [](AuthenticationService* authentication_service) { - bool is_authenticated = authentication_service->IsAuthenticated(); - crash_keys::SetCurrentlySignedIn(is_authenticated); - }, - this)); + crash_keys::SetCurrentlySignedIn(IsAuthenticated()); - identity_service_observer_.Add(identity_service); + identity_service_observer_.Add( + ios::GetChromeBrowserProvider()->GetChromeIdentityService()); OnApplicationWillEnterForeground(); } @@ -140,9 +134,6 @@ UpdateHaveAccountsChangedWhileInBackground(); StoreKnownAccountsWhileInForeground(); - ios::ChromeIdentityService* identity_service = - ios::GetChromeBrowserProvider()->GetChromeIdentityService(); - identity_service->WaitUntilCacheIsPopulated(); if (IsAuthenticated()) { bool sync_enabled = sync_setup_service_->IsSyncEnabled(); LoginMethodAndSyncState loginMethodAndSyncState = @@ -153,7 +144,9 @@ LOGIN_METHOD_AND_SYNC_STATE_COUNT); } UMA_HISTOGRAM_COUNTS_100("Signin.IOSNumberOfDeviceAccounts", - identity_service->GetAllIdentities().count); + [ios::GetChromeBrowserProvider() + ->GetChromeIdentityService() + ->GetAllIdentities() count]); // Clear signin errors on the accounts that had a specific MDM device status. // This will trigger services to fetch data for these accounts again. @@ -305,12 +298,6 @@ ->GetIdentityWithGaiaID(authenticated_gaia_id); } -void AuthenticationService::WaitUntilCacheIsPopulated() const { - ios::ChromeIdentityService* identity_service = - ios::GetChromeBrowserProvider()->GetChromeIdentityService(); - identity_service->WaitUntilCacheIsPopulated(); -} - void AuthenticationService::SignIn(ChromeIdentity* identity) { DCHECK(ios::GetChromeBrowserProvider() ->GetChromeIdentityService() @@ -477,7 +464,6 @@ if (is_blocked && weak_ptr.get()) { // If the identity is blocked, sign out of the account. As only managed // account can be blocked, this will clear the associated browsing data. - weak_ptr->WaitUntilCacheIsPopulated(); if (identity == weak_ptr->GetAuthenticatedIdentity()) { weak_ptr->SignOut(signin_metrics::ABORT_SIGNIN, /*force_clear_browsing_data=*/false, nil); @@ -542,9 +528,6 @@ return; } - ios::ChromeIdentityService* identity_service = - ios::GetChromeBrowserProvider()->GetChromeIdentityService(); - identity_service->WaitUntilCacheIsPopulated(); ChromeIdentity* authenticated_identity = GetAuthenticatedIdentity(); if (authenticated_identity && authenticated_identity != invalid_identity) { // |authenticated_identity| exists and is a valid identity. Nothing to do @@ -567,7 +550,6 @@ base::AutoReset<bool> auto_reset(&is_reloading_credentials_, true); - WaitUntilCacheIsPopulated(); HandleForgottenIdentity(nil, should_prompt); if (IsAuthenticated()) { identity_manager_->GetDeviceAccountsSynchronizer()
diff --git a/ios/chrome/browser/signin/device_accounts_provider_impl.mm b/ios/chrome/browser/signin/device_accounts_provider_impl.mm index 4f06fba..b0bcb4b 100644 --- a/ios/chrome/browser/signin/device_accounts_provider_impl.mm +++ b/ios/chrome/browser/signin/device_accounts_provider_impl.mm
@@ -61,7 +61,6 @@ // copy). This is required to have correct interaction between move-only // types and Objective-C blocks. __block AccessTokenCallback scopedCallback = std::move(callback); - identity_service->WaitUntilCacheIsPopulated(); identity_service->GetAccessToken( identity_service->GetIdentityWithGaiaID(gaia_id), client_id, scopes, ^(NSString* token, NSDate* expiration, NSError* error) { @@ -74,7 +73,6 @@ std::vector<AccountInfo> accounts; ios::ChromeIdentityService* identity_service = ios::GetChromeBrowserProvider()->GetChromeIdentityService(); - identity_service->WaitUntilCacheIsPopulated(); NSArray* identities = identity_service->GetAllIdentities(); for (ChromeIdentity* identity in identities) { accounts.push_back(GetAccountInfo(identity, identity_service)); @@ -94,7 +92,6 @@ ios::ChromeIdentityService* identity_service = ios::GetChromeBrowserProvider()->GetChromeIdentityService(); - identity_service->WaitUntilCacheIsPopulated(); if (identity_service->IsMDMError( identity_service->GetIdentityWithGaiaID(gaia_id), error)) { return kAuthenticationErrorCategoryAuthorizationErrors;
diff --git a/ios/chrome/browser/sync/ios_trusted_vault_client.mm b/ios/chrome/browser/sync/ios_trusted_vault_client.mm index bfce9a09..de85b1e 100644 --- a/ios/chrome/browser/sync/ios_trusted_vault_client.mm +++ b/ios/chrome/browser/sync/ios_trusted_vault_client.mm
@@ -45,7 +45,6 @@ ios::GetChromeBrowserProvider(); ios::ChromeIdentityService* identity_service = browser_provider->GetChromeIdentityService(); - identity_service->WaitUntilCacheIsPopulated(); ChromeIdentity* identity = identity_service->GetIdentityWithGaiaID(account_info.gaia); ios::ChromeTrustedVaultService* trusted_vault_service =
diff --git a/ios/chrome/browser/ui/authentication/authentication_flow.mm b/ios/chrome/browser/ui/authentication/authentication_flow.mm index 4ae7579..9b673e8 100644 --- a/ios/chrome/browser/ui/authentication/authentication_flow.mm +++ b/ios/chrome/browser/ui/authentication/authentication_flow.mm
@@ -333,11 +333,9 @@ } - (void)checkSigninSteps { - AuthenticationService* authentication_service = - AuthenticationServiceFactory::GetForBrowserState( - _browser->GetBrowserState()); - authentication_service->WaitUntilCacheIsPopulated(); - _browserStateIdentity = authentication_service->GetAuthenticatedIdentity(); + _browserStateIdentity = AuthenticationServiceFactory::GetForBrowserState( + _browser->GetBrowserState()) + ->GetAuthenticatedIdentity(); if (_browserStateIdentity) _shouldSignOut = YES;
diff --git a/ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.mm b/ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.mm index 04e9323..30818ab 100644 --- a/ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.mm +++ b/ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.mm
@@ -72,7 +72,6 @@ if (!authService->ShouldPromptForSignIn()) return nullptr; // Returns null if user has already signed in via some other path. - authService->WaitUntilCacheIsPopulated(); if (authService->IsAuthenticated()) { authService->ResetPromptForSignIn(); return nullptr;
diff --git a/ios/chrome/browser/ui/authentication/signed_in_accounts_view_controller.mm b/ios/chrome/browser/ui/authentication/signed_in_accounts_view_controller.mm index 61653b9..d890a940 100644 --- a/ios/chrome/browser/ui/authentication/signed_in_accounts_view_controller.mm +++ b/ios/chrome/browser/ui/authentication/signed_in_accounts_view_controller.mm
@@ -206,9 +206,6 @@ if (!browserState || browserState->IsOffTheRecord()) { return NO; } - ios::ChromeIdentityService* identityService = - ios::GetChromeBrowserProvider()->GetChromeIdentityService(); - identityService->WaitUntilCacheIsPopulated(); AuthenticationService* authService = AuthenticationServiceFactory::GetForBrowserState(browserState); return !gSignedInAccountsViewControllerIsShown &&
diff --git a/ios/chrome/browser/ui/authentication/signin/signin_utils.mm b/ios/chrome/browser/ui/authentication/signin/signin_utils.mm index b2f2989a..1e8bd7bf 100644 --- a/ios/chrome/browser/ui/authentication/signin/signin_utils.mm +++ b/ios/chrome/browser/ui/authentication/signin/signin_utils.mm
@@ -72,7 +72,6 @@ AuthenticationService* authService = AuthenticationServiceFactory::GetForBrowserState(browserState); - authService->WaitUntilCacheIsPopulated(); // Do not show the SSO promo if the user is already logged in. if (authService->IsAuthenticated()) return false;
diff --git a/ios/chrome/browser/ui/authentication/signin/user_signin/logging/upgrade_signin_logger.mm b/ios/chrome/browser/ui/authentication/signin/user_signin/logging/upgrade_signin_logger.mm index 9d3de3f..b750ad3 100644 --- a/ios/chrome/browser/ui/authentication/signin/user_signin/logging/upgrade_signin_logger.mm +++ b/ios/chrome/browser/ui/authentication/signin/user_signin/logging/upgrade_signin_logger.mm
@@ -61,10 +61,9 @@ [standardDefaults setInteger:promoSeenCount forKey:kDisplayedSSORecallPromoCountKey]; - ios::ChromeIdentityService* identity_service = - ios::GetChromeBrowserProvider()->GetChromeIdentityService(); - identity_service->WaitUntilCacheIsPopulated(); - NSArray* identities = identity_service->GetAllIdentitiesSortedForDisplay(); + NSArray* identities = ios::GetChromeBrowserProvider() + ->GetChromeIdentityService() + ->GetAllIdentitiesSortedForDisplay(); UMA_HISTOGRAM_COUNTS_100(kUMASSORecallAccountsAvailable, [identities count]); UMA_HISTOGRAM_COUNTS_100(kUMASSORecallPromoSeenCount, promoSeenCount); }
diff --git a/ios/chrome/browser/ui/authentication/signin/user_signin/user_signin_coordinator.mm b/ios/chrome/browser/ui/authentication/signin/user_signin/user_signin_coordinator.mm index 271d4cc..5bd1c58 100644 --- a/ios/chrome/browser/ui/authentication/signin/user_signin/user_signin_coordinator.mm +++ b/ios/chrome/browser/ui/authentication/signin/user_signin/user_signin_coordinator.mm
@@ -111,7 +111,6 @@ AuthenticationService* authenticationService = AuthenticationServiceFactory::GetForBrowserState( self.browser->GetBrowserState()); - authenticationService->WaitUntilCacheIsPopulated(); // The user should be signed out before triggering sign-in or upgrade states. // Users are allowed to be signed-in during FirstRun for testing purposes. DCHECK(base::FeatureList::IsEnabled(signin::kMobileIdentityConsistency) ||
diff --git a/ios/chrome/browser/ui/authentication/signin_promo_view_mediator.mm b/ios/chrome/browser/ui/authentication/signin_promo_view_mediator.mm index 5cb5d08..8dad903 100644 --- a/ios/chrome/browser/ui/authentication/signin_promo_view_mediator.mm +++ b/ios/chrome/browser/ui/authentication/signin_promo_view_mediator.mm
@@ -413,10 +413,9 @@ _accessPoint = accessPoint; _browserState = browserState; _presenter = presenter; - ios::ChromeIdentityService* identityService = - ios::GetChromeBrowserProvider()->GetChromeIdentityService(); - identityService->WaitUntilCacheIsPopulated(); - NSArray* identities = identityService->GetAllIdentitiesSortedForDisplay(); + NSArray* identities = ios::GetChromeBrowserProvider() + ->GetChromeIdentityService() + ->GetAllIdentitiesSortedForDisplay(); if (identities.count != 0) { [self selectIdentity:identities[0]]; }
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/BUILD.gn b/ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/BUILD.gn index d570c1a..490ee84 100644 --- a/ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/BUILD.gn +++ b/ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/BUILD.gn
@@ -19,7 +19,6 @@ "//ios/chrome/browser", "//ios/chrome/browser/signin", "//ios/chrome/browser/ui/coordinators:chrome_coordinators", - "//ios/public/provider/chrome/browser", "//ios/public/provider/chrome/browser/signin", ] }
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_coordinator.mm b/ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_coordinator.mm index c865c06..783bb16a 100644 --- a/ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_coordinator.mm +++ b/ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_coordinator.mm
@@ -13,8 +13,6 @@ #import "ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_transition_delegate.h" #import "ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_view_controller.h" #import "ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_view_controller_presentation_delegate.h" -#import "ios/public/provider/chrome/browser/chrome_browser_provider.h" -#import "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -65,9 +63,6 @@ - (void)start { [super start]; - ios::ChromeIdentityService* chromeIdentityService = - ios::GetChromeBrowserProvider()->GetChromeIdentityService(); - chromeIdentityService->WaitUntilCacheIsPopulated(); DCHECK_EQ(IdentityChooserCoordinatorStateNotStarted, self.state); self.state = IdentityChooserCoordinatorStateStarted; // Creates the controller.
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm index 473ae123..f974f1a 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm
@@ -151,7 +151,6 @@ self.authService = AuthenticationServiceFactory::GetForBrowserState( self.browser->GetBrowserState()); - self.authService->WaitUntilCacheIsPopulated(); ntp_snippets::ContentSuggestionsService* contentSuggestionsService = IOSChromeContentSuggestionsServiceFactory::GetForBrowserState(
diff --git a/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator.mm b/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator.mm index df82b93..47e74a6 100644 --- a/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator.mm +++ b/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator.mm
@@ -671,15 +671,14 @@ - (void)updateAccountImage { UIImage* image; // Fetches user's identity from Authentication Service. - ios::ChromeIdentityService* identityService = - ios::GetChromeBrowserProvider()->GetChromeIdentityService(); - identityService->WaitUntilCacheIsPopulated(); ChromeIdentity* identity = self.authService->GetAuthenticatedIdentity(); if (identity) { // Fetches user's avatar from Authentication Service. Use cached version if // one is available. If not, use the default avatar and initiate a fetch // in the background. When background fetch completes, all observers will // be notified to refresh the user's avatar. + ios::ChromeIdentityService* identityService = + ios::GetChromeBrowserProvider()->GetChromeIdentityService(); image = identityService->GetCachedAvatarForIdentity(identity); if (!image) { image = [self defaultAvatar];
diff --git a/ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.mm b/ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.mm index 0e52b7e..7257dc70 100644 --- a/ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.mm +++ b/ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.mm
@@ -190,7 +190,6 @@ first_run::SignInAttemptStatus::NOT_ATTEMPTED; ios::ChromeIdentityService* identityService = ios::GetChromeBrowserProvider()->GetChromeIdentityService(); - identityService->WaitUntilCacheIsPopulated(); self.firstRunConfig.hasSSOAccount = identityService->HasIdentities(); if (!signin::IsSigninAllowed(_browser->GetBrowserState()->GetPrefs())) {
diff --git a/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.mm b/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.mm index 0313157..7f13e403 100644 --- a/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.mm
@@ -133,7 +133,6 @@ if (self) { _browser = browser; _closeSettingsOnAddAccount = closeSettingsOnAddAccount; - [self authService]->WaitUntilCacheIsPopulated(); _identityManagerObserver = std::make_unique<signin::IdentityManagerObserverBridge>( IdentityManagerFactory::GetForBrowserState(
diff --git a/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm b/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm index c1e104e..a88f0f2 100644 --- a/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm +++ b/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm
@@ -93,7 +93,6 @@ } - (void)start { - self.authService->WaitUntilCacheIsPopulated(); GoogleServicesSettingsViewController* viewController = [[GoogleServicesSettingsViewController alloc] initWithStyle:ChromeTableViewStyle()];
diff --git a/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm b/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm index 6a46aa6..f61c601 100644 --- a/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm +++ b/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm
@@ -93,7 +93,6 @@ - (void)start { DCHECK(self.baseNavigationController); - self.authService->WaitUntilCacheIsPopulated(); self.mediator = [[ManageSyncSettingsMediator alloc] initWithSyncService:self.syncService userPrefService:self.browser->GetBrowserState()->GetPrefs()];
diff --git a/ios/chrome/browser/ui/settings/password/passwords_coordinator.mm b/ios/chrome/browser/ui/settings/password/passwords_coordinator.mm index 9b1742a9..94f06e78 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_coordinator.mm +++ b/ios/chrome/browser/ui/settings/password/passwords_coordinator.mm
@@ -13,7 +13,6 @@ #include "ios/chrome/browser/passwords/ios_chrome_password_check_manager.h" #include "ios/chrome/browser/passwords/ios_chrome_password_check_manager_factory.h" #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" -#import "ios/chrome/browser/signin/authentication_service.h" #include "ios/chrome/browser/signin/authentication_service_factory.h" #include "ios/chrome/browser/sync/sync_setup_service_factory.h" #import "ios/chrome/browser/ui/commands/application_commands.h" @@ -97,16 +96,13 @@ #pragma mark - ChromeCoordinator - (void)start { - AuthenticationService* authenticationService = - AuthenticationServiceFactory::GetForBrowserState( - self.browser->GetBrowserState()); - authenticationService->WaitUntilCacheIsPopulated(); self.mediator = [[PasswordsMediator alloc] initWithPasswordStore:IOSChromePasswordStoreFactory::GetForBrowserState( self.browser->GetBrowserState(), ServiceAccessType::EXPLICIT_ACCESS) passwordCheckManager:[self passwordCheckManager] - authService:authenticationService + authService:AuthenticationServiceFactory::GetForBrowserState( + self.browser->GetBrowserState()) syncService:SyncSetupServiceFactory::GetForBrowserState( self.browser->GetBrowserState())]; self.reauthModule = [[ReauthenticationModule alloc]
diff --git a/ios/chrome/browser/ui/settings/safety_check/safety_check_coordinator.mm b/ios/chrome/browser/ui/settings/safety_check/safety_check_coordinator.mm index 9c641c0..c863c81ac 100644 --- a/ios/chrome/browser/ui/settings/safety_check/safety_check_coordinator.mm +++ b/ios/chrome/browser/ui/settings/safety_check/safety_check_coordinator.mm
@@ -16,7 +16,6 @@ #include "ios/chrome/browser/passwords/ios_chrome_password_check_manager.h" #include "ios/chrome/browser/passwords/ios_chrome_password_check_manager_factory.h" #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" -#import "ios/chrome/browser/signin/authentication_service.h" #import "ios/chrome/browser/signin/authentication_service_factory.h" #include "ios/chrome/browser/sync/profile_sync_service_factory.h" #import "ios/chrome/browser/sync/sync_setup_service.h" @@ -91,10 +90,6 @@ #pragma mark - ChromeCoordinator - (void)start { - AuthenticationService* authenticationService = - AuthenticationServiceFactory::GetForBrowserState( - self.browser->GetBrowserState()); - authenticationService->WaitUntilCacheIsPopulated(); SafetyCheckTableViewController* viewController = [[SafetyCheckTableViewController alloc] initWithStyle:UITableViewStyleGrouped]; @@ -106,7 +101,8 @@ self.mediator = [[SafetyCheckMediator alloc] initWithUserPrefService:self.browser->GetBrowserState()->GetPrefs() passwordCheckManager:passwordCheckManager - authService:authenticationService + authService:AuthenticationServiceFactory::GetForBrowserState( + self.browser->GetBrowserState()) syncService:SyncSetupServiceFactory::GetForBrowserState( self.browser->GetBrowserState())];
diff --git a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm index a5c9742..296d228 100644 --- a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm
@@ -314,7 +314,6 @@ AuthenticationService* authService = AuthenticationServiceFactory::GetForBrowserState(_browserState); - authService->WaitUntilCacheIsPopulated(); _identity = authService->GetAuthenticatedIdentity(); _identityServiceObserver.reset( new ChromeIdentityServiceObserverBridge(self));
diff --git a/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm b/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm index 3d6e4a0e..b1c13209 100644 --- a/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm
@@ -93,11 +93,9 @@ ChromeBrowserState* browserState = self.browser->GetBrowserState(); self.title = l10n_util::GetNSString(IDS_IOS_SYNC_ENTER_PASSPHRASE_TITLE); self.shouldHideDoneButton = YES; - AuthenticationService* authenticationService = - AuthenticationServiceFactory::GetForBrowserState(browserState); - authenticationService->WaitUntilCacheIsPopulated(); NSString* userEmail = - authenticationService->GetAuthenticatedIdentity().userEmail; + [AuthenticationServiceFactory::GetForBrowserState(browserState) + ->GetAuthenticatedIdentity() userEmail]; DCHECK(userEmail); syncer::SyncService* service = ProfileSyncServiceFactory::GetForBrowserState(browserState);
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1 index 12208ff..1aa246cf 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -8493e8d04083a4921d0d46b556443bf8f978d42c \ No newline at end of file +cfb6628631b0eade9a89c3a9e026153bcb0ff25b \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1 index 1905e8e..e60d062 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -78fdced5554ddd871ff39e4b943c57a9840ac6e0 \ No newline at end of file +f9b2d3ca7121aa9d58a0638b109902715c95f902 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1 index 482be11..77bd28fa 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -11e8055d0ca7ed3c174263771a9f5099831a285c \ No newline at end of file +b307b9973183217fa47e4d6705850225c2f43b14 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1 index e4fe888a..eed9afe4 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -ba13d4d17a95485196a6ec2b0a3e990f677448d9 \ No newline at end of file +17af97771d1bcb3e9ccc18a0fbc691aed670c264 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1 index abfb929..09d7252 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -d2bdd8ef794346dd9609aebc7f2c0c3626831510 \ No newline at end of file +133c69e75363e84ce3c453776561f8a552355eee \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1 index 23d84fc..3465aa5 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -33afa940b3f0967f8549d3e0bef245b033af237f \ No newline at end of file +0bc5985329576385fb0f8ba74334dea1f8a857f1 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1 index 85d82dc..a925d08 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.arm64.zip.sha1
@@ -1 +1 @@ -ccedac2b85d68b3dc14a5ecb67c2b7484c566ed8 \ No newline at end of file +f6564d72809e153e72815297ba2b55b54db3de19 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1 index b9cfb6ed..5b1b32ef 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.x64.zip.sha1
@@ -1 +1 @@ -256a34114e3c2c394a21d27377b2a04978d71550 \ No newline at end of file +f3eeaa520ee1c07670e2a1c5ab83f938ed15d086 \ No newline at end of file
diff --git a/ios/web/navigation/navigation_item_storage_builder.h b/ios/web/navigation/navigation_item_storage_builder.h index c180441..4e5a767 100644 --- a/ios/web/navigation/navigation_item_storage_builder.h +++ b/ios/web/navigation/navigation_item_storage_builder.h
@@ -16,6 +16,9 @@ // Class that can serialize and deserialize NavigationItems. class NavigationItemStorageBuilder { public: + // Returns approximate sizes of the given |navigation_item| without building + // storage. Only string sizes are added. + int ItemStoredSize(NavigationItemImpl* navigation_item) const; // Creates a serialized NavigationItem from |navigation_Item|. CRWNavigationItemStorage* BuildStorage( NavigationItemImpl* navigation_item) const;
diff --git a/ios/web/navigation/navigation_item_storage_builder.mm b/ios/web/navigation/navigation_item_storage_builder.mm index e9ffca7..9da16008 100644 --- a/ios/web/navigation/navigation_item_storage_builder.mm +++ b/ios/web/navigation/navigation_item_storage_builder.mm
@@ -15,6 +15,21 @@ namespace web { +int NavigationItemStorageBuilder::ItemStoredSize( + NavigationItemImpl* navigation_item) const { + DCHECK(navigation_item); + int size = 0; + size += navigation_item->virtual_url_.spec().size(); + size += navigation_item->url_.spec().size(); + size += navigation_item->referrer_.url.spec().size(); + size += navigation_item->title_.size(); + for (NSString* key in navigation_item->http_request_headers_) { + NSString* value = navigation_item->http_request_headers_[key]; + size += key.length + value.length; + } + return size; +} + CRWNavigationItemStorage* NavigationItemStorageBuilder::BuildStorage( NavigationItemImpl* navigation_item) const { DCHECK(navigation_item);
diff --git a/ios/web/navigation/session_storage_builder.h b/ios/web/navigation/session_storage_builder.h index 82f2c8f..0caf846 100644 --- a/ios/web/navigation/session_storage_builder.h +++ b/ios/web/navigation/session_storage_builder.h
@@ -11,6 +11,9 @@ class WebStateImpl; +// Allow navigation items up to ~63k (like components/sessions/core) +const int kMaxNavigationItemSize = 63 * 1024; + // Class that can serialize and deserialize session information. class SessionStorageBuilder { public:
diff --git a/ios/web/navigation/session_storage_builder.mm b/ios/web/navigation/session_storage_builder.mm index 11817a0..f99a00e 100644 --- a/ios/web/navigation/session_storage_builder.mm +++ b/ios/web/navigation/session_storage_builder.mm
@@ -45,6 +45,7 @@ NSMutableArray* item_storages = [[NSMutableArray alloc] init]; NavigationItemStorageBuilder item_storage_builder; size_t originalIndex = session_storage.lastCommittedItemIndex; + // Drop URLs larger than a certain threshold. for (size_t index = 0; index < static_cast<size_t>(navigation_manager->GetItemCount()); ++index) { @@ -57,6 +58,18 @@ } continue; } + if (base::FeatureList::IsEnabled(features::kReduceSessionSize)) { + // Go through the builder who's a friend of web::NavigationItemImpl + // and has access to raw fields, so for example url is not + // counted twice if virtyual url is empty. + if (item_storage_builder.ItemStoredSize(item) > kMaxNavigationItemSize) { + if (index <= originalIndex) { + session_storage.lastCommittedItemIndex--; + } + continue; + } + } + [item_storages addObject:item_storage_builder.BuildStorage(item)]; }
diff --git a/ios/web/navigation/session_storage_builder_unittest.mm b/ios/web/navigation/session_storage_builder_unittest.mm index 3ad77536..2a26337e 100644 --- a/ios/web/navigation/session_storage_builder_unittest.mm +++ b/ios/web/navigation/session_storage_builder_unittest.mm
@@ -5,6 +5,8 @@ #import "ios/web/navigation/session_storage_builder.h" #include "base/strings/sys_string_conversions.h" +#include "base/test/scoped_feature_list.h" +#include "ios/web/common/features.h" #import "ios/web/navigation/wk_navigation_util.h" #import "ios/web/public/session/crw_navigation_item_storage.h" #import "ios/web/public/session/crw_session_storage.h" @@ -47,6 +49,51 @@ using SessionStorageBuilderTest = WebTest; +void SetNavigationItemSizedStrings(WebStateWithMockProxy& web_state, + int index, + int url_length, + int virtual_url_length, + int title_length, + int referrer_url_length) { + NavigationItemImpl* item = + web_state.GetNavigationManagerImpl().GetNavigationItemImplAtIndex(index); + if (url_length) { + NSString* url = [@"https://" stringByPaddingToLength:url_length + withString:@"a" + startingAtIndex:0]; + item->SetURL(GURL(base::SysNSStringToUTF8(url))); + } else { + item->SetURL(GURL()); + } + if (virtual_url_length) { + NSString* virtual_url = + [@"https://" stringByPaddingToLength:virtual_url_length + withString:@"b" + startingAtIndex:0]; + item->SetVirtualURL(GURL(base::SysNSStringToUTF8(virtual_url))); + } else { + item->SetVirtualURL(GURL()); + } + if (title_length) { + NSString* title = [@"" stringByPaddingToLength:title_length + withString:@"c" + startingAtIndex:0]; + item->SetTitle(base::SysNSStringToUTF16(title)); + } else { + item->SetTitle(base::SysNSStringToUTF16(@"")); + } + + Referrer referrer; + if (referrer_url_length) { + NSString* referrer_url = + [@"https://" stringByPaddingToLength:referrer_url_length + withString:@"d" + startingAtIndex:0]; + referrer.url = GURL(base::SysNSStringToUTF8(referrer_url)); + } + item->SetReferrer(referrer); +} + // Tests building storage for session that is longer than kMaxSessionSize with // last committed item at the end of the session. TEST_F(SessionStorageBuilderTest, BuildStorageForExtraLongSession) { @@ -170,4 +217,87 @@ EXPECT_EQ(GURL::EmptyGURL(), [storage.itemStorages.firstObject referrer].url); } +// Tests building storage for session that has items longer than +// web::kMaxNavigationItemSize. +TEST_F(SessionStorageBuilderTest, SkipItemOverMaxSize) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndEnableFeature(features::kReduceSessionSize); + + // Create WebState with navigation item count that are below maximum size. + WebState::CreateParams params(GetBrowserState()); + WebStateWithMockProxy web_state(params); + + NSString* normal_url = @"https://foo.test"; + NSString* const current_url = normal_url; + [web_state.fake_wk_list() setCurrentURL:normal_url + backListURLs:@[ normal_url ] + forwardListURLs:nil]; + OCMStub([web_state.mock_web_view() URL]) + .andReturn([NSURL URLWithString:current_url]); + NavigationManager* navigation_manager = web_state.GetNavigationManager(); + ASSERT_EQ(2, navigation_manager->GetItemCount()); + + SessionStorageBuilder builder; + CRWSessionStorage* storage = builder.BuildStorage(&web_state); + ASSERT_TRUE(storage); + ASSERT_EQ(2U, storage.itemStorages.count); + + SetNavigationItemSizedStrings(web_state, 0, web::kMaxNavigationItemSize - 1, + 0, 0, 0); + storage = builder.BuildStorage(&web_state); + ASSERT_TRUE(storage); + ASSERT_EQ(2U, storage.itemStorages.count); + + SetNavigationItemSizedStrings(web_state, 0, web::kMaxNavigationItemSize, 0, 0, + 0); + + storage = builder.BuildStorage(&web_state); + ASSERT_TRUE(storage); + ASSERT_EQ(1U, storage.itemStorages.count); + + SetNavigationItemSizedStrings( + web_state, 0, web::kMaxNavigationItemSize - 1000 - 1, 1000 - 1, 0, 0); + + storage = builder.BuildStorage(&web_state); + ASSERT_TRUE(storage); + ASSERT_EQ(2U, storage.itemStorages.count); + + SetNavigationItemSizedStrings(web_state, 0, + web::kMaxNavigationItemSize - 1000, 1000, 0, 0); + + storage = builder.BuildStorage(&web_state); + ASSERT_TRUE(storage); + ASSERT_EQ(1U, storage.itemStorages.count); + + SetNavigationItemSizedStrings(web_state, 0, + web::kMaxNavigationItemSize - 1040 - 1, + 1000 - 1, 40 - 1, 0); + + storage = builder.BuildStorage(&web_state); + ASSERT_TRUE(storage); + ASSERT_EQ(2U, storage.itemStorages.count); + + SetNavigationItemSizedStrings( + web_state, 0, web::kMaxNavigationItemSize - 1040, 1000, 40, 0); + + storage = builder.BuildStorage(&web_state); + ASSERT_TRUE(storage); + ASSERT_EQ(1U, storage.itemStorages.count); + + SetNavigationItemSizedStrings(web_state, 0, + web::kMaxNavigationItemSize - 2040 - 1, + 1000 - 1, 40 - 1, 1000 - 1); + + storage = builder.BuildStorage(&web_state); + ASSERT_TRUE(storage); + ASSERT_EQ(2U, storage.itemStorages.count); + + SetNavigationItemSizedStrings( + web_state, 0, web::kMaxNavigationItemSize - 2040, 1000, 40, 1000); + + storage = builder.BuildStorage(&web_state); + ASSERT_TRUE(storage); + ASSERT_EQ(1U, storage.itemStorages.count); +} + } // namespace web
diff --git a/media/capture/video/mac/video_capture_device_avfoundation_mac.mm b/media/capture/video/mac/video_capture_device_avfoundation_mac.mm index e4457496..1ea68ad 100644 --- a/media/capture/video/mac/video_capture_device_avfoundation_mac.mm +++ b/media/capture/video/mac/video_capture_device_avfoundation_mac.mm
@@ -693,11 +693,22 @@ const base::TimeDelta timestamp = GetCMSampleBufferTimestamp(sampleBuffer); + // The SampleBufferTransformer CHECK-crashes if the sample buffer is not MJPEG + // and does not have a pixel buffer (https://crbug.com/1160647) so we fall + // back on the M87 code path if this is the case. + // TODO(https://crbug.com/1160315): When the SampleBufferTransformer is + // patched to support non-MJPEG-and-non-pixel-buffer sample buffers, remove + // this workaround. + bool sampleBufferLacksPixelBufferAndIsNotMjpeg = + !CMSampleBufferGetImageBuffer(sampleBuffer) && + CMFormatDescriptionGetMediaSubType(CMSampleBufferGetFormatDescription( + sampleBuffer)) != kCMVideoCodecType_JPEG_OpenDML; + // If the SampleBufferTransformer is enabled, convert all possible capture // formats to an IOSurface-backed NV12 pixel buffer. // TODO(hbos): If |_sampleBufferTransformer| gets shipped 100%, delete the // other code paths. - if (_sampleBufferTransformer) { + if (_sampleBufferTransformer && !sampleBufferLacksPixelBufferAndIsNotMjpeg) { base::ScopedCFTypeRef<CVPixelBufferRef> pixelBuffer = _sampleBufferTransformer->AutoReconfigureAndTransform(sampleBuffer); if (!pixelBuffer) {
diff --git a/remoting/host/evaluate_capability.cc b/remoting/host/evaluate_capability.cc index 321aa17..47e3120 100644 --- a/remoting/host/evaluate_capability.cc +++ b/remoting/host/evaluate_capability.cc
@@ -7,14 +7,13 @@ #include <iostream> #include "base/base_paths.h" -#include "base/check.h" #include "base/command_line.h" #include "base/files/file_path.h" +#include "base/logging.h" #include "base/notreached.h" #include "base/path_service.h" #include "base/process/kill.h" #include "base/process/launch.h" -#include "base/threading/thread_restrictions.h" #include "build/build_config.h" #include "remoting/host/host_exit_codes.h" #include "remoting/host/ipc_constants.h" @@ -27,9 +26,6 @@ namespace remoting { -// TODO(crbug.com/1144161): Do not perform blocking operations on the IO thread. -class ScopedBypassIOThreadRestrictions : public base::ScopedAllowBlocking {}; - namespace { // Returns the full path of the binary file we should use to evaluate the @@ -117,22 +113,23 @@ output = &dummy_output; } - // TODO(crbug.com/1144161): Do not perform blocking operations on the IO - // thread. - ScopedBypassIOThreadRestrictions bypass; -#if DCHECK_IS_ON() && !defined(OS_WIN) - const bool result = + bool result = base::GetAppOutputWithExitCode(command, output, &exit_code); +#if defined(OS_WIN) + // On Windows, base::GetAppOutputWithExitCode() usually returns false when + // receiving "unknown" exit code. See + // https://cs.chromium.org/chromium/src/base/process/launch_win.cc?rcl=39ec40095376e8d977decbdc5d7ca28ba7d39cf2&l=130 + // But we forward the |exit_code| through return value, so the return value of + // base::GetAppOutputWithExitCode() should be ignored. + result = true; #endif - base::GetAppOutputWithExitCode(command, output, &exit_code); - -// On Windows, base::GetAppOutputWithExitCode() usually returns false when -// receiving "unknown" exit code. See -// https://cs.chromium.org/chromium/src/base/process/launch_win.cc?rcl=39ec40095376e8d977decbdc5d7ca28ba7d39cf2&l=130 -#if DCHECK_IS_ON() && !defined(OS_WIN) - DCHECK(result) << "Failed to execute process " - << command.GetCommandLineString() << ", exit code " - << exit_code; -#endif + if (!result) { + LOG(ERROR) << "Failed to execute process " + << command.GetCommandLineString() + << ", exit code " + << exit_code; + // This should not happen. + NOTREACHED(); + } return exit_code; }
diff --git a/services/network/public/cpp/data_element.cc b/services/network/public/cpp/data_element.cc index ad83f0a..32879fe 100644 --- a/services/network/public/cpp/data_element.cc +++ b/services/network/public/cpp/data_element.cc
@@ -81,6 +81,13 @@ return clone; } +const mojo::PendingRemote<mojom::ChunkedDataPipeGetter>& +DataElement::chunked_data_pipe_getter() const { + DCHECK(type_ == mojom::DataElementType::kChunkedDataPipe || + type_ == mojom::DataElementType::kReadOnceStream); + return chunked_data_pipe_getter_; +} + mojo::PendingRemote<mojom::ChunkedDataPipeGetter> DataElement::ReleaseChunkedDataPipeGetter() { DCHECK(type_ == mojom::DataElementType::kChunkedDataPipe ||
diff --git a/services/network/public/cpp/data_element.h b/services/network/public/cpp/data_element.h index 3024a07..7eeb277b 100644 --- a/services/network/public/cpp/data_element.h +++ b/services/network/public/cpp/data_element.h
@@ -121,8 +121,12 @@ mojo::PendingRemote<mojom::DataPipeGetter> ReleaseDataPipeGetter(); mojo::PendingRemote<mojom::DataPipeGetter> CloneDataPipeGetter() const; + // Can be called only when this is of type kChunkedDataPipe or + // kReadOnceStream. + const mojo::PendingRemote<mojom::ChunkedDataPipeGetter>& + chunked_data_pipe_getter() const; // Takes ownership of the DataPipeGetter, if this is of - // TYPE_CHUNKED_DATA_PIPE. + // kChunkedDataPipe or kReadOnceStream. mojo::PendingRemote<mojom::ChunkedDataPipeGetter> ReleaseChunkedDataPipeGetter();
diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc index c92b8a07..3f5b58a7 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc
@@ -648,6 +648,25 @@ // Resolve elements from request_body and prepare upload data. if (request.request_body.get()) { + const auto& elements = *request.request_body->elements(); + // TODO(crbug.com/1156550): Move this logic to the deserialization part. + if (elements.size() == 1 && + (elements[0].type() == mojom::DataElementType::kChunkedDataPipe || + elements[0].type() == mojom::DataElementType::kReadOnceStream)) { + const bool chunked_data_pipe_getter_is_valid = + elements[0].chunked_data_pipe_getter().is_valid(); + UMA_HISTOGRAM_BOOLEAN( + "NetworkService.StreamingUploadDataPipeGetterValidity", + chunked_data_pipe_getter_is_valid); + if (!chunked_data_pipe_getter_is_valid) { + base::SequencedTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::BindOnce(&URLLoader::NotifyCompleted, base::Unretained(this), + net::ERR_INVALID_ARGUMENT)); + return; + } + } + OpenFilesForUpload(request); return; }
diff --git a/skia/config/SkUserConfig.h b/skia/config/SkUserConfig.h index 42abc3e..d973db06 100644 --- a/skia/config/SkUserConfig.h +++ b/skia/config/SkUserConfig.h
@@ -221,6 +221,10 @@ #define SK_SUPPORT_LEGACY_AAA_CHOICE #endif +#ifndef SK_SUPPORT_LEGACY_SPRITE_IGNORE_HQ +#define SK_SUPPORT_LEGACY_SPRITE_IGNORE_HQ +#endif + #ifndef GR_OP_ALLOCATE_USE_NEW #define GR_OP_ALLOCATE_USE_NEW #endif
diff --git a/testing/buildbot/chromium.android.fyi.json b/testing/buildbot/chromium.android.fyi.json index ac78802..023a4809 100644 --- a/testing/buildbot/chromium.android.fyi.json +++ b/testing/buildbot/chromium.android.fyi.json
@@ -240,11 +240,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.122" + "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.123" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.122", + "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.123", "resultdb": { "enable": true }, @@ -254,7 +254,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M87", - "revision": "version:87.0.4280.122" + "revision": "version:87.0.4280.123" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -317,11 +317,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.55" + "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.56" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.55", + "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.56", "resultdb": { "enable": true }, @@ -331,7 +331,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M88", - "revision": "version:88.0.4324.55" + "revision": "version:88.0.4324.56" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -394,11 +394,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.122" + "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.123" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.122", + "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.123", "resultdb": { "enable": true }, @@ -408,7 +408,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M87", - "revision": "version:87.0.4280.122" + "revision": "version:87.0.4280.123" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -471,11 +471,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.55" + "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.56" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.55", + "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.56", "resultdb": { "enable": true }, @@ -485,7 +485,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M88", - "revision": "version:88.0.4324.55" + "revision": "version:88.0.4324.56" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -769,11 +769,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.122" + "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.123" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.122", + "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.123", "resultdb": { "enable": true }, @@ -783,7 +783,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M87", - "revision": "version:87.0.4280.122" + "revision": "version:87.0.4280.123" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -846,11 +846,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.55" + "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.56" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.55", + "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.56", "resultdb": { "enable": true }, @@ -860,7 +860,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M88", - "revision": "version:88.0.4324.55" + "revision": "version:88.0.4324.56" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -923,11 +923,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.122" + "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.123" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.122", + "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.123", "resultdb": { "enable": true }, @@ -937,7 +937,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M87", - "revision": "version:87.0.4280.122" + "revision": "version:87.0.4280.123" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -1000,11 +1000,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.55" + "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.56" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.55", + "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.56", "resultdb": { "enable": true }, @@ -1014,7 +1014,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M88", - "revision": "version:88.0.4324.55" + "revision": "version:88.0.4324.56" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -1298,11 +1298,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.122" + "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.123" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.122", + "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.123", "resultdb": { "enable": true }, @@ -1312,7 +1312,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M87", - "revision": "version:87.0.4280.122" + "revision": "version:87.0.4280.123" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -1375,11 +1375,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.55" + "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.56" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.55", + "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.56", "resultdb": { "enable": true }, @@ -1389,7 +1389,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M88", - "revision": "version:88.0.4324.55" + "revision": "version:88.0.4324.56" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -1452,11 +1452,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.122" + "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.123" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.122", + "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.123", "resultdb": { "enable": true }, @@ -1466,7 +1466,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M87", - "revision": "version:87.0.4280.122" + "revision": "version:87.0.4280.123" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -1529,11 +1529,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.55" + "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.56" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.55", + "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.56", "resultdb": { "enable": true }, @@ -1543,7 +1543,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M88", - "revision": "version:88.0.4324.55" + "revision": "version:88.0.4324.56" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -1827,11 +1827,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.122" + "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.123" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.122", + "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 87.0.4280.123", "resultdb": { "enable": true }, @@ -1841,7 +1841,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M87", - "revision": "version:87.0.4280.122" + "revision": "version:87.0.4280.123" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -1904,11 +1904,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.55" + "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.56" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.55", + "name": "weblayer_instrumentation_test_versions_apk_Client Tests For 88.0.4324.56", "resultdb": { "enable": true }, @@ -1918,7 +1918,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M88", - "revision": "version:88.0.4324.55" + "revision": "version:88.0.4324.56" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -1981,11 +1981,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.122" + "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.123" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.122", + "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 87.0.4280.123", "resultdb": { "enable": true }, @@ -1995,7 +1995,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M87", - "revision": "version:87.0.4280.122" + "revision": "version:87.0.4280.123" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -2058,11 +2058,11 @@ "--bucket", "chromium-result-details", "--test-name", - "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.55" + "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.56" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" }, - "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.55", + "name": "weblayer_instrumentation_test_versions_apk_Implementation Tests For 88.0.4324.56", "resultdb": { "enable": true }, @@ -2072,7 +2072,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M88", - "revision": "version:88.0.4324.55" + "revision": "version:88.0.4324.56" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}",
diff --git a/testing/buildbot/variants.pyl b/testing/buildbot/variants.pyl index b70a2561..54ec3921 100644 --- a/testing/buildbot/variants.pyl +++ b/testing/buildbot/variants.pyl
@@ -319,13 +319,13 @@ '../../weblayer/browser/android/javatests/skew/expectations.txt', '--impl-version=88', ], - 'identifier': 'Implementation Tests For 88.0.4324.55', + 'identifier': 'Implementation Tests For 88.0.4324.56', 'swarming': { 'cipd_packages': [ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M88', - 'revision': 'version:88.0.4324.55', + 'revision': 'version:88.0.4324.56', } ], }, @@ -342,13 +342,13 @@ '../../weblayer/browser/android/javatests/skew/expectations.txt', '--impl-version=87', ], - 'identifier': 'Implementation Tests For 87.0.4280.122', + 'identifier': 'Implementation Tests For 87.0.4280.123', 'swarming': { 'cipd_packages': [ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M87', - 'revision': 'version:87.0.4280.122', + 'revision': 'version:87.0.4280.123', } ], }, @@ -388,13 +388,13 @@ '../../weblayer/browser/android/javatests/skew/expectations.txt', '--client-version=88', ], - 'identifier': 'Client Tests For 88.0.4324.55', + 'identifier': 'Client Tests For 88.0.4324.56', 'swarming': { 'cipd_packages': [ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M88', - 'revision': 'version:88.0.4324.55', + 'revision': 'version:88.0.4324.56', } ], }, @@ -411,13 +411,13 @@ '../../weblayer/browser/android/javatests/skew/expectations.txt', '--client-version=87', ], - 'identifier': 'Client Tests For 87.0.4280.122', + 'identifier': 'Client Tests For 87.0.4280.123', 'swarming': { 'cipd_packages': [ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M87', - 'revision': 'version:87.0.4280.122', + 'revision': 'version:87.0.4280.123', } ], },
diff --git a/third_party/blink/public/BUILD.gn b/third_party/blink/public/BUILD.gn index f79d47a..92600b5 100644 --- a/third_party/blink/public/BUILD.gn +++ b/third_party/blink/public/BUILD.gn
@@ -72,8 +72,8 @@ if (is_android) { java_cpp_enum("blink_headers_java_enums_srcjar") { sources = [ - "./common/context_menu_data/media_type.h", "./common/input/web_input_event.h", + "./mojom/context_menu/context_menu_data.mojom", "./platform/web_text_input_mode.h", "./platform/web_text_input_type.h", ]
diff --git a/third_party/blink/public/common/BUILD.gn b/third_party/blink/public/common/BUILD.gn index bb3d652..1b409bc 100644 --- a/third_party/blink/public/common/BUILD.gn +++ b/third_party/blink/public/common/BUILD.gn
@@ -69,7 +69,6 @@ "client_hints/client_hints.h", "context_menu_data/edit_flags.h", "context_menu_data/input_field_type.h", - "context_menu_data/media_type.h", "css/forced_colors.h", "css/navigation_controls.h", "css/page_orientation.h",
diff --git a/third_party/blink/public/common/context_menu_data/media_type.h b/third_party/blink/public/common/context_menu_data/media_type.h deleted file mode 100644 index 24b9750..0000000 --- a/third_party/blink/public/common/context_menu_data/media_type.h +++ /dev/null
@@ -1,33 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_CONTEXT_MENU_DATA_MEDIA_TYPE_H_ -#define THIRD_PARTY_BLINK_PUBLIC_COMMON_CONTEXT_MENU_DATA_MEDIA_TYPE_H_ - -namespace blink { - -// A Java counterpart will be generated for this enum. -// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.blink_public.common -// GENERATED_JAVA_CLASS_NAME_OVERRIDE: ContextMenuDataMediaType -enum class ContextMenuDataMediaType { - // No special node is in context. - kNone, - // An image node is selected. - kImage, - // A video node is selected. - kVideo, - // An audio node is selected. - kAudio, - // A canvas node is selected. - kCanvas, - // A file node is selected. - kFile, - // A plugin node is selected. - kPlugin, - kLast = kPlugin -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_CONTEXT_MENU_DATA_MEDIA_TYPE_H_
diff --git a/third_party/blink/public/mojom/BUILD.gn b/third_party/blink/public/mojom/BUILD.gn index 4e5cda1..9fb6d365 100644 --- a/third_party/blink/public/mojom/BUILD.gn +++ b/third_party/blink/public/mojom/BUILD.gn
@@ -42,6 +42,7 @@ "clipboard/raw_clipboard.mojom", "commit_result/commit_result.mojom", "content_index/content_index.mojom", + "context_menu/context_menu_data.mojom", "conversions/conversions.mojom", "cookie_store/cookie_store.mojom", "crash/crash_memory_metrics_reporter.mojom",
diff --git a/third_party/blink/public/mojom/context_menu/OWNERS b/third_party/blink/public/mojom/context_menu/OWNERS new file mode 100644 index 0000000..08850f4 --- /dev/null +++ b/third_party/blink/public/mojom/context_menu/OWNERS
@@ -0,0 +1,2 @@ +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/third_party/blink/public/mojom/context_menu/context_menu_data.mojom b/third_party/blink/public/mojom/context_menu/context_menu_data.mojom new file mode 100644 index 0000000..c7d209d --- /dev/null +++ b/third_party/blink/public/mojom/context_menu/context_menu_data.mojom
@@ -0,0 +1,30 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module blink.mojom; + +// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.blink_public.common +// GENERATED_JAVA_CLASS_NAME_OVERRIDE: ContextMenuDataMediaType +enum ContextMenuDataMediaType { + // No special node is in context. + kNone, + + // An image node is selected. + kImage, + + // A video node is selected. + kVideo, + + // An audio node is selected. + kAudio, + + // A canvas node is selected. + kCanvas, + + // A file node is selected. + kFile, + + // A plugin node is selected. + kPlugin, +};
diff --git a/third_party/blink/public/mojom/web_feature/web_feature.mojom b/third_party/blink/public/mojom/web_feature/web_feature.mojom index b314567..9117bb9a 100644 --- a/third_party/blink/public/mojom/web_feature/web_feature.mojom +++ b/third_party/blink/public/mojom/web_feature/web_feature.mojom
@@ -3064,7 +3064,6 @@ kCrossOriginSubframeWithoutEmbeddingControl = 3742, kReadableStreamWithByteSource = 3743, kReadableStreamBYOBReader = 3744, - kSetReferrerPolicyUnsafeUrlInSecureContext = 3745, // Add new features immediately above this line. Don't change assigned // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/blink/public/web/web_context_menu_data.h b/third_party/blink/public/web/web_context_menu_data.h index 0fe7554..e63cfef 100644 --- a/third_party/blink/public/web/web_context_menu_data.h +++ b/third_party/blink/public/web/web_context_menu_data.h
@@ -33,8 +33,8 @@ #include "services/network/public/mojom/referrer_policy.mojom-shared.h" #include "third_party/blink/public/common/context_menu_data/input_field_type.h" -#include "third_party/blink/public/common/context_menu_data/media_type.h" #include "third_party/blink/public/common/input/web_menu_source_type.h" +#include "third_party/blink/public/mojom/context_menu/context_menu_data.mojom-shared.h" #include "third_party/blink/public/platform/web_impression.h" #include "third_party/blink/public/platform/web_rect.h" #include "third_party/blink/public/platform/web_string.h" @@ -48,8 +48,8 @@ // This struct is passed to WebViewClient::ShowContextMenu. struct WebContextMenuData { // The type of media the context menu is being invoked on. - // using MediaType = ContextMenuDataMediaType; - ContextMenuDataMediaType media_type; + // using MediaType = blink::mojom::ContextMenuDataMediaType; + blink::mojom::ContextMenuDataMediaType media_type; // The x and y position of the mouse pointer (relative to the webview). gfx::Point mouse_position; @@ -155,7 +155,7 @@ WebMenuSourceType source_type; WebContextMenuData() - : media_type(ContextMenuDataMediaType::kNone), + : media_type(blink::mojom::ContextMenuDataMediaType::kNone), has_image_contents(false), media_flags(kMediaNone), is_spell_checking_enabled(false),
diff --git a/third_party/blink/renderer/core/execution_context/execution_context.cc b/third_party/blink/renderer/core/execution_context/execution_context.cc index b898dd9..f191f6df 100644 --- a/third_party/blink/renderer/core/execution_context/execution_context.cc +++ b/third_party/blink/renderer/core/execution_context/execution_context.cc
@@ -434,11 +434,6 @@ UseCounter::Count(this, WebFeature::kSetReferrerPolicy); if (referrer_policy_ != network::mojom::ReferrerPolicy::kDefault) UseCounter::Count(this, WebFeature::kResetReferrerPolicy); - if (IsSecureContext() && - referrer_policy == network::mojom::ReferrerPolicy::kAlways) { - UseCounter::Count(this, - WebFeature::kSetReferrerPolicyUnsafeUrlInSecureContext); - } referrer_policy_ = referrer_policy; }
diff --git a/third_party/blink/renderer/core/html/canvas/image_data.cc b/third_party/blink/renderer/core/html/canvas/image_data.cc index eb4eb12..19593e7 100644 --- a/third_party/blink/renderer/core/html/canvas/image_data.cc +++ b/third_party/blink/renderer/core/html/canvas/image_data.cc
@@ -53,37 +53,36 @@ } // namespace bool ImageData::ValidateConstructorArguments( - const unsigned& param_flags, const IntSize* size, - const unsigned& width, - const unsigned& height, - const NotShared<DOMArrayBufferView> data, + const unsigned* width, + const unsigned* height, + const NotShared<DOMArrayBufferView>* data, const ImageDataSettings* settings, ExceptionState* exception_state) { // We accept all the combinations of colorSpace and storageFormat in an // ImageDataSettings to be stored in an ImageData. Therefore, we don't // check the color settings in this function. - if ((param_flags & kParamWidth) && !width) { + if (width && !*width) { return RaiseDOMExceptionAndReturnFalse( exception_state, DOMExceptionCode::kIndexSizeError, "The source width is zero or not a number."); } - if ((param_flags & kParamHeight) && !height) { + if (height && !*height) { return RaiseDOMExceptionAndReturnFalse( exception_state, DOMExceptionCode::kIndexSizeError, "The source height is zero or not a number."); } - if (param_flags & (kParamWidth | kParamHeight)) { + if (width || height) { base::CheckedNumeric<unsigned> data_size = StorageFormatBytesPerPixel(kUint8ClampedArrayStorageFormatName); if (settings) { data_size = StorageFormatBytesPerPixel(settings->storageFormat()); } - data_size *= width; - data_size *= height; + data_size *= width ? *width : 0; + data_size *= height ? *height : 0; if (!data_size.IsValid()) { return RaiseDOMExceptionAndReturnFalse( exception_state, DOMExceptionCode::kIndexSizeError, @@ -100,11 +99,11 @@ } unsigned data_length = 0; - if (param_flags & kParamData) { + if (data) { DCHECK(data); - if (data->GetType() != DOMArrayBufferView::ViewType::kTypeUint8Clamped && - data->GetType() != DOMArrayBufferView::ViewType::kTypeUint16 && - data->GetType() != DOMArrayBufferView::ViewType::kTypeFloat32) { + if ((*data)->GetType() != DOMArrayBufferView::ViewType::kTypeUint8Clamped && + (*data)->GetType() != DOMArrayBufferView::ViewType::kTypeUint16 && + (*data)->GetType() != DOMArrayBufferView::ViewType::kTypeFloat32) { return RaiseDOMExceptionAndReturnFalse( exception_state, DOMExceptionCode::kNotSupportedError, "The input data type is not supported."); @@ -115,7 +114,7 @@ std::numeric_limits<uint32_t>::max(), "We use UINT32_MAX as the upper bound of the input size and expect " "that the result fits into an `unsigned`."); - if (!base::CheckedNumeric<uint32_t>(data->byteLength()) + if (!base::CheckedNumeric<uint32_t>((*data)->byteLength()) .AssignIfValid(&data_length)) { return RaiseDOMExceptionAndReturnFalse( exception_state, DOMExceptionCode::kNotSupportedError, @@ -126,27 +125,26 @@ exception_state, DOMExceptionCode::kInvalidStateError, "The input data has zero elements."); } - data_length /= data->TypeSize(); + data_length /= (*data)->TypeSize(); if (data_length % 4) { return RaiseDOMExceptionAndReturnFalse( exception_state, DOMExceptionCode::kInvalidStateError, "The input data length is not a multiple of 4."); } - if ((param_flags & kParamWidth) && (data_length / 4) % width) { + if (width && (data_length / 4) % *width) { return RaiseDOMExceptionAndReturnFalse( exception_state, DOMExceptionCode::kIndexSizeError, "The input data length is not a multiple of (4 * width)."); } - if ((param_flags & kParamWidth) && (param_flags & kParamHeight) && - height != data_length / (4 * width)) + if (width && height && *height != data_length / (4 * *width)) return RaiseDOMExceptionAndReturnFalse( exception_state, DOMExceptionCode::kIndexSizeError, "The input data length is not equal to (4 * width * height)."); } - if (param_flags & kParamSize) { + if (size) { if (size->Width() <= 0 || size->Height() <= 0) return false; base::CheckedNumeric<unsigned> data_size = 4; @@ -155,7 +153,7 @@ if (!data_size.IsValid() || data_size.ValueOrDie() > v8::TypedArray::kMaxLength) return false; - if (param_flags & kParamData) { + if (data) { if (data_size.ValueOrDie() > data_length) return false; } @@ -203,8 +201,7 @@ ImageData* ImageData::Create(const IntSize& size, const ImageDataSettings* settings) { - if (!ValidateConstructorArguments(kParamSize, &size, 0, 0, - NotShared<DOMArrayBufferView>(), settings)) + if (!ValidateConstructorArguments(&size, nullptr, nullptr, nullptr, settings)) return nullptr; ImageDataStorageFormat storage_format = kUint8ClampedArrayStorageFormat; if (settings) { @@ -254,8 +251,9 @@ ImageData* ImageData::Create(const IntSize& size, NotShared<DOMArrayBufferView> data_array, const ImageDataSettings* settings) { - if (!ValidateConstructorArguments(kParamSize | kParamData, &size, 0, 0, - data_array, settings)) + NotShared<DOMArrayBufferView> buffer_view = data_array; + if (!ValidateConstructorArguments(&size, nullptr, nullptr, &buffer_view, + settings)) return nullptr; return MakeGarbageCollected<ImageData>(size, data_array, settings); } @@ -263,9 +261,8 @@ ImageData* ImageData::Create(unsigned width, unsigned height, ExceptionState& exception_state) { - if (!ValidateConstructorArguments(kParamWidth | kParamHeight, nullptr, width, - height, NotShared<DOMArrayBufferView>(), - nullptr, &exception_state)) + if (!ValidateConstructorArguments(nullptr, &width, &height, nullptr, nullptr, + &exception_state)) return nullptr; NotShared<DOMArrayBufferView> byte_array = AllocateAndValidateDataArray( @@ -278,8 +275,9 @@ ImageData* ImageData::Create(NotShared<DOMUint8ClampedArray> data, unsigned width, ExceptionState& exception_state) { - if (!ValidateConstructorArguments(kParamData | kParamWidth, nullptr, width, 0, - data, nullptr, &exception_state)) + NotShared<DOMArrayBufferView> buffer_view = data; + if (!ValidateConstructorArguments(nullptr, &width, nullptr, &buffer_view, + nullptr, &exception_state)) return nullptr; unsigned height = base::checked_cast<unsigned>(data->length()) / (width * 4); @@ -290,9 +288,9 @@ unsigned width, unsigned height, ExceptionState& exception_state) { - if (!ValidateConstructorArguments(kParamData | kParamWidth | kParamHeight, - nullptr, width, height, data, nullptr, - &exception_state)) + NotShared<DOMArrayBufferView> buffer_view = data; + if (!ValidateConstructorArguments(nullptr, &width, &height, &buffer_view, + nullptr, &exception_state)) return nullptr; return MakeGarbageCollected<ImageData>(IntSize(width, height), data); @@ -302,9 +300,8 @@ unsigned height, const ImageDataSettings* settings, ExceptionState& exception_state) { - if (!ValidateConstructorArguments(kParamWidth | kParamHeight, nullptr, width, - height, NotShared<DOMArrayBufferView>(), - settings, &exception_state)) + if (!ValidateConstructorArguments(nullptr, &width, &height, nullptr, settings, + &exception_state)) return nullptr; ImageDataStorageFormat storage_format = @@ -347,8 +344,7 @@ if (settings->storageFormat() != storage_format_name) settings->setStorageFormat(storage_format_name); - if (!ValidateConstructorArguments(kParamData | kParamWidth | kParamHeight, - nullptr, width, height, buffer_view, + if (!ValidateConstructorArguments(nullptr, &width, &height, &buffer_view, settings, &exception_state)) return nullptr;
diff --git a/third_party/blink/renderer/core/html/canvas/image_data.h b/third_party/blink/renderer/core/html/canvas/image_data.h index 2148cc41..8f0977b 100644 --- a/third_party/blink/renderer/core/html/canvas/image_data.h +++ b/third_party/blink/renderer/core/html/canvas/image_data.h
@@ -143,15 +143,6 @@ const WrapperTypeInfo*, v8::Local<v8::Object> wrapper) override; - static bool ValidateConstructorArguments( - const unsigned&, - const IntSize* = nullptr, - const unsigned& = 0, - const unsigned& = 0, - const NotShared<DOMArrayBufferView> = NotShared<DOMArrayBufferView>(), - const ImageDataSettings* = nullptr, - ExceptionState* = nullptr); - private: IntSize size_; Member<ImageDataSettings> settings_; @@ -160,6 +151,14 @@ NotShared<DOMUint16Array> data_u16_; NotShared<DOMFloat32Array> data_f32_; + static bool ValidateConstructorArguments( + const IntSize* size, + const unsigned* width, + const unsigned* height, + const NotShared<DOMArrayBufferView>* data, + const ImageDataSettings* settings, + ExceptionState* = nullptr); + static NotShared<DOMArrayBufferView> AllocateAndValidateDataArray( const unsigned&, ImageDataStorageFormat,
diff --git a/third_party/blink/renderer/core/html/html_anchor_element.cc b/third_party/blink/renderer/core/html/html_anchor_element.cc index 15265fa5..da093b1d 100644 --- a/third_party/blink/renderer/core/html/html_anchor_element.cc +++ b/third_party/blink/renderer/core/html/html_anchor_element.cc
@@ -505,11 +505,6 @@ !HasRel(kRelationNoReferrer)) { UseCounter::Count(GetDocument(), WebFeature::kHTMLAnchorElementReferrerPolicyAttribute); - if (GetDocument().GetExecutionContext()->IsSecureContext() && - policy == network::mojom::ReferrerPolicy::kAlways) { - UseCounter::Count(GetDocument(), - WebFeature::kSetReferrerPolicyUnsafeUrlInSecureContext); - } request.SetReferrerPolicy(policy); }
diff --git a/third_party/blink/renderer/core/html/html_iframe_element.cc b/third_party/blink/renderer/core/html/html_iframe_element.cc index 0ef6aa5..06cda47 100644 --- a/third_party/blink/renderer/core/html/html_iframe_element.cc +++ b/third_party/blink/renderer/core/html/html_iframe_element.cc
@@ -184,12 +184,6 @@ value, kSupportReferrerPolicyLegacyKeywords, &referrer_policy_); UseCounter::Count(GetDocument(), WebFeature::kHTMLIFrameElementReferrerPolicyAttribute); - if (GetDocument().GetExecutionContext()->IsSecureContext() && - referrer_policy_ == network::mojom::ReferrerPolicy::kAlways) { - UseCounter::Count( - GetDocument(), - WebFeature::kSetReferrerPolicyUnsafeUrlInSecureContext); - } } } else if (name == html_names::kAllowfullscreenAttr) { bool old_allow_fullscreen = allow_fullscreen_;
diff --git a/third_party/blink/renderer/core/html/html_image_element.cc b/third_party/blink/renderer/core/html/html_image_element.cc index 324cabd..8b745cc 100644 --- a/third_party/blink/renderer/core/html/html_image_element.cc +++ b/third_party/blink/renderer/core/html/html_image_element.cc
@@ -286,11 +286,7 @@ params.new_value, kSupportReferrerPolicyLegacyKeywords, &referrer_policy_); } - if (GetDocument().GetExecutionContext()->IsSecureContext() && - referrer_policy_ == network::mojom::ReferrerPolicy::kAlways) { - UseCounter::Count(GetDocument(), - WebFeature::kSetReferrerPolicyUnsafeUrlInSecureContext); - } + if (referrer_policy_ != old_referrer_policy) { GetImageLoader().UpdateFromElement( ImageLoader::kUpdateIgnorePreviousError, referrer_policy_);
diff --git a/third_party/blink/renderer/core/html/html_link_element.cc b/third_party/blink/renderer/core/html/html_link_element.cc index ba70bb69..8ae0f2ff 100644 --- a/third_party/blink/renderer/core/html/html_link_element.cc +++ b/third_party/blink/renderer/core/html/html_link_element.cc
@@ -122,12 +122,6 @@ value, kDoNotSupportReferrerPolicyLegacyKeywords, &referrer_policy_); UseCounter::Count(GetDocument(), WebFeature::kHTMLLinkElementReferrerPolicyAttribute); - if (GetDocument().GetExecutionContext()->IsSecureContext() && - referrer_policy_ == network::mojom::ReferrerPolicy::kAlways) { - UseCounter::Count( - GetDocument(), - WebFeature::kSetReferrerPolicyUnsafeUrlInSecureContext); - } } } else if (name == html_names::kSizesAttr) { sizes_->DidUpdateAttributeValue(params.old_value, value);
diff --git a/third_party/blink/renderer/core/html/portal/html_portal_element.cc b/third_party/blink/renderer/core/html/portal/html_portal_element.cc index f2e869c2..b554a4c 100644 --- a/third_party/blink/renderer/core/html/portal/html_portal_element.cc +++ b/third_party/blink/renderer/core/html/portal/html_portal_element.cc
@@ -494,12 +494,6 @@ SecurityPolicy::ReferrerPolicyFromString( params.new_value, kDoNotSupportReferrerPolicyLegacyKeywords, &referrer_policy_); - if (GetDocument().GetExecutionContext()->IsSecureContext() && - referrer_policy_ == network::mojom::ReferrerPolicy::kAlways) { - UseCounter::Count( - GetDocument(), - WebFeature::kSetReferrerPolicyUnsafeUrlInSecureContext); - } } return; }
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource.cc b/third_party/blink/renderer/core/layout/layout_image_resource.cc index 4a332548..62774f0 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource.cc +++ b/third_party/blink/renderer/core/layout/layout_image_resource.cc
@@ -95,6 +95,15 @@ return !cached_image_ || cached_image_->GetImage()->HasIntrinsicSize(); } +RespectImageOrientationEnum LayoutImageResource::ImageOrientation() const { + DCHECK(cached_image_); + // Always respect the orientation of opaque origin images to avoid leaking + // image data. Otherwise pull orientation from the layout object's style. + RespectImageOrientationEnum respect_orientation = + LayoutObject::ShouldRespectImageOrientation(layout_object_); + return cached_image_->ForceOrientationIfNecessary(respect_orientation); +} + FloatSize LayoutImageResource::ImageSize(float multiplier) const { if (!cached_image_) return FloatSize();
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource.h b/third_party/blink/renderer/core/layout/layout_image_resource.h index 05bc56a..b5c425f 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource.h +++ b/third_party/blink/renderer/core/layout/layout_image_resource.h
@@ -69,6 +69,7 @@ // Default size is effective when this is LayoutImageResourceStyleImage. virtual FloatSize ImageSizeWithDefaultSize(float multiplier, const FloatSize&) const; + virtual RespectImageOrientationEnum ImageOrientation() const; virtual WrappedImagePtr ImagePtr() const { return cached_image_.Get(); } virtual void Trace(Visitor* visitor) const { visitor->Trace(cached_image_); }
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc index 575f1c5..ac6e978e7 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc +++ b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.cc
@@ -86,6 +86,16 @@ layout_object_->GetDocument(), multiplier, default_size, LayoutObject::ShouldRespectImageOrientation(layout_object_)); } + +RespectImageOrientationEnum LayoutImageResourceStyleImage::ImageOrientation() + const { + // Always respect the orientation of opaque origin images to avoid leaking + // image data. Otherwise pull orientation from the layout object's style. + RespectImageOrientationEnum respect_orientation = + LayoutObject::ShouldRespectImageOrientation(layout_object_); + return style_image_->ForceOrientationIfNecessary(respect_orientation); +} + void LayoutImageResourceStyleImage::Trace(Visitor* visitor) const { visitor->Trace(style_image_); LayoutImageResource::Trace(visitor);
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h index 93c5e6f..ef6931c8 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h +++ b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h
@@ -53,6 +53,7 @@ FloatSize ImageSize(float multiplier) const override; FloatSize ImageSizeWithDefaultSize(float multiplier, const FloatSize&) const override; + RespectImageOrientationEnum ImageOrientation() const override; WrappedImagePtr ImagePtr() const override { return style_image_->Data(); } void Trace(Visitor*) const override;
diff --git a/third_party/blink/renderer/core/page/context_menu_controller.cc b/third_party/blink/renderer/core/page/context_menu_controller.cc index 699c2e3..518ba80c 100644 --- a/third_party/blink/renderer/core/page/context_menu_controller.cc +++ b/third_party/blink/renderer/core/page/context_menu_controller.cc
@@ -32,6 +32,7 @@ #include "third_party/blink/public/common/context_menu_data/edit_flags.h" #include "third_party/blink/public/common/input/web_menu_source_type.h" +#include "third_party/blink/public/mojom/context_menu/context_menu_data.mojom-blink.h" #include "third_party/blink/public/web/web_context_menu_data.h" #include "third_party/blink/public/web/web_local_frame_client.h" #include "third_party/blink/public/web/web_plugin.h" @@ -208,8 +209,8 @@ const WebContextMenuData& data) { return page_->GetSettings().GetAlwaysShowContextMenuOnTouch() || !data.link_url.IsEmpty() || - data.media_type == ContextMenuDataMediaType::kImage || - data.media_type == ContextMenuDataMediaType::kVideo || + data.media_type == mojom::blink::ContextMenuDataMediaType::kImage || + data.media_type == mojom::blink::ContextMenuDataMediaType::kVideo || data.is_editable || !data.selected_text.IsEmpty(); } @@ -283,11 +284,11 @@ // Links, Images, Media tags, and Image/Media-Links take preference over // all else. if (IsA<HTMLCanvasElement>(result.InnerNode())) { - data.media_type = ContextMenuDataMediaType::kCanvas; + data.media_type = mojom::blink::ContextMenuDataMediaType::kCanvas; data.has_image_contents = true; } else if (!result.AbsoluteImageURL().IsEmpty()) { data.src_url = result.AbsoluteImageURL(); - data.media_type = ContextMenuDataMediaType::kImage; + data.media_type = mojom::blink::ContextMenuDataMediaType::kImage; data.media_flags |= WebContextMenuData::kMediaCanPrint; // An image can be null for many reasons, like being blocked, no image @@ -305,9 +306,9 @@ // A video element should be presented as an audio element when it has an // audio track but no video track. if (media_element->HasAudio() && !media_element->HasVideo()) - data.media_type = ContextMenuDataMediaType::kAudio; + data.media_type = mojom::blink::ContextMenuDataMediaType::kAudio; else - data.media_type = ContextMenuDataMediaType::kVideo; + data.media_type = mojom::blink::ContextMenuDataMediaType::kVideo; if (media_element->SupportsPictureInPicture()) { data.media_flags |= WebContextMenuData::kMediaCanPictureInPicture; if (PictureInPictureController::IsElementInPictureInPicture( @@ -315,7 +316,7 @@ data.media_flags |= WebContextMenuData::kMediaPictureInPicture; } } else if (IsA<HTMLAudioElement>(*media_element)) { - data.media_type = ContextMenuDataMediaType::kAudio; + data.media_type = mojom::blink::ContextMenuDataMediaType::kAudio; } data.suggested_filename = media_element->title(); @@ -348,7 +349,7 @@ result.InnerNode()->GetLayoutObject())) { WebPluginContainerImpl* plugin_view = embedded->Plugin(); if (plugin_view) { - data.media_type = ContextMenuDataMediaType::kPlugin; + data.media_type = mojom::blink::ContextMenuDataMediaType::kPlugin; WebPlugin* plugin = plugin_view->Plugin(); data.link_url = plugin->LinkAtPosition(data.mouse_position);
diff --git a/third_party/blink/renderer/core/page/context_menu_controller_test.cc b/third_party/blink/renderer/core/page/context_menu_controller_test.cc index 9888972..60c8a0d 100644 --- a/third_party/blink/renderer/core/page/context_menu_controller_test.cc +++ b/third_party/blink/renderer/core/page/context_menu_controller_test.cc
@@ -10,6 +10,7 @@ #include "third_party/blink/public/common/context_menu_data/edit_flags.h" #include "third_party/blink/public/common/input/web_keyboard_event.h" #include "third_party/blink/public/common/input/web_menu_source_type.h" +#include "third_party/blink/public/mojom/context_menu/context_menu_data.mojom-blink.h" #include "third_party/blink/public/platform/web_rect.h" #include "third_party/blink/public/web/web_context_menu_data.h" #include "third_party/blink/renderer/core/dom/xml_document.h" @@ -161,7 +162,8 @@ // Context menu info are sent to the WebLocalFrameClient. WebContextMenuData context_menu_data = GetWebFrameClient().GetContextMenuData(); - EXPECT_EQ(ContextMenuDataMediaType::kVideo, context_menu_data.media_type); + EXPECT_EQ(mojom::blink::ContextMenuDataMediaType::kVideo, + context_menu_data.media_type); EXPECT_EQ(video_url, context_menu_data.src_url.GetString()); const Vector<std::pair<WebContextMenuData::MediaFlags, bool>> @@ -222,7 +224,8 @@ // Context menu info are sent to the WebLocalFrameClient. WebContextMenuData context_menu_data = GetWebFrameClient().GetContextMenuData(); - EXPECT_EQ(ContextMenuDataMediaType::kAudio, context_menu_data.media_type); + EXPECT_EQ(mojom::blink::ContextMenuDataMediaType::kAudio, + context_menu_data.media_type); EXPECT_EQ(video_url, context_menu_data.src_url.GetString()); const Vector<std::pair<WebContextMenuData::MediaFlags, bool>> @@ -279,7 +282,8 @@ // Context menu info are sent to the WebLocalFrameClient. WebContextMenuData context_menu_data = GetWebFrameClient().GetContextMenuData(); - EXPECT_EQ(ContextMenuDataMediaType::kVideo, context_menu_data.media_type); + EXPECT_EQ(mojom::blink::ContextMenuDataMediaType::kVideo, + context_menu_data.media_type); EXPECT_EQ(video_url, context_menu_data.src_url.GetString()); const Vector<std::pair<WebContextMenuData::MediaFlags, bool>> @@ -336,7 +340,8 @@ // Context menu info are sent to the WebLocalFrameClient. WebContextMenuData context_menu_data = GetWebFrameClient().GetContextMenuData(); - EXPECT_EQ(ContextMenuDataMediaType::kVideo, context_menu_data.media_type); + EXPECT_EQ(mojom::blink::ContextMenuDataMediaType::kVideo, + context_menu_data.media_type); EXPECT_EQ(video_url, context_menu_data.src_url.GetString()); const Vector<std::pair<WebContextMenuData::MediaFlags, bool>> @@ -395,7 +400,8 @@ // Context menu info are sent to the WebLocalFrameClient. WebContextMenuData context_menu_data = GetWebFrameClient().GetContextMenuData(); - EXPECT_EQ(ContextMenuDataMediaType::kVideo, context_menu_data.media_type); + EXPECT_EQ(mojom::blink::ContextMenuDataMediaType::kVideo, + context_menu_data.media_type); const Vector<std::pair<WebContextMenuData::MediaFlags, bool>> expected_media_flags = { @@ -457,7 +463,8 @@ // Context menu info are sent to the WebLocalFrameClient. WebContextMenuData context_menu_data = GetWebFrameClient().GetContextMenuData(); - EXPECT_EQ(ContextMenuDataMediaType::kVideo, context_menu_data.media_type); + EXPECT_EQ(mojom::blink::ContextMenuDataMediaType::kVideo, + context_menu_data.media_type); EXPECT_EQ(video_url, context_menu_data.src_url.GetString()); const Vector<std::pair<WebContextMenuData::MediaFlags, bool>> @@ -513,7 +520,8 @@ WebContextMenuData context_menu_data = GetWebFrameClient().GetContextMenuData(); - EXPECT_EQ(context_menu_data.media_type, ContextMenuDataMediaType::kNone); + EXPECT_EQ(context_menu_data.media_type, + mojom::blink::ContextMenuDataMediaType::kNone); EXPECT_EQ(context_menu_data.edit_flags, ContextMenuDataEditFlags::kCanCopy); EXPECT_EQ(context_menu_data.selected_text, "able tex"); @@ -523,7 +531,8 @@ EXPECT_TRUE(ShowContextMenuForElement(editable_element, kMenuSourceMouse)); context_menu_data = GetWebFrameClient().GetContextMenuData(); - EXPECT_EQ(context_menu_data.media_type, ContextMenuDataMediaType::kNone); + EXPECT_EQ(context_menu_data.media_type, + mojom::blink::ContextMenuDataMediaType::kNone); EXPECT_EQ(context_menu_data.edit_flags, ContextMenuDataEditFlags::kCanCut | ContextMenuDataEditFlags::kCanCopy | @@ -555,7 +564,8 @@ WebContextMenuData context_menu_data = GetWebFrameClient().GetContextMenuData(); - EXPECT_EQ(context_menu_data.media_type, ContextMenuDataMediaType::kNone); + EXPECT_EQ(context_menu_data.media_type, + mojom::blink::ContextMenuDataMediaType::kNone); EXPECT_EQ(context_menu_data.edit_flags, ContextMenuDataEditFlags::kCanCopy); EXPECT_EQ(context_menu_data.selected_text, "Blue text"); } @@ -634,7 +644,8 @@ WebContextMenuData context_menu_data = GetWebFrameClient().GetContextMenuData(); - EXPECT_EQ(context_menu_data.media_type, ContextMenuDataMediaType::kImage); + EXPECT_EQ(context_menu_data.media_type, + mojom::blink::ContextMenuDataMediaType::kImage); } #endif
diff --git a/third_party/blink/renderer/core/page/drag_controller.cc b/third_party/blink/renderer/core/page/drag_controller.cc index 68c0b0f..f6248d2 100644 --- a/third_party/blink/renderer/core/page/drag_controller.cc +++ b/third_party/blink/renderer/core/page/drag_controller.cc
@@ -1074,14 +1074,8 @@ const LayoutImageResource& image_resource = *layout_image->ImageResource(); scoped_refptr<Image> image = image_resource.GetImage(image_element_size_in_pixels); - - // Always respect the orientation of opaque origin images to avoid leaking - // image data. Otherwise pull orientation from the layout object's style. - const ImageResourceContent* image_content = image_resource.CachedImage(); RespectImageOrientationEnum respect_orientation = - LayoutObject::ShouldRespectImageOrientation(layout_image); - respect_orientation = - image_content->ForceOrientationIfNecessary(respect_orientation); + image_resource.ImageOrientation(); IntSize image_size = image->Size(respect_orientation); if (image_size.Area() > kMaxOriginalImageArea)
diff --git a/third_party/blink/renderer/core/paint/image_painter.cc b/third_party/blink/renderer/core/paint/image_painter.cc index 68c9e2fd..b383b4e 100644 --- a/third_party/blink/renderer/core/paint/image_painter.cc +++ b/third_party/blink/renderer/core/paint/image_painter.cc
@@ -251,23 +251,12 @@ } } - ImageResourceContent* image_content = image_resource.CachedImage(); - - // Always respect the orientation of opaque origin images to avoid leaking - // image data. Otherwise pull orientation from the layout object's style. - RespectImageOrientationEnum respect_orientation = - LayoutObject::ShouldRespectImageOrientation(&layout_image_); - if (image_content) { - respect_orientation = - image_content->ForceOrientationIfNecessary(respect_orientation); - } - context.DrawImage(image.get(), decode_mode, FloatRect(pixel_snapped_dest_rect), &src_rect, layout_image_.StyleRef().HasFilterInducingProperty(), - SkBlendMode::kSrcOver, respect_orientation); + SkBlendMode::kSrcOver, image_resource.ImageOrientation()); - if (image_content) { + if (ImageResourceContent* image_content = image_resource.CachedImage()) { if ((IsA<HTMLImageElement>(node) || IsA<HTMLVideoElement>(node)) && image_content->IsLoaded()) { LocalDOMWindow* window = layout_image_.GetDocument().domWindow();
diff --git a/third_party/blink/renderer/core/paint/svg_image_painter.cc b/third_party/blink/renderer/core/paint/svg_image_painter.cc index 0f917eb0..af754d84 100644 --- a/third_party/blink/renderer/core/paint/svg_image_painter.cc +++ b/third_party/blink/renderer/core/paint/svg_image_painter.cc
@@ -55,24 +55,18 @@ } void SVGImagePainter::PaintForeground(const PaintInfo& paint_info) { - const LayoutImageResource* image_resource = layout_svg_image_.ImageResource(); + const LayoutImageResource& image_resource = + *layout_svg_image_.ImageResource(); FloatSize image_viewport_size = ComputeImageViewportSize(); image_viewport_size.Scale(layout_svg_image_.StyleRef().EffectiveZoom()); if (image_viewport_size.IsEmpty()) return; - scoped_refptr<Image> image = image_resource->GetImage(image_viewport_size); + scoped_refptr<Image> image = image_resource.GetImage(image_viewport_size); FloatRect dest_rect = layout_svg_image_.ObjectBoundingBox(); - auto* image_element = To<SVGImageElement>(layout_svg_image_.GetElement()); - - ImageResourceContent* image_content = image_resource->CachedImage(); - - // Always respect the orientation of opaque origin images to avoid leaking - // image data. Otherwise pull orientation from the layout object's style. RespectImageOrientationEnum respect_orientation = - image_content->ForceOrientationIfNecessary( - LayoutObject::ShouldRespectImageOrientation(&layout_svg_image_)); + image_resource.ImageOrientation(); FloatRect src_rect(FloatPoint(), image->SizeAsFloat(respect_orientation)); if (respect_orientation && !image->HasDefaultOrientation()) { @@ -98,21 +92,21 @@ image.get(), decode_mode, dest_rect, &src_rect, layout_svg_image_.StyleRef().HasFilterInducingProperty(), SkBlendMode::kSrcOver, respect_orientation); - if (image_content) { - if (image_content->IsLoaded()) { - LocalDOMWindow* window = layout_svg_image_.GetDocument().domWindow(); - DCHECK(window); - DCHECK(paint_info.PaintContainer()); - ImageElementTiming::From(*window).NotifyImagePainted( - layout_svg_image_, *image_content, - paint_info.context.GetPaintController().CurrentPaintChunkProperties(), - EnclosingIntRect(dest_rect)); - } - PaintTimingDetector::NotifyImagePaint( - layout_svg_image_, image->Size(), *image_content, + + ImageResourceContent* image_content = image_resource.CachedImage(); + if (image_content->IsLoaded()) { + LocalDOMWindow* window = layout_svg_image_.GetDocument().domWindow(); + DCHECK(window); + DCHECK(paint_info.PaintContainer()); + ImageElementTiming::From(*window).NotifyImagePainted( + layout_svg_image_, *image_content, paint_info.context.GetPaintController().CurrentPaintChunkProperties(), EnclosingIntRect(dest_rect)); } + PaintTimingDetector::NotifyImagePaint( + layout_svg_image_, image->Size(), *image_content, + paint_info.context.GetPaintController().CurrentPaintChunkProperties(), + EnclosingIntRect(dest_rect)); PaintTiming& timing = PaintTiming::From( layout_svg_image_.GetElement()->GetDocument().TopDocument()); timing.MarkFirstContentfulPaint();
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc index 92eef09..f008cde 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
@@ -1006,7 +1006,10 @@ TRACE_ID_WITH_SCOPE(kServiceWorkerGlobalScopeTraceScope, TRACE_ID_LOCAL(fetch_event_id)), TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT); - DCHECK(fetch_response_callbacks_.Contains(fetch_event_id)); + // `fetch_response_callbacks_` does not have the entry when the event timed + // out. + if (!fetch_response_callbacks_.Contains(fetch_event_id)) + return; mojom::blink::ServiceWorkerFetchResponseCallback* response_callback = fetch_response_callbacks_.Take(fetch_event_id)->Value().get(); @@ -1031,7 +1034,10 @@ TRACE_ID_WITH_SCOPE(kServiceWorkerGlobalScopeTraceScope, TRACE_ID_LOCAL(fetch_event_id)), TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT); - DCHECK(fetch_response_callbacks_.Contains(fetch_event_id)); + // `fetch_response_callbacks_` does not have the entry when the event timed + // out. + if (!fetch_response_callbacks_.Contains(fetch_event_id)) + return; mojom::blink::ServiceWorkerFetchResponseCallback* response_callback = fetch_response_callbacks_.Take(fetch_event_id)->Value().get(); @@ -1059,7 +1065,10 @@ TRACE_ID_WITH_SCOPE(kServiceWorkerGlobalScopeTraceScope, TRACE_ID_LOCAL(fetch_event_id)), TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT); - DCHECK(fetch_response_callbacks_.Contains(fetch_event_id)); + // `fetch_response_callbacks_` does not have the entry when the event timed + // out. + if (!fetch_response_callbacks_.Contains(fetch_event_id)) + return; mojom::blink::ServiceWorkerFetchResponseCallback* response_callback = fetch_response_callbacks_.Take(fetch_event_id)->Value().get(); @@ -1472,11 +1481,25 @@ DispatchExtendableEvent(event_to_dispatch, observer); } +void ServiceWorkerGlobalScope::AbortCallbackForFetchEvent( + int event_id, + mojom::blink::ServiceWorkerEventStatus status) { + // Discard a callback for an inflight respondWith() if it still exists. + auto response_callback_iter = fetch_response_callbacks_.find(event_id); + if (response_callback_iter != fetch_response_callbacks_.end()) { + response_callback_iter->value->TakeValue().reset(); + fetch_response_callbacks_.erase(response_callback_iter); + } + + // Run the event callback with the error code. + auto event_callback_iter = fetch_event_callbacks_.find(event_id); + std::move(event_callback_iter->value).Run(status); + fetch_event_callbacks_.erase(event_callback_iter); +} + void ServiceWorkerGlobalScope::StartFetchEvent( mojom::blink::DispatchFetchEventParamsPtr params, base::WeakPtr<CrossOriginResourcePolicyChecker> corp_checker, - mojo::PendingRemote<mojom::blink::ServiceWorkerFetchResponseCallback> - response_callback, base::Optional<base::TimeTicks> created_time, int event_id) { DCHECK(IsContextThread()); @@ -1484,13 +1507,6 @@ RecordQueuingTime(created_time.value()); } - HeapMojoRemote<mojom::blink::ServiceWorkerFetchResponseCallback, - HeapMojoWrapperMode::kWithoutContextObserver> - remote(this); - remote.Bind(std::move(response_callback), - GetThread()->GetTaskRunner(TaskType::kNetworking)); - fetch_response_callbacks_.Set(event_id, WrapDisallowNew(std::move(remote))); - // This TRACE_EVENT is used for perf benchmark to confirm if all of fetch // events have completed. (crbug.com/736697) TRACE_EVENT_WITH_FLOW1( @@ -1574,23 +1590,31 @@ const int event_id = event_queue_->NextEventId(); fetch_event_callbacks_.Set(event_id, std::move(callback)); + HeapMojoRemote<mojom::blink::ServiceWorkerFetchResponseCallback, + HeapMojoWrapperMode::kWithoutContextObserver> + remote(this); + remote.Bind(std::move(response_callback), + GetThread()->GetTaskRunner(TaskType::kNetworking)); + fetch_response_callbacks_.Set(event_id, WrapDisallowNew(std::move(remote))); if (RequestedTermination()) { event_queue_->EnqueuePending( event_id, WTF::Bind(&ServiceWorkerGlobalScope::StartFetchEvent, WrapWeakPersistent(this), std::move(params), - std::move(corp_checker), std::move(response_callback), - base::TimeTicks::Now()), - CreateAbortCallback(&fetch_event_callbacks_), base::nullopt); + std::move(corp_checker), base::TimeTicks::Now()), + WTF::Bind(&ServiceWorkerGlobalScope::AbortCallbackForFetchEvent, + WrapWeakPersistent(this)), + base::nullopt); } else { event_queue_->EnqueueNormal( event_id, WTF::Bind(&ServiceWorkerGlobalScope::StartFetchEvent, WrapWeakPersistent(this), std::move(params), - std::move(corp_checker), std::move(response_callback), - base::TimeTicks::Now()), - CreateAbortCallback(&fetch_event_callbacks_), base::nullopt); + std::move(corp_checker), base::TimeTicks::Now()), + WTF::Bind(&ServiceWorkerGlobalScope::AbortCallbackForFetchEvent, + WrapWeakPersistent(this)), + base::nullopt); } } @@ -1960,6 +1984,13 @@ const int event_id = event_queue_->NextEventId(); fetch_event_callbacks_.Set(event_id, std::move(callback)); + HeapMojoRemote<mojom::blink::ServiceWorkerFetchResponseCallback, + HeapMojoWrapperMode::kWithoutContextObserver> + remote(this); + remote.Bind(std::move(response_callback), + GetThread()->GetTaskRunner(TaskType::kNetworking)); + fetch_response_callbacks_.Set(event_id, WrapDisallowNew(std::move(remote))); + // We can use nullptr as a |corp_checker| for the main resource because it // must be the same origin. if (params->is_offline_capability_check) { @@ -1967,18 +1998,19 @@ event_id, WTF::Bind(&ServiceWorkerGlobalScope::StartFetchEvent, WrapWeakPersistent(this), std::move(params), - /*corp_checker=*/nullptr, std::move(response_callback), - base::nullopt), - CreateAbortCallback(&fetch_event_callbacks_), + /*corp_checker=*/nullptr, base::nullopt), + WTF::Bind(&ServiceWorkerGlobalScope::AbortCallbackForFetchEvent, + WrapWeakPersistent(this)), base::TimeDelta::FromSeconds(kCustomTimeoutForOfflineEvent.Get())); } else { event_queue_->EnqueueNormal( event_id, WTF::Bind(&ServiceWorkerGlobalScope::StartFetchEvent, WrapWeakPersistent(this), std::move(params), - /*corp_checker=*/nullptr, std::move(response_callback), - base::TimeTicks::Now()), - CreateAbortCallback(&fetch_event_callbacks_), base::nullopt); + /*corp_checker=*/nullptr, base::TimeTicks::Now()), + WTF::Bind(&ServiceWorkerGlobalScope::AbortCallbackForFetchEvent, + WrapWeakPersistent(this)), + base::nullopt); } }
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h index 720408c..ae5aea6 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h +++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h
@@ -499,13 +499,15 @@ void NoteNewFetchEvent(const KURL& request_url); void NoteRespondedToFetchEvent(const KURL& request_url); + void AbortCallbackForFetchEvent( + int event_id, + mojom::blink::ServiceWorkerEventStatus status); + // Dispatches the event synchronously. Enqueued by Dispatch*Event methods to // the event queue, and executed immediately or sometimes later. void StartFetchEvent( mojom::blink::DispatchFetchEventParamsPtr params, base::WeakPtr<CrossOriginResourcePolicyChecker> corp_checker, - mojo::PendingRemote<mojom::blink::ServiceWorkerFetchResponseCallback> - response_callback, base::Optional<base::TimeTicks> created_time, int event_id); void StartInstallEvent(int event_id);
diff --git a/third_party/blink/renderer/platform/loader/fetch/cross_origin_attribute_value.h b/third_party/blink/renderer/platform/loader/fetch/cross_origin_attribute_value.h index 2da56da..4093593 100644 --- a/third_party/blink/renderer/platform/loader/fetch/cross_origin_attribute_value.h +++ b/third_party/blink/renderer/platform/loader/fetch/cross_origin_attribute_value.h
@@ -7,6 +7,8 @@ namespace blink { +// This corresponds to the CORS settings attributes defined in the HTML spec: +// https://html.spec.whatwg.org/C/#cors-settings-attributes enum CrossOriginAttributeValue { kCrossOriginAttributeNotSet, kCrossOriginAttributeAnonymous,
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index abf55077..8153f40 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -1561,6 +1561,9 @@ crbug.com/836783 fast/peerconnection/RTCRtpSender-setParameters.html [ Pass Timeout ] crbug.com/846981 fast/webgl/texImage-imageBitmap-from-imageData-resize.html [ Pass Timeout ] +# Test failing on "Linux Tests (dbg)(1)" since it was introduced. +crbug.com/1160616 [ Linux ] fast/peerconnection/RTCPeerConnection-addMultipleTracks.html [ Failure ] + # crbug.com/1095379: These fail with a timeout, even when they're given extra time (via SlowTests) crbug.com/846656 external/wpt/css/selectors/focus-visible-002.html [ Pass Timeout ] crbug.com/1135405 http/tests/devtools/sources/debugger-pause/debugger-pause-infinite-loop.js [ Pass Timeout ] @@ -5881,6 +5884,10 @@ crbug.com/681468 fast/forms/suggestion-picker/date-suggestion-picker-appearance-zoom125.html [ Failure Pass ] crbug.com/681468 fast/forms/suggestion-picker/date-suggestion-picker-appearance-zoom200.html [ Failure Pass ] +# Other fast/forms/suggestion-picker/time-suggestion-picker-appearance.html +# failures on Win7 caused by focus appearing on the wrong element. +crbug.com/1160594 [ Win7 ] fast/forms/suggestion-picker/time-suggestion-picker-appearance.html [ Failure ] + # These tests will only run in the virtual test suite where the frequency # capping for overlay popup detection is disabled. This eliminates the need # for waitings in web tests to trigger a detection event.
diff --git a/third_party/blink/web_tests/external/wpt/css/selectors/focus-visible-006.html b/third_party/blink/web_tests/external/wpt/css/selectors/focus-visible-006-manual.html similarity index 89% rename from third_party/blink/web_tests/external/wpt/css/selectors/focus-visible-006.html rename to third_party/blink/web_tests/external/wpt/css/selectors/focus-visible-006-manual.html index 4b034b2..974abc0 100644 --- a/third_party/blink/web_tests/external/wpt/css/selectors/focus-visible-006.html +++ b/third_party/blink/web_tests/external/wpt/css/selectors/focus-visible-006-manual.html
@@ -7,9 +7,6 @@ <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" /> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> - <script src="/resources/testdriver.js"></script> - <script src="/resources/testdriver-actions.js"></script> - <script src="/resources/testdriver-vendor.js"></script> <style> span[contenteditable] { border: 1px solid black; @@ -45,8 +42,6 @@ assert_equals(getComputedStyle(el).outlineColor, "rgb(0, 100, 0)"); t.done(); })); - - test_driver.click(el); }, "Focus should always match :focus-visible on content editable divs"); </script> </body>
diff --git a/third_party/blink/web_tests/external/wpt/css/selectors/focus-visible-008.html b/third_party/blink/web_tests/external/wpt/css/selectors/focus-visible-008-manual.html similarity index 83% rename from third_party/blink/web_tests/external/wpt/css/selectors/focus-visible-008.html rename to third_party/blink/web_tests/external/wpt/css/selectors/focus-visible-008-manual.html index 75f676f..53306a9 100644 --- a/third_party/blink/web_tests/external/wpt/css/selectors/focus-visible-008.html +++ b/third_party/blink/web_tests/external/wpt/css/selectors/focus-visible-008-manual.html
@@ -7,9 +7,6 @@ <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" /> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> - <script src="/resources/testdriver.js"></script> - <script src="/resources/testdriver-actions.js"></script> - <script src="/resources/testdriver-vendor.js"></script> <style> :focus-visible { outline: darkgreen auto 5px; @@ -47,12 +44,6 @@ el.focus(); }); } - - const tab_key = '\ue004'; - const enter_key = '\uE007'; - test_driver.send_keys(el, tab_key).then(() => { - test_driver.send_keys(el, enter_key); - }); </script> </body> </html>
diff --git a/third_party/blink/web_tests/external/wpt/workers/Worker-terminate-forever-during-evaluation.html b/third_party/blink/web_tests/external/wpt/workers/Worker-terminate-forever-during-evaluation.html index 4513c5b..ab66f29 100644 --- a/third_party/blink/web_tests/external/wpt/workers/Worker-terminate-forever-during-evaluation.html +++ b/third_party/blink/web_tests/external/wpt/workers/Worker-terminate-forever-during-evaluation.html
@@ -38,6 +38,11 @@ url: 'support/Worker-run-forever-during-dynamic-import.js', options: {type: 'module'}, description: 'Worker is terminated during dynamic import() (module)' + }, + { + url: 'support/Worker-run-forever-during-top-level-await.js', + options: {type: 'module'}, + description: 'Worker is terminated during top-level await' } ]) { async_test((t) => {
diff --git a/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/002.worker-expected.txt b/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/002.worker-expected.txt deleted file mode 100644 index d73864c..0000000 --- a/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/002.worker-expected.txt +++ /dev/null
@@ -1,36 +0,0 @@ -This is a testharness.js-based test. -PASS The SharedWorkerGlobalScope interface object should not be exposed. -PASS The AbstractView interface object should not be exposed. -PASS The AbstractWorker interface object should not be exposed. -PASS The ApplicationCache interface object should not be exposed. -PASS The Location interface object should not be exposed. -PASS The Navigator interface object should not be exposed. -PASS The Audio interface object should not be exposed. -PASS The HTMLCanvasElement interface object should not be exposed. -PASS The Path interface object should not be exposed. -PASS The CanvasProxy interface object should not be exposed. -PASS The CanvasRenderingContext2D interface object should not be exposed. -PASS The DrawingStyle interface object should not be exposed. -PASS The BeforeUnloadEvent interface object should not be exposed. -PASS The PopStateEvent interface object should not be exposed. -PASS The HashChangeEvent interface object should not be exposed. -PASS The PageTransitionEvent interface object should not be exposed. -PASS The DOMImplementation interface object should not be exposed. -FAIL The ReadableStreamDefaultReader interface object should not be exposed. assert_false: expected false got true -FAIL The ReadableStreamBYOBReader interface object should not be exposed. assert_false: expected false got true -FAIL The ReadableByteStreamController interface object should not be exposed. assert_false: expected false got true -FAIL The WritableStreamDefaultWriter interface object should not be exposed. assert_false: expected false got true -PASS The WritableStreamDefaultController interface object should not be exposed. -PASS The IDBEnvironment interface object should not be exposed. -PASS The Database interface object should not be exposed. -PASS The UIEvent interface object should not be exposed. -PASS The FocusEvent interface object should not be exposed. -PASS The MouseEvent interface object should not be exposed. -PASS The WheelEvent interface object should not be exposed. -PASS The InputEvent interface object should not be exposed. -PASS The KeyboardEvent interface object should not be exposed. -PASS The CompositionEvent interface object should not be exposed. -PASS The VTTCue interface object should not be exposed. -PASS The VTTRegion interface object should not be exposed. -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/002.worker.js b/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/002.worker.js index 065cc6e..8eb41c23 100644 --- a/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/002.worker.js +++ b/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/002.worker.js
@@ -20,10 +20,6 @@ // https://dom.spec.whatwg.org/ "DOMImplementation", // https://streams.spec.whatwg.org/ - "ReadableStreamDefaultReader", - "ReadableStreamBYOBReader", - "ReadableByteStreamController", - "WritableStreamDefaultWriter", "WritableStreamDefaultController", // http://w3c.github.io/IndexedDB/ "IDBEnvironment",
diff --git a/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/004.any.js b/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/004.any.js index 2cbb4b54..963a9962 100644 --- a/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/004.any.js +++ b/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/004.any.js
@@ -18,10 +18,6 @@ "HashChangeEvent", "PageTransitionEvent", // https://streams.spec.whatwg.org/ - "ReadableStreamDefaultReader", - "ReadableStreamBYOBReader", - "ReadableByteStreamController", - "WritableStreamDefaultWriter", "WritableStreamDefaultController", // http://w3c.github.io/IndexedDB/ "IDBEnvironment",
diff --git a/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/004.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/004.any.sharedworker-expected.txt deleted file mode 100644 index ba2bc24..0000000 --- a/third_party/blink/web_tests/external/wpt/workers/semantics/interface-objects/004.any.sharedworker-expected.txt +++ /dev/null
@@ -1,32 +0,0 @@ -This is a testharness.js-based test. -PASS The DedicatedWorkerGlobalScope interface object should not be exposed -PASS The AbstractView interface object should not be exposed -PASS The AbstractWorker interface object should not be exposed -PASS The Location interface object should not be exposed -PASS The Navigator interface object should not be exposed -PASS The DOMImplementation interface object should not be exposed -PASS The Audio interface object should not be exposed -PASS The HTMLCanvasElement interface object should not be exposed -PASS The Path interface object should not be exposed -PASS The CanvasProxy interface object should not be exposed -PASS The CanvasRenderingContext2D interface object should not be exposed -PASS The DrawingStyle interface object should not be exposed -PASS The PopStateEvent interface object should not be exposed -PASS The HashChangeEvent interface object should not be exposed -PASS The PageTransitionEvent interface object should not be exposed -FAIL The ReadableStreamDefaultReader interface object should not be exposed assert_false: expected false got true -FAIL The ReadableStreamBYOBReader interface object should not be exposed assert_false: expected false got true -FAIL The ReadableByteStreamController interface object should not be exposed assert_false: expected false got true -FAIL The WritableStreamDefaultWriter interface object should not be exposed assert_false: expected false got true -PASS The WritableStreamDefaultController interface object should not be exposed -PASS The IDBEnvironment interface object should not be exposed -PASS The Database interface object should not be exposed -PASS The UIEvent interface object should not be exposed -PASS The FocusEvent interface object should not be exposed -PASS The MouseEvent interface object should not be exposed -PASS The WheelEvent interface object should not be exposed -PASS The InputEvent interface object should not be exposed -PASS The KeyboardEvent interface object should not be exposed -PASS The CompositionEvent interface object should not be exposed -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/workers/support/Worker-run-forever-during-top-level-await.js b/third_party/blink/web_tests/external/wpt/workers/support/Worker-run-forever-during-top-level-await.js new file mode 100644 index 0000000..a1c8b32b --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/workers/support/Worker-run-forever-during-top-level-await.js
@@ -0,0 +1,4 @@ +await 1; +postMessage('start'); +onerror = () => postMessage('onerror'); +while(1);
diff --git a/third_party/blink/web_tests/external/wpt_automation/css/selectors/focus-visible-006-manual-automation.js b/third_party/blink/web_tests/external/wpt_automation/css/selectors/focus-visible-006-manual-automation.js new file mode 100644 index 0000000..6e6fc92 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt_automation/css/selectors/focus-visible-006-manual-automation.js
@@ -0,0 +1,5 @@ +importAutomationScript('/pointerevents/pointerevent_common_input.js'); + +function inject_input() { + return mouseClickInTarget("#el"); +};
diff --git a/third_party/blink/web_tests/external/wpt_automation/css/selectors/focus-visible-008-manual-automation.js b/third_party/blink/web_tests/external/wpt_automation/css/selectors/focus-visible-008-manual-automation.js new file mode 100644 index 0000000..154e9a9 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt_automation/css/selectors/focus-visible-008-manual-automation.js
@@ -0,0 +1,7 @@ +importAutomationScript('/input-events/inputevent_common_input.js'); + +function inject_input() { + return keyDown("Tab").then(() => { + return keyDown("Enter"); + }); +};
diff --git a/third_party/openh264/BUILD.gn b/third_party/openh264/BUILD.gn index 0e82bb5..a8c658b 100644 --- a/third_party/openh264/BUILD.gn +++ b/third_party/openh264/BUILD.gn
@@ -5,7 +5,6 @@ import("//build/config/chromeos/ui_mode.gni") import("//build/config/sanitizers/sanitizers.gni") import("//third_party/nasm/nasm_assemble.gni") -import("//third_party/openh264/openh264_args.gni") import("//third_party/openh264/openh264_sources.gni") # Config shared by all openh264 targets.
diff --git a/third_party/openh264/openh264_args.gni b/third_party/openh264/openh264_args.gni deleted file mode 100644 index b7558fbd..0000000 --- a/third_party/openh264/openh264_args.gni +++ /dev/null
@@ -1,12 +0,0 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("//build/config/chrome_build.gni") - -declare_args() { - # Enable this to build OpenH264 (for encoding, not decoding). - # CHECK THE OPENH264 LICENSE/PATENT BEFORE BUILDING, see - # http://www.openh264.org/. - use_openh264 = false -}
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 480cdd1..21c65a8 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -30695,7 +30695,6 @@ <int value="3742" label="CrossOriginSubframeWithoutEmbeddingControl"/> <int value="3743" label="ReadableStreamWithByteSource"/> <int value="3744" label="ReadableStreamBYOBReader"/> - <int value="3745" label="SetReferrerPolicyUnsafeUrlInSecureContext"/> </enum> <enum name="FeaturePolicyAllowlistType"> @@ -37834,6 +37833,9 @@ <int value="7" label="PERSONAL_NUMBER"/> <int value="8" label="PERSONAL_FIRST_NAME"/> <int value="9" label="PERSONAL_LAST_NAME"/> + <int value="10" label="AUTOCORRECT_SHOWN"/> + <int value="11" label="AUTOCORRECT_UNDERLINED"/> + <int value="12" label="AUTOCORRECT_REVERTED"/> </enum> <enum name="IMEAssistiveDisabledReason">
diff --git a/tools/metrics/histograms/histograms_xml/crostini/histograms.xml b/tools/metrics/histograms/histograms_xml/crostini/histograms.xml index 128050a..050eb29 100644 --- a/tools/metrics/histograms/histograms_xml/crostini/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/crostini/histograms.xml
@@ -241,6 +241,38 @@ </summary> </histogram> +<histogram name="Crostini.EngagementTime.{Variant}" units="ms" + expires_after="2021-04-18"> + <owner>davidmunro@google.com</owner> + <owner>clumptini@google.com</owner> + <summary> + {Variant} Engagement time metrics, along with foreground and background + time, are only collected on users with Crostini enabled. All four metrics + are accumulated and recorded to UMA once a day. + </summary> + <token key="Variant"> + <variant name="Background" + summary="Times when a user is engaged and Crostini apps are running + in the background, but the user isn't focusing on an + Crostini app window."/> + <variant name="CrostiniTotal" + summary="Total of Crostini.EngagementTime.Background and .Foreground, + which is the time the user is engaged and Crostini is + running either in the foreground or background."/> + <variant name="Foreground" + summary="Times when a user is engaged and focuses on a Crostini GUI + window. As of 2020-12-15 this may count some + similar-but-not-quite-Crostini windows e.g. Bruschetta, see + crbug/1158644 for more details."/> + <variant name="Total" + summary="Total CrOS user session time (from login to logout) + excluding times when a user "disengages". A user + is disengaged when the screen is locked or dimmed due to + user inactivity. For Total Crostini engagement time, see + Crostini.EngagementTime.CrostiniTotal."/> + </token> +</histogram> + <histogram name="Crostini.FilesystemCorruption" enum="CorruptionStates" expires_after="2021-06-13"> <owner>clumptini@google.com</owner>
diff --git a/tools/metrics/histograms/histograms_xml/network/histograms.xml b/tools/metrics/histograms/histograms_xml/network/histograms.xml index c28ce7f..db93fe1 100644 --- a/tools/metrics/histograms/histograms_xml/network/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/network/histograms.xml
@@ -2151,6 +2151,17 @@ </summary> </histogram> +<histogram name="NetworkService.StreamingUploadDataPipeGetterValidity" + units="BooleanValid" expires_after="2021-03-31"> + <owner>yhirano@chromium.org</owner> + <owner>yoichio@chromium.org</owner> + <summary> + It seems in some cases the ChunkedDataPipeGetter for a request body is + missing. This histogram counts whether the mojo::Remote is valid, for each + request with body of type KChunkedDataPipe or kReadOnceStream. + </summary> +</histogram> + <histogram name="NetworkService.TimeToFirstResponse" units="ms" expires_after="M82"> <owner>cduvall@chromium.org</owner>
diff --git a/ui/accessibility/ax_position.h b/ui/accessibility/ax_position.h index 434efe5..626aef3 100644 --- a/ui/accessibility/ax_position.h +++ b/ui/accessibility/ax_position.h
@@ -670,12 +670,12 @@ AXPositionInstance previous_text_position = text_position->Clone(); do { previous_text_position = - previous_text_position->CreatePreviousTextAnchorPosition( + previous_text_position->CreatePreviousLeafTextPosition( abort_move_predicate); // If the previous position is whitespace, then continue searching // until a non-whitespace leaf text position is found within the // current paragraph because whitespace is supposed to be collapsed. - // There's a chance that |CreatePreviousTextAnchorPosition| will + // There's a chance that |CreatePreviousLeafTextPosition| will // return whitespace that should be appended to a previous paragraph // rather than separating two pieces of the current paragraph. } while (previous_text_position->IsInWhiteSpace() || @@ -728,7 +728,7 @@ // using the paragraph boundary abort predicate. // If a null position was found, then this position must be the end of // a paragraph. - // |CreateNextTextAnchorPosition| + |AbortMoveAtParagraphBoundary| + // |CreateNextLeafTextPosition| + |AbortMoveAtParagraphBoundary| // will return a null position when an anchor movement would // cross a paragraph boundary and there is no doubt that it is the end // of a paragraph, or the end of content was reached. @@ -741,7 +741,7 @@ AXPositionInstance next_text_position = text_position->Clone(); do { - next_text_position = next_text_position->CreateNextTextAnchorPosition( + next_text_position = next_text_position->CreateNextLeafTextPosition( abort_move_predicate); } while (next_text_position->IsIgnored()); if (next_text_position->IsNullPosition()) @@ -793,7 +793,7 @@ // This will return a null position when an anchor movement would // cross a page boundary, or the start of content was reached. AXPositionInstance previous_text_position = - text_position->CreatePreviousTextAnchorPosition( + text_position->CreatePreviousLeafTextPosition( base::BindRepeating(&AbortMoveAtPageBoundary)); return previous_text_position->IsNullPosition(); } @@ -821,7 +821,7 @@ // This will return a null position when an anchor movement would // cross a page boundary, or the end of content was reached. AXPositionInstance next_text_position = - text_position->CreateNextTextAnchorPosition( + text_position->CreateNextLeafTextPosition( base::BindRepeating(&AbortMoveAtPageBoundary)); return next_text_position->IsNullPosition(); } @@ -2117,7 +2117,7 @@ // Creates a text position using the previous text-only node as its anchor. // Assumes that text-only nodes are leaf nodes. AXPositionInstance CreatePreviousLeafTextPosition() const { - return CreatePreviousTextAnchorPosition( + return CreatePreviousLeafTextPosition( base::BindRepeating(&DefaultAbortMovePredicate)); } @@ -3835,9 +3835,9 @@ return rightmost_leaf; } - // Creates a position using the next text-only node as its anchor. - // Assumes that text-only nodes are leaf nodes. - AXPositionInstance CreateNextTextAnchorPosition( + // Creates a text position using the next leaf node as its anchor. + // Leaf nodes often make up the trees text representation. + AXPositionInstance CreateNextLeafTextPosition( const AbortMovePredicate& abort_predicate) const { // If this is an ancestor text position, resolve to its leaf text position. if (IsTextPosition() && !IsLeaf()) @@ -3851,9 +3851,9 @@ return next_leaf->AsLeafTextPosition(); } - // Creates a position using the previous text-only node as its anchor. - // Assumes that text-only nodes are leaf nodes. - AXPositionInstance CreatePreviousTextAnchorPosition( + // Creates a text position using the previous leaf node as its anchor. + // Leaf nodes often make up the trees text representation. + AXPositionInstance CreatePreviousLeafTextPosition( const AbortMovePredicate& abort_predicate) const { // If this is an ancestor text position, resolve to its leaf text position. if (IsTextPosition() && !IsLeaf())
diff --git a/ui/aura/window_event_dispatcher.cc b/ui/aura/window_event_dispatcher.cc index af90753a..b1cbb2b 100644 --- a/ui/aura/window_event_dispatcher.cc +++ b/ui/aura/window_event_dispatcher.cc
@@ -519,6 +519,8 @@ event->time_stamp()); } + WindowTracker target_window_tracker; + target_window_tracker.Add(target_window); if (!dispatching_held_event_) { bool can_be_held = IsEventCandidateForHold(*event); if (!move_hold_count_ || !can_be_held) { @@ -529,6 +531,12 @@ return details; } } + if (target_window_tracker.windows().empty()) { + // The event target is destroyed while processing the held event. + DispatchDetails details; + details.target_destroyed = true; + return details; + } DispatchDetails details; if (event->IsMouseEvent()) {
diff --git a/ui/aura/window_event_dispatcher_unittest.cc b/ui/aura/window_event_dispatcher_unittest.cc index 09696873..8b05ebc 100644 --- a/ui/aura/window_event_dispatcher_unittest.cc +++ b/ui/aura/window_event_dispatcher_unittest.cc
@@ -3108,4 +3108,84 @@ root_window()->RemovePreTargetHandler(&root_recorder); } +// A test case for crbug.com/1099985 +TEST_F(WindowEventDispatcherTest, TargetIsDestroyedByHeldEvent) { + EventFilterRecorder recorder; + root_window()->AddPreTargetHandler(&recorder); + + // Create a window which should be a target of all MouseEvent in this tests. + test::TestWindowDelegate delegate; + std::unique_ptr<aura::Window> mouse_target(CreateTestWindowWithDelegate( + &delegate, 1, gfx::Rect(0, 0, 100, 100), root_window())); + + // Create a window which has a focus, so should receive all KeyEvents. + ConsumeKeyHandler key_handler; + // Not using std::unique_ptr<> intentionally + aura::Window* focused(test::CreateTestWindowWithBounds( + gfx::Rect(200, 200, 100, 100), root_window())); + focused->SetProperty(client::kSkipImeProcessing, true); + focused->AddPostTargetHandler(&key_handler); + focused->Show(); + focused->Focus(); + + // Make sure that the key event goes to the |focused| window. + ui::KeyEvent key_press(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); + DispatchEventUsingWindowDispatcher(&key_press); + EXPECT_EQ(1, key_handler.num_key_events()); + key_handler.Reset(); + + ui::MouseEvent mouse_move_event(ui::ET_MOUSE_MOVED, gfx::Point(1, 1), + gfx::Point(1, 1), ui::EventTimeForNow(), 0, + 0); + DispatchEventUsingWindowDispatcher(&mouse_move_event); + // Discard MOUSE_ENTER. + recorder.Reset(); + + host()->dispatcher()->HoldPointerMoves(); + + // The dragged event should not be sent to the |target| window because + // WindowEventDispatcher is holding it now. + ui::MouseEvent mouse_dragged_event(ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0), + gfx::Point(0, 0), ui::EventTimeForNow(), 0, + 0); + DispatchEventUsingWindowDispatcher(&mouse_dragged_event); + EXPECT_TRUE(recorder.events().empty()); + + // Create a event handler which destroys the |focused| window when it sees any + // mouse event. + class Handler : public ui::test::TestEventHandler { + public: + explicit Handler(aura::Window* focused) : focused_(focused) {} + ~Handler() override = default; + + Handler(const Handler&) = delete; + Handler& operator=(const Handler&) = delete; + + // Overridden from ui::EventHandler: + void OnMouseEvent(ui::MouseEvent* event) override { + ui::test::TestEventHandler::OnMouseEvent(event); + LOG(ERROR) << "|focused_| is being deleted"; + // !!! + delete focused_; + } + + private: + aura::Window* focused_; + }; + Handler mouse_handler(focused); + mouse_target->AddPostTargetHandler(&mouse_handler); + + // Sending a key event should stop the hold and the mouse event goes to the + // |target| window. + // The key event should not be sent to the handler because the focused window + // is destroyed before the event is dispatched. + ui::KeyEvent key_press2(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); + DispatchEventUsingWindowDispatcher(&key_press2); + EXPECT_EQ(1u, recorder.events().size()); + EXPECT_EQ(0, key_handler.num_key_events()); + EXPECT_EQ(1, mouse_handler.num_mouse_events()); + + root_window()->RemovePreTargetHandler(&recorder); +} + } // namespace aura
diff --git a/ui/base/ime/chromeos/component_extension_ime_manager.h b/ui/base/ime/chromeos/component_extension_ime_manager.h index 1281be2..ea34f20e 100644 --- a/ui/base/ime/chromeos/component_extension_ime_manager.h +++ b/ui/base/ime/chromeos/component_extension_ime_manager.h
@@ -29,7 +29,6 @@ std::string display_name; std::string indicator; std::vector<std::string> language_codes; // e.g. "en". - std::string description; std::string layout; GURL options_page_url; GURL input_view_url;
diff --git a/weblayer/browser/tab_impl.cc b/weblayer/browser/tab_impl.cc index 02a84347..61e611a 100644 --- a/weblayer/browser/tab_impl.cc +++ b/weblayer/browser/tab_impl.cc
@@ -858,9 +858,9 @@ reinterpret_cast<content::ContextMenuParams*>(native_context_menu_params); bool is_link = context_menu_params->media_type != - blink::ContextMenuDataMediaType::kImage && + blink::mojom::ContextMenuDataMediaType::kImage && context_menu_params->media_type != - blink::ContextMenuDataMediaType::kVideo; + blink::mojom::ContextMenuDataMediaType::kVideo; download::CreateContextMenuDownload(web_contents_.get(), *context_menu_params, std::string(), is_link);