diff --git a/DEPS b/DEPS index 5bd8690..87f8cd6 100644 --- a/DEPS +++ b/DEPS
@@ -177,7 +177,7 @@ # luci-go CIPD package version. # Make sure the revision is uploaded by infra-packagers builder. # https://ci.chromium.org/p/infra-internal/g/infra-packagers/console - 'luci_go': 'git_revision:22d464e2f8f3bd2bd33f69fe819326d63f881008', + 'luci_go': 'git_revision:9cd9603def7a649cd3e29517180d6622be2fa898', # This can be overridden, e.g. with custom_vars, to build clang from HEAD # instead of downloading the prebuilt pinned revision. @@ -209,11 +209,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': 'd7d7a8215e6c1c3dcba33a17d899253d1e0f669c', + 'skia_revision': 'a65c295c1c9b65d796087aeaac26287ac59b1b1e', # 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': '99437251b0a727233fc455893463c16097b8f45a', + 'v8_revision': '51238348f95a1f5e0acc321efac7942d18a687a2', # 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. @@ -221,7 +221,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': 'f871545d293f8fd55357eb2bcdaacea3cca9569f', + 'angle_revision': '88156d2686c8df127d1e5ba675221573a8a13b4c', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -260,7 +260,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. - 'freetype_revision': '1bc801b0d6ae70683c0a7952e949d2b3edff76e2', + 'freetype_revision': '06e21ffedfac81edfa79137959141a9d78b6f858', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling freetype # and whatever else without interference from each other. @@ -288,7 +288,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': 'a6d99cd3195d77314afe48c013faa3f5c09412fa', + 'devtools_frontend_revision': '436469a9e3582bc20cdd9ee7a7ca89b46704e8f1', # 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. @@ -328,7 +328,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': '3fd20367551e113858b87f05fc32bd4f132edc42', + 'dawn_revision': 'ce3d4a5b094dce131453da9a5ef422671f20ad7d', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -946,7 +946,7 @@ # Tools used when building Chrome for Chrome OS. This affects both the Simple # Chrome workflow, as well as the chromeos-chrome ebuild. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '5b3d7cd3d9d5eec0c5196071da6ac08fcab5e34c', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + 'bf0c3c52412c0a7cf5a5e41d127db5ad8d7e8541', 'condition': 'checkout_chromeos', }, @@ -1349,7 +1349,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'dac610dd857535ee840a1cdcc2a5103e59a99388', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '9a1689eeaa281b21c5bcedcad5d54ddaeeb7889c', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1574,7 +1574,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'a03bb38c0e771a0b404753b8e65250e98719870f', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '723e92e93a7fe14f71679747f7ca60cadafa1152', + Var('webrtc_git') + '/src.git' + '@' + 'cf0ec283d2a6ef55f3e6f6c19ec1f282e355a42b', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1635,7 +1635,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@eaec9fb5752624684294dcded84901dff2ed4209', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@cb232a24709c9be3cc91fa068b4aa4833d03031b', 'condition': 'checkout_src_internal', }, @@ -1665,7 +1665,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/media_app/app', - 'version': 'HyHhySYWLEoRLGTd_7K3mlmG2-DW2AYoHfBpKjDQkmsC', + 'version': 'eu5KcWk2CMngdZ-5jWXPVukDEwnyb4g5Ez8T6uqIRzoC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/android_webview/browser/aw_contents.cc b/android_webview/browser/aw_contents.cc index daecd26..1c6d1dd 100644 --- a/android_webview/browser/aw_contents.cc +++ b/android_webview/browser/aw_contents.cc
@@ -261,8 +261,7 @@ const JavaParamRef<jobject>& web_contents_delegate, const JavaParamRef<jobject>& contents_client_bridge, const JavaParamRef<jobject>& io_thread_client, - const JavaParamRef<jobject>& intercept_navigation_delegate, - const JavaParamRef<jobject>& autofill_provider) { + const JavaParamRef<jobject>& intercept_navigation_delegate) { DCHECK_CURRENTLY_ON(BrowserThread::UI); // The |aw_content| param is technically spurious as it duplicates |obj| but // is passed over anyway to make the binding more explicit. @@ -282,11 +281,17 @@ InterceptNavigationDelegate::Associate( web_contents_.get(), std::make_unique<InterceptNavigationDelegate>( env, intercept_navigation_delegate)); +} - if (autofill_provider) { - autofill_provider_ = std::make_unique<autofill::AutofillProviderAndroid>( - autofill_provider, web_contents_.get()); - } +void AwContents::InitializeAndroidAutofill(JNIEnv* env) { + // Initialize Android Autofill, this method shall only be called in Android O + // and beyond. + // AutofillProvider shall already be created for |web_contents_| from + // AutofillProvider java. + DCHECK(autofill::AutofillProvider::FromWebContents(web_contents_.get())); + // Autocomplete is only supported for Android pre-O, disable it if Android + // autofill is enabled. + InitAutofillIfNecessary(/*autocomplete_enabled=*/false); } void AwContents::SetSaveFormData(bool enabled) { @@ -301,20 +306,23 @@ } void AwContents::InitAutofillIfNecessary(bool autocomplete_enabled) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + // This method initializes either Android autofill or Chrome autocomplete: + // - If autofill_provider is available, Android autofill shall be initialized. + // - Otherwise, initialize Chrome autocomplete if autocomplete_enabled. + // Check if the autofill driver factory already exists. content::WebContents* web_contents = web_contents_.get(); if (ContentAutofillDriverFactory::FromWebContents(web_contents)) return; - // Check if AutofillProvider is available. - DCHECK_CURRENTLY_ON(BrowserThread::UI); - JNIEnv* env = AttachCurrentThread(); - ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); - if (!obj) - return; + // The autofill_provider object shall already be created by the + // AutofillProvider Java object in Android O and beyond. + auto* autofill_provider = + autofill::AutofillProvider::FromWebContents(web_contents); // Just return, if the app neither runs on O sdk nor enables autocomplete. - if (!autofill_provider_ && !autocomplete_enabled) + if (!autofill_provider && !autocomplete_enabled) return; AwAutofillClient::CreateForWebContents(web_contents); @@ -327,9 +335,8 @@ is_download_manager_disabled_for_testing()) ? autofill::AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER : autofill::AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER, - autofill_provider_ - ? base::BindRepeating(&autofill::AndroidAutofillManager::Create, - autofill_provider_.get()) + autofill_provider + ? base::BindRepeating(&autofill::AndroidAutofillManager::Create) : autofill::AutofillManager::AutofillManagerFactoryCallback()); } @@ -1488,12 +1495,6 @@ web_contents_->ResumeLoadingCreatedWebContents(); } -jlong AwContents::GetAutofillProvider( - JNIEnv* env, - const base::android::JavaParamRef<jobject>& obj) { - return reinterpret_cast<jlong>(autofill_provider_.get()); -} - void JNI_AwContents_SetShouldDownloadFavicons(JNIEnv* env) { g_should_download_favicons = true; }
diff --git a/android_webview/browser/aw_contents.h b/android_webview/browser/aw_contents.h index 0e494a00..2bdc973 100644 --- a/android_webview/browser/aw_contents.h +++ b/android_webview/browser/aw_contents.h
@@ -30,10 +30,6 @@ class SkBitmap; -namespace autofill { -class AutofillProvider; -} - namespace content { class WebContents; } @@ -96,8 +92,9 @@ const base::android::JavaParamRef<jobject>& web_contents_delegate, const base::android::JavaParamRef<jobject>& contents_client_bridge, const base::android::JavaParamRef<jobject>& io_thread_client, - const base::android::JavaParamRef<jobject>& intercept_navigation_delegate, - const base::android::JavaParamRef<jobject>& autofill_provider); + const base::android::JavaParamRef<jobject>& + intercept_navigation_delegate); + void InitializeAndroidAutofill(JNIEnv* env); base::android::ScopedJavaLocalRef<jobject> GetWebContents( JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); @@ -382,9 +379,6 @@ JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); - jlong GetAutofillProvider(JNIEnv* env, - const base::android::JavaParamRef<jobject>& obj); - void RendererUnresponsive(content::RenderProcessHost* render_process_host); void RendererResponsive(content::RenderProcessHost* render_process_host); @@ -427,7 +421,6 @@ std::unique_ptr<AwContents> pending_contents_; std::unique_ptr<AwPdfExporter> pdf_exporter_; std::unique_ptr<PermissionRequestHandler> permission_request_handler_; - std::unique_ptr<autofill::AutofillProvider> autofill_provider_; std::unique_ptr<js_injection::JsCommunicationHost> js_communication_host_; bool view_tree_force_dark_state_ = false;
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java index 66d05d4..00c18a9 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -1015,7 +1015,6 @@ mContainerView.setWillNotDraw(false); mContext = context; - initializeAutofillProviderIfNecessary(mContext); mAppTargetSdkVersion = mContext.getApplicationInfo().targetSdkVersion; mInternalAccessAdapter = internalAccessAdapter; mNativeDrawFunctorFactory = nativeDrawFunctorFactory; @@ -1073,10 +1072,6 @@ mViewEventSink.setHideKeyboardOnBlur(false); SelectionPopupController controller = SelectionPopupController.fromWebContents(webContents); controller.setActionModeCallback(new AwActionModeCallback(mContext, this, webContents)); - if (mAutofillProvider != null) { - controller.setNonSelectionActionModeCallback( - new AutofillActionModeCallback(mContext, mAutofillProvider)); - } controller.setSelectionClient(SelectionClient.createSmartSelectionClient(webContents)); // Listen for dpad events from IMEs (e.g. Samsung Cursor Control) so we know to enable @@ -1091,10 +1086,19 @@ }); } - private void initializeAutofillProviderIfNecessary(Context context) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - mAutofillProvider = new AutofillProvider(context, mContainerView, "Android WebView"); + private void initializeAutofillProviderIfNecessary() { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return; + + if (mAutofillProvider == null) { + mAutofillProvider = + new AutofillProvider(mContext, mContainerView, mWebContents, "Android WebView"); + } else { + mAutofillProvider.setWebContents(mWebContents); } + SelectionPopupController.fromWebContents(mWebContents) + .setNonSelectionActionModeCallback( + new AutofillActionModeCallback(mContext, mAutofillProvider)); + AwContentsJni.get().initializeAndroidAutofill(mNativeAwContents); } private boolean isSamsungMailApp() { @@ -1420,14 +1424,14 @@ mWindowAndroid.getWindowAndroid(), mWebContentsInternalsHolder); AwContentsJni.get().setJavaPeers(mNativeAwContents, AwContents.this, this, mWebContentsDelegate, mContentsClientBridge, mIoThreadClient, - mInterceptNavigationDelegate, mAutofillProvider); + mInterceptNavigationDelegate); GestureListenerManager.fromWebContents(mWebContents) .addListener(new AwGestureStateListener()); mNavigationController = mWebContents.getNavigationController(); installWebContentsObserver(); mSettings.setWebContents(mWebContents); - if (mAutofillProvider != null) mAutofillProvider.setWebContents(mWebContents); + initializeAutofillProviderIfNecessary(); mDisplayObserver.onDIPScaleChanged(getDeviceScaleFactor()); @@ -1586,6 +1590,11 @@ mOnscreenContentProvider = null; } + if (mAutofillProvider != null) { + mAutofillProvider.destroy(); + mAutofillProvider = null; + } + // Remove pending messages mContentsClient.getCallbackHelper().removeCallbacksAndMessages(); @@ -4247,8 +4256,8 @@ AwWebContentsDelegate webViewWebContentsDelegate, AwContentsClientBridge contentsClientBridge, AwContentsIoThreadClient ioThreadClient, - InterceptNavigationDelegate navigationInterceptionDelegate, - AutofillProvider autofillProvider); + InterceptNavigationDelegate navigationInterceptionDelegate); + void initializeAndroidAutofill(long nativeAwContents); WebContents getWebContents(long nativeAwContents, AwContents caller); AwBrowserContext getBrowserContext(long nativeAwContents, AwContents caller); void setCompositorFrameConsumer(
diff --git a/android_webview/java/src/org/chromium/android_webview/AwSettings.java b/android_webview/java/src/org/chromium/android_webview/AwSettings.java index 8d61be4..bb3044a 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwSettings.java +++ b/android_webview/java/src/org/chromium/android_webview/AwSettings.java
@@ -592,6 +592,7 @@ * See {@link android.webkit.WebSettings#setSaveFormData}. */ public void setSaveFormData(final boolean enable) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) return; if (TRACE) Log.i(LOGTAG, "setSaveFormData=" + enable); synchronized (mAwSettingsLock) { if (mAutoCompleteEnabled != enable) {
diff --git a/ash/accessibility/ui/accessibility_confirmation_dialog.cc b/ash/accessibility/ui/accessibility_confirmation_dialog.cc index 8abeb60..a71f6d8 100644 --- a/ash/accessibility/ui/accessibility_confirmation_dialog.cc +++ b/ash/accessibility/ui/accessibility_confirmation_dialog.cc
@@ -67,6 +67,10 @@ AccessibilityConfirmationDialog::~AccessibilityConfirmationDialog() = default; +bool AccessibilityConfirmationDialog::ShouldShowCloseButton() const { + return false; +} + base::WeakPtr<AccessibilityConfirmationDialog> AccessibilityConfirmationDialog::GetWeakPtr() { return weak_ptr_factory_.GetWeakPtr();
diff --git a/ash/accessibility/ui/accessibility_confirmation_dialog.h b/ash/accessibility/ui/accessibility_confirmation_dialog.h index 9359b321..b3150e7 100644 --- a/ash/accessibility/ui/accessibility_confirmation_dialog.h +++ b/ash/accessibility/ui/accessibility_confirmation_dialog.h
@@ -29,6 +29,9 @@ AccessibilityConfirmationDialog& operator=( const AccessibilityConfirmationDialog&) = delete; + // views::DialogDelegate: + bool ShouldShowCloseButton() const override; + base::WeakPtr<AccessibilityConfirmationDialog> GetWeakPtr(); private:
diff --git a/ash/capture_mode/capture_mode_controller.cc b/ash/capture_mode/capture_mode_controller.cc index 113f7e1..c39434f 100644 --- a/ash/capture_mode/capture_mode_controller.cc +++ b/ash/capture_mode/capture_mode_controller.cc
@@ -621,19 +621,24 @@ } bool CaptureModeController::ShouldBlockRecordingForContentProtection( - aura::Window* window) const { - if (window->IsRootWindow()) { - // Recording fullscreen or partial region of it. Block if this root has a - // window with protection. - for (const auto& iter : protected_windows_) { - if (iter.first->GetRootWindow() == window) - return true; - } + aura::Window* window_being_recorded) const { + DCHECK(window_being_recorded); - return false; + // The protected window can be a descendant of the window being recorded, for + // examples: + // - When recording a fullscreen or partial region of it, the + // |window_being_recorded| in this case is the root window, and a + // protected window on this root will be a descendant. + // - When recording a browser window showing a page with protected content, + // the |window_being_recorded| in this case is the BrowserFrame, while the + // protected window will be the RenderWidgetHostViewAura, which is also a + // descendant. + for (const auto& iter : protected_windows_) { + if (window_being_recorded->Contains(iter.first)) + return true; } - return protected_windows_.contains(window); + return false; } void CaptureModeController::EndSessionOrRecording(EndRecordingReason reason) {
diff --git a/ash/capture_mode/capture_mode_controller.h b/ash/capture_mode/capture_mode_controller.h index 663748a..450311e 100644 --- a/ash/capture_mode/capture_mode_controller.h +++ b/ash/capture_mode/capture_mode_controller.h
@@ -344,7 +344,7 @@ // Tracks the windows that currently have content protection enabled, so that // we prevent them from being video recorded. Each window is mapped to its - // cureently-set protection_mask. Windows in this map are only the ones that + // currently-set protection_mask. Windows in this map are only the ones that // have protection masks other than |display::CONTENT_PROTECTION_METHOD_NONE|. base::flat_map<aura::Window*, /*protection_mask*/ uint32_t> protected_windows_;
diff --git a/ash/capture_mode/capture_mode_unittests.cc b/ash/capture_mode/capture_mode_unittests.cc index 62e5785..4082a4b 100644 --- a/ash/capture_mode/capture_mode_unittests.cc +++ b/ash/capture_mode/capture_mode_unittests.cc
@@ -2101,14 +2101,21 @@ void SetUp() override { CaptureModeTest::SetUp(); window_ = CreateTestWindow(gfx::Rect(200, 200)); - protection_delegate_ = - std::make_unique<OutputProtectionDelegate>(window_.get()); + // Create a child window with protected content. This simulates the real + // behavior of a browser window hosting a page with protected content, where + // the window that has a protection mask is the RenderWidgetHostViewAura, + // which is a descendant of the BrowserFrame window which can get recorded. + protected_content_window_ = CreateTestWindow(gfx::Rect(150, 150)); + window_->AddChild(protected_content_window_.get()); + protection_delegate_ = std::make_unique<OutputProtectionDelegate>( + protected_content_window_.get()); CaptureModeController::Get()->SetUserCaptureRegion(gfx::Rect(20, 50), /*by_user=*/true); } void TearDown() override { protection_delegate_.reset(); + protected_content_window_.reset(); window_.reset(); CaptureModeTest::TearDown(); } @@ -2141,6 +2148,7 @@ protected: std::unique_ptr<aura::Window> window_; + std::unique_ptr<aura::Window> protected_content_window_; std::unique_ptr<OutputProtectionDelegate> protection_delegate_; }; @@ -2239,6 +2247,7 @@ window_util::MoveWindowToDisplay(window_.get(), roots[1]->GetHost()->GetDisplayId()); ASSERT_EQ(window_->GetRootWindow(), roots[1]); + ASSERT_EQ(protected_content_window_->GetRootWindow(), roots[1]); EXPECT_FALSE(controller->is_recording_in_progress()); histogram_tester.ExpectBucketCount( kEndRecordingReasonInClamshellHistogramName,
diff --git a/ash/clipboard/clipboard_history_resource_manager.cc b/ash/clipboard/clipboard_history_resource_manager.cc index 6e726cc..d7569f5 100644 --- a/ash/clipboard/clipboard_history_resource_manager.cc +++ b/ash/clipboard/clipboard_history_resource_manager.cc
@@ -159,7 +159,7 @@ const ClipboardHistoryItem& item) const { const ui::ClipboardData& data = item.data(); switch (ClipboardHistoryUtil::CalculateMainFormat(data).value()) { - case ui::ClipboardInternalFormat::kBitmap: + case ui::ClipboardInternalFormat::kPng: RecordPlaceholderString(ClipboardHistoryPlaceholderStringType::kBitmap); return GetLocalizedString(IDS_CLIPBOARD_MENU_IMAGE); case ui::ClipboardInternalFormat::kText:
diff --git a/ash/clipboard/clipboard_history_resource_manager_unittest.cc b/ash/clipboard/clipboard_history_resource_manager_unittest.cc index cbe619f4..18efb2a 100644 --- a/ash/clipboard/clipboard_history_resource_manager_unittest.cc +++ b/ash/clipboard/clipboard_history_resource_manager_unittest.cc
@@ -131,16 +131,16 @@ .SetFilenames({ui::FileInfo(base::FilePath("/dir/filename"), base::FilePath("filename"))}) .SetBookmarkTitle("Bookmark Title") - .SetBitmap(gfx::test::CreateBitmap(10, 10)) + .SetPng(gfx::test::CreatePNGBytes(10)) .SetFileSystemData({u"/path/to/File.txt", u"/path/to/Other%20File.txt"}) .SetWebSmartPaste(true); - // Bitmap data always take precedence. + // PNG data always take precedence. EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), u"Image"); - builder.ClearBitmap(); + builder.ClearPng(); - // In the absence of bitmap data, HTML data takes precedence, but we use + // In the absence of PNG data, HTML data takes precedence, but we use // plain-text format for the label. EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), u"Text");
diff --git a/ash/clipboard/clipboard_history_util.cc b/ash/clipboard/clipboard_history_util.cc index 7659fd8..fbc9e89 100644 --- a/ash/clipboard/clipboard_history_util.cc +++ b/ash/clipboard/clipboard_history_util.cc
@@ -29,7 +29,7 @@ // The array of formats in order of decreasing priority. constexpr ui::ClipboardInternalFormat kPrioritizedFormats[] = { - ui::ClipboardInternalFormat::kBitmap, + ui::ClipboardInternalFormat::kPng, ui::ClipboardInternalFormat::kHtml, ui::ClipboardInternalFormat::kText, ui::ClipboardInternalFormat::kRtf, @@ -53,7 +53,8 @@ ClipboardHistoryDisplayFormat CalculateDisplayFormat( const ui::ClipboardData& data) { switch (CalculateMainFormat(data).value()) { - case ui::ClipboardInternalFormat::kBitmap: + case ui::ClipboardInternalFormat::kPng: + // TODO(crbug.com/1207638): Rename this to kImage or kPng. return ClipboardHistoryDisplayFormat::kBitmap; case ui::ClipboardInternalFormat::kHtml: if ((data.markup_data().find("<img") == std::string::npos) &&
diff --git a/ash/clipboard/clipboard_history_util_unittest.cc b/ash/clipboard/clipboard_history_util_unittest.cc index 6224678..d9f735d 100644 --- a/ash/clipboard/clipboard_history_util_unittest.cc +++ b/ash/clipboard/clipboard_history_util_unittest.cc
@@ -19,7 +19,7 @@ namespace { constexpr std::array<ui::ClipboardInternalFormat, 7> kAllFormats = { - ui::ClipboardInternalFormat::kBitmap, + ui::ClipboardInternalFormat::kPng, ui::ClipboardInternalFormat::kHtml, ui::ClipboardInternalFormat::kText, ui::ClipboardInternalFormat::kRtf, @@ -47,7 +47,7 @@ // We will cycle through all formats in prioritized order. std::deque<ui::ClipboardInternalFormat> prioritized_formats = { - ui::ClipboardInternalFormat::kBitmap, + ui::ClipboardInternalFormat::kPng, ui::ClipboardInternalFormat::kHtml, ui::ClipboardInternalFormat::kText, ui::ClipboardInternalFormat::kRtf,
diff --git a/ash/clipboard/test_support/clipboard_history_item_builder.cc b/ash/clipboard/test_support/clipboard_history_item_builder.cc index 3bc5e9e..782ac122 100644 --- a/ash/clipboard/test_support/clipboard_history_item_builder.cc +++ b/ash/clipboard/test_support/clipboard_history_item_builder.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "ash/clipboard/test_support/clipboard_history_item_builder.h" +#include <vector> #include "ash/clipboard/clipboard_history_item.h" #include "base/notreached.h" @@ -12,6 +13,7 @@ #include "ui/base/clipboard/clipboard_data.h" #include "ui/base/clipboard/clipboard_format_type.h" #include "ui/base/clipboard/custom_data_helper.h" +#include "ui/gfx/codec/png_codec.h" #include "ui/gfx/image/image_unittest_util.h" namespace ash { @@ -32,8 +34,8 @@ data.set_filenames(filenames_); if (bookmark_title_.has_value()) data.set_bookmark_title(bookmark_title_.value()); - if (bitmap_.has_value()) - data.SetBitmapData(bitmap_.value()); + if (png_.has_value()) + data.SetPngData(png_.value()); if (custom_format_.has_value() && custom_data_.has_value()) data.SetCustomData(custom_format_.value(), custom_data_.value()); if (web_smart_paste_.has_value()) @@ -46,7 +48,7 @@ markup_ = absl::nullopt; rtf_ = absl::nullopt; bookmark_title_ = absl::nullopt; - bitmap_ = absl::nullopt; + png_ = absl::nullopt; custom_format_ = absl::nullopt; custom_data_ = absl::nullopt; web_smart_paste_ = absl::nullopt; @@ -69,8 +71,8 @@ base::FilePath("filename"))}); case ui::ClipboardInternalFormat::kBookmark: return SetBookmarkTitle("Bookmark Title"); - case ui::ClipboardInternalFormat::kBitmap: - return SetBitmap(gfx::test::CreateBitmap(10, 10)); + case ui::ClipboardInternalFormat::kPng: + return SetPng(gfx::test::CreatePNGBytes(10)); case ui::ClipboardInternalFormat::kCustom: return SetCustomData("Custom Format", "Custom Data"); case ui::ClipboardInternalFormat::kWeb: @@ -94,8 +96,8 @@ return ClearFilenames(); case ui::ClipboardInternalFormat::kBookmark: return ClearBookmarkTitle(); - case ui::ClipboardInternalFormat::kBitmap: - return ClearBitmap(); + case ui::ClipboardInternalFormat::kPng: + return ClearPng(); case ui::ClipboardInternalFormat::kCustom: return ClearCustomData(); case ui::ClipboardInternalFormat::kWeb: @@ -171,14 +173,20 @@ return *this; } -ClipboardHistoryItemBuilder& ClipboardHistoryItemBuilder::SetBitmap( - const SkBitmap& bitmap) { - bitmap_ = bitmap; +ClipboardHistoryItemBuilder& ClipboardHistoryItemBuilder::SetPng( + const scoped_refptr<base::RefCountedMemory>& png) { + std::vector<uint8_t> data(png->data(), png->data() + png->size()); + return SetPng(std::move(data)); +} + +ClipboardHistoryItemBuilder& ClipboardHistoryItemBuilder::SetPng( + std::vector<uint8_t> png) { + png_ = std::move(png); return *this; } -ClipboardHistoryItemBuilder& ClipboardHistoryItemBuilder::ClearBitmap() { - bitmap_ = absl::nullopt; +ClipboardHistoryItemBuilder& ClipboardHistoryItemBuilder::ClearPng() { + png_ = absl::nullopt; return *this; }
diff --git a/ash/clipboard/test_support/clipboard_history_item_builder.h b/ash/clipboard/test_support/clipboard_history_item_builder.h index 5a9ea88..6665efee 100644 --- a/ash/clipboard/test_support/clipboard_history_item_builder.h +++ b/ash/clipboard/test_support/clipboard_history_item_builder.h
@@ -8,8 +8,8 @@ #include <string> #include "ash/ash_export.h" +#include "base/memory/ref_counted_memory.h" #include "third_party/abseil-cpp/absl/types/optional.h" -#include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/clipboard/file_info.h" namespace ui { @@ -67,9 +67,11 @@ const std::string& bookmark_title); ClipboardHistoryItemBuilder& ClearBookmarkTitle(); - // Sets/clears `bitmap_` data. - ClipboardHistoryItemBuilder& SetBitmap(const SkBitmap& bitmap); - ClipboardHistoryItemBuilder& ClearBitmap(); + // Sets/clears `png_` data. + ClipboardHistoryItemBuilder& SetPng(std::vector<uint8_t> png); + ClipboardHistoryItemBuilder& SetPng( + const scoped_refptr<base::RefCountedMemory>& png); + ClipboardHistoryItemBuilder& ClearPng(); // Sets/clears `custom_format_` and `custom_data_` data. ClipboardHistoryItemBuilder& SetCustomData(const std::string& custom_format, @@ -93,7 +95,7 @@ absl::optional<std::string> rtf_; std::vector<ui::FileInfo> filenames_; absl::optional<std::string> bookmark_title_; - absl::optional<SkBitmap> bitmap_; + absl::optional<std::vector<uint8_t>> png_; absl::optional<std::string> custom_format_; absl::optional<std::string> custom_data_; absl::optional<bool> web_smart_paste_;
diff --git a/ash/clipboard/views/clipboard_history_bitmap_item_view.cc b/ash/clipboard/views/clipboard_history_bitmap_item_view.cc index df18376..31cf4f7 100644 --- a/ash/clipboard/views/clipboard_history_bitmap_item_view.cc +++ b/ash/clipboard/views/clipboard_history_bitmap_item_view.cc
@@ -15,9 +15,11 @@ #include "base/time/time.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/models/image_model.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animation_observer.h" #include "ui/compositor/scoped_layer_animation_settings.h" +#include "ui/gfx/image/image.h" #include "ui/gfx/image/image_skia.h" #include "ui/strings/grit/ui_strings.h" #include "ui/views/controls/image_view.h" @@ -235,11 +237,13 @@ clipboard_history_item, container_->resource_manager_, base::BindRepeating(&BitmapContentsView::UpdateImageViewSize, weak_ptr_factory_.GetWeakPtr())); - case ui::ClipboardInternalFormat::kBitmap: { + case ui::ClipboardInternalFormat::kPng: { auto image_view = std::make_unique<views::ImageView>(); - gfx::ImageSkia bitmap_image = gfx::ImageSkia::CreateFrom1xBitmap( - clipboard_history_item->data().bitmap()); - image_view->SetImage(bitmap_image); + gfx::Image image = gfx::Image::CreateFrom1xPNGBytes( + clipboard_history_item->data().png().data(), + clipboard_history_item->data().png().size()); + ui::ImageModel image_model = ui::ImageModel::FromImage(image); + image_view->SetImage(image_model); return image_view; } default: @@ -262,7 +266,7 @@ // should meet at least one edge of the contents bounds. float scaling_up_ratio = 0.f; switch (container_->data_format_) { - case ui::ClipboardInternalFormat::kBitmap: { + case ui::ClipboardInternalFormat::kPng: { scaling_up_ratio = std::fmin(width_ratio, height_ratio); break; } @@ -318,8 +322,8 @@ switch (data_format_) { case ui::ClipboardInternalFormat::kHtml: return l10n_util::GetStringUTF16(IDS_CLIPBOARD_HISTORY_MENU_HTML_IMAGE); - case ui::ClipboardInternalFormat::kBitmap: - return l10n_util::GetStringUTF16(IDS_CLIPBOARD_HISTORY_MENU_BITMAP_IMAGE); + case ui::ClipboardInternalFormat::kPng: + return l10n_util::GetStringUTF16(IDS_CLIPBOARD_HISTORY_MENU_PNG_IMAGE); default: NOTREACHED(); return std::u16string();
diff --git a/ash/constants/ash_switches.cc b/ash/constants/ash_switches.cc index 0b46057..1358575fa 100644 --- a/ash/constants/ash_switches.cc +++ b/ash/constants/ash_switches.cc
@@ -202,6 +202,12 @@ // file). const char kDefaultWallpaperSmall[] = "default-wallpaper-small"; +// App ID to use for highlights app in demo mode. +const char kDemoModeHighlightsApp[] = "demo-mode-highlights-extension"; + +// App ID to use for screensaver app in demo mode. +const char kDemoModeScreensaverApp[] = "demo-mode-screensaver-extension"; + // Time in seconds before a machine at OOBE is considered derelict. const char kDerelictDetectionTimeout[] = "derelict-detection-timeout";
diff --git a/ash/constants/ash_switches.h b/ash/constants/ash_switches.h index 0c20adfe..96e0f7c0 100644 --- a/ash/constants/ash_switches.h +++ b/ash/constants/ash_switches.h
@@ -65,6 +65,8 @@ COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kDefaultWallpaperIsOem[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kDefaultWallpaperLarge[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kDefaultWallpaperSmall[]; +COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kDemoModeHighlightsApp[]; +COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kDemoModeScreensaverApp[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kDerelictDetectionTimeout[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kDerelictIdleTimeout[];
diff --git a/ash/public/cpp/default_scale_factor_retriever.cc b/ash/public/cpp/default_scale_factor_retriever.cc index 02462ac..55ad199 100644 --- a/ash/public/cpp/default_scale_factor_retriever.cc +++ b/ash/public/cpp/default_scale_factor_retriever.cc
@@ -7,6 +7,7 @@ #include <utility> #include "base/bind.h" +#include "ui/display/display.h" namespace ash {
diff --git a/ash/services/recording/recording_service.h b/ash/services/recording/recording_service.h index b550dd4..9da58778 100644 --- a/ash/services/recording/recording_service.h +++ b/ash/services/recording/recording_service.h
@@ -27,7 +27,7 @@ #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" -#include "services/viz/privileged/mojom/compositing/frame_sink_video_capture.mojom-forward.h" +#include "services/viz/privileged/mojom/compositing/frame_sink_video_capture.mojom.h" #include "ui/gfx/image/image_skia.h" namespace recording {
diff --git a/ash/wm/default_state.cc b/ash/wm/default_state.cc index f082f67..fcaeae3 100644 --- a/ash/wm/default_state.cc +++ b/ash/wm/default_state.cc
@@ -248,7 +248,6 @@ case WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE: { gfx::Rect work_area = screen_util::GetDisplayWorkAreaBoundsInParent(window); - // Maximize vertically if: // - The window does not have a max height defined. // - The window has the normal state type. Snapped windows are excluded @@ -258,18 +257,14 @@ !window_state->IsNormalStateType()) { return; } - if (window_state->HasRestoreBounds() && - (window->bounds().height() == work_area.height() && - window->bounds().y() == work_area.y())) { - window_state->SetBoundsDirectCrossFade( - window_state->GetRestoreBoundsInParent()); - window_state->ClearRestoreBounds(); - } else { - window_state->SaveCurrentBoundsForRestore(); + if (!window_state->VerticallyShrinkWindow(work_area)) { + gfx::Rect restore_bounds = window->GetTargetBounds(); const gfx::Rect new_bounds = gfx::Rect(window->bounds().x(), work_area.y(), window->bounds().width(), work_area.height()); window_state->SetBoundsDirectCrossFade(new_bounds); + if (!window_state->HasRestoreBounds()) + window_state->SetRestoreBoundsInParent(restore_bounds); } return; } @@ -283,28 +278,20 @@ return; gfx::Rect work_area = screen_util::GetDisplayWorkAreaBoundsInParent(window); - if (window_state->IsNormalStateType() && - window_state->HasRestoreBounds() && - (window->bounds().width() == work_area.width() && - window->bounds().x() == work_area.x())) { - window_state->SetBoundsDirectCrossFade( - window_state->GetRestoreBoundsInParent()); - window_state->ClearRestoreBounds(); - } else { + if (!window_state->HorizontallyShrinkWindow(work_area)) { gfx::Rect new_bounds(work_area.x(), window->bounds().y(), work_area.width(), window->bounds().height()); - gfx::Rect restore_bounds = window->GetTargetBounds(); if (window_state->IsSnapped()) { - window_state->SetRestoreBoundsInParent(new_bounds); + window_state->SetRestoreBoundsInParent(window->bounds()); window_state->Restore(); // The restore logic prevents a window from being restored to bounds // which match the workspace bounds exactly so it is necessary to set // the bounds again below. } - - window_state->SetRestoreBoundsInParent(restore_bounds); + if (!window_state->HasRestoreBounds()) + window_state->SetRestoreBoundsInParent(restore_bounds); window_state->SetBoundsDirectCrossFade(new_bounds); } return;
diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc index f2617db..1825874 100644 --- a/ash/wm/window_state.cc +++ b/ash/wm/window_state.cc
@@ -431,6 +431,52 @@ window_->ClearProperty(::wm::kVirtualKeyboardRestoreBoundsKey); } +bool WindowState::VerticallyShrinkWindow(const gfx::Rect& work_area) { + if (!HasRestoreBounds()) + return false; + // Check if window is not work area vertical maximized. + gfx::Rect bounds = window_->bounds(); + if (bounds.height() != work_area.height() || bounds.y() != work_area.y()) + return false; + + gfx::Rect restore_bounds = GetRestoreBoundsInParent(); + gfx::Rect new_bounds = restore_bounds; + + // Shrink from work area maximized window. + if (bounds == work_area) { + new_bounds = gfx::Rect(work_area.x(), restore_bounds.y(), work_area.width(), + restore_bounds.height()); + // Restore bounds is not cleared here in case a 2nd shrink is called next. + } else { + ClearRestoreBounds(); + } + + SetBoundsDirectCrossFade(new_bounds); + return true; +} + +bool WindowState::HorizontallyShrinkWindow(const gfx::Rect& work_area) { + if (!HasRestoreBounds()) + return false; + // Check if window is not work area horizontal maximized. + gfx::Rect bounds = window_->bounds(); + if (bounds.width() != work_area.width() || bounds.x() != work_area.x()) + return false; + + gfx::Rect restore_bounds = GetRestoreBoundsInParent(); + gfx::Rect new_bounds = restore_bounds; + + // Shrink from work area maximized window. + if (bounds == work_area) { + new_bounds = gfx::Rect(restore_bounds.x(), work_area.y(), + restore_bounds.width(), work_area.height()); + } else { + ClearRestoreBounds(); + } + SetBoundsDirectCrossFade(new_bounds); + return true; +} + std::unique_ptr<WindowState::State> WindowState::SetStateObject( std::unique_ptr<WindowState::State> new_state) { current_state_->DetachState(this);
diff --git a/ash/wm/window_state.h b/ash/wm/window_state.h index d1c38c7..5fa3098 100644 --- a/ash/wm/window_state.h +++ b/ash/wm/window_state.h
@@ -199,6 +199,14 @@ // Deletes and clears the restore bounds property on the window. void ClearRestoreBounds(); + // Shrink window from work_area/vertical maximized state. + // If window is not vertically shrinkable, return false. + bool VerticallyShrinkWindow(const gfx::Rect& work_area); + + // Shrink window from work_area/horizontal maximized state. + // If window is not horizontally shrinkable, return false. + bool HorizontallyShrinkWindow(const gfx::Rect& work_area); + // Replace the State object of a window with a state handler which can // implement a new window manager type. The passed object will be owned // by this object and the returned object will be owned by the caller.
diff --git a/ash/wm/workspace/workspace_event_handler_unittest.cc b/ash/wm/workspace/workspace_event_handler_unittest.cc index 932b83a..5007cc61 100644 --- a/ash/wm/workspace/workspace_event_handler_unittest.cc +++ b/ash/wm/workspace/workspace_event_handler_unittest.cc
@@ -376,6 +376,91 @@ EXPECT_EQ(restore_bounds.ToString(), window->bounds().ToString()); } +// Test that double clicking on window side edge horizontally and vertically +// will maximize the window, double click vertically and horizontally will +// return to previous state. +TEST_F(WorkspaceEventHandlerTest, DoubleClickEdgesTogglesMaximizeAndRestore) { + aura::test::TestWindowDelegate delegate; + std::unique_ptr<aura::Window> window( + CreateTestWindow(&delegate, gfx::Rect(1, 0, 30, 40))); + window->SetProperty(aura::client::kResizeBehaviorKey, + aura::client::kResizeBehaviorCanMaximize | + aura::client::kResizeBehaviorCanResize); + + WindowState* window_state = WindowState::Get(window.get()); + gfx::Rect restore_bounds_original = window->bounds(); + gfx::Rect work_area_in_parent = + screen_util::GetDisplayWorkAreaBoundsInParent(window.get()); + + ASSERT_FALSE(window_state->IsMaximized()); + + // 1) Double clicking a normal window's left edge should toggle horizontal + // maximize. + delegate.set_window_component(HTLEFT); + aura::Window* root = Shell::GetPrimaryRootWindow(); + ui::test::EventGenerator generator(root, window.get()); + generator.DoubleClickLeftButton(); + EXPECT_TRUE(window_state->IsNormalStateType()); + EXPECT_EQ(work_area_in_parent.x(), window->bounds().x()); + EXPECT_EQ(restore_bounds_original.y(), window->bounds().y()); + EXPECT_EQ(work_area_in_parent.width(), window->bounds().width()); + EXPECT_EQ(restore_bounds_original.height(), window->bounds().height()); + // Second restore bounds is set to the horizontal maximized bound. + gfx::Rect restore_bounds_second = window->bounds(); + + // 2) Double clicking a horizontal maximized window's top edge should vertical + // maximize. + delegate.set_window_component(HTTOP); + generator.DoubleClickLeftButton(); + EXPECT_EQ(work_area_in_parent.width(), window->bounds().width()); + + // 3) Double clicking a maximized window's top edge should restore it to + // second restore bounds. + delegate.set_window_component(HTTOP); + generator.DoubleClickLeftButton(); + EXPECT_EQ(restore_bounds_second, window->bounds()); + + // 4) Double clicking again will restore the window to original bounds. + delegate.set_window_component(HTLEFT); + generator.DoubleClickLeftButton(); + EXPECT_TRUE(window_state->IsNormalStateType()); + EXPECT_EQ(restore_bounds_original, window->bounds()); + + // Test restore bounds when reverse the order of double click on edges. + // 1) Double clicking a normal window's left edge should toggle horizontal + // maximize. + delegate.set_window_component(HTLEFT); + // Third restore bounds is set to the vertical maximized bound with width from + // original window. + gfx::Rect restore_bounds_third = window->bounds(); + restore_bounds_third.set_height(work_area_in_parent.height()); + + generator.DoubleClickLeftButton(); + EXPECT_TRUE(window_state->IsNormalStateType()); + EXPECT_EQ(work_area_in_parent.x(), window->bounds().x()); + EXPECT_EQ(restore_bounds_original.y(), window->bounds().y()); + EXPECT_EQ(work_area_in_parent.width(), window->bounds().width()); + EXPECT_EQ(restore_bounds_original.height(), window->bounds().height()); + + // 2) Double clicking a horizontal maximized window's top edge should vertical + // maximize. + delegate.set_window_component(HTTOP); + generator.DoubleClickLeftButton(); + EXPECT_EQ(work_area_in_parent.width(), window->bounds().width()); + + // 3) Double clicking a maximized window's left edge should restore it to + // third restore bounds. + delegate.set_window_component(HTLEFT); + generator.DoubleClickLeftButton(); + EXPECT_TRUE(window_state->IsNormalStateType()); + EXPECT_EQ(restore_bounds_third, window->bounds()); + + // 4) Double clicking again will restore the window to original bounds. + delegate.set_window_component(HTTOP); + generator.DoubleClickLeftButton(); + EXPECT_EQ(restore_bounds_original, window->bounds()); +} + // Test that double clicking the middle button on the window header does not // toggle the maximized state. TEST_F(WorkspaceEventHandlerTest,
diff --git a/base/android/java/src/org/chromium/base/CommandLine.java b/base/android/java/src/org/chromium/base/CommandLine.java index 63ff321..06ecab4 100644 --- a/base/android/java/src/org/chromium/base/CommandLine.java +++ b/base/android/java/src/org/chromium/base/CommandLine.java
@@ -268,9 +268,6 @@ private HashMap<String, String> mSwitches = new HashMap<String, String>(); private ArrayList<String> mArgs = new ArrayList<String>(); - // The arguments begin at index 1, since index 0 contains the executable name. - private int mArgsBegin = 1; - JavaCommandLine(@Nullable String[] args) { if (args == null || args.length == 0 || args[0] == null) { mArgs.add(""); @@ -319,13 +316,13 @@ public void appendSwitchWithValue(String switchString, String value) { mSwitches.put(switchString, value == null ? "" : value); - // Append the switch and update the switches/arguments divider mArgsBegin. + // Append the switch String combinedSwitchString = SWITCH_PREFIX + switchString; if (value != null && !value.isEmpty()) { combinedSwitchString += SWITCH_VALUE_SEPARATOR + value; } - mArgs.add(mArgsBegin++, combinedSwitchString); + mArgs.add(combinedSwitchString); } @Override @@ -363,10 +360,9 @@ // Since we permit a switch to be added multiple times, we need to remove all instances // from mArgs. - for (int i = mArgsBegin - 1; i > 0; i--) { + for (int i = mArgs.size() - 1; i > 0; i--) { if (mArgs.get(i).equals(combinedSwitchString) || mArgs.get(i).startsWith(combinedSwitchString + SWITCH_VALUE_SEPARATOR)) { - --mArgsBegin; mArgs.remove(i); } }
diff --git a/base/message_loop/message_pump_win.cc b/base/message_loop/message_pump_win.cc index 67212c1a..e8f30369 100644 --- a/base/message_loop/message_pump_win.cc +++ b/base/message_loop/message_pump_win.cc
@@ -561,25 +561,15 @@ MSG msg; bool have_message = false; { - // ::PeekMessage may process internal events. - auto scoped_do_work = run_state_->delegate->BeginWorkItem(); - + // Note: Ideally this call wouldn't process sent-messages (as we already did + // that in the PeekMessage call that lead to receiving this kMsgHaveWork), + // but there's no way to specify this (omitting PM_QS_SENDMESSAGE as in + // crrev.com/791043 doesn't do anything). Hence this call must be considered + // as a potential work item. TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("base"), "MessagePumpForUI::ProcessPumpReplacementMessage PeekMessage"); - - // The system headers don't define PM_QS_ALLEVENTS; it's equivalent to - // PM_QS_INPUT | PM_QS_PAINT | PM_QS_POSTMESSAGE. i.e., anything but - // QS_SENDMESSAGE. - // Since we're looking to replace our kMsgHaveWork posted message, we can - // ignore sent messages (which never compete with posted messages in the - // initial PeekMessage call). - constexpr auto PM_QS_ALLEVENTS = QS_ALLEVENTS << 16; - static_assert( - PM_QS_ALLEVENTS == (PM_QS_INPUT | PM_QS_PAINT | PM_QS_POSTMESSAGE), ""); - static_assert((PM_QS_ALLEVENTS & PM_QS_SENDMESSAGE) == 0, ""); - - have_message = ::PeekMessage(&msg, nullptr, 0, 0, - PM_REMOVE | PM_QS_ALLEVENTS) != FALSE; + auto scoped_do_work = run_state_->delegate->BeginWorkItem(); + have_message = ::PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE) != FALSE; } // Expect no message or a message different than kMsgHaveWork.
diff --git a/base/process/process_metrics.cc b/base/process/process_metrics.cc index 54b00ac..21a8428 100644 --- a/base/process/process_metrics.cc +++ b/base/process/process_metrics.cc
@@ -4,13 +4,6 @@ #include "base/process/process_metrics.h" -#if defined(OS_LINUX) -// process_metrics.h is a widely included header and its size impacts build -// time. Try not to raise this limit unless necessary. See -// https://chromium.googlesource.com/chromium/src/+/HEAD/docs/wmax_tokens.md -#pragma clang max_tokens_here 406534 -#endif // defined(OS_LINUX) - #include <utility> #include "base/check.h"
diff --git a/base/task/sequence_manager/DIR_METADATA b/base/task/sequence_manager/DIR_METADATA new file mode 100644 index 0000000..dbabb3c --- /dev/null +++ b/base/task/sequence_manager/DIR_METADATA
@@ -0,0 +1,3 @@ +monorail { + component: "Internals>SequenceManager" +}
diff --git a/base/task/sequence_manager/OWNERS b/base/task/sequence_manager/OWNERS index 04b3a71..9b112a6 100644 --- a/base/task/sequence_manager/OWNERS +++ b/base/task/sequence_manager/OWNERS
@@ -1,5 +1,3 @@ altimin@chromium.org carlscab@google.com skyostil@chromium.org - -# Component: Internals>SequenceManager \ No newline at end of file
diff --git a/base/test/android/java/src/org/chromium/base/OWNERS b/base/test/android/java/src/org/chromium/base/OWNERS index 89442abe..8f094e0 100644 --- a/base/test/android/java/src/org/chromium/base/OWNERS +++ b/base/test/android/java/src/org/chromium/base/OWNERS
@@ -1,2 +1,2 @@ per-file *.aidl=set noparent -per-file *.aidl=file://ipc/SECURITY_OWNERS \ No newline at end of file +per-file *.aidl=file://ipc/SECURITY_OWNERS
diff --git a/base/tracing/OWNERS b/base/tracing/OWNERS index 2c2f79b..e94c6d8f 100644 --- a/base/tracing/OWNERS +++ b/base/tracing/OWNERS
@@ -1 +1 @@ -file://base/trace_event/OWNERS \ No newline at end of file +file://base/trace_event/OWNERS
diff --git a/base/util/memory_pressure/OWNERS b/base/util/memory_pressure/OWNERS index 0ca8879..cc5fb076c 100644 --- a/base/util/memory_pressure/OWNERS +++ b/base/util/memory_pressure/OWNERS
@@ -1,3 +1,3 @@ chrisha@chromium.org fdoray@chromium.org -sebmarchand@chromium.org \ No newline at end of file +sebmarchand@chromium.org
diff --git a/build/config/chromeos/ui_mode.gni b/build/config/chromeos/ui_mode.gni index df578bc9..208969e 100644 --- a/build/config/chromeos/ui_mode.gni +++ b/build/config/chromeos/ui_mode.gni
@@ -30,7 +30,4 @@ # is_chromeos_{ash,lacros} should be set true only for builds with target # toolchains. is_chromeos_ash = is_chromeos && !chromeos_is_browser_only - -# TODO(crbug.com/1052397): Remove is_linux once lacros-chrome switches -# to target_os=chromeos -is_chromeos_lacros = (is_chromeos || is_linux) && chromeos_is_browser_only +is_chromeos_lacros = is_chromeos && chromeos_is_browser_only
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index f8aa62f..8d5a1965 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -952,6 +952,7 @@ "//chrome/browser/ui/android/theme:java", "//chrome/browser/ui/android/toolbar:java", "//chrome/browser/ui/android/toolbar:junit", + "//chrome/browser/ui/android/webid:junit", "//chrome/browser/ui/messages/android:java", "//chrome/browser/ui/messages/android:junit", "//chrome/browser/user_education:java",
diff --git a/chrome/android/chrome_java_resources.gni b/chrome/android/chrome_java_resources.gni index acd85c25..56ea2c7 100644 --- a/chrome/android/chrome_java_resources.gni +++ b/chrome/android/chrome_java_resources.gni
@@ -599,6 +599,7 @@ "java/res/drawable/ic_person_add_40dp.xml", "java/res/drawable/ic_photo_camera_black.xml", "java/res/drawable/ic_reading_list_folder.xml", + "java/res/drawable/ic_right_arrow_black_24dp.xml", "java/res/drawable/ic_settings_black.xml", "java/res/drawable/ic_signal_cellular_0_bar.xml", "java/res/drawable/ic_signal_cellular_1_bar.xml", @@ -849,6 +850,7 @@ "java/res/layout/update_menu_item.xml", "java/res/layout/url_action_container.xml", "java/res/layout/url_bar.xml", + "java/res/layout/webapk_icon_name_update_dialog.xml", "java/res/menu/bookmark_action_bar_menu.xml", "java/res/menu/custom_tabs_menu.xml", "java/res/menu/history_manager_menu.xml",
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index 8c7b4fce..050b531 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -1365,6 +1365,8 @@ "java/src/org/chromium/chrome/browser/webapps/WebApkActivityCoordinator.java", "java/src/org/chromium/chrome/browser/webapps/WebApkActivityLifecycleUmaTracker.java", "java/src/org/chromium/chrome/browser/webapps/WebApkHandlerDelegate.java", + "java/src/org/chromium/chrome/browser/webapps/WebApkIconNameUpdateCustomView.java", + "java/src/org/chromium/chrome/browser/webapps/WebApkIconNameUpdateDialog.java", "java/src/org/chromium/chrome/browser/webapps/WebApkInstallService.java", "java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java", "java/src/org/chromium/chrome/browser/webapps/WebApkIntentDataProviderFactory.java",
diff --git a/chrome/android/chrome_test_java_sources.gni b/chrome/android/chrome_test_java_sources.gni index 7a553d2..4fad85a 100644 --- a/chrome/android/chrome_test_java_sources.gni +++ b/chrome/android/chrome_test_java_sources.gni
@@ -616,6 +616,7 @@ "javatests/src/org/chromium/chrome/browser/webapps/WebApkActivityTest.java", "javatests/src/org/chromium/chrome/browser/webapps/WebApkActivityTestRule.java", "javatests/src/org/chromium/chrome/browser/webapps/WebApkCurrentPageVerifierTest.java", + "javatests/src/org/chromium/chrome/browser/webapps/WebApkIconNameUpdateDialogTest.java", "javatests/src/org/chromium/chrome/browser/webapps/WebApkInitializationTest.java", "javatests/src/org/chromium/chrome/browser/webapps/WebApkIntegrationTest.java", "javatests/src/org/chromium/chrome/browser/webapps/WebApkUpdateDataFetcherTest.java",
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java index 7a5b192..484773a 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java
@@ -68,6 +68,7 @@ import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.browser.autofill_assistant.generic_ui.AssistantDimension; import org.chromium.chrome.browser.autofill_assistant.proto.ActionProto; +import org.chromium.chrome.browser.autofill_assistant.proto.AutofillCreditCardProto; import org.chromium.chrome.browser.autofill_assistant.proto.AutofillFormatProto; import org.chromium.chrome.browser.autofill_assistant.proto.AutofillProfileProto; import org.chromium.chrome.browser.autofill_assistant.proto.BooleanAndProto; @@ -85,6 +86,7 @@ import org.chromium.chrome.browser.autofill_assistant.proto.ComputeValueProto; import org.chromium.chrome.browser.autofill_assistant.proto.CreateCreditCardResponseProto; import org.chromium.chrome.browser.autofill_assistant.proto.CreateNestedGenericUiProto; +import org.chromium.chrome.browser.autofill_assistant.proto.CreditCardList; import org.chromium.chrome.browser.autofill_assistant.proto.CreditCardResponseProto; import org.chromium.chrome.browser.autofill_assistant.proto.DateFormatProto; import org.chromium.chrome.browser.autofill_assistant.proto.DateList; @@ -94,6 +96,7 @@ import org.chromium.chrome.browser.autofill_assistant.proto.ElementAreaProto; import org.chromium.chrome.browser.autofill_assistant.proto.ElementAreaProto.Rectangle; import org.chromium.chrome.browser.autofill_assistant.proto.ElementConditionProto; +import org.chromium.chrome.browser.autofill_assistant.proto.Empty; import org.chromium.chrome.browser.autofill_assistant.proto.EndActionProto; import org.chromium.chrome.browser.autofill_assistant.proto.EventProto; import org.chromium.chrome.browser.autofill_assistant.proto.ForEachProto; @@ -3524,14 +3527,31 @@ @Test @MediumTest - public void testDisplaySelectedAddressInfo() throws Exception { + public void testDisplaySelectedInfo() throws Exception { mHelper.addDummyCreditCard( mHelper.addDummyProfile("Jane Doe", "johndoe@google.com"), "4111111111111111"); - ViewProto rootView = + ViewProto creditCardView = + (ViewProto) ViewProto.newBuilder() + .setTextView(TextViewProto.newBuilder().setModelIdentifier("card_type")) + .setIdentifier("cardView") + .build(); + + ViewProto profileView = (ViewProto) ViewProto.newBuilder() .setTextView(TextViewProto.newBuilder().setModelIdentifier("profile_name")) - .setIdentifier("textView") + .setIdentifier("profileView") + .build(); + + ViewProto rootView = + (ViewProto) ViewProto.newBuilder() + .setViewContainer( + ViewContainerProto.newBuilder() + .setLinearLayout( + LinearLayoutProto.newBuilder().setOrientation( + LinearLayoutProto.Orientation.VERTICAL)) + .addViews(creditCardView) + .addViews(profileView)) .build(); List<InteractionProto> interactions = new ArrayList<>(); @@ -3539,28 +3559,48 @@ (InteractionProto) InteractionProto.newBuilder() .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( OnModelValueChangedEventProto.newBuilder().setModelIdentifier( + "selected_card"))) + .addCallbacks( + createAutofillToStringCallback("selected_card[0]", "card_type", + ValueExpression.newBuilder().addChunk( + Chunk.newBuilder().setKey(58)))) + .build()); + + interactions.add( + (InteractionProto) InteractionProto.newBuilder() + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( + OnModelValueChangedEventProto.newBuilder().setModelIdentifier( "profile"))) .addCallbacks(createAutofillToStringCallback("profile[0]", "profile_name", ValueExpression.newBuilder().addChunk( Chunk.newBuilder().setKey(3)))) .build()); + List<ModelProto.ModelValue> modelValues = new ArrayList<>(); modelValues.add( ModelValue.newBuilder() + .setValue(ValueProto.newBuilder().setCreditCards( + CreditCardList.newBuilder().addValues( + AutofillCreditCardProto.newBuilder().setSelectedCreditCard( + Empty.newBuilder())))) + .setIdentifier("selected_card") + .build()); + modelValues.add( + ModelValue.newBuilder() .setValue(ValueProto.newBuilder().setProfiles( ProfileList.newBuilder().addValues( AutofillProfileProto.newBuilder().setSelectedProfileName( - "SHIPPING_ADDRESS")))) + "billing_address")))) .setIdentifier("profile") .build()); ArrayList<ActionProto> list = new ArrayList<>(); list.add((ActionProto) ActionProto.newBuilder() - .setCollectUserData( - CollectUserDataProto.newBuilder() - .setRequestTermsAndConditions(false) - .setShippingAddressSectionTitle("Delivery address") - .setShippingAddressName("SHIPPING_ADDRESS")) + .setCollectUserData(CollectUserDataProto.newBuilder() + .setRequestTermsAndConditions(false) + .setRequestPaymentMethod(true) + .setBillingAddressName("billing_address") + .addSupportedBasicCardNetworks("visa")) .build()); list.add((ActionProto) ActionProto.newBuilder() .setSetPersistentUi( @@ -3594,6 +3634,7 @@ onView(withText("Continue")).perform(click()); waitUntilViewMatchesCondition(withText("End"), isDisplayed()); + waitUntilViewMatchesCondition(withText("Visa"), isCompletelyDisplayed()); waitUntilViewMatchesCondition(withText("Jane"), isCompletelyDisplayed()); } }
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/TriggerContext.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/TriggerContext.java index 13153f0d..d579f81 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/TriggerContext.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/TriggerContext.java
@@ -134,7 +134,10 @@ * initial URL when available to avoid issues where the initial URL points to a redirect * rather than the actual deeplink. */ - private static final String PARAMETER_ORIGINAL_DEEPLINK = "ORIGINAL_DEEPLINK"; + public static final String PARAMETER_ORIGINAL_DEEPLINK = "ORIGINAL_DEEPLINK"; + + /** Identifies the caller, i.e., the trigger surface. */ + public static final String PARAMETER_CALLER = "CALLER"; /** * Defines whether or not it is allowed to open an app instead of continuing with Autofill
diff --git a/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceTest.java b/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceTest.java index c96235fb..afa1992 100644 --- a/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceTest.java +++ b/chrome/android/features/start_surface/internal/javatests/src/org/chromium/chrome/features/start_surface/StartSurfaceTest.java
@@ -4,8 +4,6 @@ package org.chromium.chrome.features.start_surface; -import static android.os.Build.VERSION_CODES.M; - import static androidx.test.espresso.Espresso.onView; import static androidx.test.espresso.action.ViewActions.click; import static androidx.test.espresso.action.ViewActions.pressKey; @@ -111,6 +109,7 @@ import org.chromium.chrome.test.util.ChromeApplicationTestUtils; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.chrome.test.util.OverviewModeBehaviorWatcher; +import org.chromium.chrome.test.util.ViewUtils; import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.chrome.test.util.browser.suggestions.SuggestionsDependenciesRule; import org.chromium.chrome.test.util.browser.suggestions.mostvisited.FakeMostVisitedSites; @@ -227,17 +226,7 @@ @MediumTest @Feature({"StartSurface"}) @CommandLineFlags.Add({BASE_PARAMS + "/single/home_button_on_grid_tab_switcher/false"}) - @FlakyTest(message = "https://crbug.com/1207306") public void testShow_SingleAsHomepage() { - Assume.assumeFalse("https://crbug.com/1196473", - mUseInstantStart && mImmediateReturn - && (Build.VERSION.SDK_INT == Build.VERSION_CODES.N - || Build.VERSION.SDK_INT == Build.VERSION_CODES.N_MR1)); - Assume.assumeFalse("https://crbug.com/1205514", - mUseInstantStart && !mImmediateReturn - && (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP - || Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1)); - if (!mImmediateReturn) { StartSurfaceTestUtils.pressHomePageButton(mActivityTestRule.getActivity()); } @@ -246,7 +235,7 @@ ChromeTabbedActivity cta = mActivityTestRule.getActivity(); onViewWaiting(withId(R.id.primary_tasks_surface_view)); - onView(withId(R.id.search_box_text)).check(matches(isDisplayed())); + onViewWaiting(withId(R.id.search_box_text)).check(matches(isDisplayed())); onView(withId(org.chromium.chrome.tab_ui.R.id.mv_tiles_container)) .check(matches(isDisplayed())); onView(withId(org.chromium.chrome.tab_ui.R.id.tab_switcher_title)) @@ -463,8 +452,6 @@ @Feature({"StartSurface"}) // clang-format off @CommandLineFlags.Add({BASE_PARAMS + "/single"}) - @DisableIf. - Build(sdk_is_less_than = Build.VERSION_CODES.P, message = "Flaky, see crbug.com/1169673") public void testShow_SingleAsHomepage_FromResumeShowStart() throws Exception { // clang-format on if (!mImmediateReturn) { @@ -523,8 +510,7 @@ assertThat(cta.getTabModelSelector().getCurrentModel().getCount(), equalTo(2)); TestThreadUtils.runOnUiThreadBlocking(() -> cta.getTabCreator(false).launchNTP()); - StartSurfaceTestUtils.waitForOverviewVisible( - mLayoutChangedCallbackHelper, mCurrentlyActiveLayout); + StartSurfaceTestUtils.waitForOverviewVisible(cta); onViewWaiting(withId(R.id.search_box_text)); TextView urlBar = cta.findViewById(R.id.url_bar); Assert.assertFalse(urlBar.isFocused()); @@ -939,7 +925,6 @@ @Test @MediumTest @Feature({"StartSurface"}) - @DisabledTest(message = "https://crbug.com/1176084") // clang-format off @CommandLineFlags.Add({BASE_PARAMS + "/single"}) public void testShow_SingleAsHomepage_BackButton() { @@ -1262,10 +1247,7 @@ @Test @LargeTest @Feature({"StartSurface"}) - @DisableIf.Build(sdk_is_less_than = M, message = "https://crbug.com/1170553") - @DisableIf.Build(supported_abis_includes = "x86", message = "https://crbug.com/1170553") @CommandLineFlags.Add({BASE_PARAMS + "/single/omnibox_focused_on_new_tab/true"}) - @DisabledTest(message = "http://crbug/1205998 - the NoInstant_Return version is flaky.") public void testOmnibox_FocusedOnNewTabInSingleSurface() { if (!mImmediateReturn) { StartSurfaceTestUtils.pressHomePageButton(mActivityTestRule.getActivity()); @@ -1274,7 +1256,7 @@ mLayoutChangedCallbackHelper, mCurrentlyActiveLayout); ChromeTabbedActivity cta = mActivityTestRule.getActivity(); StartSurfaceTestUtils.waitForTabModel(cta); - assertThat(cta.getTabModelSelector().getCurrentModel().getCount(), equalTo(1)); + TabUiTestHelper.verifyTabModelTabCount(cta, 1, 0); // Launches a new Tab from the Start surface, and verifies the omnibox is focused. TestThreadUtils.runOnUiThreadBlocking(() -> cta.getTabCreator(false).launchNTP()); @@ -1313,25 +1295,6 @@ TestThreadUtils.runOnUiThreadBlocking(() -> { assertTrue(TextUtils.equals(toolbarDataProvider.getCurrentUrl(), UrlConstants.NTP_URL)); }); - - // Navigates the Tab to show home button. - TestThreadUtils.runOnUiThreadBlocking(() -> urlBar.setText("about:blank")); - onView(withId(R.id.url_bar)).perform(pressKey(KeyEvent.KEYCODE_ENTER)); - - // Goes to the Start surface from tapping home button, and navigate from the Omnibox. The - // new created Tab shouldn't get focus. - StartSurfaceTestUtils.pressHomePageButton(cta); - StartSurfaceTestUtils.waitForOverviewVisible( - mLayoutChangedCallbackHelper, mCurrentlyActiveLayout); - - onViewWaiting(withId(R.id.search_box_text)).perform(replaceText("about:blank")); - onView(withId(R.id.url_bar)).perform(pressKey(KeyEvent.KEYCODE_ENTER)); - waitForView(withId(R.id.primary_tasks_surface_view), VIEW_GONE); - - TabUiTestHelper.verifyTabModelTabCount(cta, 4, 0); - waitForView(withId(R.id.search_box_text)); - waitForView(withId(R.id.toolbar_buttons)); - Assert.assertFalse(urlBar.isFocused()); } @Test @@ -1349,7 +1312,7 @@ mLayoutChangedCallbackHelper, mCurrentlyActiveLayout); ChromeTabbedActivity cta = mActivityTestRule.getActivity(); StartSurfaceTestUtils.waitForTabModel(cta); - assertThat(cta.getTabModelSelector().getCurrentModel().getCount(), equalTo(1)); + TabUiTestHelper.verifyTabModelTabCount(cta, 1, 0); // Launches a new Tab from the Start surface, and verifies the omnibox is focused. TestThreadUtils.runOnUiThreadBlocking(() -> cta.getTabCreator(false).launchNTP()); @@ -1388,25 +1351,33 @@ TestThreadUtils.runOnUiThreadBlocking(() -> { assertTrue(TextUtils.equals(toolbarDataProvider.getCurrentUrl(), UrlConstants.NTP_URL)); }); + } - // Navigates the Tab to show home button. - TestThreadUtils.runOnUiThreadBlocking(() -> urlBar.setText("about:blank")); - onView(withId(R.id.url_bar)).perform(pressKey(KeyEvent.KEYCODE_ENTER)); - - // Goes to the Start surface from tapping home button, and navigate from the Omnibox. The - // new created Tab shouldn't get focus. - StartSurfaceTestUtils.pressHomePageButton(cta); + @Test + @LargeTest + @Feature({"StartSurface"}) + // clang-format off + @CommandLineFlags.Add({BASE_PARAMS + "/single/omnibox_focused_on_new_tab/true"}) + public void testOmnibox_TabOpenedFromOmniboxShouldNotGetFocused() { + // clang-format on + if (!mImmediateReturn) { + StartSurfaceTestUtils.pressHomePageButton(mActivityTestRule.getActivity()); + } StartSurfaceTestUtils.waitForOverviewVisible( mLayoutChangedCallbackHelper, mCurrentlyActiveLayout); + ChromeTabbedActivity cta = mActivityTestRule.getActivity(); + StartSurfaceTestUtils.waitForTabModel(cta); + TabUiTestHelper.verifyTabModelTabCount(cta, 1, 0); onViewWaiting(allOf(withId(R.id.search_box_text), isDisplayed())) .perform(replaceText("about:blank")); - onView(withId(R.id.url_bar)).perform(pressKey(KeyEvent.KEYCODE_ENTER)); - waitForView(withId(R.id.primary_tasks_surface_view), VIEW_GONE); + onViewWaiting(withId(R.id.url_bar)).perform(pressKey(KeyEvent.KEYCODE_ENTER)); + waitForView(withId(R.id.primary_tasks_surface_view), ViewUtils.VIEW_INVISIBLE); - TabUiTestHelper.verifyTabModelTabCount(cta, 4, 0); + TabUiTestHelper.verifyTabModelTabCount(cta, 2, 0); waitForView(withId(R.id.search_box_text)); waitForView(withId(R.id.toolbar_buttons)); + TextView urlBar = cta.findViewById(R.id.url_bar); Assert.assertFalse(urlBar.isFocused()); } @@ -1502,8 +1473,7 @@ StartSurfaceTestUtils.pressHomePageButton(cta); // MV tiles and carousel tab switcher should not show anymore. - StartSurfaceTestUtils.waitForOverviewVisible( - mLayoutChangedCallbackHelper, mCurrentlyActiveLayout); + StartSurfaceTestUtils.waitForOverviewVisible(cta); onViewWaiting(withId(R.id.start_tab_switcher_button)); onView(withId(org.chromium.chrome.tab_ui.R.id.mv_tiles_container)) .check(matches(withEffectiveVisibility(GONE))); @@ -1537,8 +1507,7 @@ StartSurfaceTestUtils.pressHomePageButton(cta); // MV tiles should shown and carousel tab switcher should not show anymore. - StartSurfaceTestUtils.waitForOverviewVisible( - mLayoutChangedCallbackHelper, mCurrentlyActiveLayout); + StartSurfaceTestUtils.waitForOverviewVisible(cta); onViewWaiting(withId(R.id.start_tab_switcher_button)); onView(withId(org.chromium.chrome.tab_ui.R.id.mv_tiles_layout)) .check(matches(withEffectiveVisibility(VISIBLE)));
diff --git a/chrome/android/java/res/drawable/ic_right_arrow_black_24dp.xml b/chrome/android/java/res/drawable/ic_right_arrow_black_24dp.xml new file mode 100644 index 0000000..39cd249 --- /dev/null +++ b/chrome/android/java/res/drawable/ic_right_arrow_black_24dp.xml
@@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 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. --> + +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + + <path + android:fillColor="@color/modern_grey_700" + android:pathData="M 6.23 20.23 L 8 22 L 18 12 L 8 2 L 6.23 3.77 L 14.46 12 Z" /> +</vector> \ No newline at end of file
diff --git a/chrome/android/java/res/layout/webapk_icon_name_update_dialog.xml b/chrome/android/java/res/layout/webapk_icon_name_update_dialog.xml new file mode 100644 index 0000000..a904a184 --- /dev/null +++ b/chrome/android/java/res/layout/webapk_icon_name_update_dialog.xml
@@ -0,0 +1,94 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 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. --> +<org.chromium.chrome.browser.webapps.WebApkIconNameUpdateCustomView + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + android:paddingTop="16dp" + android:gravity="center|top" + android:orientation="horizontal"> + + <!-- The icon, name and short_name as it is before updating. --> + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="16dp" + android:orientation="vertical" + android:gravity="center"> + + <ImageView + android:id="@+id/app_icon_old" + android:layout_width="128dp" + android:layout_height="128dp" + android:visibility="gone" + android:contentDescription="@string/update_webapk_current_icon" /> + + <TextView + android:id="@+id/short_app_name_old" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:visibility="gone" + android:maxWidth="128dp" + android:maxLines="5" + android:ellipsize="end" + android:textAppearance="@style/TextAppearance.TextMediumThick.Primary" /> + + <TextView + android:id="@+id/app_name_old" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:visibility="gone" + android:maxWidth="128dp" + android:maxLines="5" + android:ellipsize="end" + android:textAppearance="@style/TextAppearance.TextMedium.Primary" /> + </LinearLayout> + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="45dp" + android:importantForAccessibility="no" + app:srcCompat="@drawable/ic_right_arrow_black_24dp" /> + + <!-- The icon, name and short_name as it will be after the update. --> + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:orientation="vertical" + android:gravity="center"> + + <ImageView + android:id="@+id/app_icon_new" + android:layout_width="128dp" + android:layout_height="128dp" + android:visibility="gone" + android:contentDescription="@string/update_webapk_updated_icon"/> + + <TextView + android:id="@+id/short_app_name_new" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:visibility="gone" + android:maxWidth="128dp" + android:maxLines="5" + android:ellipsize="end" + android:textAppearance="@style/TextAppearance.TextMediumThick.Primary" /> + + <TextView + android:id="@+id/app_name_new" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:visibility="gone" + android:maxWidth="128dp" + android:maxLines="5" + android:ellipsize="end" + android:textAppearance="@style/TextAppearance.TextMedium.Primary" /> + </LinearLayout> +</org.chromium.chrome.browser.webapps.WebApkIconNameUpdateCustomView>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/ephemeraltab/EphemeralTabCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/ephemeraltab/EphemeralTabCoordinator.java index 270e63c..34b2991 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/ephemeraltab/EphemeralTabCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/ephemeraltab/EphemeralTabCoordinator.java
@@ -21,7 +21,6 @@ import org.chromium.chrome.browser.content.ContentUtils; import org.chromium.chrome.browser.dependency_injection.ActivityScope; import org.chromium.chrome.browser.feature_engagement.TrackerFactory; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.incognito.IncognitoUtils; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; @@ -108,15 +107,14 @@ * @return {@code true} if the feature is enabled. */ public static boolean isSupported() { - return ChromeFeatureList.isEnabled(ChromeFeatureList.EPHEMERAL_TAB_USING_BOTTOM_SHEET) - && !SysUtils.isLowEndDevice(); + return !SysUtils.isLowEndDevice(); } /** * Checks if the preview tab is in open (peek) state. */ public boolean isOpened() { - return mPeeked; + return mPeeked || mFullyOpened; } /** @@ -223,6 +221,9 @@ private void destroyWebContents() { mSheetContent = null; // Will be destroyed by BottomSheet controller. + mPeeked = false; + mFullyOpened = false; + if (mWebContents != null) { mWebContents.destroy(); mWebContents = null;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/ephemeraltab/EphemeralTabSheetContent.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/ephemeraltab/EphemeralTabSheetContent.java index 35a437d..a8134e72 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/ephemeraltab/EphemeralTabSheetContent.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/ephemeraltab/EphemeralTabSheetContent.java
@@ -16,12 +16,10 @@ import android.widget.TextView; import androidx.annotation.DrawableRes; -import androidx.annotation.IntDef; import androidx.annotation.Nullable; import org.chromium.base.ApiCompatibilityUtils; import org.chromium.chrome.R; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.components.browser_ui.bottomsheet.BottomSheetContent; import org.chromium.components.browser_ui.widget.FadingShadow; import org.chromium.components.browser_ui.widget.FadingShadowView; @@ -36,9 +34,6 @@ import org.chromium.content_public.browser.WebContents; import org.chromium.url.GURL; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - /** * Represents ephemeral tab content and the toolbar, which can be included inside the bottom sheet. */ @@ -51,23 +46,9 @@ private static final float PEEK_TOOLBAR_HEIGHT_MULTIPLE = 2.f; - /** Ratio of the height when in half mode. */ - private static final float HALF_HEIGHT_RATIO = 0.6f; - /** Ratio of the height when in full mode. Used in half-open variation. */ private static final float FULL_HEIGHT_RATIO = 0.9f; - private static final String OPEN_MODE_VARIATION_NAME = "ephemeral_tab_open_mode"; - - /** The state to which preview tab will open to when requested. */ - @IntDef({OpenMode.PEEK, OpenMode.HALF, OpenMode.FULL}) - @Retention(RetentionPolicy.SOURCE) - @interface OpenMode { - int PEEK = 0; - int HALF = 1; - int FULL = 2; - } - private final Context mContext; private final Runnable mOpenNewTabCallback; private final Runnable mToolbarClickCallback; @@ -83,7 +64,6 @@ private FadingShadowView mShadow; private Drawable mCurrentFavicon; private ImageView mFaviconView; - private @OpenMode int mOpenMode; /** * Constructor. @@ -104,9 +84,6 @@ createThinWebView((int) (maxViewHeight * FULL_HEIGHT_RATIO)); createToolbarView(); - mOpenMode = ChromeFeatureList.getFieldTrialParamByFeatureAsInt( - ChromeFeatureList.EPHEMERAL_TAB_USING_BOTTOM_SHEET, OPEN_MODE_VARIATION_NAME, - OpenMode.PEEK); } /** @@ -278,23 +255,17 @@ @Override public int getPeekHeight() { - if (mOpenMode == OpenMode.PEEK) { - int toolbarHeight = - mContext.getResources().getDimensionPixelSize(R.dimen.toolbar_height_no_shadow); - return (int) (toolbarHeight * PEEK_TOOLBAR_HEIGHT_MULTIPLE); - } else { - return HeightMode.DISABLED; - } + return HeightMode.DISABLED; } @Override public float getHalfHeightRatio() { - return mOpenMode == OpenMode.HALF ? HALF_HEIGHT_RATIO : HeightMode.DEFAULT; + return HeightMode.DEFAULT; } @Override public float getFullHeightRatio() { - return mOpenMode == OpenMode.HALF ? FULL_HEIGHT_RATIO : HeightMode.WRAP_CONTENT; + return HeightMode.WRAP_CONTENT; } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java index 5def2ac..64f7602 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java
@@ -46,8 +46,6 @@ private long mNativeAutocompleteControllerAndroid; private OnSuggestionsReceivedListener mListener; - private boolean mUseCachedZeroSuggestResults; - private boolean mWaitingForSuggestionsToCache; private Profile mProfile; private @NonNull AutocompleteResult mAutocompleteResult = AutocompleteResult.EMPTY_RESULT; @@ -108,17 +106,6 @@ } /** - * Use cached zero suggest results if there are any available and start caching them - * for all zero suggest updates. - */ - void startCachedZeroSuggest() { - assert mListener != null : "Ensure a listener is set prior to calling."; - mUseCachedZeroSuggestResults = true; - AutocompleteResult data = CachedZeroSuggestionsManager.readFromCache(); - mListener.onSuggestionsReceived(data, ""); - } - - /** * Starts querying for omnibox suggestions for a given text. * * @param profile The profile to use for starting the AutocompleteController @@ -145,7 +132,6 @@ AutocompleteController.this, text, cursorPosition, null, url, pageClassification, preventInlineAutocomplete, false, false, true, queryTileId, isQueryStartedFromTiles); - mWaitingForSuggestionsToCache = false; } } @@ -210,7 +196,6 @@ setProfile(profile); if (mNativeAutocompleteControllerAndroid != 0) { - if (mUseCachedZeroSuggestResults) mWaitingForSuggestionsToCache = true; AutocompleteControllerJni.get().onOmniboxFocused(mNativeAutocompleteControllerAndroid, AutocompleteController.this, omniboxText, url, pageClassification, title); } @@ -226,7 +211,6 @@ */ public void stop(boolean clear) { assert mListener != null : "Ensure a listener is set prior to calling."; - mWaitingForSuggestionsToCache = false; if (mNativeAutocompleteControllerAndroid != 0) { AutocompleteControllerJni.get().stop( mNativeAutocompleteControllerAndroid, AutocompleteController.this, clear); @@ -274,10 +258,6 @@ // Notify callbacks of suggestions. mListener.onSuggestionsReceived(autocompleteResult, inlineAutocompleteText); - - if (mWaitingForSuggestionsToCache) { - CachedZeroSuggestionsManager.saveToCache(originalResult); - } } @CalledByNative
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteCoordinator.java index fff215b..36a537c3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteCoordinator.java
@@ -304,13 +304,12 @@ } /** - * Sets to show cached zero suggest results. This will start both caching zero suggest results - * in shared preferences and also attempt to show them when appropriate without needing native - * initialization. - * @param showCachedZeroSuggestResults Whether cached zero suggest should be shown. + * Show cached zero suggest results. + * Enables Autocomplete subsystem to offer most recently presented suggestions in the event + * where Native counterpart is not yet initialized. */ - public void setShowCachedZeroSuggestResults(boolean showCachedZeroSuggestResults) { - mMediator.setShowCachedZeroSuggestResults(showCachedZeroSuggestResults); + public void startCachedZeroSuggest() { + mMediator.startCachedZeroSuggest(); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteMediator.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteMediator.java index da7c3bc..6bf35911 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteMediator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteMediator.java
@@ -98,6 +98,7 @@ private AutocompleteController mAutocomplete; private long mUrlFocusTime; private boolean mEnableAdaptiveSuggestionsCount; + private boolean mShouldCacheSuggestions; @IntDef({SuggestionVisibilityState.DISALLOWED, SuggestionVisibilityState.PENDING_ALLOW, SuggestionVisibilityState.ALLOWED}) @@ -294,13 +295,15 @@ } /** - * Sets to show cached zero suggest results. This will start both caching zero suggest results - * in shared preferences and also attempt to show them when appropriate without needing native - * initialization. - * @param showCachedZeroSuggestResults Whether cached zero suggest should be shown. + * Show cached zero suggest results. + * Enables Autocomplete subsystem to offer most recently presented suggestions in the event + * where Native counterpart is not yet initialized. + * + * Note: the only supported page context right now is the ANDROID_SEARCH_WIDGET. */ - void setShowCachedZeroSuggestResults(boolean showCachedZeroSuggestResults) { - if (showCachedZeroSuggestResults) mAutocomplete.startCachedZeroSuggest(); + void startCachedZeroSuggest() { + if (mNativeInitialized) return; + onSuggestionsReceived(CachedZeroSuggestionsManager.readFromCache(), ""); } /** Notify the mediator that a item selection is pending and should be accepted. */ @@ -707,6 +710,10 @@ return; } + if (mShouldCacheSuggestions) { + CachedZeroSuggestionsManager.saveToCache(autocompleteResult); + } + final List<AutocompleteMatch> newSuggestions = autocompleteResult.getSuggestionsList(); String userText = mUrlBarEditingTextProvider.getTextWithoutAutocomplete(); mUrlTextAfterSuggestionsReceived = userText + inlineAutocompleteText; @@ -857,6 +864,8 @@ && (mDataProvider.hasTab() || mDataProvider.isInOverviewAndShowingOmnibox())) { int pageClassification = mDataProvider.getPageClassification(mDelegate.didFocusUrlFromFakebox()); + mShouldCacheSuggestions = + pageClassification == PageClassification.ANDROID_SEARCH_WIDGET_VALUE; mAutocomplete.startZeroSuggest(mDataProvider.getProfile(), mUrlBarEditingTextProvider.getTextWithAutocomplete(), mDataProvider.getCurrentUrl(), pageClassification, mDataProvider.getTitle()); @@ -1074,6 +1083,7 @@ * Cancel any pending autocomplete actions. */ private void cancelAutocompleteRequests() { + mShouldCacheSuggestions = false; if (mCurrentAutocompleteRequest != null) { mHandler.removeCallbacks(mCurrentAutocompleteRequest); mCurrentAutocompleteRequest = null;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordChangeLauncher.java b/chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordChangeLauncher.java index a7eb32db..88488e1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordChangeLauncher.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordChangeLauncher.java
@@ -23,6 +23,7 @@ private static final String INTENT = "PASSWORD_CHANGE"; private static final String DEBUG_BUNDLE_ID = "DEBUG_BUNDLE_ID"; private static final String DEBUG_SOCKET_ID = "DEBUG_SOCKET_ID"; + private static final int IN_CHROME_CALLER = 7; @CalledByNative public static void start(WindowAndroid windowAndroid, GURL origin, String username) { @@ -33,13 +34,14 @@ String debugBundleId, String debutSocketId) { AutofillAssistantFacade.start(windowAndroid.getActivity().get(), TriggerContext.newBuilder() - .withInitialUrl(origin.getSpec()) .addParameter(DEBUG_BUNDLE_ID, debugBundleId) .addParameter(DEBUG_SOCKET_ID, debutSocketId) .addParameter(PASSWORD_CHANGE_USERNAME_PARAMETER, username) .addParameter(INTENT_PARAMETER, INTENT) .addParameter(TriggerContext.PARAMETER_START_IMMEDIATELY, true) .addParameter(TriggerContext.PARAMETER_ENABLED, true) + .addParameter(TriggerContext.PARAMETER_ORIGINAL_DEEPLINK, origin.getSpec()) + .addParameter(TriggerContext.PARAMETER_CALLER, IN_CHROME_CALLER) .build()); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivityLocationBarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivityLocationBarLayout.java index 87b3ba7e..a111b70 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivityLocationBarLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivityLocationBarLayout.java
@@ -157,10 +157,9 @@ mUrlBar.post(() -> { mUrlBar.requestFocus(); mUrlCoordinator.setKeyboardVisibility(true, false); + getAutocompleteCoordinator().startCachedZeroSuggest(); }); mUrlBarFocusRequested = false; } - // Use cached suggestions only if native is not yet ready. - getAutocompleteCoordinator().setShowCachedZeroSuggestResults(!mNativeInitialized); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java index bbb3b29..a348d78 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java
@@ -44,6 +44,7 @@ import org.chromium.chrome.browser.password_check.PasswordCheckFragmentView; import org.chromium.chrome.browser.password_entry_edit.CredentialEditUiFactory; import org.chromium.chrome.browser.password_entry_edit.CredentialEntryFragmentViewBase; +import org.chromium.chrome.browser.privacy_sandbox.FlocSettingsFragment; import org.chromium.chrome.browser.privacy_sandbox.PrivacySandboxSettingsFragment; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManagerUtils; @@ -364,6 +365,11 @@ .setCctHelpers(LaunchIntentDispatcher::createCustomTabActivityIntent, IntentHandler::addTrustedIntentExtras); } + if (fragment instanceof FlocSettingsFragment) { + ((FlocSettingsFragment) fragment) + .setCctHelpers(LaunchIntentDispatcher::createCustomTabActivityIntent, + IntentHandler::addTrustedIntentExtras); + } if (fragment instanceof LanguageSettings) { ((LanguageSettings) fragment).setRestartAction(() -> { ApplicationLifetime.terminate(true);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/TrustedVaultClient.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/TrustedVaultClient.java index 8dc2710..51f6091 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/TrustedVaultClient.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/TrustedVaultClient.java
@@ -159,7 +159,7 @@ */ @CalledByNative private static void fetchKeys( - long nativeTrustedVaultClientAndroid, CoreAccountInfo accountInfo) { + long nativeTrustedVaultClientAndroid, int requestId, CoreAccountInfo accountInfo) { assert isNativeRegistered(nativeTrustedVaultClientAndroid); get().mBackend.fetchKeys(accountInfo) @@ -168,15 +168,15 @@ -> { if (isNativeRegistered(nativeTrustedVaultClientAndroid)) { TrustedVaultClientJni.get().fetchKeysCompleted( - nativeTrustedVaultClientAndroid, accountInfo.getGaiaId(), - keys.toArray(new byte[0][])); + nativeTrustedVaultClientAndroid, requestId, + accountInfo.getGaiaId(), keys.toArray(new byte[0][])); } }, (exception) -> { if (isNativeRegistered(nativeTrustedVaultClientAndroid)) { TrustedVaultClientJni.get().fetchKeysCompleted( - nativeTrustedVaultClientAndroid, accountInfo.getGaiaId(), - new byte[0][]); + nativeTrustedVaultClientAndroid, requestId, + accountInfo.getGaiaId(), new byte[0][]); } }); } @@ -187,7 +187,7 @@ */ @CalledByNative private static void markKeysAsStale( - long nativeTrustedVaultClientAndroid, CoreAccountInfo accountInfo) { + long nativeTrustedVaultClientAndroid, int requestId, CoreAccountInfo accountInfo) { assert isNativeRegistered(nativeTrustedVaultClientAndroid); get().mBackend.markKeysAsStale(accountInfo) @@ -196,7 +196,7 @@ -> { if (isNativeRegistered(nativeTrustedVaultClientAndroid)) { TrustedVaultClientJni.get().markKeysAsStaleCompleted( - nativeTrustedVaultClientAndroid, result); + nativeTrustedVaultClientAndroid, requestId, result); } }, (exception) -> { @@ -205,15 +205,17 @@ // difference so let's return true indicating that it might have, // since false positives are allowed. TrustedVaultClientJni.get().markKeysAsStaleCompleted( - nativeTrustedVaultClientAndroid, true); + nativeTrustedVaultClientAndroid, requestId, true); } }); } @NativeMethods interface Natives { - void fetchKeysCompleted(long nativeTrustedVaultClientAndroid, String gaiaId, byte[][] keys); - void markKeysAsStaleCompleted(long nativeTrustedVaultClientAndroid, boolean result); + void fetchKeysCompleted( + long nativeTrustedVaultClientAndroid, int requestId, String gaiaId, byte[][] keys); + void markKeysAsStaleCompleted( + long nativeTrustedVaultClientAndroid, int requestId, boolean result); void notifyKeysChanged(long nativeTrustedVaultClientAndroid); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkIconNameUpdateCustomView.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkIconNameUpdateCustomView.java new file mode 100644 index 0000000..6e619e9 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkIconNameUpdateCustomView.java
@@ -0,0 +1,83 @@ +// Copyright 2021 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. + +package org.chromium.chrome.browser.webapps; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.drawable.Icon; +import android.os.Build; +import android.util.AttributeSet; +import android.view.View; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.Nullable; + +/** + * The custom view part of the {@link WebApkIconNameUpdateDialog}. Shows the icon changes and + * changes to name and short_name. + */ +public class WebApkIconNameUpdateCustomView extends LinearLayout { + /** + * Constructor for inflating from XMLs. + */ + public WebApkIconNameUpdateCustomView(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + /** + * Setup the views showing the two icons (before and after). + * @param oldIcon The icon of the currently installed app. + * @param newIcon The proposed new icon for the updated app. + * @param oldIconAdaptive Wheter the current icon is adaptive. + * @param newIconAdaptive Wheter the updated icon is adaptive. + */ + public void configureIcons( + Bitmap oldIcon, Bitmap newIcon, boolean oldIconAdaptive, boolean newIconAdaptive) { + ImageView oldIconView = findViewById(R.id.app_icon_old); + ImageView newIconView = findViewById(R.id.app_icon_new); + if (oldIconAdaptive && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + oldIconView.setImageIcon(Icon.createWithAdaptiveBitmap(oldIcon)); + } else { + oldIconView.setImageBitmap(oldIcon); + } + if (newIconAdaptive && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + newIconView.setImageIcon(Icon.createWithAdaptiveBitmap(newIcon)); + } else { + newIconView.setImageBitmap(newIcon); + } + oldIconView.setVisibility(View.VISIBLE); + newIconView.setVisibility(View.VISIBLE); + } + + /** + * Setup the short app names text views. + * @param oldAppShortName The short name of the currently installed app. + * @param newAppShortName The proposed short name for the updated app. + */ + public void configureShortNames(String oldAppShortName, String newAppShortName) { + TextView currentShortName = findViewById(R.id.short_app_name_old); + TextView updatedShortName = findViewById(R.id.short_app_name_new); + currentShortName.setText(oldAppShortName); + updatedShortName.setText(newAppShortName); + currentShortName.setVisibility(View.VISIBLE); + updatedShortName.setVisibility(View.VISIBLE); + } + + /** + * Setup the app names text views. + * @param oldAppName The name of the currently installed app. + * @param newAppName The proposed name for the updated app. + */ + public void configureNames(String oldAppName, String newAppName) { + TextView currentLongName = findViewById(R.id.app_name_old); + TextView updatedLongName = findViewById(R.id.app_name_new); + currentLongName.setText(oldAppName); + updatedLongName.setText(newAppName); + currentLongName.setVisibility(View.VISIBLE); + updatedLongName.setVisibility(View.VISIBLE); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkIconNameUpdateDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkIconNameUpdateDialog.java new file mode 100644 index 0000000..d7d2abe --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkIconNameUpdateDialog.java
@@ -0,0 +1,124 @@ +// Copyright 2021 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. + +package org.chromium.chrome.browser.webapps; + +import android.content.Context; +import android.content.res.Resources; +import android.graphics.Bitmap; + +import org.chromium.base.Callback; +import org.chromium.base.ContextUtils; +import org.chromium.base.Log; +import org.chromium.ui.LayoutInflaterUtils; +import org.chromium.ui.modaldialog.DialogDismissalCause; +import org.chromium.ui.modaldialog.ModalDialogManager; +import org.chromium.ui.modaldialog.ModalDialogProperties; +import org.chromium.ui.modelutil.PropertyModel; + +/** + * The dialog that warns the user that a WebApk is about to be updated, which will result in a + * short name, long name and/or icon change. + */ +public class WebApkIconNameUpdateDialog implements ModalDialogProperties.Controller { + private static Boolean sActionToTakeInTests; + + private static final String TAG = "IconNameUpdateDlg"; + + // The modal dialog manager to use. + private ModalDialogManager mModalDialogManager; + + // The callback to run when the user has made a decision. + private Callback<Integer> mDialogResultCallback; + + public WebApkIconNameUpdateDialog() {} + + /** + * Shows the dialog. + * @param manager The {@ModalDialogManager} to use. + * @param iconChanging Whether an icon change has been detected. + * @param shortNameChanging Whether a short name change has been detected. + * @param nameChanging Whether a name change has been detected. + * @param oldAppShortName The short name of the currently installed app. + * @param newAppShortName The proposed short name for the updated app. + * @param oldAppName The name of the currently installed app. + * @param newAppName The proposed name for the updated app. + * @param oldIcon The icon of the currently installed app. + * @param newIcon The proposed new icon for the updated app. + * @param oldIconAdaptive Wheter the current icon is adaptive. + * @param newIconAdaptive Wheter the updated icon is adaptive. + * @param callback The callback to use to communicate the results. + */ + public void show(ModalDialogManager manager, boolean iconChanging, boolean shortNameChanging, + boolean nameChanging, String oldAppShortName, String newAppShortName, String oldAppName, + String newAppName, Bitmap currentAppIcon, Bitmap updatedAppIcon, + boolean oldIconAdaptive, boolean newIconAdaptive, Callback<Integer> callback) { + Context context = ContextUtils.getApplicationContext(); + Resources resources = context.getResources(); + mDialogResultCallback = callback; + + int titleId = 0; + int explanationId = 0; + if (iconChanging && (shortNameChanging || nameChanging)) { + titleId = R.string.webapk_update_dialog_title_name_and_icon; + explanationId = R.string.webapk_update_explanation_name_and_icon; + } else { + titleId = iconChanging ? R.string.webapk_update_dialog_title_icon + : R.string.webapk_update_dialog_title_name; + explanationId = iconChanging ? R.string.webapk_update_explanation_icon + : R.string.webapk_update_explanation_name; + } + + WebApkIconNameUpdateCustomView dialogCustomView = + (WebApkIconNameUpdateCustomView) LayoutInflaterUtils.inflate( + context, R.layout.webapk_icon_name_update_dialog, null); + dialogCustomView.configureIcons( + currentAppIcon, updatedAppIcon, oldIconAdaptive, newIconAdaptive); + if (shortNameChanging) { + dialogCustomView.configureShortNames(oldAppShortName, newAppShortName); + } + if (nameChanging) { + dialogCustomView.configureNames(oldAppName, newAppName); + } + + PropertyModel dialogModel = + new PropertyModel.Builder(ModalDialogProperties.ALL_KEYS) + .with(ModalDialogProperties.CONTROLLER, this) + .with(ModalDialogProperties.TITLE, resources, titleId) + .with(ModalDialogProperties.MESSAGE, resources, explanationId) + .with(ModalDialogProperties.CUSTOM_VIEW, dialogCustomView) + .with(ModalDialogProperties.PRIMARY_BUTTON_FILLED, true) + .with(ModalDialogProperties.POSITIVE_BUTTON_TEXT, resources, + R.string.webapk_update_button_update) + .with(ModalDialogProperties.NEGATIVE_BUTTON_TEXT, resources, + R.string.webapk_update_button_close) + .with(ModalDialogProperties.TITLE_SCROLLABLE, true) + .build(); + + mModalDialogManager = manager; + mModalDialogManager.showDialog(dialogModel, ModalDialogManager.ModalDialogType.APP); + } + + @Override + public void onClick(PropertyModel model, int buttonType) { + switch (buttonType) { + case ModalDialogProperties.ButtonType.POSITIVE: + mModalDialogManager.dismissDialog( + model, DialogDismissalCause.POSITIVE_BUTTON_CLICKED); + break; + case ModalDialogProperties.ButtonType.NEGATIVE: + mModalDialogManager.dismissDialog( + model, DialogDismissalCause.NEGATIVE_BUTTON_CLICKED); + break; + default: + Log.i(TAG, "Unexpected button pressed in dialog: " + buttonType); + } + } + + @Override + public void onDismiss(PropertyModel model, @DialogDismissalCause int dismissalCause) { + mDialogResultCallback.onResult(dismissalCause); + mModalDialogManager = null; + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java index cd6d7765..ce43a4b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java
@@ -23,6 +23,7 @@ import org.chromium.chrome.browser.browserservices.intents.WebApkShareTarget; import org.chromium.chrome.browser.browserservices.intents.WebDisplayMode; import org.chromium.chrome.browser.dependency_injection.ActivityScope; +import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; import org.chromium.chrome.browser.lifecycle.DestroyObserver; @@ -34,6 +35,8 @@ import org.chromium.components.background_task_scheduler.TaskInfo; import org.chromium.components.embedder_support.util.UrlUtilities; import org.chromium.components.webapps.WebappsIconUtils; +import org.chromium.ui.modaldialog.DialogDismissalCause; +import org.chromium.ui.modaldialog.ModalDialogManager; import org.chromium.webapk.lib.client.WebApkVersion; import java.util.ArrayList; @@ -61,6 +64,18 @@ /** Data extracted from the WebAPK's launch intent and from the WebAPK's Android Manifest. */ private WebappInfo mInfo; + /** The updated manifest information. */ + private WebappInfo mFetchedInfo; + + /** The URL of the primary icon. */ + private String mFetchedPrimaryIconUrl; + + /** The URL of the splash icon. */ + private String mFetchedSplashIconUrl; + + /** The list of reasons why an update was triggered. */ + private @WebApkUpdateReason List<Integer> mUpdateReasons; + /** The WebappDataStorage with cached data about prior update requests. */ private WebappDataStorage mStorage; @@ -121,21 +136,22 @@ @Override public void onGotManifestData(BrowserServicesIntentDataProvider fetchedIntentDataProvider, String primaryIconUrl, String splashIconUrl) { - WebappInfo fetchedInfo = WebappInfo.create(fetchedIntentDataProvider); + mFetchedInfo = WebappInfo.create(fetchedIntentDataProvider); + mFetchedPrimaryIconUrl = primaryIconUrl; + mFetchedSplashIconUrl = splashIconUrl; mStorage.updateTimeOfLastCheckForUpdatedWebManifest(); if (mUpdateFailureHandler != null) { mUpdateFailureHandler.removeCallbacksAndMessages(null); } - boolean gotManifest = (fetchedInfo != null); - @WebApkUpdateReason - List<Integer> updateReasons = - generateUpdateReasons(mInfo, fetchedInfo, primaryIconUrl, splashIconUrl); - boolean needsUpgrade = !updateReasons.isEmpty(); + boolean gotManifest = (mFetchedInfo != null); + mUpdateReasons = generateUpdateReasons( + mInfo, mFetchedInfo, mFetchedPrimaryIconUrl, mFetchedSplashIconUrl); + boolean needsUpgrade = !mUpdateReasons.isEmpty(); if (mStorage.shouldForceUpdate() && needsUpgrade) { // Add to the front of the list to designate it as the primary reason. - updateReasons.add(0, WebApkUpdateReason.MANUALLY_TRIGGERED); + mUpdateReasons.add(0, WebApkUpdateReason.MANUALLY_TRIGGERED); } Log.i(TAG, "Got Manifest: " + gotManifest); Log.i(TAG, "WebAPK upgrade needed: " + needsUpgrade); @@ -163,13 +179,47 @@ return; } + boolean iconChanging = mUpdateReasons.contains(WebApkUpdateReason.PRIMARY_ICON_HASH_DIFFERS) + || mUpdateReasons.contains(WebApkUpdateReason.PRIMARY_ICON_MASKABLE_DIFFERS); + boolean shortNameChanging = mUpdateReasons.contains(WebApkUpdateReason.SHORT_NAME_DIFFERS); + boolean nameChanging = mUpdateReasons.contains(WebApkUpdateReason.NAME_DIFFERS); + if (!iconOrNameUpdateDialogEnabled() + || (!iconChanging && !shortNameChanging && !nameChanging)) { + onUserApprovedUpdate(DialogDismissalCause.POSITIVE_BUTTON_CLICKED); + return; + } + + showIconOrNameUpdateDialog(iconChanging, shortNameChanging, nameChanging); + } + + protected boolean iconOrNameUpdateDialogEnabled() { + return ChromeFeatureList.isEnabled(ChromeFeatureList.PWA_UPDATE_DIALOG_FOR_NAME_AND_ICON); + } + + protected void showIconOrNameUpdateDialog( + boolean iconChanging, boolean shortNameChanging, boolean nameChanging) { + // Show the dialog to confirm name and/or icon update. + ModalDialogManager dialogManager = + mTabProvider.get().getWindowAndroid().getModalDialogManager(); + WebApkIconNameUpdateDialog dialog = new WebApkIconNameUpdateDialog(); + dialog.show(dialogManager, iconChanging, shortNameChanging, nameChanging, mInfo.shortName(), + mFetchedInfo.shortName(), mInfo.name(), mFetchedInfo.name(), mInfo.icon().bitmap(), + mFetchedInfo.icon().bitmap(), mInfo.isIconAdaptive(), mFetchedInfo.isIconAdaptive(), + this::onUserApprovedUpdate); + } + + protected void onUserApprovedUpdate(int dismissalCause) { // Set WebAPK update as having failed in case that Chrome is killed prior to // {@link onBuiltWebApk} being called. recordUpdate(mStorage, WebApkInstallResult.FAILURE, false /* relaxUpdates*/); - if (fetchedInfo != null) { - buildUpdateRequestAndSchedule(fetchedInfo, primaryIconUrl, splashIconUrl, - false /* isManifestStale */, updateReasons); + if (dismissalCause != DialogDismissalCause.POSITIVE_BUTTON_CLICKED) { + return; + } + + if (mFetchedInfo != null) { + buildUpdateRequestAndSchedule(mFetchedInfo, mFetchedPrimaryIconUrl, + mFetchedSplashIconUrl, false /* isManifestStale */, mUpdateReasons); return; } @@ -177,7 +227,7 @@ // our Web Manifest data if the server's Web Manifest data is newer. This scenario can // occur if the Web Manifest is temporarily unreachable. buildUpdateRequestAndSchedule(mInfo, "" /* primaryIconUrl */, "" /* splashIconUrl */, - true /* isManifestStale */, updateReasons); + true /* isManifestStale */, mUpdateReasons); } /**
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulatorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulatorTest.java index 327febdc..b377695a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulatorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulatorTest.java
@@ -104,7 +104,6 @@ HashMap<String, Boolean> features = new HashMap<String, Boolean>(); features.put(ChromeFeatureList.CONTEXT_MENU_SEARCH_WITH_GOOGLE_LENS, false); - features.put(ChromeFeatureList.EPHEMERAL_TAB_USING_BOTTOM_SHEET, false); features.put(ChromeFeatureList.READ_LATER, false); ChromeFeatureList.setTestFeatures(features); @@ -180,12 +179,14 @@ initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.NORMAL, params); int[] expected2 = {R.id.contextmenu_open_in_new_tab, R.id.contextmenu_open_in_incognito_tab, - R.id.contextmenu_copy_link_address, R.id.contextmenu_copy_link_text, - R.id.contextmenu_save_link_as, R.id.contextmenu_share_link}; + R.id.contextmenu_open_in_ephemeral_tab, R.id.contextmenu_copy_link_address, + R.id.contextmenu_copy_link_text, R.id.contextmenu_save_link_as, + R.id.contextmenu_share_link}; checkMenuOptions(expected2); initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.CUSTOM_TAB, params); - int[] expected3 = {R.id.contextmenu_open_in_browser_id, R.id.contextmenu_copy_link_address, + int[] expected3 = {R.id.contextmenu_open_in_browser_id, + R.id.contextmenu_open_in_ephemeral_tab, R.id.contextmenu_copy_link_address, R.id.contextmenu_copy_link_text, R.id.contextmenu_save_link_as, R.id.contextmenu_share_link}; checkMenuOptions(expected3); @@ -210,7 +211,8 @@ // should not be present. mSupportsOpenInChromeFromCct = false; initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.CUSTOM_TAB, params); - int[] expected = {R.id.contextmenu_copy_link_address, R.id.contextmenu_copy_link_text, + int[] expected = {R.id.contextmenu_open_in_ephemeral_tab, + R.id.contextmenu_copy_link_address, R.id.contextmenu_copy_link_text, R.id.contextmenu_save_link_as, R.id.contextmenu_share_link}; checkMenuOptions(expected); } @@ -226,7 +228,6 @@ FirstRunStatus.setFirstRunFlowComplete(true); HashMap<String, Boolean> features = new HashMap<String, Boolean>(); - features.put(ChromeFeatureList.EPHEMERAL_TAB_USING_BOTTOM_SHEET, true); features.put(ChromeFeatureList.READ_LATER, false); ChromeFeatureList.setTestFeatures(features); @@ -361,16 +362,17 @@ initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.NORMAL, params); int[] expected2Tab1 = {R.id.contextmenu_open_in_new_tab, - R.id.contextmenu_open_in_incognito_tab, R.id.contextmenu_copy_link_address, - R.id.contextmenu_copy_link_text, R.id.contextmenu_save_link_as, - R.id.contextmenu_share_link}; + R.id.contextmenu_open_in_incognito_tab, R.id.contextmenu_open_in_ephemeral_tab, + R.id.contextmenu_copy_link_address, R.id.contextmenu_copy_link_text, + R.id.contextmenu_save_link_as, R.id.contextmenu_share_link}; int[] expected2Tab2 = {R.id.contextmenu_save_video}; checkMenuOptions(expected2Tab1, expected2Tab2); initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.CUSTOM_TAB, params); int[] expected3Tab1 = {R.id.contextmenu_open_in_browser_id, - R.id.contextmenu_copy_link_address, R.id.contextmenu_copy_link_text, - R.id.contextmenu_save_link_as, R.id.contextmenu_share_link}; + R.id.contextmenu_open_in_ephemeral_tab, R.id.contextmenu_copy_link_address, + R.id.contextmenu_copy_link_text, R.id.contextmenu_save_link_as, + R.id.contextmenu_share_link}; checkMenuOptions(expected3Tab1, expected2Tab2); initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.WEB_APP, params); @@ -401,14 +403,15 @@ FirstRunStatus.setFirstRunFlowComplete(true); initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.NORMAL, params); - int[] expected2 = {R.id.contextmenu_open_image_in_new_tab, R.id.contextmenu_copy_image, + int[] expected2 = {R.id.contextmenu_open_image_in_new_tab, + R.id.contextmenu_open_image_in_ephemeral_tab, R.id.contextmenu_copy_image, R.id.contextmenu_save_image, R.id.contextmenu_share_image}; checkMenuOptions(expected2); initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.CUSTOM_TAB, params); int[] expected3 = {R.id.contextmenu_open_in_browser_id, R.id.contextmenu_open_image, - R.id.contextmenu_copy_image, R.id.contextmenu_save_image, - R.id.contextmenu_share_image}; + R.id.contextmenu_open_image_in_ephemeral_tab, R.id.contextmenu_copy_image, + R.id.contextmenu_save_image, R.id.contextmenu_share_image}; checkMenuOptions(expected3); initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.WEB_APP, params); @@ -442,17 +445,20 @@ initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.NORMAL, params); int[] expected2Tab1 = {R.id.contextmenu_open_in_new_tab, - R.id.contextmenu_open_in_incognito_tab, R.id.contextmenu_copy_link_address, - R.id.contextmenu_save_link_as, R.id.contextmenu_share_link}; - int[] expected2Tab2 = {R.id.contextmenu_open_image_in_new_tab, R.id.contextmenu_copy_image, + R.id.contextmenu_open_in_incognito_tab, R.id.contextmenu_open_in_ephemeral_tab, + R.id.contextmenu_copy_link_address, R.id.contextmenu_save_link_as, + R.id.contextmenu_share_link}; + int[] expected2Tab2 = {R.id.contextmenu_open_image_in_new_tab, + R.id.contextmenu_open_image_in_ephemeral_tab, R.id.contextmenu_copy_image, R.id.contextmenu_save_image, R.id.contextmenu_share_image}; checkMenuOptions(expected2Tab1, expected2Tab2); initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.CUSTOM_TAB, params); int[] expected3Tab1 = {R.id.contextmenu_open_in_browser_id, - R.id.contextmenu_copy_link_address, R.id.contextmenu_save_link_as, - R.id.contextmenu_share_link}; - int[] expected3Tab2 = {R.id.contextmenu_open_image, R.id.contextmenu_copy_image, + R.id.contextmenu_open_in_ephemeral_tab, R.id.contextmenu_copy_link_address, + R.id.contextmenu_save_link_as, R.id.contextmenu_share_link}; + int[] expected3Tab2 = {R.id.contextmenu_open_image, + R.id.contextmenu_open_image_in_ephemeral_tab, R.id.contextmenu_copy_image, R.id.contextmenu_save_image, R.id.contextmenu_share_image}; checkMenuOptions(expected3Tab1, expected3Tab2); @@ -471,7 +477,6 @@ FirstRunStatus.setFirstRunFlowComplete(true); HashMap<String, Boolean> features = new HashMap<String, Boolean>(); - features.put(ChromeFeatureList.EPHEMERAL_TAB_USING_BOTTOM_SHEET, false); features.put(ChromeFeatureList.READ_LATER, true); ChromeFeatureList.setTestFeatures(features); @@ -482,14 +487,15 @@ // HTTP scheme should include read later context menu item. initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.NORMAL, params); int[] expected = {R.id.contextmenu_open_in_new_tab, R.id.contextmenu_open_in_incognito_tab, - R.id.contextmenu_copy_link_address, R.id.contextmenu_copy_link_text, - R.id.contextmenu_save_link_as, R.id.contextmenu_read_later, - R.id.contextmenu_share_link}; + R.id.contextmenu_open_in_ephemeral_tab, R.id.contextmenu_copy_link_address, + R.id.contextmenu_copy_link_text, R.id.contextmenu_save_link_as, + R.id.contextmenu_read_later, R.id.contextmenu_share_link}; checkMenuOptions(expected); // Custom tab should include read later. initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.CUSTOM_TAB, params); - int[] expected2 = {R.id.contextmenu_open_in_browser_id, R.id.contextmenu_copy_link_address, + int[] expected2 = {R.id.contextmenu_open_in_browser_id, + R.id.contextmenu_open_in_ephemeral_tab, R.id.contextmenu_copy_link_address, R.id.contextmenu_copy_link_text, R.id.contextmenu_save_link_as, R.id.contextmenu_read_later, R.id.contextmenu_share_link}; checkMenuOptions(expected2); @@ -518,7 +524,6 @@ FirstRunStatus.setFirstRunFlowComplete(true); HashMap<String, Boolean> features = new HashMap<String, Boolean>(); - features.put(ChromeFeatureList.EPHEMERAL_TAB_USING_BOTTOM_SHEET, false); features.put(ChromeFeatureList.READ_LATER, true); ChromeFeatureList.setTestFeatures(features); @@ -529,8 +534,9 @@ when(mItemDelegate.isIncognito()).thenReturn(true); initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.NORMAL, params); int[] expectedIncognito = {R.id.contextmenu_open_in_new_tab, - R.id.contextmenu_copy_link_address, R.id.contextmenu_copy_link_text, - R.id.contextmenu_read_later, R.id.contextmenu_share_link}; + R.id.contextmenu_open_in_ephemeral_tab, R.id.contextmenu_copy_link_address, + R.id.contextmenu_copy_link_text, R.id.contextmenu_read_later, + R.id.contextmenu_share_link}; checkMenuOptions(expectedIncognito); } @@ -541,7 +547,6 @@ FirstRunStatus.setFirstRunFlowComplete(true); HashMap<String, Boolean> features = new HashMap<String, Boolean>(); - features.put(ChromeFeatureList.EPHEMERAL_TAB_USING_BOTTOM_SHEET, false); features.put(ChromeFeatureList.READ_LATER, false); ChromeFeatureList.setTestFeatures(features); @@ -553,8 +558,9 @@ initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.NORMAL, params); int[] expectedMultiWindow = {R.id.contextmenu_open_in_new_tab, R.id.contextmenu_open_in_incognito_tab, R.id.contextmenu_open_in_other_window, - R.id.contextmenu_copy_link_address, R.id.contextmenu_copy_link_text, - R.id.contextmenu_save_link_as, R.id.contextmenu_share_link}; + R.id.contextmenu_open_in_ephemeral_tab, R.id.contextmenu_copy_link_address, + R.id.contextmenu_copy_link_text, R.id.contextmenu_save_link_as, + R.id.contextmenu_share_link}; checkMenuOptions(expectedMultiWindow); } @@ -576,8 +582,9 @@ initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.NORMAL, params); int[] expected = {R.id.contextmenu_open_in_new_tab, R.id.contextmenu_open_in_new_tab_in_group, R.id.contextmenu_open_in_incognito_tab, - R.id.contextmenu_copy_link_address, R.id.contextmenu_copy_link_text, - R.id.contextmenu_save_link_as, R.id.contextmenu_share_link}; + R.id.contextmenu_open_in_ephemeral_tab, R.id.contextmenu_copy_link_address, + R.id.contextmenu_copy_link_text, R.id.contextmenu_save_link_as, + R.id.contextmenu_share_link}; checkMenuOptions(expected); // Show "open in new tab in group" item first @@ -586,8 +593,9 @@ initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.NORMAL, params); int[] expected2 = {R.id.contextmenu_open_in_new_tab_in_group, R.id.contextmenu_open_in_new_tab, R.id.contextmenu_open_in_incognito_tab, - R.id.contextmenu_copy_link_address, R.id.contextmenu_copy_link_text, - R.id.contextmenu_save_link_as, R.id.contextmenu_share_link}; + R.id.contextmenu_open_in_ephemeral_tab, R.id.contextmenu_copy_link_address, + R.id.contextmenu_copy_link_text, R.id.contextmenu_save_link_as, + R.id.contextmenu_share_link}; checkMenuOptions(expected2); // Clean up
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java index 8e4380c..32ed819 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java
@@ -1057,7 +1057,7 @@ R.id.contextmenu_open_image_in_new_tab, R.id.contextmenu_share_image, R.id.contextmenu_copy_image, R.id.contextmenu_search_with_google_lens}; expectedItems = addItemsIf(EphemeralTabCoordinator.isSupported(), expectedItems, - new Integer[] {R.id.contextmenu_open_in_ephemeral_tab}); + new Integer[] {R.id.contextmenu_open_image_in_ephemeral_tab}); String title = getMenuTitleFromItem(menu, R.id.contextmenu_search_with_google_lens); Assert.assertTrue("Context menu item name should be \'Search with Google Lens\'.", title.startsWith("Search with Google Lens")); @@ -1084,7 +1084,7 @@ R.id.contextmenu_open_image_in_new_tab, R.id.contextmenu_share_image, R.id.contextmenu_copy_image, R.id.contextmenu_search_with_google_lens}; expectedItems = addItemsIf(EphemeralTabCoordinator.isSupported(), expectedItems, - new Integer[] {R.id.contextmenu_open_in_ephemeral_tab}); + new Integer[] {R.id.contextmenu_open_image_in_ephemeral_tab}); String title = getMenuTitleFromItem(menu, R.id.contextmenu_search_with_google_lens); Assert.assertTrue("Context menu item name should be \'Search image with Google Lens\'.", title.startsWith("Search image with Google Lens"));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/basic/BasicSuggestionProcessorUnitTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/basic/BasicSuggestionProcessorUnitTest.java index 6cd876f9..98d30bd 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/basic/BasicSuggestionProcessorUnitTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/basic/BasicSuggestionProcessorUnitTest.java
@@ -90,7 +90,6 @@ put(OmniboxSuggestionType.NAVSUGGEST_PERSONALIZED, "NAVSUGGEST_PERSONALIZED"); put(OmniboxSuggestionType.VOICE_SUGGEST, "VOICE_SUGGEST"); put(OmniboxSuggestionType.DOCUMENT_SUGGESTION, "DOCUMENT_SUGGESTION"); - put(OmniboxSuggestionType.PEDAL, "PEDAL"); // Note: CALCULATOR suggestions are not handled by basic suggestion processor. // These suggestions are now processed by AnswerSuggestionProcessor instead. } @@ -193,7 +192,6 @@ {OmniboxSuggestionType.NAVSUGGEST_PERSONALIZED, SuggestionIcon.MAGNIFIER}, {OmniboxSuggestionType.VOICE_SUGGEST, SuggestionIcon.VOICE}, {OmniboxSuggestionType.DOCUMENT_SUGGESTION, SuggestionIcon.MAGNIFIER}, - {OmniboxSuggestionType.PEDAL, SuggestionIcon.MAGNIFIER}, }; mProcessor.onNativeInitialized(); @@ -227,7 +225,6 @@ {OmniboxSuggestionType.NAVSUGGEST_PERSONALIZED, SuggestionIcon.GLOBE}, {OmniboxSuggestionType.VOICE_SUGGEST, SuggestionIcon.GLOBE}, {OmniboxSuggestionType.DOCUMENT_SUGGESTION, SuggestionIcon.GLOBE}, - {OmniboxSuggestionType.PEDAL, SuggestionIcon.GLOBE}, }; mProcessor.onNativeInitialized(); @@ -261,7 +258,6 @@ {OmniboxSuggestionType.NAVSUGGEST_PERSONALIZED, SuggestionIcon.BOOKMARK}, {OmniboxSuggestionType.VOICE_SUGGEST, SuggestionIcon.BOOKMARK}, {OmniboxSuggestionType.DOCUMENT_SUGGESTION, SuggestionIcon.BOOKMARK}, - {OmniboxSuggestionType.PEDAL, SuggestionIcon.BOOKMARK}, }; mIsBookmarked.mState = true;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/previewtab/PreviewTabTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/previewtab/PreviewTabTest.java index 975600c..b03a530 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/previewtab/PreviewTabTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/previewtab/PreviewTabTest.java
@@ -21,13 +21,11 @@ import org.chromium.chrome.browser.compositor.bottombar.ephemeraltab.EphemeralTabCoordinator; import org.chromium.chrome.browser.contextualsearch.ContextualSearchManager; import org.chromium.chrome.browser.firstrun.DisableFirstRun; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.incognito.IncognitoUtils; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabbed_mode.TabbedRootUiCoordinator; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; -import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.chrome.test.util.browser.contextmenu.ContextMenuUtils; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController.SheetState; @@ -43,7 +41,6 @@ */ @RunWith(ChromeJUnit4ClassRunner.class) @Restriction(Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE) -@EnableFeatures(ChromeFeatureList.EPHEMERAL_TAB_USING_BOTTOM_SHEET) public class PreviewTabTest { @Rule public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkIconNameUpdateDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkIconNameUpdateDialogTest.java new file mode 100644 index 0000000..0e2abee --- /dev/null +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkIconNameUpdateDialogTest.java
@@ -0,0 +1,235 @@ +// Copyright 2021 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. + +package org.chromium.chrome.browser.webapps; + +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.drawable.BitmapDrawable; +import android.os.Looper; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.test.filters.SmallTest; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.chromium.base.test.BaseJUnit4ClassRunner; +import org.chromium.base.test.util.CallbackHelper; +import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.base.test.util.Feature; +import org.chromium.chrome.browser.flags.ChromeSwitches; +import org.chromium.chrome.test.ChromeTabbedActivityTestRule; +import org.chromium.content_public.browser.test.util.TestThreadUtils; +import org.chromium.ui.modaldialog.DialogDismissalCause; +import org.chromium.ui.modaldialog.ModalDialogManager; +import org.chromium.ui.modaldialog.ModalDialogProperties; + +/** + * Test for the dialog warning that WebApks have an updated name/icon. + */ +// TODO(crbug/1209230): Investigate converting this to Roboelectric test. +@RunWith(BaseJUnit4ClassRunner.class) +@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) +public class WebApkIconNameUpdateDialogTest { + // A callback that fires when an action is taken in the dialog. + public final CallbackHelper mOnActionCallback = new CallbackHelper(); + + private boolean mLastSeenActionWasAccept; + + @Rule + public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); + + static class DialogParams { + public static DialogParams createDefault() { + DialogParams dialogParams = new DialogParams(); + dialogParams.iconChanged = false; + dialogParams.bitmapBefore = null; + dialogParams.bitmapAfter = null; + dialogParams.shortNameChanged = false; + dialogParams.shortNameBefore = ""; + dialogParams.shortNameAfter = ""; + dialogParams.nameChanged = false; + dialogParams.nameBefore = ""; + dialogParams.nameAfter = ""; + return dialogParams; + } + + public boolean iconChanged; + public Bitmap bitmapBefore; + public Bitmap bitmapAfter; + public boolean shortNameChanged; + public String shortNameBefore; + public String shortNameAfter; + public boolean nameChanged; + public String nameBefore; + public String nameAfter; + } + + @Before + public void setUp() { + Looper.prepare(); + mActivityTestRule.startMainActivityOnBlankPage(); + } + + /** + * Generates a 320x320 test single-colored bitmap. + */ + private Bitmap generateTestBitmap(int color) { + int width = 320; + int height = 320; + Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + + Paint paint = new Paint(); + paint.setColor(color); + paint.setStyle(Paint.Style.FILL); + canvas.drawPaint(paint); + return bitmap; + } + + private View getUpdateDialogCustomView() { + return mActivityTestRule.getActivity() + .getModalDialogManager() + .getCurrentDialogForTest() + .get(ModalDialogProperties.CUSTOM_VIEW); + } + + private Bitmap getUpdateDialogBitmap(int resId) { + ImageView imageView = getUpdateDialogCustomView().findViewById(resId); + if (imageView.getVisibility() != View.VISIBLE) return null; + return ((BitmapDrawable) imageView.getDrawable()).getBitmap(); + } + + private String getUpdateDialogAppNameLabel(int resId) { + TextView textView = getUpdateDialogCustomView().findViewById(resId); + if (textView.getVisibility() != View.VISIBLE) return null; + + return textView.getText().toString(); + } + + private void onResult(Integer dialogDismissalCause) { + mLastSeenActionWasAccept = + dialogDismissalCause == DialogDismissalCause.POSITIVE_BUTTON_CLICKED; + mOnActionCallback.notifyCalled(); + } + + public void verifyValues(Boolean expectAccept, DialogParams dialogParams) throws Exception { + TestThreadUtils.runOnUiThreadBlocking(() -> { + int callCount = mOnActionCallback.getCallCount(); + ModalDialogManager modalDialogManager = + mActivityTestRule.getActivity().getModalDialogManager(); + + WebApkIconNameUpdateDialog dialog = new WebApkIconNameUpdateDialog(); + + dialog.show(modalDialogManager, dialogParams.iconChanged, dialogParams.shortNameChanged, + dialogParams.nameChanged, dialogParams.shortNameBefore, + dialogParams.shortNameAfter, dialogParams.nameBefore, dialogParams.nameAfter, + dialogParams.bitmapBefore, dialogParams.bitmapAfter, false, false, + this::onResult); + + Assert.assertEquals(dialogParams.shortNameChanged ? dialogParams.shortNameBefore : null, + getUpdateDialogAppNameLabel(R.id.short_app_name_old)); + Assert.assertEquals(dialogParams.shortNameChanged ? dialogParams.shortNameAfter : null, + getUpdateDialogAppNameLabel(R.id.short_app_name_new)); + Assert.assertEquals(dialogParams.nameChanged ? dialogParams.nameBefore : null, + getUpdateDialogAppNameLabel(R.id.app_name_old)); + Assert.assertEquals(dialogParams.nameChanged ? dialogParams.nameAfter : null, + getUpdateDialogAppNameLabel(R.id.app_name_new)); + Assert.assertEquals(dialogParams.iconChanged ? dialogParams.bitmapBefore : null, + getUpdateDialogBitmap(R.id.app_icon_old)); + Assert.assertEquals(dialogParams.iconChanged ? dialogParams.bitmapAfter : null, + getUpdateDialogBitmap(R.id.app_icon_new)); + + modalDialogManager.getCurrentPresenterForTest().dismissCurrentDialog(expectAccept + ? DialogDismissalCause.POSITIVE_BUTTON_CLICKED + : DialogDismissalCause.NEGATIVE_BUTTON_CLICKED); + Assert.assertEquals(callCount + 1, mOnActionCallback.getCallCount()); + }); + + Assert.assertEquals(expectAccept, mLastSeenActionWasAccept); + } + + @Test + @SmallTest + @Feature({"Webapps"}) + public void testCombinations() throws Throwable { + Bitmap blue = generateTestBitmap(Color.BLUE); + Bitmap red = generateTestBitmap(Color.RED); + + // Test only icons changing. + DialogParams dialogParams = DialogParams.createDefault(); + dialogParams.iconChanged = true; + dialogParams.bitmapBefore = blue; + dialogParams.bitmapAfter = red; + verifyValues(/* expectAccept= */ true, dialogParams); + + // Test only short name changing. + dialogParams = DialogParams.createDefault(); + dialogParams.shortNameChanged = true; + dialogParams.shortNameBefore = "short1"; + dialogParams.shortNameAfter = "short2"; + verifyValues(/* expectAccept= */ true, dialogParams); + + // Test only long name changing. + dialogParams = DialogParams.createDefault(); + dialogParams.nameChanged = true; + dialogParams.nameBefore = "name1"; + dialogParams.nameAfter = "name2"; + verifyValues(/* expectAccept= */ true, dialogParams); + + // Test only short name and icon changing. + dialogParams = DialogParams.createDefault(); + dialogParams.iconChanged = true; + dialogParams.bitmapBefore = blue; + dialogParams.bitmapAfter = red; + dialogParams.shortNameChanged = true; + dialogParams.shortNameBefore = "short1"; + dialogParams.shortNameAfter = "short2"; + verifyValues(/* expectAccept= */ true, dialogParams); + + // Test only name and icon changing. + dialogParams = DialogParams.createDefault(); + dialogParams.iconChanged = true; + dialogParams.bitmapBefore = blue; + dialogParams.bitmapAfter = red; + dialogParams.nameChanged = true; + dialogParams.nameBefore = "name1"; + dialogParams.nameAfter = "name2"; + verifyValues(/* expectAccept= */ true, dialogParams); + + // Test all values changing. + dialogParams = DialogParams.createDefault(); + dialogParams.iconChanged = true; + dialogParams.bitmapBefore = blue; + dialogParams.bitmapAfter = red; + dialogParams.shortNameChanged = true; + dialogParams.shortNameBefore = "short1"; + dialogParams.shortNameAfter = "short2"; + dialogParams.nameChanged = true; + dialogParams.nameBefore = "name1"; + dialogParams.nameAfter = "name2"; + verifyValues(/* expectAccept= */ true, dialogParams); + + // Test all values changing, but dialog gets canceled. + dialogParams = DialogParams.createDefault(); + dialogParams.iconChanged = true; + dialogParams.bitmapBefore = blue; + dialogParams.bitmapAfter = red; + dialogParams.shortNameChanged = true; + dialogParams.shortNameBefore = "short1"; + dialogParams.shortNameAfter = "short2"; + dialogParams.nameChanged = true; + dialogParams.nameBefore = "name1"; + dialogParams.nameAfter = "name2"; + verifyValues(/* expectAccept= */ false, dialogParams); + } +}
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java index 3d137caf1..faab649 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerTest.java
@@ -36,6 +36,8 @@ import org.chromium.device.mojom.ScreenOrientationLockType; import org.chromium.net.test.EmbeddedTestServer; import org.chromium.net.test.EmbeddedTestServerRule; +import org.chromium.ui.modaldialog.DialogDismissalCause; +import org.chromium.ui.modaldialog.ModalDialogManager; import org.chromium.webapk.lib.client.WebApkVersion; import java.util.ArrayList; @@ -87,18 +89,29 @@ private List<Integer> mLastUpdateReasons; + // Whether the dialog, to warn about icon/names changing, should be shown. + private boolean mAllowIconOrNameUpdateDialog; + + // Whether the dialog, to warn about icon/names changing, was shown. + private boolean mIconOrNameUpdateDialogShown; + + // Whether an update was requested in the end. + private boolean mUpdateRequested; + /** * Subclass of {@link WebApkUpdateManager} which notifies the {@link CallbackHelper} passed to * the constructor when it has been determined whether an update is needed. */ private class TestWebApkUpdateManager extends WebApkUpdateManager { private CallbackHelper mWaiter; + private boolean mAcceptDialogIfAppears; public TestWebApkUpdateManager(CallbackHelper waiter, ActivityTabProvider tabProvider, - ActivityLifecycleDispatcher lifecycleDispatcher) { + ActivityLifecycleDispatcher lifecycleDispatcher, boolean acceptDialogIfAppears) { super(tabProvider, lifecycleDispatcher); mWaiter = waiter; mLastUpdateReasons = new ArrayList<>(); + mAcceptDialogIfAppears = acceptDialogIfAppears; } @Override @@ -114,6 +127,29 @@ List<Integer> updateReasons, Callback<Boolean> callback) { mLastUpdateReasons = updateReasons; } + + @Override + protected boolean iconOrNameUpdateDialogEnabled() { + return mAllowIconOrNameUpdateDialog; + } + + @Override + protected void showIconOrNameUpdateDialog( + boolean iconChanging, boolean shortNameChanging, boolean nameChanging) { + mIconOrNameUpdateDialogShown = true; + super.showIconOrNameUpdateDialog(iconChanging, shortNameChanging, nameChanging); + ModalDialogManager modalDialogManager = + mActivityTestRule.getActivity().getModalDialogManager(); + modalDialogManager.getCurrentPresenterForTest().dismissCurrentDialog( + mAcceptDialogIfAppears ? DialogDismissalCause.POSITIVE_BUTTON_CLICKED + : DialogDismissalCause.NEGATIVE_BUTTON_CLICKED); + } + + @Override + protected void onUserApprovedUpdate(int dismissalCause) { + mUpdateRequested = dismissalCause == DialogDismissalCause.POSITIVE_BUTTON_CLICKED; + super.onUserApprovedUpdate(dismissalCause); + } } private static class CreationData { @@ -165,10 +201,12 @@ } /** Checks whether a WebAPK update is needed. */ - private boolean checkUpdateNeeded(final CreationData creationData) throws Exception { + private boolean checkUpdateNeeded( + final CreationData creationData, boolean acceptDialogIfAppears) throws Exception { CallbackHelper waiter = new CallbackHelper(); - final TestWebApkUpdateManager updateManager = new TestWebApkUpdateManager( - waiter, mActivity.getActivityTabProvider(), mActivity.getLifecycleDispatcher()); + final TestWebApkUpdateManager updateManager = + new TestWebApkUpdateManager(waiter, mActivity.getActivityTabProvider(), + mActivity.getLifecycleDispatcher(), acceptDialogIfAppears); TestThreadUtils.runOnUiThreadBlocking(() -> { WebappDataStorage storage = @@ -196,6 +234,10 @@ Assert.assertEquals(Arrays.asList(reasons), mLastUpdateReasons); } + private void enableIconOrNameUpdateDialog() { + mAllowIconOrNameUpdateDialog = true; + } + /** * Test that the canonicalized URLs are used in determining whether the fetched Web Manifest * data differs from the metadata in the WebAPK's Android Manifest. This is important because @@ -213,7 +255,7 @@ WebappTestPage.navigateToServiceWorkerPageWithManifest( mTestServer, mTab, WEBAPK_MANIFEST_URL); - Assert.assertFalse(checkUpdateNeeded(creationData)); + Assert.assertFalse(checkUpdateNeeded(creationData, /* acceptDialogIfAppears= */ false)); } /** @@ -230,7 +272,7 @@ WebappTestPage.navigateToServiceWorkerPageWithManifest( mTestServer, mTab, WEBAPK_MANIFEST_URL); - Assert.assertTrue(checkUpdateNeeded(creationData)); + Assert.assertTrue(checkUpdateNeeded(creationData, /* acceptDialogIfAppears= */ false)); assertUpdateReasonsEqual(WebApkUpdateReason.START_URL_DIFFERS); } @@ -244,7 +286,7 @@ WebappTestPage.navigateToServiceWorkerPageWithManifest( mTestServer, mTab, WEBAPK_MANIFEST_URL); - Assert.assertFalse(checkUpdateNeeded(creationData)); + Assert.assertFalse(checkUpdateNeeded(creationData, /* acceptDialogIfAppears= */ false)); } @Test @@ -278,11 +320,16 @@ WebappTestPage.navigateToServiceWorkerPageWithManifest( mTestServer, mTab, maskableManifestUrl); + // Icon changes should trigger the warning dialog, if the platform supports maskable icons. + enableIconOrNameUpdateDialog(); Assert.assertEquals(WebappsIconUtils.doesAndroidSupportMaskableIcons(), - checkUpdateNeeded(creationData)); - if (WebappsIconUtils.doesAndroidSupportMaskableIcons()) { + checkUpdateNeeded(creationData, /* acceptDialogIfAppears= */ true)); + boolean supportsMaskableIcons = WebappsIconUtils.doesAndroidSupportMaskableIcons(); + if (supportsMaskableIcons) { assertUpdateReasonsEqual(WebApkUpdateReason.PRIMARY_ICON_MASKABLE_DIFFERS); } + Assert.assertEquals(supportsMaskableIcons, mUpdateRequested); + Assert.assertEquals(supportsMaskableIcons, mIconOrNameUpdateDialogShown); } @Test @@ -303,7 +350,7 @@ // The fifth shortcut should be ignored. WebappTestPage.navigateToServiceWorkerPageWithManifest( mTestServer, mTab, WEBAPK_MANIFEST_TOO_MANY_SHORTCUTS_URL); - Assert.assertFalse(checkUpdateNeeded(creationData)); + Assert.assertFalse(checkUpdateNeeded(creationData, /* acceptDialogIfAppears= */ false)); } @Test @@ -322,9 +369,70 @@ WebappTestPage.navigateToServiceWorkerPageWithManifest( mTestServer, mTab, WEBAPK_MANIFEST_URL); - Assert.assertTrue(checkUpdateNeeded(creationData)); + Assert.assertTrue(checkUpdateNeeded(creationData, /* acceptDialogIfAppears= */ false)); assertUpdateReasonsEqual(WebApkUpdateReason.PRIMARY_ICON_HASH_DIFFERS, WebApkUpdateReason.SPLASH_ICON_HASH_DIFFERS, WebApkUpdateReason.SHORT_NAME_DIFFERS, WebApkUpdateReason.NAME_DIFFERS, WebApkUpdateReason.BACKGROUND_COLOR_DIFFERS); } + + @Test + @MediumTest + @Feature({"WebApk"}) + public void testUpdateWarningOnNameChange() throws Exception { + CreationData creationData = defaultCreationData(); + creationData.startUrl = + mTestServer.getURL("/chrome/test/data/banners/manifest_test_page.html"); + + creationData.name += "!"; + + enableIconOrNameUpdateDialog(); + WebappTestPage.navigateToServiceWorkerPageWithManifest( + mTestServer, mTab, WEBAPK_MANIFEST_URL); + Assert.assertTrue(checkUpdateNeeded(creationData, /* acceptDialogIfAppears= */ true)); + assertUpdateReasonsEqual(WebApkUpdateReason.NAME_DIFFERS); + + Assert.assertTrue(mIconOrNameUpdateDialogShown); + Assert.assertTrue(mUpdateRequested); + } + + @Test + @MediumTest + @Feature({"WebApk"}) + public void testUpdateWarningOnShortNameChange() throws Exception { + CreationData creationData = defaultCreationData(); + creationData.startUrl = + mTestServer.getURL("/chrome/test/data/banners/manifest_test_page.html"); + + creationData.shortName += "!"; + + enableIconOrNameUpdateDialog(); + WebappTestPage.navigateToServiceWorkerPageWithManifest( + mTestServer, mTab, WEBAPK_MANIFEST_URL); + Assert.assertTrue(checkUpdateNeeded(creationData, /* acceptDialogIfAppears= */ true)); + assertUpdateReasonsEqual(WebApkUpdateReason.SHORT_NAME_DIFFERS); + + Assert.assertTrue(mIconOrNameUpdateDialogShown); + Assert.assertTrue(mUpdateRequested); + } + + @Test + @MediumTest + @Feature({"WebApk"}) + public void testUpdateWarningNotShown() throws Exception { + CreationData creationData = defaultCreationData(); + creationData.startUrl = + mTestServer.getURL("/chrome/test/data/banners/manifest_test_page.html"); + + // Make a trivial change, which should not trigger the dialog. + creationData.backgroundColor -= 1; + + enableIconOrNameUpdateDialog(); + WebappTestPage.navigateToServiceWorkerPageWithManifest( + mTestServer, mTab, WEBAPK_MANIFEST_URL); + Assert.assertTrue(checkUpdateNeeded(creationData, /* acceptDialogIfAppears= */ false)); + assertUpdateReasonsEqual(WebApkUpdateReason.BACKGROUND_COLOR_DIFFERS); + + Assert.assertFalse(mIconOrNameUpdateDialogShown); + Assert.assertTrue(mUpdateRequested); + } }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java index 14903a4..a8ac672 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkUpdateManagerUnitTest.java
@@ -204,6 +204,11 @@ } @Override + protected boolean iconOrNameUpdateDialogEnabled() { + return false; + } + + @Override protected WebApkUpdateDataFetcher buildFetcher() { mFetcher = new TestWebApkUpdateDataFetcher(); return mFetcher;
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index f5af4c8..48f0e355 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp
@@ -1573,6 +1573,9 @@ <message name="IDS_CHROMEOS_NETWORK_ERROR_NOT_REGISTERED" desc="Network error details in notifications: NOT_REGISTERED. Error when a connect attempt fails because the modem is not registered."> Modem not registered </message> + <message name="IDS_CHROMEOS_NETWORK_ERROR_WRONG_STATE" desc="Network error details in notifications: NOT_REGISTERED. Error when a connect attempt fails because the modem is in a busy state."> + Device is busy + </message> <message name="IDS_NETWORK_ERROR_CANNOT_CHANGE_SHARED_CONFIG" desc="Network error message shown when attempting to change a shared network configuration if the operation is not allowed"> Changing shared network configurations is not allowed </message>
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd index 850fa69..2ce93ba 100644 --- a/chrome/app/chromium_strings.grd +++ b/chrome/app/chromium_strings.grd
@@ -545,6 +545,11 @@ This file may be dangerous, so Chromium has blocked it. </message> + <message name="IDS_PROMPT_CONFIRM_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE_BODY" + desc="Body prompt text for the confirmation dialog asking whether the user really meant to keep a download deemed to be associated with account compromise by safebrowsing"> + Chromium recommends that you don't download or open this file. + </message> + <!-- Abandon in-progress downloads confirmation dialog --> <if expr="not is_macosx"> <message name="IDS_ABANDON_DOWNLOAD_DIALOG_BROWSER_MESSAGE" desc="Message on a dialog shown when the user closes the browser while one or more downloads are in progress. This string is shown on Windows, Chrome OS, and Linux, which all use 'Exit' to refer to closing a browser.">
diff --git a/chrome/app/chromium_strings_grd/IDS_PROMPT_CONFIRM_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE_BODY.png.sha1 b/chrome/app/chromium_strings_grd/IDS_PROMPT_CONFIRM_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE_BODY.png.sha1 new file mode 100644 index 0000000..a12df10 --- /dev/null +++ b/chrome/app/chromium_strings_grd/IDS_PROMPT_CONFIRM_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE_BODY.png.sha1
@@ -0,0 +1 @@ +ff5c5371ca77643a94c7b149ef29769133bbfe55 \ No newline at end of file
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 8aaa2c8..05d993db 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -1764,6 +1764,10 @@ Extensions, apps, and themes can harm your computer. Are you sure you want to continue? </message> </if> + <message name="IDS_PROMPT_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE" + desc="Message shown to the user to validate the download when the download content is deteremined to be associated with account compromise by safebrowsing."> + <ph name="FILE_NAME">$1<ex>bla.exe</ex></ph> could let attackers steal your personal information. + </message> <message name="IDS_PROMPT_UNCOMMON_DOWNLOAD_CONTENT" desc="Message shown to the user to validate the download when the download content is classified as uncommon by safebrowsing."> <ph name="FILE_NAME">$1<ex>bla.exe</ex></ph> is not commonly downloaded and may be dangerous. @@ -1848,6 +1852,10 @@ desc="Message shown on chrome://downloads when a download is being scanned"> This file is being scanned. </message> + <message name="IDS_BLOCK_REASON_ACCOUNT_COMPROMISE" + desc="Message shown to the user on chrome://downloads page to explain that this download is blocked because it is associated with account compromise."> + This file could let attackers steal your personal information. + </message> <message name="IDS_DEEP_SCANNED_SAFE_DESCRIPTION" desc="Message shown to the user on chrome://downloads page to explain this this download was deep scanned, and found to be safe."> Security checks are done @@ -1902,6 +1910,10 @@ desc="Title for the confirmation dialog asking whether the user really meant to keep an uncommon download"> Keep file? </message> + <message name="IDS_CONFIRM_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE_TITLE" + desc="Title for the confirmation dialog asking whether the user really meant to keep an uncommon download"> + This file is dangerous + </message> <message name="IDS_PROMPT_CONFIRM_KEEP_DANGEROUS_DOWNLOAD" desc="Prompt text for the confirmation dialog asking whether the user really meant to keep a dangerous download"> This file may be harmful for your computer.
diff --git a/chrome/app/generated_resources_grd/IDS_BLOCK_REASON_ACCOUNT_COMPROMISE.png.sha1 b/chrome/app/generated_resources_grd/IDS_BLOCK_REASON_ACCOUNT_COMPROMISE.png.sha1 new file mode 100644 index 0000000..f450c87 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_BLOCK_REASON_ACCOUNT_COMPROMISE.png.sha1
@@ -0,0 +1 @@ +0f7d0e451fead58953c347f8ff785783018b56df \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_CONFIRM_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE_TITLE.png.sha1 b/chrome/app/generated_resources_grd/IDS_CONFIRM_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE_TITLE.png.sha1 new file mode 100644 index 0000000..dd72338f --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_CONFIRM_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE_TITLE.png.sha1
@@ -0,0 +1 @@ +2b2e77eb48a4b18df8aa3695dfe62365669357e0 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_PROMPT_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE.png.sha1 b/chrome/app/generated_resources_grd/IDS_PROMPT_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE.png.sha1 new file mode 100644 index 0000000..1f6aca6 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_PROMPT_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE.png.sha1
@@ -0,0 +1 @@ +15192606f62c48eac06cf0a25f8ce76b631c26a0 \ No newline at end of file
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd index cd0b721..fdbbd00 100644 --- a/chrome/app/google_chrome_strings.grd +++ b/chrome/app/google_chrome_strings.grd
@@ -552,6 +552,11 @@ This file may be dangerous, so Chrome has blocked it. </message> + <message name="IDS_PROMPT_CONFIRM_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE_BODY" + desc="Body prompt text for the confirmation dialog asking whether the user really meant to keep a download deemed to be associated with account compromise by safebrowsing"> + Chrome recommends that you don't download or open this file. + </message> + <!-- Abandon in-progress downloads confirmation dialog --> <if expr="not is_macosx"> <message name="IDS_ABANDON_DOWNLOAD_DIALOG_BROWSER_MESSAGE" desc="Message on a dialog shown when the user closes the browser while one or more downloads are in progress. This string is shown on Windows, Chrome OS, and Linux, which all use 'Exit' to refer to closing a browser.">
diff --git a/chrome/app/google_chrome_strings_grd/IDS_PROMPT_CONFIRM_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE_BODY.png.sha1 b/chrome/app/google_chrome_strings_grd/IDS_PROMPT_CONFIRM_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE_BODY.png.sha1 new file mode 100644 index 0000000..dd72338f --- /dev/null +++ b/chrome/app/google_chrome_strings_grd/IDS_PROMPT_CONFIRM_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE_BODY.png.sha1
@@ -0,0 +1 @@ +2b2e77eb48a4b18df8aa3695dfe62365669357e0 \ No newline at end of file
diff --git a/chrome/app/os_settings_strings.grdp b/chrome/app/os_settings_strings.grdp index c975a22..09c4857 100644 --- a/chrome/app/os_settings_strings.grdp +++ b/chrome/app/os_settings_strings.grdp
@@ -175,10 +175,10 @@ Couldn't update your Chromebook. Please try again later. </message> <message name="IDS_SETTINGS_UPGRADE_DOWNLOAD_ERROR" desc="Status label: Update check download error(ChromiumOS/ChromeOS)"> - There was an issue downloading the update. Please try again later. + Couldn't download the update. Please try again later. </message> <message name="IDS_SETTINGS_UPGRADE_ADMINISTRATOR_ERROR" desc="Status label: Update blocked by policy (ChromiumOS/ChromeOS)"> - This update is blocked by your administrator + Updates are blocked by your administrator </message> <message name="IDS_SETTINGS_UPGRADE_UP_TO_DATE" desc="Status label: Already up to date (ChromiumOS/ChromeOS)"> Your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> is up to date
diff --git a/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_UPGRADE_ADMINISTRATOR_ERROR.png.sha1 b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_UPGRADE_ADMINISTRATOR_ERROR.png.sha1 index 85ac041..40dd4b6 100644 --- a/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_UPGRADE_ADMINISTRATOR_ERROR.png.sha1 +++ b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_UPGRADE_ADMINISTRATOR_ERROR.png.sha1
@@ -1 +1 @@ -886da1b08c9b335a946beda54bd53dad6ad6c34f \ No newline at end of file +363ffe9202dc83f2ad6e74c287c964c857fbac19 \ No newline at end of file
diff --git a/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_UPGRADE_DOWNLOAD_ERROR.png.sha1 b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_UPGRADE_DOWNLOAD_ERROR.png.sha1 index 292575ad..95e19e1e0 100644 --- a/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_UPGRADE_DOWNLOAD_ERROR.png.sha1 +++ b/chrome/app/os_settings_strings_grdp/IDS_SETTINGS_UPGRADE_DOWNLOAD_ERROR.png.sha1
@@ -1 +1 @@ -aa5475b993579e0421d66c521aba528e42e48ef8 \ No newline at end of file +63ac0e39c17e6199aca9ea364f397b5c117bd26a \ No newline at end of file
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index e66db21..d3fa11c 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -1266,11 +1266,14 @@ <message name="IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_EXPLANATION" desc="Explanation of Federated Learning of Cohorts (FLoC) which appears at the top of the FLoC settings card"> FLoC provides a privacy-preserving mechanism for interest-based ad selection. </message> + <message name="IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_STATUS" desc="The text used to label the user's current Federated Learning of Cohorts (FLoC) trial status"> + Status + </message> <message name="IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_COHORT" desc="The text used to label the user's current Federated Learning of Cohorts (FLoC) cohort"> FLoC ID </message> - <message name="IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_COHORT_UPDATED" desc="The text used to label when the user's current Federated Learning of Cohorts (FLoC) cohort was last updated"> - Updated + <message name="IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_COHORT_NEXT_UPDATE" desc="The text used to label when the user's current Federated Learning of Cohorts (FLoC) cohort will next be updated"> + Next Update </message> <message name="IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_RESET_COHORT" desc="The text used to label the button which allows a user to reset their Federated Learning of Cohorts (FLoC) cohort identifier"> Reset ID
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_COHORT_NEXT_UPDATE.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_COHORT_NEXT_UPDATE.png.sha1 new file mode 100644 index 0000000..2861af2 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_COHORT_NEXT_UPDATE.png.sha1
@@ -0,0 +1 @@ +6cbefe28cc2ed13c14d009fd4ce3433d063b1b41 \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_COHORT_UPDATED.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_COHORT_UPDATED.png.sha1 deleted file mode 100644 index 2616739..0000000 --- a/chrome/app/settings_strings_grdp/IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_COHORT_UPDATED.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -9de2c1031455bd0a067c985f091f8512ee8323ad \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_STATUS.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_STATUS.png.sha1 new file mode 100644 index 0000000..9695bb2 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_STATUS.png.sha1
@@ -0,0 +1 @@ +d3f688764daae0a3ff481d8df45679f0772b98f0 \ No newline at end of file
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index bed276ea..67e7ad6 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -1588,22 +1588,6 @@ base::size(kOverridePrefsForHrefTranslateForceAuto), nullptr}}; #if defined(OS_ANDROID) -const FeatureEntry::FeatureParam kEphemeralTabOpenPeek[] = { - {"ephemeral_tab_open_mode", "0"}}; -const FeatureEntry::FeatureParam kEphemeralTabOpenHalf[] = { - {"ephemeral_tab_open_mode", "1"}}; -const FeatureEntry::FeatureParam kEphemeralTabOpenFull[] = { - {"ephemeral_tab_open_mode", "2"}}; -const FeatureEntry::FeatureVariation kEphemeralTabOpenVariations[] = { - {"Open at peek state", kEphemeralTabOpenPeek, - base::size(kEphemeralTabOpenPeek), nullptr}, - {"Open at half state", kEphemeralTabOpenHalf, - base::size(kEphemeralTabOpenHalf), nullptr}, - {"Open at full state", kEphemeralTabOpenFull, - base::size(kEphemeralTabOpenFull), nullptr}}; -#endif - -#if defined(OS_ANDROID) const FeatureEntry::FeatureParam kExploreSitesExperimental = { chrome::android::explore_sites::kExploreSitesVariationParameterName, chrome::android::explore_sites::kExploreSitesVariationExperimental}; @@ -2625,6 +2609,12 @@ kReaderModeDiscoverabilityVariations, "ReaderMode")}, #endif // !defined(OS_ANDROID) +#if BUILDFLAG(IS_CHROMEOS_ASH) + {"enable-aura-window-subtree-capture", + flag_descriptions::kAuraWindowSubtreeCaptureName, + flag_descriptions::kAuraWindowSubtreeCaptureDescription, kOsCrOS, + FEATURE_VALUE_TYPE(features::kAuraWindowSubtreeCapture)}, +#endif // BUILDFLAG(IS_CHROMEOS_ASH) #if defined(WEBRTC_USE_PIPEWIRE) {"enable-webrtc-pipewire-capturer", flag_descriptions::kWebrtcPipeWireCapturerName, @@ -5176,15 +5166,6 @@ flag_descriptions::kUseAngleDescription, kOsWin, MULTI_VALUE_TYPE(kUseAngleChoices)}, #endif -#if defined(OS_ANDROID) - {"enable-ephemeral-tab-bottom-sheet", - flag_descriptions::kEphemeralTabUsingBottomSheetName, - flag_descriptions::kEphemeralTabUsingBottomSheetDescription, kOsAndroid, - FEATURE_WITH_PARAMS_VALUE_TYPE( - chrome::android::kEphemeralTabUsingBottomSheet, - kEphemeralTabOpenVariations, - "EphemeralTabOpenMode")}, -#endif // defined(OS_ANDROID) #if BUILDFLAG(IS_CHROMEOS_ASH) {"enable-assistant-dsp", flag_descriptions::kEnableGoogleAssistantDspName, @@ -6704,6 +6685,13 @@ FEATURE_VALUE_TYPE(language::kDesktopDetailedLanguageSettings)}, #endif +#if defined(OS_ANDROID) + {"pwa-update-dialog-for-name-and-icon", + flag_descriptions::kPwaUpdateDialogForNameAndIconName, + flag_descriptions::kPwaUpdateDialogForNameAndIconDescription, kOsAndroid, + FEATURE_VALUE_TYPE(chrome::android::kPwaUpdateDialogForNameAndIcon)}, +#endif + {"sync-autofill-wallet-offer-data", flag_descriptions::kSyncAutofillWalletOfferDataName, flag_descriptions::kSyncAutofillWalletOfferDataDescription, kOsAll,
diff --git a/chrome/browser/app_controller_mac_browsertest.mm b/chrome/browser/app_controller_mac_browsertest.mm index 90b7e5f..7f793fef 100644 --- a/chrome/browser/app_controller_mac_browsertest.mm +++ b/chrome/browser/app_controller_mac_browsertest.mm
@@ -363,69 +363,34 @@ EXPECT_EQ(GetAppURL(), current_url.spec()); } -class AppControllerNewProfileManagementBrowserTest - : public InProcessBrowserTest { - protected: - AppControllerNewProfileManagementBrowserTest() +class AppControllerProfilePickerBrowserTest : public InProcessBrowserTest { + public: + AppControllerProfilePickerBrowserTest() : active_browser_list_(BrowserList::GetInstance()) {} + ~AppControllerProfilePickerBrowserTest() override = default; + void SetUpOnMainThread() override { + InProcessBrowserTest::SetUpOnMainThread(); + + // Flag the profile picker as already shown in the past, to avoid additional + // feature onboarding logic. + g_browser_process->local_state()->SetBoolean( + prefs::kBrowserProfilePickerShown, true); + } + + const BrowserList* active_browser_list() const { + return active_browser_list_; + } + + private: const BrowserList* active_browser_list_; }; -// Test that for a regular last profile, a reopen event opens a browser. -IN_PROC_BROWSER_TEST_F(AppControllerNewProfileManagementBrowserTest, - RegularProfileReopenWithNoWindows) { - AppController* ac = base::mac::ObjCCast<AppController>( - [[NSApplication sharedApplication] delegate]); - ASSERT_TRUE(ac); - - EXPECT_EQ(1u, active_browser_list_->size()); - BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:NO]; - - EXPECT_FALSE(result); - EXPECT_EQ(2u, active_browser_list_->size()); - EXPECT_FALSE(ProfilePicker::IsOpen()); -} - -// Test that for a locked last profile, a reopen event opens the User Manager. -// -// Flaky: crbug.com/1163620 -IN_PROC_BROWSER_TEST_F(AppControllerNewProfileManagementBrowserTest, - DISABLED_LockedProfileReopenWithNoWindows) { - // The User Manager uses the system profile as its underlying profile. To - // minimize flakiness due to the scheduling/descheduling of tasks on the - // different threads, pre-initialize the guest profile before it is needed. - CreateAndWaitForSystemProfile(); - AppController* ac = base::mac::ObjCCast<AppController>( - [[NSApplication sharedApplication] delegate]); - ASSERT_TRUE(ac); - - // Lock the active profile. - base::ScopedAllowBlockingForTesting allow_blocking; - Profile* profile = [ac lastProfile]; - ProfileAttributesEntry* entry = - g_browser_process->profile_manager() - ->GetProfileAttributesStorage() - .GetProfileAttributesWithPath(profile->GetPath()); - ASSERT_NE(entry, nullptr); - entry->SetIsSigninRequired(true); - EXPECT_TRUE(entry->IsSigninRequired()); - - EXPECT_EQ(1u, active_browser_list_->size()); - BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:NO]; - EXPECT_FALSE(result); - - base::RunLoop().RunUntilIdle(); - EXPECT_EQ(1u, active_browser_list_->size()); - EXPECT_TRUE(ProfilePicker::IsOpen()); - ProfilePicker::Hide(); -} - // Test that for a guest last profile, commandDispatch should open UserManager // if guest mode is disabled. Note that this test might be flaky under ASAN // due to https://crbug.com/674475. Please disable this test under ASAN // as the tests below if that happened. -IN_PROC_BROWSER_TEST_F(AppControllerNewProfileManagementBrowserTest, +IN_PROC_BROWSER_TEST_F(AppControllerProfilePickerBrowserTest, OpenGuestProfileOnlyIfGuestModeIsEnabled) { CreateAndWaitForSystemProfile(); PrefService* local_state = g_browser_process->local_state(); @@ -436,7 +401,6 @@ [[NSApplication sharedApplication] delegate]); ASSERT_TRUE(ac); - base::ScopedAllowBlockingForTesting allow_blocking; Profile* profile = [ac lastProfile]; EXPECT_TRUE(profile->IsGuestSession()); @@ -444,53 +408,24 @@ ASSERT_TRUE(menu); NSMenuItem* item = [menu itemWithTag:IDC_NEW_WINDOW]; ASSERT_TRUE(item); - EXPECT_EQ(1u, active_browser_list_->size()); + EXPECT_EQ(1u, active_browser_list()->size()); [ac commandDispatch:item]; base::RunLoop().RunUntilIdle(); - EXPECT_EQ(1u, active_browser_list_->size()); + EXPECT_EQ(1u, active_browser_list()->size()); EXPECT_TRUE(ProfilePicker::IsOpen()); ProfilePicker::Hide(); local_state->SetBoolean(prefs::kBrowserGuestModeEnabled, true); [ac commandDispatch:item]; base::RunLoop().RunUntilIdle(); - EXPECT_EQ(2u, active_browser_list_->size()); + EXPECT_EQ(2u, active_browser_list()->size()); EXPECT_FALSE(ProfilePicker::IsOpen()); } -// Test that for a guest last profile, a reopen event opens the User Manager. -IN_PROC_BROWSER_TEST_F(AppControllerNewProfileManagementBrowserTest, - GuestProfileReopenWithNoWindows) { - // Create the system profile. Set the guest as the last used profile so the - // app controller can use it on init. - CreateAndWaitForSystemProfile(); - PrefService* local_state = g_browser_process->local_state(); - local_state->SetString(prefs::kProfileLastUsed, chrome::kGuestProfileDir); - - AppController* ac = base::mac::ObjCCast<AppController>( - [[NSApplication sharedApplication] delegate]); - ASSERT_TRUE(ac); - - base::ScopedAllowBlockingForTesting allow_blocking; - Profile* profile = [ac lastProfile]; - EXPECT_EQ(ProfileManager::GetGuestProfilePath(), profile->GetPath()); - EXPECT_TRUE(profile->IsGuestSession()); - - EXPECT_EQ(1u, active_browser_list_->size()); - BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:NO]; - EXPECT_FALSE(result); - - base::RunLoop().RunUntilIdle(); - - EXPECT_EQ(1u, active_browser_list_->size()); - EXPECT_TRUE(ProfilePicker::IsOpen()); - ProfilePicker::Hide(); -} - -IN_PROC_BROWSER_TEST_F(AppControllerNewProfileManagementBrowserTest, +IN_PROC_BROWSER_TEST_F(AppControllerProfilePickerBrowserTest, AboutChromeForcesUserManager) { AppController* ac = base::mac::ObjCCast<AppController>( [[NSApplication sharedApplication] delegate]); @@ -505,56 +440,34 @@ // Prohibiting guest mode forces the user manager flow for About Chrome. local_state->SetBoolean(prefs::kBrowserGuestModeEnabled, false); - base::ScopedAllowBlockingForTesting allow_blocking; Profile* guest_profile = [ac lastProfile]; EXPECT_EQ(ProfileManager::GetGuestProfilePath(), guest_profile->GetPath()); EXPECT_TRUE(guest_profile->IsGuestSession()); // Tell the browser to open About Chrome. - EXPECT_EQ(1u, active_browser_list_->size()); + EXPECT_EQ(1u, active_browser_list()->size()); [ac orderFrontStandardAboutPanel:NSApp]; base::RunLoop().RunUntilIdle(); // No new browser is opened; the User Manager opens instead. - EXPECT_EQ(1u, active_browser_list_->size()); + EXPECT_EQ(1u, active_browser_list()->size()); EXPECT_TRUE(ProfilePicker::IsActive()); ProfilePicker::Hide(); } -class AppControllerProfilePickerBrowserTest - : public AppControllerNewProfileManagementBrowserTest { - public: - AppControllerProfilePickerBrowserTest() { - feature_list_.InitAndEnableFeature(features::kNewProfilePicker); - } - ~AppControllerProfilePickerBrowserTest() override = default; - - void SetUpOnMainThread() override { - AppControllerNewProfileManagementBrowserTest::SetUpOnMainThread(); - - // Flag the profile picker as already shown in the past, to avoid additional - // feature onboarding logic. - g_browser_process->local_state()->SetBoolean( - prefs::kBrowserProfilePickerShown, true); - } - - private: - base::test::ScopedFeatureList feature_list_; -}; - // Test that for a regular last profile, a reopen event opens a browser. IN_PROC_BROWSER_TEST_F(AppControllerProfilePickerBrowserTest, RegularProfileReopenWithNoWindows) { AppController* ac = base::mac::ObjCCastStrict<AppController>( [[NSApplication sharedApplication] delegate]); - EXPECT_EQ(1u, active_browser_list_->size()); + EXPECT_EQ(1u, active_browser_list()->size()); BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:NO]; EXPECT_FALSE(result); - EXPECT_EQ(2u, active_browser_list_->size()); + EXPECT_EQ(2u, active_browser_list()->size()); EXPECT_FALSE(ProfilePicker::IsOpen()); } @@ -570,7 +483,6 @@ [[NSApplication sharedApplication] delegate]); // Lock the active profile. - base::ScopedAllowBlockingForTesting allow_blocking; Profile* profile = [ac lastProfile]; ProfileAttributesEntry* entry = g_browser_process->profile_manager() @@ -580,12 +492,12 @@ entry->SetIsSigninRequired(true); EXPECT_TRUE(entry->IsSigninRequired()); - EXPECT_EQ(1u, active_browser_list_->size()); + EXPECT_EQ(1u, active_browser_list()->size()); BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:NO]; EXPECT_FALSE(result); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(1u, active_browser_list_->size()); + EXPECT_EQ(1u, active_browser_list()->size()); EXPECT_TRUE(ProfilePicker::IsOpen()); ProfilePicker::Hide(); } @@ -602,18 +514,17 @@ AppController* ac = base::mac::ObjCCastStrict<AppController>( [[NSApplication sharedApplication] delegate]); - base::ScopedAllowBlockingForTesting allow_blocking; Profile* profile = [ac lastProfile]; EXPECT_EQ(ProfileManager::GetGuestProfilePath(), profile->GetPath()); EXPECT_TRUE(profile->IsGuestSession()); - EXPECT_EQ(1u, active_browser_list_->size()); + EXPECT_EQ(1u, active_browser_list()->size()); BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:NO]; EXPECT_FALSE(result); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(1u, active_browser_list_->size()); + EXPECT_EQ(1u, active_browser_list()->size()); EXPECT_TRUE(ProfilePicker::IsOpen()); ProfilePicker::Hide(); } @@ -626,7 +537,6 @@ [[NSApplication sharedApplication] delegate]); // Add a profile in the cache (simulate another profile on disk). - base::ScopedAllowBlockingForTesting allow_blocking; ProfileManager* profile_manager = g_browser_process->profile_manager(); ProfileAttributesStorage* profile_storage = &profile_manager->GetProfileAttributesStorage(); @@ -637,12 +547,12 @@ params.profile_name = u"name_1"; profile_storage->AddProfile(std::move(params)); - EXPECT_EQ(1u, active_browser_list_->size()); + EXPECT_EQ(1u, active_browser_list()->size()); BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:NO]; EXPECT_FALSE(result); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(1u, active_browser_list_->size()); + EXPECT_EQ(1u, active_browser_list()->size()); EXPECT_TRUE(ProfilePicker::IsOpen()); ProfilePicker::Hide(); }
diff --git a/chrome/browser/apps/app_service/publishers/extension_apps_base.cc b/chrome/browser/apps/app_service/publishers/extension_apps_base.cc index 716fa054..8d1b7aa3 100644 --- a/chrome/browser/apps/app_service/publishers/extension_apps_base.cc +++ b/chrome/browser/apps/app_service/publishers/extension_apps_base.cc
@@ -28,6 +28,7 @@ #include "chrome/browser/ui/app_list/extension_app_utils.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/extensions/app_launch_params.h" #include "chrome/browser/ui/extensions/application_launch.h" @@ -46,6 +47,7 @@ #include "extensions/common/extension_urls.h" #include "extensions/common/manifest_handlers/options_page_info.h" #include "extensions/common/switches.h" +#include "net/base/url_util.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "url/url_constants.h"
diff --git a/chrome/browser/apps/app_shim/app_shim_manager_mac.cc b/chrome/browser/apps/app_shim/app_shim_manager_mac.cc index d7b3b31..8646ae2b 100644 --- a/chrome/browser/apps/app_shim/app_shim_manager_mac.cc +++ b/chrome/browser/apps/app_shim/app_shim_manager_mac.cc
@@ -38,6 +38,7 @@ #include "chrome/browser/profiles/profile_window.h" #include "chrome/browser/profiles/profiles_state.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/profile_picker.h" #include "chrome/browser/ui/ui_features.h" #include "chrome/browser/web_applications/components/app_shim_registry_mac.h"
diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc index 0fc1eb1..22d1018 100644 --- a/chrome/browser/apps/guest_view/web_view_browsertest.cc +++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc
@@ -4791,13 +4791,11 @@ // The webview "simple" page is a first navigation to a raw data url. It is // currently considered public (internally - // network::mojom::IPAddressSpace::kUnknown). It should not be able to fetch a - // local page. This test might have to be modified if the classification of - // data URL changes in the future. - EXPECT_EQ( - false, - content::EvalJs( - guest, content::JsReplace( - "fetch($1).then(response => true).catch(error => false)", - fetch_url))); + // `network::mojom::IPAddressSpace::kUnknown`). + // For now, unknown -> local is not blocked, so this fetch succeeds. See also + // https://crbug.com/1178814. + EXPECT_EQ(true, content::EvalJs(guest, + content::JsReplace( + "fetch($1).then(response => response.ok)", + fetch_url))); }
diff --git a/chrome/browser/apps/intent_helper/apps_navigation_throttle.cc b/chrome/browser/apps/intent_helper/apps_navigation_throttle.cc index 71d75444..fe5972f7 100644 --- a/chrome/browser/apps/intent_helper/apps_navigation_throttle.cc +++ b/chrome/browser/apps/intent_helper/apps_navigation_throttle.cc
@@ -16,6 +16,7 @@ #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/web_app_launch_utils.h" #include "chrome/browser/web_applications/components/app_registrar.h" #include "chrome/browser/web_applications/components/web_app_helpers.h"
diff --git a/chrome/browser/ash/accessibility/switch_access_browsertest.cc b/chrome/browser/ash/accessibility/switch_access_browsertest.cc index b464b77..ba06316b 100644 --- a/chrome/browser/ash/accessibility/switch_access_browsertest.cc +++ b/chrome/browser/ash/accessibility/switch_access_browsertest.cc
@@ -153,11 +153,11 @@ // Load a webpage with two groups of controls. ui_test_utils::NavigateToURL(browser(), GURL(R"HTML(data:text/html, - <div aria-label=Top> + <div role="group" aria-label="Top"> <button autofocus>Northwest</button> <button>Northeast</button> </div> - <div aria-label=Bottom> + <div role="group" aria-label="Bottom"> <button>Southwest</button> <button>Southeast</button> </div> @@ -177,14 +177,14 @@ // Press the select key to press the back button, which should focus // on the Top container, with Northwest as the preview. SendVirtualKeyPress(ui::KeyboardCode::VKEY_1); - WaitForFocusRing("primary", "genericContainer", "Top"); + WaitForFocusRing("primary", "group", "Top"); WaitForFocusRing("preview", "button", "Northwest"); // Navigate to the next group by pressing the next switch. // Now we should be focused on the Bottom container, with // Southwest as the preview. SendVirtualKeyPress(ui::KeyboardCode::VKEY_2); - WaitForFocusRing("primary", "genericContainer", "Bottom"); + WaitForFocusRing("primary", "group", "Bottom"); WaitForFocusRing("preview", "button", "Southwest"); // Press the select key to enter the container, which should focus
diff --git a/chrome/browser/ash/app_mode/app_session.cc b/chrome/browser/ash/app_mode/app_session.cc index adbd0c03..4aa03a0d 100644 --- a/chrome/browser/ash/app_mode/app_session.cc +++ b/chrome/browser/ash/app_mode/app_session.cc
@@ -27,6 +27,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_list_observer.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/pref_names.h"
diff --git a/chrome/browser/ash/app_mode/web_app/web_kiosk_app_launcher.cc b/chrome/browser/ash/app_mode/web_app/web_kiosk_app_launcher.cc index 6277fff..00e8743 100644 --- a/chrome/browser/ash/app_mode/web_app/web_kiosk_app_launcher.cc +++ b/chrome/browser/ash/app_mode/web_app/web_kiosk_app_launcher.cc
@@ -14,6 +14,7 @@ #include "chrome/browser/extensions/api/tabs/tabs_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/web_applications/components/web_app_data_retriever.h" #include "chrome/browser/web_applications/components/web_app_url_loader.h"
diff --git a/chrome/browser/ash/arc/notification/arc_management_transition_notification.cc b/chrome/browser/ash/arc/notification/arc_management_transition_notification.cc index df34f49..ed3468e7 100644 --- a/chrome/browser/ash/arc/notification/arc_management_transition_notification.cc +++ b/chrome/browser/ash/arc/notification/arc_management_transition_notification.cc
@@ -90,7 +90,8 @@ void ShowManagementTransitionNotification(Profile* profile) { const ArcSupervisionTransition transition = GetSupervisionTransition(profile); DCHECK(transition == ArcSupervisionTransition::CHILD_TO_REGULAR || - transition == ArcSupervisionTransition::REGULAR_TO_CHILD); + transition == ArcSupervisionTransition::REGULAR_TO_CHILD || + transition == ArcSupervisionTransition::UNMANAGED_TO_MANAGED); message_center::NotifierId notifier_id( message_center::NotifierType::SYSTEM_COMPONENT, kNotifierId);
diff --git a/chrome/browser/ash/arc/notification/arc_management_transition_notification_unittest.cc b/chrome/browser/ash/arc/notification/arc_management_transition_notification_unittest.cc index 05bdbe4..569936e 100644 --- a/chrome/browser/ash/arc/notification/arc_management_transition_notification_unittest.cc +++ b/chrome/browser/ash/arc/notification/arc_management_transition_notification_unittest.cc
@@ -9,11 +9,13 @@ #include "base/macros.h" #include "base/run_loop.h" +#include "base/test/scoped_feature_list.h" #include "chrome/browser/notifications/notification_display_service_tester.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" #include "chrome/browser/ui/app_list/arc/arc_app_test.h" #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" #include "chrome/test/base/testing_profile.h" +#include "components/arc/arc_features.h" #include "components/arc/arc_prefs.h" #include "components/arc/metrics/arc_metrics_constants.h" #include "components/arc/session/arc_supervision_transition.h" @@ -40,6 +42,9 @@ display_service_ = std::make_unique<NotificationDisplayServiceTester>(profile()); arc_app_test_.SetUp(profile()); + + feature_list_.InitAndEnableFeature( + kEnableUnmanagedToManagedTransitionFeature); } void TearDown() override { @@ -60,6 +65,8 @@ ArcAppTest arc_app_test_; content::BrowserTaskEnvironment task_environment_; + + base::test::ScopedFeatureList feature_list_; }; INSTANTIATE_TEST_SUITE_P( @@ -67,7 +74,8 @@ ArcManagementTransitionNotificationTest, ::testing::Values(ArcSupervisionTransition::NO_TRANSITION, ArcSupervisionTransition::CHILD_TO_REGULAR, - ArcSupervisionTransition::REGULAR_TO_CHILD)); + ArcSupervisionTransition::REGULAR_TO_CHILD, + ArcSupervisionTransition::UNMANAGED_TO_MANAGED)); TEST_P(ArcManagementTransitionNotificationTest, BaseFlow) { ASSERT_TRUE(arc_app_test()->fake_apps().size());
diff --git a/chrome/browser/ash/arc/session/arc_session_manager.cc b/chrome/browser/ash/arc/session/arc_session_manager.cc index 63dd374..e422c69 100644 --- a/chrome/browser/ash/arc/session/arc_session_manager.cc +++ b/chrome/browser/ash/arc/session/arc_session_manager.cc
@@ -32,6 +32,7 @@ #include "chrome/browser/ash/arc/optin/arc_terms_of_service_default_negotiator.h" #include "chrome/browser/ash/arc/optin/arc_terms_of_service_oobe_negotiator.h" #include "chrome/browser/ash/arc/policy/arc_android_management_checker.h" +#include "chrome/browser/ash/arc/policy/arc_policy_util.h" #include "chrome/browser/ash/arc/session/arc_provisioning_result.h" #include "chrome/browser/ash/login/demo_mode/demo_resources.h" #include "chrome/browser/ash/login/demo_mode/demo_session.h" @@ -94,6 +95,9 @@ constexpr const char kArcPrepareHostGeneratedDirJobName[] = "arc_2dprepare_2dhost_2dgenerated_2ddir"; +constexpr base::TimeDelta kWaitForPoliciesTimeout = + base::TimeDelta::FromSeconds(20); + // Generates a unique, 20-character hex string from |chromeos_user| and // |salt| which can be used as Android's ro.boot.serialno and ro.serialno // properties. Note that Android treats serialno in a case-insensitive manner. @@ -670,6 +674,9 @@ PrefService* const prefs = profile_->GetPrefs(); + prefs->SetBoolean(prefs::kArcIsManaged, + policy_util::IsAccountManaged(profile_)); + if (prefs->GetBoolean(prefs::kArcSignedIn)) return; @@ -892,6 +899,7 @@ playstore_launcher_.reset(); terms_of_service_negotiator_.reset(); android_management_checker_.reset(); + wait_for_policy_timer_.AbandonAndStop(); } void ArcSessionManager::AddObserver(ArcSessionManagerObserver* observer) { @@ -974,6 +982,11 @@ return playstore_launcher_.get(); } +void ArcSessionManager::OnBackgroundAndroidManagementCheckedForTesting( + policy::AndroidManagementClient::Result result) { + OnBackgroundAndroidManagementChecked(result); +} + void ArcSessionManager::OnVmStarted( const vm_tools::concierge::VmStartedSignal& vm_signal) { // When an ARCVM starts, store the vm info. @@ -1341,15 +1354,23 @@ void ArcSessionManager::OnBackgroundAndroidManagementChecked( policy::AndroidManagementClient::Result result) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DCHECK(android_management_checker_); - android_management_checker_.reset(); + + if (g_enable_check_android_management_in_tests.value_or(true)) { + DCHECK(android_management_checker_); + android_management_checker_.reset(); + } switch (result) { case policy::AndroidManagementClient::Result::UNMANAGED: // Do nothing. ARC should be started already. break; case policy::AndroidManagementClient::Result::MANAGED: - SetArcPlayStoreEnabledForProfile(profile_, false); + if (base::FeatureList::IsEnabled( + arc::kEnableUnmanagedToManagedTransitionFeature)) { + WaitForPoliciesLoad(); + } else { + SetArcPlayStoreEnabledForProfile(profile_, false /* enabled */); + } break; case policy::AndroidManagementClient::Result::ERROR: // This code should not be reached. For background check, @@ -1358,6 +1379,60 @@ } } +void ArcSessionManager::WaitForPoliciesLoad() { + auto* policy_service = + profile()->GetProfilePolicyConnector()->policy_service(); + + // User might be transitioning to managed state, wait for policies load + // to confirm. + if (policy_service->IsFirstPolicyLoadComplete(policy::POLICY_DOMAIN_CHROME)) { + OnFirstPoliciesLoadedOrTimeout(); + } else { + profile_->GetProfilePolicyConnector()->policy_service()->AddObserver( + policy::POLICY_DOMAIN_CHROME, this); + wait_for_policy_timer_.Start( + FROM_HERE, kWaitForPoliciesTimeout, + base::BindOnce(&ArcSessionManager::OnFirstPoliciesLoadedOrTimeout, + base::Unretained(this))); + } +} + +void ArcSessionManager::OnFirstPoliciesLoaded(policy::PolicyDomain domain) { + DCHECK(domain == policy::POLICY_DOMAIN_CHROME); + + wait_for_policy_timer_.Stop(); + OnFirstPoliciesLoadedOrTimeout(); +} + +void ArcSessionManager::OnFirstPoliciesLoadedOrTimeout() { + profile_->GetProfilePolicyConnector()->policy_service()->RemoveObserver( + policy::POLICY_DOMAIN_CHROME, this); + + // OnFirstPoliciesLoaded callback is triggered for both unmanaged and managed + // users, we need to check user state here. + // If timeout comes before policies are loaded, we fallback to calling + // SetArcPlayStoreEnabledForProfile(profile_, false). + if (arc::policy_util::IsAccountManaged(profile_)) { + // User has become managed, notify ARC by setting transition preference, + // which is eventually passed to ARC via ArcSession parameters. + profile_->GetPrefs()->SetInteger( + arc::prefs::kArcSupervisionTransition, + static_cast<int>(arc::ArcSupervisionTransition::UNMANAGED_TO_MANAGED)); + + // Restart ARC to perform managed re-provisioning. + // kArcIsManaged and kArcSignedIn are not reset during the restart. + // In case of successful re-provisioning, OnProvisioningFinished is called + // and kArcIsManaged is updated. + // In case of re-provisioning failure, ARC data is removed and transition + // preference is reset. + // In case Chrome is terminated during re-provisioning, user transition will + // be detected in ProfileManager::InitProfileUserPrefs, on next startup. + StopAndEnableArc(); + } else { + SetArcPlayStoreEnabledForProfile(profile_, false /* enabled */); + } +} + void ArcSessionManager::StartArc() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK(state_ == State::STOPPED || @@ -1430,6 +1505,7 @@ profile_->GetPrefs()->SetBoolean(prefs::kArcFastAppReinstallStarted, false); profile_->GetPrefs()->SetBoolean(prefs::kArcProvisioningInitiatedFromOobe, false); + profile_->GetPrefs()->SetBoolean(prefs::kArcIsManaged, false); } ShutdownSession();
diff --git a/chrome/browser/ash/arc/session/arc_session_manager.h b/chrome/browser/ash/arc/session/arc_session_manager.h index 90a087c..f8b4338 100644 --- a/chrome/browser/ash/arc/session/arc_session_manager.h +++ b/chrome/browser/ash/arc/session/arc_session_manager.h
@@ -23,6 +23,7 @@ #include "chromeos/dbus/session_manager/session_manager_client.h" #include "components/arc/session/arc_session_runner.h" #include "components/arc/session/arc_stop_reason.h" +#include "components/policy/core/common/policy_service.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/abseil-cpp/absl/types/variant.h" @@ -51,7 +52,8 @@ class ArcSessionManager : public ArcSessionRunner::Observer, public ArcSupportHost::ErrorDelegate, public chromeos::SessionManagerClient::Observer, - public chromeos::ConciergeClient::VmObserver { + public chromeos::ConciergeClient::VmObserver, + public policy::PolicyService::Observer { public: // Represents each State of ARC session. // NOT_INITIALIZED: represents the state that the Profile is not yet ready @@ -280,6 +282,10 @@ OnExpandPropertyFilesAndReadSalt(ExpansionResult{{}, result}); } + // Invokes OnBackgroundAndroidManagementChecked as if the check is done. + void OnBackgroundAndroidManagementCheckedForTesting( + policy::AndroidManagementClient::Result result); + void reset_property_files_expansion_result() { property_files_expansion_result_.reset(); } @@ -290,6 +296,9 @@ void OnVmStopped( const vm_tools::concierge::VmStoppedSignal& vm_signal) override; + // policy::PolicyServer::Observer override. + void OnFirstPoliciesLoaded(policy::PolicyDomain domain) override; + // Getter for |vm_info_|. // If ARCVM is not running, return absl::nullopt. const absl::optional<vm_tools::concierge::VmInfo>& GetVmInfo() const; @@ -392,6 +401,13 @@ // Called when ExpandPropertyFilesAndReadSalt is done. void OnExpandPropertyFilesAndReadSalt(ExpansionResult result); + // Sets up a timer to wait for policies load, or immediately calls + // OnFirstPoliciesLoadedOrTimeout. + void WaitForPoliciesLoad(); + // Called when first policies are loaded or when wait_for_policy_timer_ + // expires. + void OnFirstPoliciesLoadedOrTimeout(); + std::unique_ptr<ArcSessionRunner> arc_session_runner_; std::unique_ptr<AdbSideloadingAvailabilityDelegateImpl> adb_sideloading_availability_delegate_; @@ -443,6 +459,10 @@ absl::optional<vm_tools::concierge::VmInfo> vm_info_; + // Timer to wait for policiesin case we are suspecting the user might be + // transitioning to the managed state. + base::OneShotTimer wait_for_policy_timer_; + // Must be the last member. base::WeakPtrFactory<ArcSessionManager> weak_ptr_factory_{this};
diff --git a/chrome/browser/ash/arc/session/arc_session_manager_unittest.cc b/chrome/browser/ash/arc/session/arc_session_manager_unittest.cc index f827f5a..2db2148 100644 --- a/chrome/browser/ash/arc/session/arc_session_manager_unittest.cc +++ b/chrome/browser/ash/arc/session/arc_session_manager_unittest.cc
@@ -2200,5 +2200,69 @@ arc_session_manager()->Shutdown(); } +class ArcTransitionToManagedTest + : public ArcSessionManagerTest, + public testing::WithParamInterface<std::tuple<bool, bool>> { + public: + ArcTransitionToManagedTest() = default; + ~ArcTransitionToManagedTest() override = default; + ArcTransitionToManagedTest(const ArcTransitionToManagedTest&) = delete; + ArcTransitionToManagedTest& operator=(const ArcTransitionToManagedTest&) = + delete; + + bool transition_feature_enabled() const { return std::get<0>(GetParam()); } + + bool user_become_managed() const { return std::get<1>(GetParam()); } + + bool ShouldArcTransitionToManaged() const { + return transition_feature_enabled() && user_become_managed(); + } +}; + +TEST_P(ArcTransitionToManagedTest, TransitionFlow) { + // Here we only test OnBackgroundAndroidManagementChecked impl, not the actual + // Android management check. + ArcSessionManager::EnableCheckAndroidManagementForTesting(false); + + // Initialize feature state. + base::test::ScopedFeatureList feature_list; + feature_list.InitWithFeatureState(kEnableUnmanagedToManagedTransitionFeature, + transition_feature_enabled()); + profile()->GetPrefs()->SetBoolean(prefs::kArcEnabled, true); + + // Initialize ARC. + arc_session_manager()->SetProfile(profile()); + arc_session_manager()->Initialize(); + arc_session_manager()->RequestEnable(); + base::RunLoop().RunUntilIdle(); + ASSERT_EQ(ArcSessionManager::State::NEGOTIATING_TERMS_OF_SERVICE, + arc_session_manager()->state()); + arc_session_manager()->OnTermsOfServiceNegotiatedForTesting(true); + arc_session_manager()->StartArcForTesting(); + + // Emulate user management state change. + profile()->GetProfilePolicyConnector()->OverrideIsManagedForTesting( + user_become_managed()); + + // Android management check response. + arc_session_manager()->OnBackgroundAndroidManagementCheckedForTesting( + policy::AndroidManagementClient::Result::MANAGED); + base::RunLoop().RunUntilIdle(); + + // Verify ARC state and ARC transition value. + EXPECT_EQ(profile()->GetPrefs()->GetBoolean(prefs::kArcEnabled), + ShouldArcTransitionToManaged()); + EXPECT_EQ(arc::GetSupervisionTransition(profile()), + ShouldArcTransitionToManaged() + ? arc::ArcSupervisionTransition::UNMANAGED_TO_MANAGED + : arc::ArcSupervisionTransition::NO_TRANSITION); +} + +INSTANTIATE_TEST_SUITE_P( + All, + ArcTransitionToManagedTest, + testing::Combine(testing::Bool() /* transition_feature_enabled */, + testing::Bool() /* user_become_managed */)); + } // namespace } // namespace arc
diff --git a/chrome/browser/ash/attestation/attestation_ca_client_unittest.cc b/chrome/browser/ash/attestation/attestation_ca_client_unittest.cc index 332e5cf..ba18374 100644 --- a/chrome/browser/ash/attestation/attestation_ca_client_unittest.cc +++ b/chrome/browser/ash/attestation/attestation_ca_client_unittest.cc
@@ -13,6 +13,7 @@ #include "net/base/net_errors.h" #include "net/http/http_status_code.h" #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" +#include "services/network/public/mojom/proxy_lookup_client.mojom.h" #include "services/network/test/test_network_context.h" #include "services/network/test/test_url_loader_factory.h" #include "services/network/test/test_utils.h"
diff --git a/chrome/browser/ash/crosapi/browser_util.cc b/chrome/browser/ash/crosapi/browser_util.cc index 4d9a985..9c4ae3d 100644 --- a/chrome/browser/ash/crosapi/browser_util.cc +++ b/chrome/browser/ash/crosapi/browser_util.cc
@@ -35,10 +35,32 @@ #include "chrome/common/chrome_features.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/pref_names.h" +#include "chromeos/components/sensors/mojom/cros_sensor_service.mojom.h" #include "chromeos/crosapi/cpp/crosapi_constants.h" +#include "chromeos/crosapi/mojom/app_service.mojom.h" +#include "chromeos/crosapi/mojom/automation.mojom.h" #include "chromeos/crosapi/mojom/cert_database.mojom.h" +#include "chromeos/crosapi/mojom/clipboard.mojom.h" +#include "chromeos/crosapi/mojom/clipboard_history.mojom.h" +#include "chromeos/crosapi/mojom/content_protection.mojom.h" #include "chromeos/crosapi/mojom/crosapi.mojom.h" +#include "chromeos/crosapi/mojom/device_attributes.mojom.h" +#include "chromeos/crosapi/mojom/download_controller.mojom.h" +#include "chromeos/crosapi/mojom/feedback.mojom.h" +#include "chromeos/crosapi/mojom/file_manager.mojom.h" +#include "chromeos/crosapi/mojom/holding_space_service.mojom.h" +#include "chromeos/crosapi/mojom/keystore_service.mojom.h" +#include "chromeos/crosapi/mojom/local_printer.mojom.h" +#include "chromeos/crosapi/mojom/message_center.mojom.h" +#include "chromeos/crosapi/mojom/metrics_reporting.mojom.h" +#include "chromeos/crosapi/mojom/prefs.mojom.h" +#include "chromeos/crosapi/mojom/screen_manager.mojom.h" +#include "chromeos/crosapi/mojom/system_display.mojom.h" #include "chromeos/crosapi/mojom/task_manager.mojom.h" +#include "chromeos/crosapi/mojom/test_controller.mojom.h" +#include "chromeos/crosapi/mojom/url_handler.mojom.h" +#include "chromeos/crosapi/mojom/video_capture.mojom.h" +#include "chromeos/services/machine_learning/public/mojom/machine_learning_service.mojom.h" #include "components/account_manager_core/account.h" #include "components/account_manager_core/account_manager_util.h" #include "components/exo/shell_surface_util.h" @@ -54,6 +76,9 @@ #include "media/capture/mojom/video_capture.mojom.h" #include "mojo/public/cpp/platform/platform_channel.h" #include "mojo/public/cpp/system/invitation.h" +#include "services/device/public/mojom/hid.mojom.h" +#include "services/media_session/public/mojom/audio_focus.mojom.h" +#include "services/media_session/public/mojom/media_controller.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" using user_manager::User;
diff --git a/chrome/browser/ash/crosapi/browser_util_unittest.cc b/chrome/browser/ash/crosapi/browser_util_unittest.cc index b7f37ee7..1079deb2 100644 --- a/chrome/browser/ash/crosapi/browser_util_unittest.cc +++ b/chrome/browser/ash/crosapi/browser_util_unittest.cc
@@ -20,6 +20,7 @@ #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" #include "chromeos/crosapi/mojom/crosapi.mojom.h" +#include "chromeos/crosapi/mojom/keystore_service.mojom.h" #include "components/account_id/account_id.h" #include "components/user_manager/scoped_user_manager.h" #include "components/version_info/channel.h"
diff --git a/chrome/browser/ash/login/demo_mode/demo_session.cc b/chrome/browser/ash/login/demo_mode/demo_session.cc index d047c68..161bf7d4 100644 --- a/chrome/browser/ash/login/demo_mode/demo_session.cc +++ b/chrome/browser/ash/login/demo_mode/demo_session.cc
@@ -7,6 +7,7 @@ #include <algorithm> #include <utility> +#include "ash/constants/ash_switches.h" #include "ash/public/cpp/locale_update_controller.h" #include "base/bind.h" #include "base/callback.h" @@ -19,7 +20,6 @@ #include "base/metrics/histogram_macros.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "base/system/sys_info.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h" #include "base/timer/timer.h" @@ -40,7 +40,6 @@ #include "chrome/browser/ui/ash/wallpaper_controller_client_impl.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/pref_names.h" -#include "chromeos/system/statistics_provider.h" #include "chromeos/tpm/install_attributes.h" #include "components/language/core/browser/pref_names.h" #include "components/prefs/pref_registry_simple.h" @@ -83,10 +82,6 @@ // Prefix for the private language tag used to indicate the device's country. constexpr char kDemoModeCountryPrivateLanguageTagPrefix[] = "x-dm-country-"; -// Prefix for the HWID for KRANE-ZDKS krane devices (based on kukuid board). -// We only care about that specific variant of krane here. -constexpr char kHwidKraneZdksPrefix[] = "KRANE-ZDKS"; - // Returns the list of apps normally pinned by Demo Mode policy that shouldn't // be pinned if the device is offline. std::vector<std::string> GetIgnorePinPolicyApps() { @@ -114,18 +109,19 @@ LOG(ERROR) << "Failed to install demo mode media."; } -std::string GetBoardName() { - const std::vector<std::string> board = - base::SplitString(base::SysInfo::GetLsbReleaseBoard(), "-", - base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); - return board[0]; +std::string GetSwitchOrDefault(const base::StringPiece& switch_string, + const std::string& default_value) { + auto* const command_line = base::CommandLine::ForCurrentProcess(); + + if (command_line->HasSwitch(switch_string)) { + return command_line->GetSwitchValueASCII(switch_string); + } + return default_value; } std::string GetHighlightsAppId() { - std::string board = GetBoardName(); - if (board == "atlas") - return extension_misc::kHighlightsAtlasAppId; - return extension_misc::kHighlightsAppId; + return GetSwitchOrDefault(switches::kDemoModeHighlightsApp, + extension_misc::kHighlightsAppId); } // If the current locale is not the default one, ensure it is reverted to the @@ -336,17 +332,8 @@ // static std::string DemoSession::GetScreensaverAppId() { - std::string board = GetBoardName(); - if (board == "atlas") - return extension_misc::kScreensaverAtlasAppId; - if (board == "kukui") { - std::string hwid; - chromeos::system::StatisticsProvider::GetInstance()->GetMachineStatistic( - chromeos::system::kHardwareClassKey, &hwid); - if (base::StartsWith(hwid, kHwidKraneZdksPrefix)) - return extension_misc::kScreensaverKraneZdksAppId; - } - return extension_misc::kScreensaverAppId; + return GetSwitchOrDefault(switches::kDemoModeScreensaverApp, + extension_misc::kScreensaverAppId); } // static
diff --git a/chrome/browser/ash/login/enable_debugging_browsertest.cc b/chrome/browser/ash/login/enable_debugging_browsertest.cc index 9c5652b5..459c73a 100644 --- a/chrome/browser/ash/login/enable_debugging_browsertest.cc +++ b/chrome/browser/ash/login/enable_debugging_browsertest.cc
@@ -189,10 +189,8 @@ chromeos::switches::kDisableHIDDetectionOnOOBEForTesting); } void SetUpInProcessBrowserTestFixture() override { - std::unique_ptr<DBusThreadManagerSetter> dbus_setter = - chromeos::DBusThreadManager::GetSetterForTesting(); debug_daemon_client_ = new TestDebugDaemonClient; - dbus_setter->SetDebugDaemonClient( + chromeos::DBusThreadManager::GetSetterForTesting()->SetDebugDaemonClient( std::unique_ptr<DebugDaemonClient>(debug_daemon_client_)); OobeBaseTest::SetUpInProcessBrowserTestFixture(); @@ -373,9 +371,7 @@ EnableDebuggingNonDevTest() = default; void SetUpInProcessBrowserTestFixture() override { - std::unique_ptr<DBusThreadManagerSetter> dbus_setter = - chromeos::DBusThreadManager::GetSetterForTesting(); - dbus_setter->SetDebugDaemonClient( + chromeos::DBusThreadManager::GetSetterForTesting()->SetDebugDaemonClient( std::unique_ptr<DebugDaemonClient>(new FakeDebugDaemonClient)); EnableDebuggingTestBase::SetUpInProcessBrowserTestFixture(); }
diff --git a/chrome/browser/ash/login/guest_login_browsertest.cc b/chrome/browser/ash/login/guest_login_browsertest.cc index b6ff951..38c3edb7 100644 --- a/chrome/browser/ash/login/guest_login_browsertest.cc +++ b/chrome/browser/ash/login/guest_login_browsertest.cc
@@ -8,6 +8,7 @@ #include "chrome/browser/ash/login/test/login_manager_mixin.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/test/base/mixin_based_in_process_browser_test.h" #include "chromeos/dbus/power/fake_power_manager_client.h" #include "chromeos/dbus/session_manager/fake_session_manager_client.h"
diff --git a/chrome/browser/ash/login/lock/screen_locker_browsertest.cc b/chrome/browser/ash/login/lock/screen_locker_browsertest.cc index 8339e0d..b3c6c73 100644 --- a/chrome/browser/ash/login/lock/screen_locker_browsertest.cc +++ b/chrome/browser/ash/login/lock/screen_locker_browsertest.cc
@@ -17,6 +17,7 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_test.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" #include "chrome/common/pref_names.h"
diff --git a/chrome/browser/ash/login/onboarding_user_activity_counter.cc b/chrome/browser/ash/login/onboarding_user_activity_counter.cc index c7e237d..26ab8cb 100644 --- a/chrome/browser/ash/login/onboarding_user_activity_counter.cc +++ b/chrome/browser/ash/login/onboarding_user_activity_counter.cc
@@ -63,7 +63,9 @@ } auto* session_manager = session_manager::SessionManager::Get(); - session_observation_.Observe(session_manager); + // Can't use base::ScopedObservation because SessionManager might be destroyed + // before OnboardingUserActivityCounter. + session_manager->AddObserver(this); SetActiveState(GetActiveState()); } @@ -146,7 +148,9 @@ } void OnboardingUserActivityCounter::StopObserving() { - session_observation_.Reset(); + auto* session_manager = session_manager::SessionManager::Get(); + if (session_manager) + session_manager->RemoveObserver(this); } void OnboardingUserActivityCounter::OnSessionStateChanged() {
diff --git a/chrome/browser/ash/login/onboarding_user_activity_counter.h b/chrome/browser/ash/login/onboarding_user_activity_counter.h index a540863f..fb737f4 100644 --- a/chrome/browser/ash/login/onboarding_user_activity_counter.h +++ b/chrome/browser/ash/login/onboarding_user_activity_counter.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ASH_LOGIN_ONBOARDING_USER_ACTIVITY_COUNTER_H_ #include "base/callback.h" -#include "base/scoped_observation.h" #include "base/time/time.h" #include "base/timer/timer.h" #include "components/session_manager/core/session_manager.h" @@ -62,9 +61,6 @@ const base::TickClock* tick_clock_; base::OneShotTimer timer_; base::OnceClosure closure_; - base::ScopedObservation<session_manager::SessionManager, - session_manager::SessionManagerObserver> - session_observation_{this}; }; } // namespace ash
diff --git a/chrome/browser/ash/login/screens/update_required_screen_unittest.cc b/chrome/browser/ash/login/screens/update_required_screen_unittest.cc index dd79d1a..2b7113b 100644 --- a/chrome/browser/ash/login/screens/update_required_screen_unittest.cc +++ b/chrome/browser/ash/login/screens/update_required_screen_unittest.cc
@@ -60,6 +60,7 @@ wizard_context_ = std::make_unique<WizardContext>(); fake_view_ = std::make_unique<FakeUpdateRequiredScreenHandler>(); fake_update_engine_client_ = new FakeUpdateEngineClient(); + DBusThreadManager::Initialize(); DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( std::unique_ptr<UpdateEngineClient>(fake_update_engine_client_));
diff --git a/chrome/browser/ash/login/screens/update_screen_unittest.cc b/chrome/browser/ash/login/screens/update_screen_unittest.cc index 22c4ca737..e84e9ab 100644 --- a/chrome/browser/ash/login/screens/update_screen_unittest.cc +++ b/chrome/browser/ash/login/screens/update_screen_unittest.cc
@@ -74,6 +74,7 @@ wizard_context_ = std::make_unique<WizardContext>(); PowerManagerClient::InitializeFake(); fake_update_engine_client_ = new FakeUpdateEngineClient(); + DBusThreadManager::Initialize(); DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( std::unique_ptr<UpdateEngineClient>(fake_update_engine_client_)); network_handler_test_helper_ = std::make_unique<NetworkHandlerTestHelper>();
diff --git a/chrome/browser/ash/login/test/oobe_base_test.cc b/chrome/browser/ash/login/test/oobe_base_test.cc index 85ae438..9537115 100644 --- a/chrome/browser/ash/login/test/oobe_base_test.cc +++ b/chrome/browser/ash/login/test/oobe_base_test.cc
@@ -148,10 +148,8 @@ // based on timer. It is nice simulation for chromeos-on-linux, but // may lead to flakiness in debug/*SAN tests. // Set up FakeUpdateEngineClient that does not have any timer-based logic. - std::unique_ptr<DBusThreadManagerSetter> dbus_setter = - chromeos::DBusThreadManager::GetSetterForTesting(); update_engine_client_ = new FakeUpdateEngineClient; - dbus_setter->SetUpdateEngineClient( + chromeos::DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( std::unique_ptr<UpdateEngineClient>(update_engine_client_)); }
diff --git a/chrome/browser/ash/login/version_updater/version_updater_unittest.cc b/chrome/browser/ash/login/version_updater/version_updater_unittest.cc index 51bb2a9..745c53f1 100644 --- a/chrome/browser/ash/login/version_updater/version_updater_unittest.cc +++ b/chrome/browser/ash/login/version_updater/version_updater_unittest.cc
@@ -90,6 +90,7 @@ void SetUp() override { // Initialize objects needed by VersionUpdater. fake_update_engine_client_ = new FakeUpdateEngineClient(); + DBusThreadManager::Initialize(); DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( std::unique_ptr<UpdateEngineClient>(fake_update_engine_client_));
diff --git a/chrome/browser/ash/login/wizard_controller_browsertest.cc b/chrome/browser/ash/login/wizard_controller_browsertest.cc index 5700456..76eee26 100644 --- a/chrome/browser/ash/login/wizard_controller_browsertest.cc +++ b/chrome/browser/ash/login/wizard_controller_browsertest.cc
@@ -1069,16 +1069,6 @@ } // WizardControllerFlowTest: - void SetUpInProcessBrowserTestFixture() override { - WizardControllerFlowTest::SetUpInProcessBrowserTestFixture(); - - // We need to initialize some dbus clients here, otherwise this test will - // timeout in WaitForAutoEnrollmentState on asan builds. TODO(stevenjb): - // Determine which client(s) need to be created and extract and initialize - // them. https://crbug.com/949063. - DBusThreadManager::Initialize(); - } - void SetUpOnMainThread() override { WizardControllerFlowTest::SetUpOnMainThread();
diff --git a/chrome/browser/ash/notifications/gnubby_notification_unittest.cc b/chrome/browser/ash/notifications/gnubby_notification_unittest.cc index 3e67d81..487b4da 100644 --- a/chrome/browser/ash/notifications/gnubby_notification_unittest.cc +++ b/chrome/browser/ash/notifications/gnubby_notification_unittest.cc
@@ -23,6 +23,7 @@ ~GnubbyNotificationTest() override {} void SetUp() override { + DBusThreadManager::Initialize(); DBusThreadManager::GetSetterForTesting()->SetGnubbyClient( std::unique_ptr<chromeos::GnubbyClient>( new chromeos::FakeGnubbyClient));
diff --git a/chrome/browser/ash/notifications/update_required_notification_unittest.cc b/chrome/browser/ash/notifications/update_required_notification_unittest.cc index 142ea49..ea174c2 100644 --- a/chrome/browser/ash/notifications/update_required_notification_unittest.cc +++ b/chrome/browser/ash/notifications/update_required_notification_unittest.cc
@@ -128,6 +128,7 @@ auto fake_update_engine_client = std::make_unique<chromeos::FakeUpdateEngineClient>(); fake_update_engine_client_ = fake_update_engine_client.get(); + chromeos::DBusThreadManager::Initialize(); chromeos::DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( std::move(fake_update_engine_client)); network_handler_test_helper_ =
diff --git a/chrome/browser/ash/system/automatic_reboot_manager_unittest.cc b/chrome/browser/ash/system/automatic_reboot_manager_unittest.cc index 25324ce..ebf01b3 100644 --- a/chrome/browser/ash/system/automatic_reboot_manager_unittest.cc +++ b/chrome/browser/ash/system/automatic_reboot_manager_unittest.cc
@@ -333,6 +333,7 @@ AutomaticRebootManager::RegisterPrefs(local_state_.registry()); update_engine_client_ = new FakeUpdateEngineClient; + DBusThreadManager::Initialize(); DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( std::unique_ptr<UpdateEngineClient>(update_engine_client_)); PowerManagerClient::InitializeFake();
diff --git a/chrome/browser/ash/system_logs/single_debug_daemon_log_source_unittest.cc b/chrome/browser/ash/system_logs/single_debug_daemon_log_source_unittest.cc index ba0ffbf..e0c7a27 100644 --- a/chrome/browser/ash/system_logs/single_debug_daemon_log_source_unittest.cc +++ b/chrome/browser/ash/system_logs/single_debug_daemon_log_source_unittest.cc
@@ -26,6 +26,7 @@ void SetUp() override { // Since no debug daemon will be available during a unit test, use // FakeDebugDaemonClient to provide dummy DebugDaemonClient functionality. + chromeos::DBusThreadManager::Initialize(); chromeos::DBusThreadManager::GetSetterForTesting()->SetDebugDaemonClient( std::make_unique<chromeos::FakeDebugDaemonClient>()); }
diff --git a/chrome/browser/ash/web_applications/system_web_app_integration_test.cc b/chrome/browser/ash/web_applications/system_web_app_integration_test.cc index c8e5c674..d358f7a 100644 --- a/chrome/browser/ash/web_applications/system_web_app_integration_test.cc +++ b/chrome/browser/ash/web_applications/system_web_app_integration_test.cc
@@ -10,6 +10,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/web_applications/components/web_app_helpers.h" #include "chrome/browser/web_applications/system_web_apps/system_web_app_manager.h" #include "content/public/browser/web_ui.h"
diff --git a/chrome/browser/autofill/autofill_provider_browsertest.cc b/chrome/browser/autofill/autofill_provider_browsertest.cc index 3b6751a..e3a24c5 100644 --- a/chrome/browser/autofill/autofill_provider_browsertest.cc +++ b/chrome/browser/autofill/autofill_provider_browsertest.cc
@@ -41,8 +41,11 @@ class MockAutofillProvider : public TestAutofillProvider { public: - MockAutofillProvider() {} - ~MockAutofillProvider() override {} + // WebContents takes ownership of the MockAutofillProvider. + explicit MockAutofillProvider(content::WebContents* web_contents) + : TestAutofillProvider(web_contents) {} + + ~MockAutofillProvider() override = default; MOCK_METHOD4(OnFormSubmitted, void(AndroidAutofillManager* manager, @@ -96,7 +99,8 @@ void SetUpOnMainThread() override { autofill_client_ = std::make_unique<TestAutofillClient>(); - autofill_provider_ = std::make_unique<MockAutofillProvider>(); + // WebContents takes ownership of the MockAutofillProvider. + autofill_provider_ = new MockAutofillProvider(WebContents()); // Serve both a.com and b.com (and any other domain). host_resolver()->AddRule("*", "127.0.0.1"); ASSERT_TRUE(embedded_test_server()->Start()); @@ -121,12 +125,11 @@ ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( web_contents, autofill_client_.get(), "en-US", BrowserAutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER, - base::BindRepeating(&AndroidAutofillManager::Create, - autofill_provider_.get())); + base::BindRepeating(&AndroidAutofillManager::Create)); } void TearDownOnMainThread() override { - testing::Mock::VerifyAndClearExpectations(autofill_provider_.get()); + testing::Mock::VerifyAndClearExpectations(autofill_provider_); } content::RenderFrameHost* GetMainFrame() { @@ -163,13 +166,13 @@ base::RunLoop run_loop; EXPECT_CALL(*autofill_provider_, OnQueryFormFieldAutofill(_, _, _, _, _, _)) .Times(testing::Exactly(2)) - .WillOnce(Invoke(autofill_provider_.get(), + .WillOnce(Invoke(autofill_provider_, &MockAutofillProvider::OnQueryFormFieldAutofillImpl)) .WillOnce( testing::InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); EXPECT_CALL(*autofill_provider_, OnFormSubmitted) - .WillOnce(Invoke(autofill_provider_.get(), + .WillOnce(Invoke(autofill_provider_, &MockAutofillProvider::OnFormSubmittedImpl)); ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( @@ -209,7 +212,7 @@ } protected: - std::unique_ptr<MockAutofillProvider> autofill_provider_; + MockAutofillProvider* autofill_provider_; private: std::unique_ptr<TestAutofillClient> autofill_client_;
diff --git a/chrome/browser/browsing_data/counters/site_data_counting_helper_unittest.cc b/chrome/browser/browsing_data/counters/site_data_counting_helper_unittest.cc index adfc7ce..4309cee 100644 --- a/chrome/browser/browsing_data/counters/site_data_counting_helper_unittest.cc +++ b/chrome/browser/browsing_data/counters/site_data_counting_helper_unittest.cc
@@ -12,9 +12,11 @@ #include "base/run_loop.h" #include "base/task/post_task.h" #include "base/test/bind.h" +#include "base/test/scoped_mock_clock_override.h" #include "chrome/browser/browsing_data/counters/site_data_counting_helper.h" #include "chrome/browser/profiles/profile.h" #include "chrome/test/base/testing_profile.h" +#include "components/services/storage/public/mojom/local_storage_control.mojom.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/storage_partition.h" @@ -22,6 +24,7 @@ #include "net/cookies/cookie_access_result.h" #include "services/network/public/mojom/cookie_manager.mojom.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/mojom/dom_storage/storage_area.mojom.h" class SiteDataCountingHelperTest : public testing::Test { public: @@ -73,20 +76,34 @@ run_loop.Run(); } - void CreateLocalStorage( - base::Time creation_time, - const std::vector<base::FilePath::StringPieceType>& storage_origins) { - // Note: This test depends on details of how the dom_storage library - // stores data in the host file system. - base::FilePath storage_path = - profile()->GetPath().AppendASCII("Local Storage"); - base::CreateDirectory(storage_path); + // Creates local storage data with a last-modified time given by the return + // value of base::Time::Now(). + void CreateLocalStorage(const std::vector<std::string>& storage_origins) { + storage::mojom::LocalStorageControl* local_storage_control = + profile()->GetDefaultStoragePartition()->GetLocalStorageControl(); - // Write some files. - for (const auto& origin : storage_origins) { - base::WriteFile(storage_path.Append(origin), NULL, 0); - base::TouchFile(storage_path.Append(origin), creation_time, - creation_time); + for (const std::string& origin_str : storage_origins) { + url::Origin origin = url::Origin::Create(GURL(origin_str)); + ASSERT_FALSE(origin.opaque()); + mojo::Remote<blink::mojom::StorageArea> area; + local_storage_control->BindStorageArea(origin, + area.BindNewPipeAndPassReceiver()); + + bool success = false; + base::RunLoop put_run_loop; + area->Put({'k', 'e', 'y'}, {'v', 'a', 'l', 'u', 'e'}, absl::nullopt, + "source", base::BindLambdaForTesting([&](bool success_in) { + success = success_in; + put_run_loop.Quit(); + })); + put_run_loop.Run(); + ASSERT_TRUE(success); + + // Flushing causes metadata to be written, so that the last-modified time + // is recorded now. + base::RunLoop flush_run_loop; + local_storage_control->Flush(flush_run_loop.QuitClosure()); + flush_run_loop.Run(); } } @@ -110,8 +127,9 @@ Profile* profile() { return profile_.get(); } - private: - content::BrowserTaskEnvironment task_environment_; + protected: + content::BrowserTaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; std::unique_ptr<TestingProfile> profile_; }; @@ -138,14 +156,16 @@ } TEST_F(SiteDataCountingHelperTest, LocalStorage) { + // Set data "one day ago". + CreateLocalStorage({"https://example.com"}); + + // Advance time and set more data "now". + task_environment_.AdvanceClock(base::TimeDelta::FromDays(1)); + CreateLocalStorage({"https://bing.com"}); + base::Time now = base::Time::Now(); base::Time last_hour = now - base::TimeDelta::FromHours(1); - base::Time last_day = now - base::TimeDelta::FromDays(1); base::Time two_days_ago = now - base::TimeDelta::FromDays(2); - CreateLocalStorage(last_day, - {FILE_PATH_LITERAL("https_example.com_443.localstorage")}); - CreateLocalStorage(now, - {FILE_PATH_LITERAL("https_bing.com_443.localstorage")}); EXPECT_EQ(1, CountEntries(base::Time(), last_hour)); EXPECT_EQ(1, CountEntries(last_hour, base::Time::Max())); @@ -158,9 +178,7 @@ TEST_F(SiteDataCountingHelperTest, CookiesAndLocalStorage) { base::Time now = base::Time::Now(); CreateCookies(now, {"http://example.com", "https://google.com"}); - CreateLocalStorage(now, - {FILE_PATH_LITERAL("https_example.com_443.localstorage"), - FILE_PATH_LITERAL("https_bing.com_443.localstorage")}); + CreateLocalStorage({"https://example.com", "https://bing.com"}); EXPECT_EQ(3, CountEntries(base::Time(), base::Time::Max())); } @@ -168,9 +186,7 @@ TEST_F(SiteDataCountingHelperTest, SameHostDifferentScheme) { base::Time now = base::Time::Now(); CreateCookies(now, {"http://google.com", "https://google.com"}); - CreateLocalStorage(now, - {FILE_PATH_LITERAL("https_google.com_443.localstorage"), - FILE_PATH_LITERAL("http_google.com_80.localstorage")}); + CreateLocalStorage({"https://google.com", "http://google.com"}); EXPECT_EQ(1, CountEntries(base::Time(), base::Time::Max())); }
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index a28afee..c528491 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc
@@ -199,8 +199,11 @@ #if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/first_run/upgrade_util.h" +#endif // !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) + +#if !BUILDFLAG(IS_CHROMEOS_ASH) #include "components/enterprise/browser/controller/chrome_browser_cloud_management_controller.h" -#endif +#endif // !BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/constants/ash_switches.h" @@ -1283,10 +1286,11 @@ return chrome::RESULT_CODE_DOWNGRADE_AND_RELAUNCH; } downgrade_manager_.UpdateLastVersion(user_data_dir_); -#endif +#endif // BUILDFLAG(ENABLE_DOWNGRADE_PROCESSING) +#endif // !defined(OS_ANDROID) -#if !BUILDFLAG(IS_CHROMEOS_ASH) && !defined(OS_ANDROID) - // Initialize the chrome browser cloud management controller controller after +#if !BUILDFLAG(IS_CHROMEOS_ASH) + // Initialize the chrome browser cloud management controller after // the browser process singleton is acquired to remove race conditions where // multiple browser processes start simultaneously. The main // initialization of browser_policy_connector is performed inside @@ -1300,17 +1304,20 @@ ->Init(browser_process_->local_state(), browser_process_->system_network_context_manager() ->GetSharedURLLoaderFactory()); +#endif // !BUILDFLAG(IS_CHROMEOS_ASH) +#if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) // Wait for the chrome browser cloud management enrollment to finish. - // If no enrollment is needed, this function returns immediately. - // Abort the launch process if the enrollment fails. + // If enrollment is not mandatory, this function returns immediately. + // Abort the launch process if required enrollment fails. if (!browser_process_->browser_policy_connector() ->chrome_browser_cloud_management_controller() ->WaitUntilPolicyEnrollmentFinished()) { return chrome::RESULT_CODE_CLOUD_POLICY_ENROLLMENT_FAILED; } -#endif +#endif // !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#if !defined(OS_ANDROID) // Handle special early return paths (which couldn't be processed even earlier // as they require the process singleton to be held) first.
diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc index d969fc5b..2f5ed43 100644 --- a/chrome/browser/chrome_browser_main_win.cc +++ b/chrome/browser/chrome_browser_main_win.cc
@@ -85,6 +85,7 @@ #include "chrome/installer/util/installer_util_strings.h" #include "chrome/installer/util/l10n_string_util.h" #include "chrome/installer/util/shell_util.h" +#include "chrome/installer/util/util_constants.h" #include "components/crash/core/app/crash_export_thunks.h" #include "components/crash/core/app/dump_hung_process_with_ptype.h" #include "components/crash/core/common/crash_key.h" @@ -539,29 +540,17 @@ if (result != chrome::RESULT_CODE_UNINSTALL_USER_CANCEL) { // The following actions are just best effort. - // TODO(gab): Look into removing this code which is now redundant with the - // work done by setup.exe on uninstall. VLOG(1) << "Executing uninstall actions"; - base::FilePath chrome_exe; - if (base::PathService::Get(base::FILE_EXE, &chrome_exe)) { - ShellUtil::ShortcutLocation user_shortcut_locations[] = { - ShellUtil::SHORTCUT_LOCATION_DESKTOP, - ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, - ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, - ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, - ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, - }; - for (size_t i = 0; i < base::size(user_shortcut_locations); ++i) { - if (!ShellUtil::RemoveShortcuts(user_shortcut_locations[i], - ShellUtil::CURRENT_USER, chrome_exe)) { - VLOG(1) << "Failed to delete shortcut at location " - << user_shortcut_locations[i]; - } - } - } else { - NOTREACHED(); + // Remove shortcuts targeting chrome.exe or chrome_proxy.exe. + base::FilePath install_dir; + if (base::PathService::Get(base::DIR_EXE, &install_dir)) { + std::vector<base::FilePath> shortcut_targets{ + install_dir.Append(installer::kChromeExe), + install_dir.Append(installer::kChromeProxyExe)}; + ShellUtil::RemoveAllShortcuts(ShellUtil::CURRENT_USER, shortcut_targets); } } + return result; }
diff --git a/chrome/browser/chrome_service_worker_browsertest.cc b/chrome/browser/chrome_service_worker_browsertest.cc index 99b86518..0278cd4 100644 --- a/chrome/browser/chrome_service_worker_browsertest.cc +++ b/chrome/browser/chrome_service_worker_browsertest.cc
@@ -54,6 +54,7 @@ #include "ppapi/shared_impl/ppapi_switches.h" #include "third_party/blink/public/common/messaging/string_message_codec.h" #include "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_registration_options.mojom.h" namespace chrome_service_worker_browser_test {
diff --git a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc index 599cdb68..4c0acdb 100644 --- a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc +++ b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider.cc
@@ -25,6 +25,7 @@ #include "mojo/public/cpp/bindings/receiver.h" #include "net/base/net_errors.h" #include "services/network/public/mojom/network_context.mojom.h" +#include "services/network/public/mojom/proxy_lookup_client.mojom.h" #include "url/gurl.h" namespace chromeos {
diff --git a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider_unittest.cc b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider_unittest.cc index c8e7c4af..c68a9bce 100644 --- a/chrome/browser/chromeos/dbus/proxy_resolution_service_provider_unittest.cc +++ b/chrome/browser/chromeos/dbus/proxy_resolution_service_provider_unittest.cc
@@ -23,6 +23,7 @@ #include "net/base/net_errors.h" #include "net/proxy_resolution/proxy_info.h" #include "services/network/public/mojom/network_context.mojom.h" +#include "services/network/public/mojom/proxy_lookup_client.mojom.h" #include "services/network/test/test_network_context.h" #include "third_party/cros_system_api/dbus/service_constants.h"
diff --git a/chrome/browser/chromeos/eche_app/eche_app_manager_factory.cc b/chrome/browser/chromeos/eche_app/eche_app_manager_factory.cc index b53d82f5..aaed3f5 100644 --- a/chrome/browser/chromeos/eche_app/eche_app_manager_factory.cc +++ b/chrome/browser/chromeos/eche_app/eche_app_manager_factory.cc
@@ -18,6 +18,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/system_web_app_ui_utils.h" #include "chromeos/components/eche_app_ui/eche_app_manager.h" #include "chromeos/components/eche_app_ui/eche_uid_provider.h"
diff --git a/chrome/browser/chromeos/eol_notification_unittest.cc b/chrome/browser/chromeos/eol_notification_unittest.cc index cc98842..81bfebf 100644 --- a/chrome/browser/chromeos/eol_notification_unittest.cc +++ b/chrome/browser/chromeos/eol_notification_unittest.cc
@@ -32,6 +32,7 @@ void SetUp() override { fake_update_engine_client_ = new FakeUpdateEngineClient(); + DBusThreadManager::Initialize(); DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( base::WrapUnique<UpdateEngineClient>(fake_update_engine_client_)); chromeos::ConciergeClient::InitializeFake(/*fake_cicerone_client=*/nullptr);
diff --git a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_apitest.cc b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_apitest.cc index f94f7c85..af0a8f2 100644 --- a/chrome/browser/chromeos/extensions/autotest_private/autotest_private_apitest.cc +++ b/chrome/browser/chromeos/extensions/autotest_private/autotest_private_apitest.cc
@@ -85,9 +85,8 @@ }; IN_PROC_BROWSER_TEST_F(AutotestPrivateApiTest, AutotestPrivate) { - ASSERT_TRUE( - RunExtensionTest({.name = "autotest_private", .custom_arg = "default"}, - {.load_as_component = true})) + ASSERT_TRUE(RunExtensionTest("autotest_private", {.custom_arg = "default"}, + {.load_as_component = true})) << message_; } @@ -126,25 +125,23 @@ true /* sync */)); app_instance->SendRefreshPackageList(std::move(packages)); - ASSERT_TRUE( - RunExtensionTest({.name = "autotest_private", .custom_arg = "arcEnabled"}, - {.load_as_component = true})) + ASSERT_TRUE(RunExtensionTest("autotest_private", {.custom_arg = "arcEnabled"}, + {.load_as_component = true})) << message_; arc::SetArcPlayStoreEnabledForProfile(profile(), false); } IN_PROC_BROWSER_TEST_F(AutotestPrivateApiTest, ScrollableShelfAPITest) { - ASSERT_TRUE(RunExtensionTest( - {.name = "autotest_private", .custom_arg = "scrollableShelf"}, - {.load_as_component = true})) + ASSERT_TRUE(RunExtensionTest("autotest_private", + {.custom_arg = "scrollableShelf"}, + {.load_as_component = true})) << message_; } IN_PROC_BROWSER_TEST_F(AutotestPrivateApiTest, ShelfAPITest) { - ASSERT_TRUE( - RunExtensionTest({.name = "autotest_private", .custom_arg = "shelf"}, - {.load_as_component = true})) + ASSERT_TRUE(RunExtensionTest("autotest_private", {.custom_arg = "shelf"}, + {.load_as_component = true})) << message_; } @@ -180,9 +177,9 @@ }; IN_PROC_BROWSER_TEST_F(AutotestPrivateApiOverviewTest, Default) { - ASSERT_TRUE(RunExtensionTest( - {.name = "autotest_private", .custom_arg = "overviewDefault"}, - {.load_as_component = true})) + ASSERT_TRUE(RunExtensionTest("autotest_private", + {.custom_arg = "overviewDefault"}, + {.load_as_component = true})) << message_; } @@ -208,9 +205,9 @@ const gfx::Point end_point(start_point.x() + 50, start_point.y()); generator.MoveTouch(end_point); - ASSERT_TRUE(RunExtensionTest( - {.name = "autotest_private", .custom_arg = "overviewDrag"}, - {.load_as_component = true})) + ASSERT_TRUE(RunExtensionTest("autotest_private", + {.custom_arg = "overviewDrag"}, + {.load_as_component = true})) << message_; } @@ -236,9 +233,9 @@ generator.MoveTouch(end_point); generator.ReleaseTouch(); - ASSERT_TRUE(RunExtensionTest( - {.name = "autotest_private", .custom_arg = "splitviewLeftSnapped"}, - {.load_as_component = true})) + ASSERT_TRUE(RunExtensionTest("autotest_private", + {.custom_arg = "splitviewLeftSnapped"}, + {.load_as_component = true})) << message_; } @@ -273,9 +270,9 @@ // GetAllEnterprisePolicies Sanity check. IN_PROC_BROWSER_TEST_F(AutotestPrivateWithPolicyApiTest, PolicyAPITest) { - ASSERT_TRUE(RunExtensionTest( - {.name = "autotest_private", .custom_arg = "enterprisePolicies"}, - {.load_as_component = true})) + ASSERT_TRUE(RunExtensionTest("autotest_private", + {.custom_arg = "enterprisePolicies"}, + {.load_as_component = true})) << message_; } @@ -324,9 +321,9 @@ wm::ActivationChangeObserver::ActivationReason::ACTIVATION_CLIENT, arc_widget->GetNativeWindow(), arc_widget->GetNativeWindow()); - ASSERT_TRUE(RunExtensionTest( - {.name = "autotest_private", .custom_arg = "arcPerformanceTracing"}, - {.load_as_component = true})) + ASSERT_TRUE(RunExtensionTest("autotest_private", + {.custom_arg = "arcPerformanceTracing"}, + {.load_as_component = true})) << message_; } @@ -348,9 +345,9 @@ }; IN_PROC_BROWSER_TEST_F(AutotestPrivateStartStopTracing, StartStopTracing) { - ASSERT_TRUE(RunExtensionTest( - {.name = "autotest_private", .custom_arg = "startStopTracing"}, - {.load_as_component = true})) + ASSERT_TRUE(RunExtensionTest("autotest_private", + {.custom_arg = "startStopTracing"}, + {.load_as_component = true})) << message_; } @@ -369,9 +366,9 @@ // TODO(crbug.com/1201545): Fix flakiness. IN_PROC_BROWSER_TEST_F(AutotestPrivateSystemWebAppsTest, DISABLED_SystemWebApps) { - ASSERT_TRUE(RunExtensionTest( - {.name = "autotest_private", .custom_arg = "systemWebApps"}, - {.load_as_component = true})) + ASSERT_TRUE(RunExtensionTest("autotest_private", + {.custom_arg = "systemWebApps"}, + {.load_as_component = true})) << message_; }
diff --git a/chrome/browser/chromeos/extensions/echo_private_api.cc b/chrome/browser/chromeos/extensions/echo_private_api.cc index b3912a1..966bff6 100644 --- a/chrome/browser/chromeos/extensions/echo_private_api.cc +++ b/chrome/browser/chromeos/extensions/echo_private_api.cc
@@ -22,6 +22,7 @@ #include "chrome/browser/extensions/extension_tab_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/common/extensions/api/echo_private.h" #include "chrome/common/pref_names.h"
diff --git a/chrome/browser/chromeos/extensions/info_private_apitest.cc b/chrome/browser/chromeos/extensions/info_private_apitest.cc index 2bc3122e..2bd29de 100644 --- a/chrome/browser/chromeos/extensions/info_private_apitest.cc +++ b/chrome/browser/chromeos/extensions/info_private_apitest.cc
@@ -69,7 +69,7 @@ ASSERT_FALSE( profile()->GetPrefs()->GetBoolean(prefs::kLanguageSendFunctionKeys)); - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/basic"}, + ASSERT_TRUE(RunExtensionTest("chromeos_info_private/basic", {}, {.load_as_component = true})) << message_; @@ -92,9 +92,9 @@ PrefService* prefs = profile()->GetPrefs(); ASSERT_FALSE(prefs->GetBoolean(ash::prefs::kDockedMagnifierEnabled)); - ASSERT_TRUE(RunExtensionTest( - {.name = "chromeos_info_private/basic", .custom_arg = "dockedMagnifier"}, - {.load_as_component = true})) + ASSERT_TRUE(RunExtensionTest("chromeos_info_private/basic", + {.custom_arg = "dockedMagnifier"}, + {.load_as_component = true})) << message_; ASSERT_TRUE(prefs->GetBoolean(ash::prefs::kDockedMagnifierEnabled)); @@ -105,9 +105,9 @@ ASSERT_FALSE( prefs->GetBoolean(ash::prefs::kAccessibilityScreenMagnifierEnabled)); - ASSERT_TRUE(RunExtensionTest( - {.name = "chromeos_info_private/basic", .custom_arg = "screenMagnifier"}, - {.load_as_component = true})) + ASSERT_TRUE(RunExtensionTest("chromeos_info_private/basic", + {.custom_arg = "screenMagnifier"}, + {.load_as_component = true})) << message_; ASSERT_TRUE( @@ -118,70 +118,70 @@ IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Kiosk) { EnableKioskSession(); - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/extended", - .custom_arg = "kiosk", - .launch_as_platform_app = true})) + ASSERT_TRUE( + RunExtensionTest("chromeos_info_private/extended", + {.custom_arg = "kiosk", .launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, ArcNotAvailable) { - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/extended", - .custom_arg = "arc not-available", - .launch_as_platform_app = true})) + ASSERT_TRUE(RunExtensionTest( + "chromeos_info_private/extended", + {.custom_arg = "arc not-available", .launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Chromebase) { SetDeviceType("CHROMEBASE"); - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/extended", - .custom_arg = "chromebase", - .launch_as_platform_app = true})) + ASSERT_TRUE(RunExtensionTest( + "chromeos_info_private/extended", + {.custom_arg = "chromebase", .launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Chromebit) { SetDeviceType("CHROMEBIT"); - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/extended", - .custom_arg = "chromebit", - .launch_as_platform_app = true})) + ASSERT_TRUE(RunExtensionTest( + "chromeos_info_private/extended", + {.custom_arg = "chromebit", .launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Chromebook) { SetDeviceType("CHROMEBOOK"); - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/extended", - .custom_arg = "chromebook", - .launch_as_platform_app = true})) + ASSERT_TRUE(RunExtensionTest( + "chromeos_info_private/extended", + {.custom_arg = "chromebook", .launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Chromebox) { SetDeviceType("CHROMEBOX"); - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/extended", - .custom_arg = "chromebox", - .launch_as_platform_app = true})) + ASSERT_TRUE(RunExtensionTest( + "chromeos_info_private/extended", + {.custom_arg = "chromebox", .launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, UnknownDeviceType) { SetDeviceType("UNKNOWN"); - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/extended", - .custom_arg = "unknown device type", - .launch_as_platform_app = true})) + ASSERT_TRUE(RunExtensionTest( + "chromeos_info_private/extended", + {.custom_arg = "unknown device type", .launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, AssistantSupported) { - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/extended", - .custom_arg = "assistant supported", - .launch_as_platform_app = true})) + ASSERT_TRUE(RunExtensionTest( + "chromeos_info_private/extended", + {.custom_arg = "assistant supported", .launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, StylusUnsupported) { - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/extended", - .custom_arg = "stylus unsupported", - .launch_as_platform_app = true})) + ASSERT_TRUE(RunExtensionTest( + "chromeos_info_private/extended", + {.custom_arg = "stylus unsupported", .launch_as_platform_app = true})) << message_; } @@ -193,9 +193,9 @@ touchscreen.has_stylus = true; test_api.SetTouchscreenDevices({touchscreen}); - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/extended", - .custom_arg = "stylus supported", - .launch_as_platform_app = true})) + ASSERT_TRUE(RunExtensionTest( + "chromeos_info_private/extended", + {.custom_arg = "stylus supported", .launch_as_platform_app = true})) << message_; } @@ -216,9 +216,9 @@ generator.ReleaseTouch(); generator.ExitPenPointerMode(); - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/extended", - .custom_arg = "stylus seen", - .launch_as_platform_app = true})) + ASSERT_TRUE(RunExtensionTest( + "chromeos_info_private/extended", + {.custom_arg = "stylus seen", .launch_as_platform_app = true})) << message_; } @@ -239,9 +239,9 @@ IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateInternalStylusTest, StylusSeenInternal) { ash::stylus_utils::SetHasStylusInputForTesting(); - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/extended", - .custom_arg = "stylus seen", - .launch_as_platform_app = true})) + ASSERT_TRUE(RunExtensionTest( + "chromeos_info_private/extended", + {.custom_arg = "stylus seen", .launch_as_platform_app = true})) << message_; } @@ -261,9 +261,9 @@ }; IN_PROC_BROWSER_TEST_F(ChromeOSArcInfoPrivateTest, ArcEnabled) { - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/extended", - .custom_arg = "arc enabled", - .launch_as_platform_app = true})) + ASSERT_TRUE(RunExtensionTest( + "chromeos_info_private/extended", + {.custom_arg = "arc enabled", .launch_as_platform_app = true})) << message_; } @@ -274,9 +274,9 @@ // does not seem to run with such cases, unfortunately. So, here directly // control the function. arc::DisallowArcForTesting(); - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/extended", - .custom_arg = "arc available", - .launch_as_platform_app = true})) + ASSERT_TRUE(RunExtensionTest( + "chromeos_info_private/extended", + {.custom_arg = "arc available", .launch_as_platform_app = true})) << message_; } @@ -294,8 +294,8 @@ }; IN_PROC_BROWSER_TEST_F(ChromeOSManagedDeviceInfoPrivateTest, Managed) { - ASSERT_TRUE(RunExtensionTest({.name = "chromeos_info_private/extended", - .custom_arg = "managed", - .launch_as_platform_app = true})) + ASSERT_TRUE(RunExtensionTest( + "chromeos_info_private/extended", + {.custom_arg = "managed", .launch_as_platform_app = true})) << message_; }
diff --git a/chrome/browser/chromeos/nearby/nearby_process_manager_impl.cc b/chrome/browser/chromeos/nearby/nearby_process_manager_impl.cc index ffd47f3..284562c 100644 --- a/chrome/browser/chromeos/nearby/nearby_process_manager_impl.cc +++ b/chrome/browser/chromeos/nearby/nearby_process_manager_impl.cc
@@ -12,6 +12,7 @@ #include "chrome/browser/chromeos/nearby/nearby_connections_dependencies_provider.h" #include "chrome/browser/nearby_sharing/logging/logging.h" #include "chrome/browser/sharing/webrtc/sharing_mojo_service.h" +#include "chromeos/services/nearby/public/mojom/nearby_decoder.mojom.h" #include "components/keyed_service/core/keyed_service.h" namespace chromeos {
diff --git a/chrome/browser/chromeos/net/shill_error.cc b/chrome/browser/chromeos/net/shill_error.cc index 48681bd..431f108 100644 --- a/chrome/browser/chromeos/net/shill_error.cc +++ b/chrome/browser/chromeos/net/shill_error.cc
@@ -115,6 +115,9 @@ if (error == shill::kErrorNotRegistered) { return l10n_util::GetStringUTF16(IDS_CHROMEOS_NETWORK_ERROR_NOT_REGISTERED); } + if (error == shill::kErrorResultWrongState) { + return l10n_util::GetStringUTF16(IDS_CHROMEOS_NETWORK_ERROR_WRONG_STATE); + } if (base::ToLowerASCII(error) == base::ToLowerASCII(shill::kUnknownString)) { return l10n_util::GetStringUTF16(IDS_CHROMEOS_NETWORK_ERROR_UNKNOWN);
diff --git a/chrome/browser/chromeos/policy/device_policy_cros_browser_test.h b/chrome/browser/chromeos/policy/device_policy_cros_browser_test.h index 2703dac..1c16a64 100644 --- a/chrome/browser/chromeos/policy/device_policy_cros_browser_test.h +++ b/chrome/browser/chromeos/policy/device_policy_cros_browser_test.h
@@ -116,9 +116,6 @@ ~DevicePolicyCrosBrowserTest() override; void RefreshDevicePolicy() { policy_helper()->RefreshDevicePolicy(); } - chromeos::DBusThreadManagerSetter* dbus_setter() { - return dbus_setter_.get(); - } DevicePolicyBuilder* device_policy() { return policy_helper()->device_policy(); @@ -134,9 +131,6 @@ private: DevicePolicyCrosTestHelper policy_helper_; - - // FakeDBusThreadManager uses FakeSessionManagerClient. - std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter_; }; } // namespace policy
diff --git a/chrome/browser/chromeos/policy/login_profile_policy_provider.cc b/chrome/browser/chromeos/policy/login_profile_policy_provider.cc index bc5f05cf..b6e3912 100644 --- a/chrome/browser/chromeos/policy/login_profile_policy_provider.cc +++ b/chrome/browser/chromeos/policy/login_profile_policy_provider.cc
@@ -249,7 +249,7 @@ // |policy_value| is expected to be a valid value for the // PowerManagementIdleSettings policy now. - if (!policy_value->empty()) { + if (!policy_value->DictEmpty()) { ApplyValueAsMandatoryPolicy(policy_value.get(), key::kPowerManagementIdleSettings, &user_policy_map);
diff --git a/chrome/browser/chromeos/policy/minimum_version_policy_handler_unittest.cc b/chrome/browser/chromeos/policy/minimum_version_policy_handler_unittest.cc index acaf2835..ed78c87 100644 --- a/chrome/browser/chromeos/policy/minimum_version_policy_handler_unittest.cc +++ b/chrome/browser/chromeos/policy/minimum_version_policy_handler_unittest.cc
@@ -113,6 +113,7 @@ auto fake_update_engine_client = std::make_unique<chromeos::FakeUpdateEngineClient>(); fake_update_engine_client_ = fake_update_engine_client.get(); + chromeos::DBusThreadManager::Initialize(); chromeos::DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( std::move(fake_update_engine_client)); network_handler_test_helper_ =
diff --git a/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker_unittest.cc b/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker_unittest.cc index 69a776f..6cc1c62 100644 --- a/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker_unittest.cc +++ b/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker_unittest.cc
@@ -315,6 +315,7 @@ auto fake_update_engine_client = std::make_unique<chromeos::FakeUpdateEngineClient>(); fake_update_engine_client_ = fake_update_engine_client.get(); + chromeos::DBusThreadManager::Initialize(); chromeos::DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( std::move(fake_update_engine_client));
diff --git a/chrome/browser/chromeos/policy/status_collector/child_status_collector_browsertest.cc b/chrome/browser/chromeos/policy/status_collector/child_status_collector_browsertest.cc index 3092737..85d47bd6 100644 --- a/chrome/browser/chromeos/policy/status_collector/child_status_collector_browsertest.cc +++ b/chrome/browser/chromeos/policy/status_collector/child_status_collector_browsertest.cc
@@ -205,9 +205,8 @@ TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); // Use FakeUpdateEngineClient. - std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter = - chromeos::DBusThreadManager::GetSetterForTesting(); - dbus_setter->SetUpdateEngineClient( + chromeos::DBusThreadManager::Initialize(); + chromeos::DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( base::WrapUnique<chromeos::UpdateEngineClient>(update_engine_client_)); chromeos::CiceroneClient::InitializeFake(); @@ -562,7 +561,7 @@ TEST_F(ChildStatusCollectorTest, ActivityKeptInPref) { EXPECT_TRUE( - pref_service()->GetDictionary(prefs::kUserActivityTimes)->empty()); + pref_service()->GetDictionary(prefs::kUserActivityTimes)->DictEmpty()); task_environment_.AdvanceClock(kHour); DeviceStateTransitions test_states[] = { @@ -579,7 +578,7 @@ SimulateStateChanges(test_states, sizeof(test_states) / sizeof(DeviceStateTransitions)); EXPECT_FALSE( - pref_service()->GetDictionary(prefs::kUserActivityTimes)->empty()); + pref_service()->GetDictionary(prefs::kUserActivityTimes)->DictEmpty()); // Process the list a second time after restarting the collector. It should be // able to count the active periods found by the original collector, because @@ -630,7 +629,7 @@ TimeDelta::FromHours(4); FastForwardTo(initial_time); EXPECT_TRUE( - pref_service()->GetDictionary(prefs::kUserActivityTimes)->empty()); + pref_service()->GetDictionary(prefs::kUserActivityTimes)->DictEmpty()); DeviceStateTransitions test_states[] = { DeviceStateTransitions::kEnterSessionActive,
diff --git a/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc b/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc index 5368506..9533842 100644 --- a/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc +++ b/chrome/browser/chromeos/policy/status_collector/device_status_collector_browsertest.cc
@@ -849,9 +849,8 @@ chromeos::KioskCryptohomeRemover::RegisterPrefs(local_state_.registry()); // Use FakeUpdateEngineClient. - std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter = - chromeos::DBusThreadManager::GetSetterForTesting(); - dbus_setter->SetUpdateEngineClient( + chromeos::DBusThreadManager::Initialize(); + chromeos::DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( base::WrapUnique<chromeos::UpdateEngineClient>(update_engine_client_)); chromeos::CrasAudioHandler::InitializeForTesting(); @@ -1270,8 +1269,8 @@ } TEST_F(DeviceStatusCollectorTest, ActivityNotWrittenToProfilePref) { - EXPECT_TRUE( - profile_pref_service_.GetDictionary(prefs::kUserActivityTimes)->empty()); + EXPECT_TRUE(profile_pref_service_.GetDictionary(prefs::kUserActivityTimes) + ->DictEmpty()); ui::IdleState test_states[] = {ui::IDLE_STATE_ACTIVE, ui::IDLE_STATE_ACTIVE, ui::IDLE_STATE_ACTIVE}; @@ -1284,8 +1283,8 @@ // Nothing should be written to profile pref service, because it is only used // for consumer reporting. - EXPECT_TRUE( - profile_pref_service_.GetDictionary(prefs::kUserActivityTimes)->empty()); + EXPECT_TRUE(profile_pref_service_.GetDictionary(prefs::kUserActivityTimes) + ->DictEmpty()); } TEST_F(DeviceStatusCollectorTest, MaxStoredPeriods) {
diff --git a/chrome/browser/chromeos/smb_client/smb_file_system_unittest.cc b/chrome/browser/chromeos/smb_client/smb_file_system_unittest.cc index 4d880c33..c11b19a3 100644 --- a/chrome/browser/chromeos/smb_client/smb_file_system_unittest.cc +++ b/chrome/browser/chromeos/smb_client/smb_file_system_unittest.cc
@@ -67,6 +67,7 @@ // The mock needs to be marked as leaked because ownership is passed to // DBusThreadManager. testing::Mock::AllowLeak(mock_client.get()); + chromeos::DBusThreadManager::Initialize(); chromeos::DBusThreadManager::GetSetterForTesting()->SetSmbProviderClient( std::move(mock_client)); }
diff --git a/chrome/browser/chromeos/smb_client/smb_service_unittest.cc b/chrome/browser/chromeos/smb_client/smb_service_unittest.cc index c094e6a4..9b1b2f4d 100644 --- a/chrome/browser/chromeos/smb_client/smb_service_unittest.cc +++ b/chrome/browser/chromeos/smb_client/smb_service_unittest.cc
@@ -171,6 +171,7 @@ std::move(user_manager_temp)); // This isn't used, but still needs to exist. + chromeos::DBusThreadManager::Initialize(); chromeos::DBusThreadManager::GetSetterForTesting()->SetSmbProviderClient( std::make_unique<FakeSmbProviderClient>()); chromeos::ConciergeClient::InitializeFake(/*fake_cicerone_client=*/nullptr);
diff --git a/chrome/browser/component_updater/crl_set_component_installer_unittest.cc b/chrome/browser/component_updater/crl_set_component_installer_unittest.cc index 31fce5f..5cd3cb3 100644 --- a/chrome/browser/component_updater/crl_set_component_installer_unittest.cc +++ b/chrome/browser/component_updater/crl_set_component_installer_unittest.cc
@@ -18,6 +18,7 @@ #include "services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom.h" #include "services/network/network_service.h" #include "services/network/public/mojom/network_context.mojom.h" +#include "services/network/public/mojom/url_loader_factory.mojom.h" #include "services/network/test/test_url_loader_client.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h"
diff --git a/chrome/browser/component_updater/cros_component_installer_chromeos_unittest.cc b/chrome/browser/component_updater/cros_component_installer_chromeos_unittest.cc index df4622a..d269495 100644 --- a/chrome/browser/component_updater/cros_component_installer_chromeos_unittest.cc +++ b/chrome/browser/component_updater/cros_component_installer_chromeos_unittest.cc
@@ -207,6 +207,7 @@ auto fake_image_loader_client = std::make_unique<chromeos::FakeImageLoaderClient>(); image_loader_client_ = fake_image_loader_client.get(); + chromeos::DBusThreadManager::Initialize(); chromeos::DBusThreadManager::GetSetterForTesting()->SetImageLoaderClient( std::move(fake_image_loader_client)); }
diff --git a/chrome/browser/content_creation/notes/internal/android/BUILD.gn b/chrome/browser/content_creation/notes/internal/android/BUILD.gn index f2b1b02..25b4f10c 100644 --- a/chrome/browser/content_creation/notes/internal/android/BUILD.gn +++ b/chrome/browser/content_creation/notes/internal/android/BUILD.gn
@@ -51,6 +51,9 @@ android_resources("java_resources") { sources = [ + "java/res/drawable/note_background_outline.xml", + "java/res/drawable/note_title_outline.xml", + "java/res/layout/carousel_item.xml", "java/res/layout/creation_dialog.xml", "java/res/layout/top_bar.xml", ]
diff --git a/chrome/browser/content_creation/notes/internal/android/java/res/drawable/note_background_outline.xml b/chrome/browser/content_creation/notes/internal/android/java/res/drawable/note_background_outline.xml new file mode 100644 index 0000000..0de44562 --- /dev/null +++ b/chrome/browser/content_creation/notes/internal/android/java/res/drawable/note_background_outline.xml
@@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 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. --> + +<shape + xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle" > + <stroke android:width="1dp" android:color="@color/modern_grey_200"/> + <corners android:radius="12dp" /> +</shape> \ No newline at end of file
diff --git a/chrome/browser/content_creation/notes/internal/android/java/res/drawable/note_title_outline.xml b/chrome/browser/content_creation/notes/internal/android/java/res/drawable/note_title_outline.xml new file mode 100644 index 0000000..975ba134 --- /dev/null +++ b/chrome/browser/content_creation/notes/internal/android/java/res/drawable/note_title_outline.xml
@@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 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. --> + +<shape + xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle" > + <solid android:color="@color/modern_white" /> + <corners android:radius="15dp" /> +</shape> \ No newline at end of file
diff --git a/chrome/browser/content_creation/notes/internal/android/java/res/layout/carousel_item.xml b/chrome/browser/content_creation/notes/internal/android/java/res/layout/carousel_item.xml new file mode 100644 index 0000000..95254c1 --- /dev/null +++ b/chrome/browser/content_creation/notes/internal/android/java/res/layout/carousel_item.xml
@@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2021 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. --> +<ScrollView + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + + <LinearLayout + android:id="@+id/item" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingTop="60dp" + android:paddingEnd="24dp" + android:layout_gravity="center_horizontal" + android:orientation="vertical" + android:background="@color/modern_grey_200"> + + <TextView + android:id="@+id/title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingTop="4dp" + android:paddingBottom="4dp" + android:paddingLeft="18dp" + android:paddingRight="18dp" + android:layout_marginBottom="17dp" + android:layout_gravity="center_horizontal" + android:background="@drawable/note_title_outline" + android:textAppearance="@style/TextAppearance.TextSmall" /> + + <LinearLayout + android:id="@+id/background" + android:layout_width="280dp" + android:layout_height="240dp" + android:gravity="center_horizontal" + android:background="@drawable/note_background_outline" + android:orientation="vertical"> + + <TextView + android:id="@+id/text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxLines="6" + android:paddingLeft="20dp" + android:paddingTop="20dp" + android:paddingRight="20dp" + android:paddingBottom="20dp" + android:textAppearance="@style/TextAppearance.Headline" /> + </LinearLayout> + </LinearLayout> + +</ScrollView> \ No newline at end of file
diff --git a/chrome/browser/content_creation/notes/internal/android/java/res/layout/creation_dialog.xml b/chrome/browser/content_creation/notes/internal/android/java/res/layout/creation_dialog.xml index c640c9e..d27d570 100644 --- a/chrome/browser/content_creation/notes/internal/android/java/res/layout/creation_dialog.xml +++ b/chrome/browser/content_creation/notes/internal/android/java/res/layout/creation_dialog.xml
@@ -13,4 +13,15 @@ <include layout="@layout/top_bar"/> + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/note_carousel" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal"/> + </LinearLayout> </LinearLayout> \ No newline at end of file
diff --git a/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationCoordinatorFactory.java b/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationCoordinatorFactory.java index 24187c0..301bfcd 100644 --- a/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationCoordinatorFactory.java +++ b/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationCoordinatorFactory.java
@@ -15,8 +15,9 @@ /** * @return a NoteCreationCoordinator instance. */ - public static NoteCreationCoordinator create(Activity activity) { + public static NoteCreationCoordinator create(Activity activity, String selectedText) { Profile profile = Profile.getLastUsedRegularProfile(); - return new NoteCreationCoordinatorImpl(activity, NoteServiceFactory.getForProfile(profile)); + return new NoteCreationCoordinatorImpl( + activity, NoteServiceFactory.getForProfile(profile), selectedText); } }
diff --git a/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationCoordinatorImpl.java b/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationCoordinatorImpl.java index 2c08ecb..61e98df 100644 --- a/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationCoordinatorImpl.java +++ b/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationCoordinatorImpl.java
@@ -25,7 +25,8 @@ private TopBarCoordinator mTopBarCoordinator; - public NoteCreationCoordinatorImpl(Activity activity, NoteService noteService) { + public NoteCreationCoordinatorImpl( + Activity activity, NoteService noteService, String selectedText) { mActivity = activity; mListModel = new ModelList(); @@ -34,7 +35,7 @@ new NoteCreationMediator(mListModel, new GoogleFontService(mActivity), noteService); mDialog = new NoteCreationDialog(); - mDialog.initDialog(this::onViewCreated); + mDialog.initDialog(this::onViewCreated, selectedText); } @Override @@ -56,5 +57,6 @@ */ private void onViewCreated(View view) { mTopBarCoordinator = new TopBarCoordinator(mActivity, view, this::dismissDialog); + mDialog.createRecyclerViews(mListModel); } }
diff --git a/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationDialog.java b/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationDialog.java index a906c9cd..3a3062d1 100644 --- a/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationDialog.java +++ b/chrome/browser/content_creation/notes/internal/android/java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationDialog.java
@@ -5,37 +5,86 @@ package org.chromium.chrome.browser.content_creation.notes; import android.app.Dialog; +import android.graphics.drawable.GradientDrawable; import android.os.Bundle; +import android.view.Gravity; import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.DialogFragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import org.chromium.chrome.browser.content_creation.internal.R; +import org.chromium.components.content_creation.notes.models.NoteTemplate; +import org.chromium.ui.modelutil.LayoutViewBuilder; +import org.chromium.ui.modelutil.MVCListAdapter.ModelList; +import org.chromium.ui.modelutil.PropertyKey; +import org.chromium.ui.modelutil.PropertyModel; +import org.chromium.ui.modelutil.SimpleRecyclerViewAdapter; /** * Dialog for the note creation. */ public class NoteCreationDialog extends DialogFragment { + private View mContentView; + private String mSelectedText; + interface NoteDialogObserver { void onViewCreated(View view); } private NoteDialogObserver mNoteDialogObserver; - public void initDialog(NoteDialogObserver noteDialogObserver) { + public void initDialog(NoteDialogObserver noteDialogObserver, String selectedText) { mNoteDialogObserver = noteDialogObserver; + mSelectedText = selectedText; } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.Theme_Chromium_Fullscreen); - View contentView = - getActivity().getLayoutInflater().inflate(R.layout.creation_dialog, null); - builder.setView(contentView); + mContentView = getActivity().getLayoutInflater().inflate(R.layout.creation_dialog, null); + builder.setView(mContentView); - if (mNoteDialogObserver != null) mNoteDialogObserver.onViewCreated(contentView); + if (mNoteDialogObserver != null) mNoteDialogObserver.onViewCreated(mContentView); return builder.create(); } + + /* + * Creates a note carousel for the provided PropertyModels. + * + * @param activity The activity the share sheet belongs to. + * @param carouselItems The PropertyModels used to build the top row. + */ + public void createRecyclerViews(ModelList carouselItems) { + RecyclerView noteCarousel = mContentView.findViewById(R.id.note_carousel); + + SimpleRecyclerViewAdapter adapter = new SimpleRecyclerViewAdapter(carouselItems); + adapter.registerType(NoteProperties.NOTE_VIEW_TYPE, + new LayoutViewBuilder(R.layout.carousel_item), this::bindCarouselItem); + noteCarousel.setAdapter(adapter); + LinearLayoutManager layoutManager = + new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false); + noteCarousel.setLayoutManager(layoutManager); + } + + private void bindCarouselItem(PropertyModel model, ViewGroup parent, PropertyKey propertyKey) { + NoteTemplate template = model.get(NoteProperties.TEMPLATE); + + View background = parent.findViewById(R.id.background); + GradientDrawable outline = (GradientDrawable) background.getBackground(); + outline.setColor(template.mainBackground.color); + background.setClipToOutline(true); + ((TextView) parent.findViewById(R.id.title)).setText(template.localizedName); + + TextView noteText = (TextView) parent.findViewById(R.id.text); + noteText.setText(mSelectedText); + noteText.setTextColor(template.textStyle.fontColor); + noteText.setAllCaps(template.textStyle.allCaps); + noteText.setGravity(Gravity.CENTER); + } } \ No newline at end of file
diff --git a/chrome/browser/continuous_search/internal/BUILD.gn b/chrome/browser/continuous_search/internal/BUILD.gn index 8416be5..78c02934 100644 --- a/chrome/browser/continuous_search/internal/BUILD.gn +++ b/chrome/browser/continuous_search/internal/BUILD.gn
@@ -31,6 +31,7 @@ deps = [ "//base:base_java", "//chrome/browser/continuous_search:data_structures_java", + "//chrome/browser/flags:java", "//chrome/browser/tab:java", "//chrome/browser/tabmodel:java", "//content/public/android:content_java", @@ -57,7 +58,9 @@ "//base:base_java_test_support", "//base:base_junit_test_support", "//chrome/browser/continuous_search:data_structures_java", + "//chrome/browser/flags:java", "//chrome/browser/tab:java", + "//chrome/test/android:chrome_java_test_support", "//content/public/android:content_java", "//third_party/android_deps:robolectric_all_java", "//third_party/junit",
diff --git a/chrome/browser/continuous_search/internal/android/java/src/org/chromium/chrome/browser/continuous_search/ContinuousSearchTabObserver.java b/chrome/browser/continuous_search/internal/android/java/src/org/chromium/chrome/browser/continuous_search/ContinuousSearchTabObserver.java index 6c5ad95..2db3805b 100644 --- a/chrome/browser/continuous_search/internal/android/java/src/org/chromium/chrome/browser/continuous_search/ContinuousSearchTabObserver.java +++ b/chrome/browser/continuous_search/internal/android/java/src/org/chromium/chrome/browser/continuous_search/ContinuousSearchTabObserver.java
@@ -6,8 +6,10 @@ import androidx.annotation.Nullable; +import org.chromium.base.metrics.RecordHistogram; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.components.continuous_search.SearchResultExtractorClientStatus; import org.chromium.ui.base.WindowAndroid; import org.chromium.url.GURL; @@ -66,6 +68,7 @@ @Override public void onResult(ContinuousNavigationMetadata metadata) { assert metadata != null; + reportStatus(mProducer.getSuccessStatus(), mProducer.getClass()); mProducer = null; ContinuousNavigationUserDataImpl.getOrCreateForTab(mTab).updateData( @@ -75,6 +78,7 @@ @Override public void onError(int errorCode) { // TODO: Handle errors. + reportStatus(errorCode, mProducer.getClass()); mProducer = null; } @@ -89,4 +93,12 @@ mProducer = null; } } + + private void reportStatus(int status, Class<?> clazz) { + if (clazz == SearchResultExtractorProducer.class) { + RecordHistogram.recordEnumeratedHistogram( + "Browser.ContinuousSearch.SearchResultExtractionStatus", status, + SearchResultExtractorClientStatus.MAX_VALUE); + } + } }
diff --git a/chrome/browser/continuous_search/internal/android/java/src/org/chromium/chrome/browser/continuous_search/SearchResultExtractorProducer.java b/chrome/browser/continuous_search/internal/android/java/src/org/chromium/chrome/browser/continuous_search/SearchResultExtractorProducer.java index e144029..191758f 100644 --- a/chrome/browser/continuous_search/internal/android/java/src/org/chromium/chrome/browser/continuous_search/SearchResultExtractorProducer.java +++ b/chrome/browser/continuous_search/internal/android/java/src/org/chromium/chrome/browser/continuous_search/SearchResultExtractorProducer.java
@@ -5,10 +5,12 @@ package org.chromium.chrome.browser.continuous_search; import androidx.annotation.IntDef; +import androidx.annotation.VisibleForTesting; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.NativeMethods; +import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.tab.Tab; import org.chromium.components.continuous_search.SearchResultExtractorClientStatus; import org.chromium.content_public.browser.WebContents; @@ -26,9 +28,15 @@ */ @JNINamespace("continuous_search") public class SearchResultExtractorProducer extends SearchResultProducer { + private static final String MINIUM_URL_COUNT_PARAM = "minimum_url_count"; + private static final int DEFAULT_MINIUM_URL_COUNT = 5; + private long mNativeSearchResultExtractorProducer; private @State int mState; + @VisibleForTesting + int mMinimumUrlCount; + @IntDef({State.READY, State.CAPTURING, State.CANCELLED}) @Retention(RetentionPolicy.SOURCE) public @interface State { @@ -41,6 +49,9 @@ super(tab, listener); mNativeSearchResultExtractorProducer = SearchResultExtractorProducerJni.get().create(this); mState = State.READY; + mMinimumUrlCount = ChromeFeatureList.getFieldTrialParamByFeatureAsInt( + ChromeFeatureList.CONTINUOUS_SEARCH, MINIUM_URL_COUNT_PARAM, + DEFAULT_MINIUM_URL_COUNT); } @CalledByNative @@ -60,6 +71,7 @@ if (oldState == State.CANCELLED) return; int groupOffset = 0; + int urlCount = 0; List<PageGroup> groups = new ArrayList<PageGroup>(); for (int i = 0; i < groupLabel.length; i++) { List<PageItem> results = new ArrayList<PageItem>(); @@ -69,12 +81,18 @@ if (!groupUrls.add(urls[groupOffset + j])) continue; results.add(new PageItem(urls[groupOffset + j], titles[groupOffset + j])); + urlCount++; } groupOffset += groupSize[i]; groups.add(new PageGroup(groupLabel[i], isAdGroup[i], results)); } + if (urlCount < mMinimumUrlCount) { + mListener.onError(SearchResultExtractorClientStatus.NOT_ENOUGH_RESULTS); + return; + } + assert !GURL.isEmptyOrInvalid(url); assert query != null && !query.isEmpty(); ContinuousNavigationMetadata metadata = @@ -115,6 +133,11 @@ } } + @Override + int getSuccessStatus() { + return SearchResultExtractorClientStatus.SUCCESS; + } + void destroy() { if (mNativeSearchResultExtractorProducer == 0) return;
diff --git a/chrome/browser/continuous_search/internal/android/java/src/org/chromium/chrome/browser/continuous_search/SearchResultProducer.java b/chrome/browser/continuous_search/internal/android/java/src/org/chromium/chrome/browser/continuous_search/SearchResultProducer.java index 7f908d4..eebf22c 100644 --- a/chrome/browser/continuous_search/internal/android/java/src/org/chromium/chrome/browser/continuous_search/SearchResultProducer.java +++ b/chrome/browser/continuous_search/internal/android/java/src/org/chromium/chrome/browser/continuous_search/SearchResultProducer.java
@@ -29,4 +29,11 @@ * Cancels the request. */ abstract void cancel(); + + /** + * Gets the OK status of a class. + */ + int getSuccessStatus() { + return 0; + } }
diff --git a/chrome/browser/continuous_search/internal/android/junit/org/chromium/chrome/browser/continuous_search/ContinuousSearchTabObserverTest.java b/chrome/browser/continuous_search/internal/android/junit/org/chromium/chrome/browser/continuous_search/ContinuousSearchTabObserverTest.java index 3d895e3..e288493 100644 --- a/chrome/browser/continuous_search/internal/android/junit/org/chromium/chrome/browser/continuous_search/ContinuousSearchTabObserverTest.java +++ b/chrome/browser/continuous_search/internal/android/junit/org/chromium/chrome/browser/continuous_search/ContinuousSearchTabObserverTest.java
@@ -4,6 +4,7 @@ package org.chromium.chrome.browser.continuous_search; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.inOrder; @@ -13,16 +14,24 @@ import static org.mockito.MockitoAnnotations.initMocks; import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestRule; import org.junit.runner.RunWith; import org.mockito.InOrder; import org.mockito.Mock; +import org.robolectric.annotation.Config; +import org.chromium.base.metrics.test.ShadowRecordHistogram; import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.base.test.util.JniMocker; +import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.test.util.browser.Features; +import org.chromium.chrome.test.util.browser.Features.EnableFeatures; +import org.chromium.components.continuous_search.SearchResultExtractorClientStatus; import org.chromium.url.GURL; import org.chromium.url.JUnitTestGURLs; @@ -30,6 +39,7 @@ * Tests for {@link ContinuousSearchTabObserver}. */ @RunWith(BaseRobolectricTestRunner.class) +@Config(shadows = {ShadowRecordHistogram.class}) public class ContinuousSearchTabObserverTest { private static final String TEST_QUERY = "Foo"; @@ -41,12 +51,16 @@ private ContinuousNavigationUserDataImpl mUserDataMock; @Mock private SearchResultProducer mProducerMock; + @Mock + private SearchResultExtractorProducer.Natives mSearchResultExtractorProducerJniMock; private GURL mSrpUrl; private GURL mNonSrpUrl; private ContinuousSearchTabObserver mObserver; @Rule + public TestRule mProcessor = new Features.JUnitProcessor(); + @Rule public JniMocker mJniMocker = new JniMocker(); class FakeSearchResultProducerFactory @@ -59,6 +73,8 @@ @Before public void setUp() { + ShadowRecordHistogram.reset(); + mSrpUrl = JUnitTestGURLs.getGURL(JUnitTestGURLs.URL_1); mNonSrpUrl = JUnitTestGURLs.getGURL(JUnitTestGURLs.URL_2); @@ -162,4 +178,25 @@ // Test no-op. mObserver.onActivityAttachmentChanged(mTabMock, null); } + + /** + * Verifies that histogram recording works. + */ + @Test + @EnableFeatures({ChromeFeatureList.CONTINUOUS_SEARCH}) + public void testHistogramRecording() { + SearchResultProducerFactory.overrideFactory(null); + mJniMocker.mock( + SearchResultExtractorProducerJni.TEST_HOOKS, mSearchResultExtractorProducerJniMock); + final long nativePtr = 123L; + doReturn(nativePtr).when(mSearchResultExtractorProducerJniMock).create(any()); + + mObserver.onPageLoadStarted(mTabMock, mSrpUrl); + mObserver.onPageLoadFinished(mTabMock, mSrpUrl); + + Assert.assertEquals(1, + ShadowRecordHistogram.getHistogramValueCountForTesting( + "Browser.ContinuousSearch.SearchResultExtractionStatus", + SearchResultExtractorClientStatus.WEB_CONTENTS_GONE)); + } }
diff --git a/chrome/browser/continuous_search/internal/android/junit/org/chromium/chrome/browser/continuous_search/SearchResultExtractorProducerTest.java b/chrome/browser/continuous_search/internal/android/junit/org/chromium/chrome/browser/continuous_search/SearchResultExtractorProducerTest.java index ee513de..7bae3b71 100644 --- a/chrome/browser/continuous_search/internal/android/junit/org/chromium/chrome/browser/continuous_search/SearchResultExtractorProducerTest.java +++ b/chrome/browser/continuous_search/internal/android/junit/org/chromium/chrome/browser/continuous_search/SearchResultExtractorProducerTest.java
@@ -22,6 +22,7 @@ import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.base.test.util.JniMocker; +import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.tab.Tab; import org.chromium.components.continuous_search.SearchResultExtractorClientStatus; import org.chromium.content_public.browser.WebContents; @@ -29,6 +30,7 @@ import org.chromium.url.JUnitTestGURLs; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -61,6 +63,9 @@ mJniMocker.mock( SearchResultExtractorProducerJni.TEST_HOOKS, mSearchResultExtractorProducerJniMock); when(mSearchResultExtractorProducerJniMock.create(any())).thenReturn(FAKE_NATIVE_ADDRESS); + ChromeFeatureList.setTestFeatures( + Collections.singletonMap(ChromeFeatureList.CONTINUOUS_SEARCH, true)); + mSearchResultProducer = new SearchResultExtractorProducer(mTabMock, mListenerMock); when(mTabMock.getWebContents()).thenReturn(mWebContentsMock); when(mWebContentsMock.getLastCommittedUrl()).thenReturn(mTestUrl); @@ -70,6 +75,7 @@ * Starts fetching data. */ private void startFetching() { + mSearchResultProducer.mMinimumUrlCount = 0; mSearchResultProducer.fetchResults(mTestUrl, TEST_QUERY); verify(mSearchResultExtractorProducerJniMock, times(1)) @@ -258,7 +264,7 @@ } /** - * Verify that results can be requested successfully if a pre-emptive cancel is issued. + * Verify that no error is reported after cancellation. */ @Test public void testOnErrorNoOpOnCancel() { @@ -267,4 +273,17 @@ mSearchResultProducer.onError(SearchResultExtractorClientStatus.WEB_CONTENTS_GONE); verify(mListenerMock, never()).onError(anyInt()); } + + /** + * Verify no result is reported if there are an insufficient number of URLs. + */ + @Test + public void testMinimumRequiredResults() { + startFetching(); + mSearchResultProducer.mMinimumUrlCount = 6; + // Treat the fetch as being cancelled as no result is returned. + finishFetching(true); + verify(mListenerMock, times(1)) + .onError(SearchResultExtractorClientStatus.NOT_ENOUGH_RESULTS); + } }
diff --git a/chrome/browser/continuous_search/internal/search_result_extractor_producer.cc b/chrome/browser/continuous_search/internal/search_result_extractor_producer.cc index 04715242..0d931f7 100644 --- a/chrome/browser/continuous_search/internal/search_result_extractor_producer.cc +++ b/chrome/browser/continuous_search/internal/search_result_extractor_producer.cc
@@ -95,10 +95,6 @@ const std::string& query, SearchResultExtractorClientStatus status, mojom::CategoryResultsPtr results) { - base::UmaHistogramEnumeration( - "Browser.ContinuousSearch.SearchResultExtractionStatus", status, - SearchResultExtractorClientStatus::kMaxValue); - JNIEnv* env = base::android::AttachCurrentThread(); if (status != SearchResultExtractorClientStatus::kSuccess) { java_interface_->OnError(env, java_ref_, status);
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc index 0335038..c344493 100644 --- a/chrome/browser/devtools/devtools_ui_bindings.cc +++ b/chrome/browser/devtools/devtools_ui_bindings.cc
@@ -78,6 +78,7 @@ #include "ipc/ipc_channel.h" #include "net/base/escape.h" #include "net/base/net_errors.h" +#include "net/base/url_util.h" #include "net/http/http_response_headers.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "services/network/public/cpp/simple_url_loader.h"
diff --git a/chrome/browser/dom_distiller/dom_distiller_viewer_source_browsertest.cc b/chrome/browser/dom_distiller/dom_distiller_viewer_source_browsertest.cc index 30c06cd..fb92919 100644 --- a/chrome/browser/dom_distiller/dom_distiller_viewer_source_browsertest.cc +++ b/chrome/browser/dom_distiller/dom_distiller_viewer_source_browsertest.cc
@@ -16,7 +16,9 @@ #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_isolated_world_ids.h" #include "chrome/common/chrome_switches.h" @@ -42,6 +44,7 @@ #include "content/public/common/isolated_world_ids.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" +#include "net/base/url_util.h" #include "testing/gmock/include/gmock/gmock-matchers.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index 0e18901..1c9d55f 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -676,8 +676,7 @@ // CRX_INSTALLER_DONE will fire when the install completes. At that // time, Observe() will call the passed callback. registrar_.Add( - this, - extensions::NOTIFICATION_CRX_INSTALLER_DONE, + this, extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<extensions::CrxInstaller>(crx_installer.get())); crx_installers_[crx_installer.get()] = std::move(callback); @@ -883,7 +882,7 @@ } DownloadProtectionService* - ChromeDownloadManagerDelegate::GetDownloadProtectionService() { +ChromeDownloadManagerDelegate::GetDownloadProtectionService() { DCHECK_CURRENTLY_ON(BrowserThread::UI); #if BUILDFLAG(FULL_SAFE_BROWSING) safe_browsing::SafeBrowsingService* sb_service = @@ -1362,6 +1361,10 @@ danger_type = download::DOWNLOAD_DANGER_TYPE_BLOCKED_UNSUPPORTED_FILETYPE; break; + case safe_browsing::DownloadCheckResult::DANGEROUS_ACCOUNT_COMPROMISE: + danger_type = + download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE; + break; } DCHECK_NE(danger_type, download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT); @@ -1545,13 +1548,17 @@ case (DownloadPrefs::DownloadRestriction::DANGEROUS_FILES): { return (danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT || danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE || - danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL); + danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL || + danger_type == + download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE); } case (DownloadPrefs::DownloadRestriction::MALICIOUS_FILES): { return (danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT || danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST || - danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL); + danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL || + danger_type == + download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE); } case (DownloadPrefs::DownloadRestriction::ALL_FILES):
diff --git a/chrome/browser/download/download_danger_prompt.cc b/chrome/browser/download/download_danger_prompt.cc index 1d10ed7..28e9acfd 100644 --- a/chrome/browser/download/download_danger_prompt.cc +++ b/chrome/browser/download/download_danger_prompt.cc
@@ -59,6 +59,8 @@ return "PromptForScanning"; case download::DOWNLOAD_DANGER_TYPE_BLOCKED_UNSUPPORTED_FILETYPE: return "BlockedUnsupportedFiletype"; + case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE: + return "DangerousAccountCompromise"; case download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: case download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT: case download::DOWNLOAD_DANGER_TYPE_USER_VALIDATED: @@ -97,14 +99,17 @@ case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: report->set_download_verdict(ClientDownloadResponse::DANGEROUS_HOST); break; + case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE: + report->set_download_verdict( + ClientDownloadResponse::DANGEROUS_ACCOUNT_COMPROMISE); + break; default: // Don't send report for any other danger types. return; } report->set_url(download.GetURL().spec()); report->set_did_proceed(did_proceed); std::string token = - safe_browsing::DownloadProtectionService::GetDownloadPingToken( - &download); + safe_browsing::DownloadProtectionService::GetDownloadPingToken(&download); if (!token.empty()) report->set_token(token); std::string serialized_report;
diff --git a/chrome/browser/download/download_danger_prompt_browsertest.cc b/chrome/browser/download/download_danger_prompt_browsertest.cc index c7e8de5..eb0eaf7 100644 --- a/chrome/browser/download/download_danger_prompt_browsertest.cc +++ b/chrome/browser/download/download_danger_prompt_browsertest.cc
@@ -85,10 +85,8 @@ expected_action_ = expected_action; SetUpDownloadItemExpectations(danger_type, token); SetUpSafeBrowsingReportExpectations( - expected_action == DownloadDangerPrompt::ACCEPT, - download_verdict, - token, - from_download_api); + expected_action == DownloadDangerPrompt::ACCEPT, download_verdict, + token, from_download_api); CreatePrompt(from_download_api); } @@ -125,8 +123,8 @@ void SetUpDownloadItemExpectations( const download::DownloadDangerType& danger_type, const std::string& token) { - EXPECT_CALL(download_, GetFileNameToReportUser()).WillRepeatedly(Return( - base::FilePath(FILE_PATH_LITERAL("evil.exe")))); + EXPECT_CALL(download_, GetFileNameToReportUser()) + .WillRepeatedly(Return(base::FilePath(FILE_PATH_LITERAL("evil.exe")))); EXPECT_CALL(download_, GetDangerType()).WillRepeatedly(Return(danger_type)); auto token_obj = std::make_unique<DownloadProtectionService::DownloadPingToken>(token); @@ -371,4 +369,15 @@ FROM_DOWNLOAD_API); } +IN_PROC_BROWSER_TEST_F(DownloadDangerPromptBrowserTest, + InvokeUi_AccountCompromise) { + RunTest(download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE, + USER_INITIATED); +} +IN_PROC_BROWSER_TEST_F(DownloadDangerPromptBrowserTest, + InvokeUi_AccountCompromiseFromApi) { + RunTest(download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE, + FROM_DOWNLOAD_API); +} + } // namespace safe_browsing
diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc index 3272ed19..b9930d4 100644 --- a/chrome/browser/download/download_item_model.cc +++ b/chrome/browser/download/download_item_model.cc
@@ -125,7 +125,7 @@ danger_level_(DownloadFileType::NOT_DANGEROUS), is_being_revived_(false) {} -} // namespace +} // namespace // ----------------------------------------------------------------------------- // DownloadItemModel @@ -176,8 +176,8 @@ base::i18n::AdjustStringForLocaleDirection(&total_text); base::i18n::AdjustStringForLocaleDirection(&received_size); - amount = l10n_util::GetStringFUTF16( - IDS_DOWNLOAD_TAB_PROGRESS_SIZE, received_size, total_text); + amount = l10n_util::GetStringFUTF16(IDS_DOWNLOAD_TAB_PROGRESS_SIZE, + received_size, total_text); } else { amount.assign(received_size); } @@ -190,9 +190,9 @@ if (download_->IsPaused()) { time_remaining = l10n_util::GetStringUTF16(IDS_DOWNLOAD_PROGRESS_PAUSED); } else if (download_->TimeRemaining(&remaining)) { - time_remaining = ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_REMAINING, - ui::TimeFormat::LENGTH_SHORT, - remaining); + time_remaining = + ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_REMAINING, + ui::TimeFormat::LENGTH_SHORT, remaining); } if (time_remaining.empty()) { @@ -200,8 +200,8 @@ return l10n_util::GetStringFUTF16( IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN, speed_text, amount); } - return l10n_util::GetStringFUTF16( - IDS_DOWNLOAD_TAB_PROGRESS_STATUS, speed_text, amount, time_remaining); + return l10n_util::GetStringFUTF16(IDS_DOWNLOAD_TAB_PROGRESS_STATUS, + speed_text, amount, time_remaining); } int64_t DownloadItemModel::GetCompletedBytes() const { @@ -209,8 +209,8 @@ } int64_t DownloadItemModel::GetTotalBytes() const { - return download_->AllDataSaved() ? download_->GetReceivedBytes() : - download_->GetTotalBytes(); + return download_->AllDataSaved() ? download_->GetReceivedBytes() + : download_->GetTotalBytes(); } // TODO(asanka,rdsmith): Once 'open' moves exclusively to the @@ -240,6 +240,7 @@ case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: case download::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED: case download::DOWNLOAD_DANGER_TYPE_DEEP_SCANNED_OPENED_DANGEROUS: + case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE: return true; case download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS:
diff --git a/chrome/browser/download/download_item_model_unittest.cc b/chrome/browser/download/download_item_model_unittest.cc index d882662..1bee267 100644 --- a/chrome/browser/download/download_item_model_unittest.cc +++ b/chrome/browser/download/download_item_model_unittest.cc
@@ -456,6 +456,8 @@ download::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE; download::DownloadDangerType dangerous_content = download::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT; + download::DownloadDangerType dangerous_account_compromise = + download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE; download::DownloadDangerType blocked_encrypted = download::DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED; download::DownloadDangerType blocked_too_large = @@ -471,16 +473,17 @@ bool is_dangerous; // Expectation for IsDangerous() bool expected_result; } kTestCases[] = { - // .--- Is dangerous. - // Download state Danger type | .--- Expected result. - {DownloadItem::COMPLETE, safe, false, true}, - {DownloadItem::COMPLETE, dangerous_file, true, false}, - {DownloadItem::CANCELLED, dangerous_file, true, true}, - {DownloadItem::COMPLETE, dangerous_content, true, true}, - {DownloadItem::COMPLETE, blocked_encrypted, true, false}, - {DownloadItem::COMPLETE, blocked_too_large, true, false}, - {DownloadItem::COMPLETE, blocked_sensitive, true, false}, - {DownloadItem::COMPLETE, blocked_filetype, true, false}, + // .--- Is dangerous. + // Download state Danger type | .--- Expected result. + {DownloadItem::COMPLETE, safe, false, true}, + {DownloadItem::COMPLETE, dangerous_file, true, false}, + {DownloadItem::CANCELLED, dangerous_file, true, true}, + {DownloadItem::COMPLETE, dangerous_account_compromise, true, true}, + {DownloadItem::COMPLETE, dangerous_content, true, true}, + {DownloadItem::COMPLETE, blocked_encrypted, true, false}, + {DownloadItem::COMPLETE, blocked_too_large, true, false}, + {DownloadItem::COMPLETE, blocked_sensitive, true, false}, + {DownloadItem::COMPLETE, blocked_filetype, true, false}, }; SetupDownloadItemDefaults();
diff --git a/chrome/browser/download/download_ui_model.cc b/chrome/browser/download/download_ui_model.cc index eb771c8..7893ea7 100644 --- a/chrome/browser/download/download_ui_model.cc +++ b/chrome/browser/download/download_ui_model.cc
@@ -253,6 +253,15 @@ case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: return l10n_util::GetStringFUTF16(IDS_PROMPT_MALICIOUS_DOWNLOAD_CONTENT, filename, offset); + case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE: { + return base::FeatureList::IsEnabled( + safe_browsing::kSafeBrowsingCTDownloadWarning) + ? l10n_util::GetStringFUTF16( + IDS_PROMPT_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE, + filename, offset) + : l10n_util::GetStringFUTF16( + IDS_PROMPT_MALICIOUS_DOWNLOAD_CONTENT, filename, offset); + } case download::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT: { bool request_ap_verdicts = false; #if BUILDFLAG(FULL_SAFE_BROWSING)
diff --git a/chrome/browser/download/notification/download_item_notification.cc b/chrome/browser/download/notification/download_item_notification.cc index b62f40a..5fed4b0a 100644 --- a/chrome/browser/download/notification/download_item_notification.cc +++ b/chrome/browser/download/notification/download_item_notification.cc
@@ -860,6 +860,15 @@ return l10n_util::GetStringFUTF16(IDS_PROMPT_MALICIOUS_DOWNLOAD_CONTENT, elided_filename); } + case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE: { + return base::FeatureList::IsEnabled( + safe_browsing::kSafeBrowsingCTDownloadWarning) + ? l10n_util::GetStringFUTF16( + IDS_PROMPT_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE, + elided_filename) + : l10n_util::GetStringFUTF16( + IDS_PROMPT_MALICIOUS_DOWNLOAD_CONTENT, elided_filename); + } case download::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT: { bool requests_ap_verdicts = safe_browsing::AdvancedProtectionStatusManagerFactory::GetForProfile(
diff --git a/chrome/browser/extensions/api/automation/automation_apitest.cc b/chrome/browser/extensions/api/automation/automation_apitest.cc index 40ced3f2..6aa5c01 100644 --- a/chrome/browser/extensions/api/automation/automation_apitest.cc +++ b/chrome/browser/extensions/api/automation/automation_apitest.cc
@@ -368,6 +368,13 @@ << message_; } +IN_PROC_BROWSER_TEST_F(AutomationApiTest, EnumValidity) { + StartEmbeddedTestServer(); + ASSERT_TRUE(RunExtensionTest( + {.name = "automation/tests/tabs", .page_url = "enum_validity.html"})) + << message_; +} + #if defined(USE_AURA) IN_PROC_BROWSER_TEST_F(AutomationApiTest, IframeNav) {
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest_chromeos.cc b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest_chromeos.cc index 111e8b0..6c3e1dd 100644 --- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest_chromeos.cc +++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest_chromeos.cc
@@ -78,17 +78,16 @@ base::CommandLine::ForCurrentProcess()->AppendSwitch( switches::kEnableBLEAdvertising); ASSERT_TRUE(RunExtensionTest( - {.name = "api_test/bluetooth_low_energy/register_advertisement_flag", - .launch_as_platform_app = true})) + "api_test/bluetooth_low_energy/register_advertisement_flag", + {.launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTestChromeOs, RegisterAdvertisement_NotKioskSession) { ASSERT_TRUE(RunExtensionTest( - {.name = - "api_test/bluetooth_low_energy/register_advertisement_no_kiosk_mode", - .launch_as_platform_app = true})) + "api_test/bluetooth_low_energy/register_advertisement_no_kiosk_mode", + {.launch_as_platform_app = true})) << message_; } @@ -96,9 +95,9 @@ RegisterAdvertisement_KioskSessionOnly) { EnterKioskSession(); ASSERT_TRUE( - RunExtensionTest({.name = "api_test/bluetooth_low_energy/" - "register_advertisement_kiosk_session_only", - .launch_as_platform_app = true})) + RunExtensionTest("api_test/bluetooth_low_energy/" + "register_advertisement_kiosk_session_only", + {.launch_as_platform_app = true})) << message_; } @@ -106,18 +105,18 @@ RegisterAdvertisement) { EnterKioskSession(); SetAutoLaunchApp(); - ASSERT_TRUE(RunExtensionTest( - {.name = "api_test/bluetooth_low_energy/register_advertisement", - .launch_as_platform_app = true})) + ASSERT_TRUE( + RunExtensionTest("api_test/bluetooth_low_energy/register_advertisement", + {.launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTestChromeOs, ResetAdvertising) { EnterKioskSession(); SetAutoLaunchApp(); - ASSERT_TRUE(RunExtensionTest( - {.name = "api_test/bluetooth_low_energy/reset_all_advertisements", - .launch_as_platform_app = true})) + ASSERT_TRUE( + RunExtensionTest("api_test/bluetooth_low_energy/reset_all_advertisements", + {.launch_as_platform_app = true})) << message_; } @@ -125,44 +124,47 @@ SetAdvertisingInterval) { EnterKioskSession(); SetAutoLaunchApp(); - ASSERT_TRUE(RunExtensionTest({.name = "api_test/bluetooth_low_energy/" - "set_advertising_interval", - .launch_as_platform_app = true})) + ASSERT_TRUE( + RunExtensionTest("api_test/bluetooth_low_energy/" + "set_advertising_interval", + {.launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTestChromeOs, CreateService) { EnterKioskSession(); SetAutoLaunchApp(); - ASSERT_TRUE(RunExtensionTest({.name = "api_test/bluetooth_low_energy/" - "create_service", - .launch_as_platform_app = true})) + ASSERT_TRUE( + RunExtensionTest("api_test/bluetooth_low_energy/" + "create_service", + {.launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTestChromeOs, CreateService_Flag) { base::CommandLine::ForCurrentProcess()->AppendSwitch( switches::kEnableBLEAdvertising); - ASSERT_TRUE(RunExtensionTest( - {.name = "api_test/bluetooth_low_energy/create_service_flag", - .launch_as_platform_app = true})) + ASSERT_TRUE( + RunExtensionTest("api_test/bluetooth_low_energy/create_service_flag", + {.launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTestChromeOs, CreateService_NotKioskSession) { ASSERT_TRUE(RunExtensionTest( - {.name = "api_test/bluetooth_low_energy/create_service_no_kiosk_mode", - .launch_as_platform_app = true})) + "api_test/bluetooth_low_energy/create_service_no_kiosk_mode", + {.launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTestChromeOs, CreateService_KioskSessionOnly) { EnterKioskSession(); - ASSERT_TRUE(RunExtensionTest({.name = "api_test/bluetooth_low_energy/" - "create_service_kiosk_session_only", - .launch_as_platform_app = true})) + ASSERT_TRUE( + RunExtensionTest("api_test/bluetooth_low_energy/" + "create_service_kiosk_session_only", + {.launch_as_platform_app = true})) << message_; } @@ -170,45 +172,50 @@ CreateCharacteristic) { EnterKioskSession(); SetAutoLaunchApp(); - ASSERT_TRUE(RunExtensionTest({.name = "api_test/bluetooth_low_energy/" - "create_characteristic", - .launch_as_platform_app = true})) + ASSERT_TRUE( + RunExtensionTest("api_test/bluetooth_low_energy/" + "create_characteristic", + {.launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTestChromeOs, CreateDescriptor) { EnterKioskSession(); SetAutoLaunchApp(); - ASSERT_TRUE(RunExtensionTest({.name = "api_test/bluetooth_low_energy/" - "create_descriptor", - .launch_as_platform_app = true})) + ASSERT_TRUE( + RunExtensionTest("api_test/bluetooth_low_energy/" + "create_descriptor", + {.launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTestChromeOs, RegisterService) { EnterKioskSession(); SetAutoLaunchApp(); - ASSERT_TRUE(RunExtensionTest({.name = "api_test/bluetooth_low_energy/" - "register_service", - .launch_as_platform_app = true})) + ASSERT_TRUE( + RunExtensionTest("api_test/bluetooth_low_energy/" + "register_service", + {.launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTestChromeOs, UnregisterService) { EnterKioskSession(); SetAutoLaunchApp(); - ASSERT_TRUE(RunExtensionTest({.name = "api_test/bluetooth_low_energy/" - "unregister_service", - .launch_as_platform_app = true})) + ASSERT_TRUE( + RunExtensionTest("api_test/bluetooth_low_energy/" + "unregister_service", + {.launch_as_platform_app = true})) << message_; } IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTestChromeOs, RemoveService) { EnterKioskSession(); SetAutoLaunchApp(); - ASSERT_TRUE(RunExtensionTest({.name = "api_test/bluetooth_low_energy/" - "remove_service", - .launch_as_platform_app = true})) + ASSERT_TRUE( + RunExtensionTest("api_test/bluetooth_low_energy/" + "remove_service", + {.launch_as_platform_app = true})) << message_; } @@ -216,9 +223,10 @@ NotifyCharacteristicValueChanged) { EnterKioskSession(); SetAutoLaunchApp(); - ASSERT_TRUE(RunExtensionTest({.name = "api_test/bluetooth_low_energy/" - "notify_characteristic_value_changed", - .launch_as_platform_app = true})) + ASSERT_TRUE( + RunExtensionTest("api_test/bluetooth_low_energy/" + "notify_characteristic_value_changed", + {.launch_as_platform_app = true})) << message_; } @@ -226,10 +234,10 @@ NotifyCharacteristicValueChanged_ErrorConditions) { EnterKioskSession(); SetAutoLaunchApp(); - ASSERT_TRUE(RunExtensionTest( - {.name = "api_test/bluetooth_low_energy/" - "notify_characteristic_value_changed_error_conditions", - .launch_as_platform_app = true})) + ASSERT_TRUE( + RunExtensionTest("api_test/bluetooth_low_energy/" + "notify_characteristic_value_changed_error_conditions", + {.launch_as_platform_app = true})) << message_; }
diff --git a/chrome/browser/extensions/api/crash_report_private/crash_report_private_api.cc b/chrome/browser/extensions/api/crash_report_private/crash_report_private_api.cc index ce4a1f4..93ede3a 100644 --- a/chrome/browser/extensions/api/crash_report_private/crash_report_private_api.cc +++ b/chrome/browser/extensions/api/crash_report_private/crash_report_private_api.cc
@@ -8,6 +8,7 @@ #include "chrome/browser/metrics/renderer_uptime_tracker.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "components/crash/content/browser/error_reporting/javascript_error_report.h" #include "components/crash/content/browser/error_reporting/js_error_report_processor.h" #include "content/public/browser/devtools_agent_host.h"
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc index b2d65fb..0902289 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -98,25 +98,27 @@ const char kInvalidQueryLimit[] = "Invalid query limit"; const char kInvalidState[] = "Invalid state"; const char kInvalidURL[] = "Invalid URL"; -const char kInvisibleContext[] = "Javascript execution context is not visible " - "(tab, window, popup bubble)"; +const char kInvisibleContext[] = + "Javascript execution context is not visible " + "(tab, window, popup bubble)"; const char kNotComplete[] = "Download must be complete"; const char kNotDangerous[] = "Download must be dangerous"; const char kNotInProgress[] = "Download must be in progress"; const char kNotResumable[] = "DownloadItem.canResume must be true"; const char kOpenPermission[] = "The \"downloads.open\" permission is required"; const char kShelfDisabled[] = "Another extension has disabled the shelf"; -const char kShelfPermission[] = "downloads.setShelfEnabled requires the " - "\"downloads.shelf\" permission"; -const char kTooManyListeners[] = "Each extension may have at most one " - "onDeterminingFilename listener between all of its renderer execution " - "contexts."; +const char kShelfPermission[] = + "downloads.setShelfEnabled requires the " + "\"downloads.shelf\" permission"; +const char kTooManyListeners[] = + "Each extension may have at most one " + "onDeterminingFilename listener between all of its renderer execution " + "contexts."; const char kUnexpectedDeterminer[] = "Unexpected determineFilename call"; const char kUserGesture[] = "User gesture required"; } // namespace download_extension_errors - namespace extensions { namespace { @@ -124,7 +126,7 @@ namespace downloads = api::downloads; // Default icon size for getFileIcon() in pixels. -const int kDefaultIconSize = 32; +const int kDefaultIconSize = 32; // Parameter keys const char kByExtensionIdKey[] = "byExtensionId"; @@ -179,6 +181,7 @@ const char kUrlRegexKey[] = "urlRegex"; const char kFinalUrlKey[] = "finalUrl"; const char kFinalUrlRegexKey[] = "finalUrlRegex"; +const char kDangerousAccountCompromise[] = "accountCompromise"; const char* const kDangerStrings[] = {kDangerSafe, kDangerFile, @@ -198,15 +201,16 @@ kDangerDeepScannedSafe, kDangerDeepScannedOpenedDangerous, kDangerPromptForScanning, - kDangerUnsupportedFileType}; + kDangerUnsupportedFileType, + kDangerousAccountCompromise}; static_assert(base::size(kDangerStrings) == download::DOWNLOAD_DANGER_TYPE_MAX, "kDangerStrings should have DOWNLOAD_DANGER_TYPE_MAX elements"); const char* const kStateStrings[] = { - kStateInProgress, - kStateComplete, - kStateInterrupted, - kStateInterrupted, + kStateInProgress, + kStateComplete, + kStateInterrupted, + kStateInterrupted, }; static_assert(base::size(kStateStrings) == download::DownloadItem::MAX_DOWNLOAD_STATE, @@ -261,8 +265,8 @@ json->SetString(kFinalUrlKey, (finalUrl.is_valid() ? finalUrl.spec() : std::string())); const GURL& referrer = download_item->GetReferrerUrl(); - json->SetString(kReferrerUrlKey, (referrer.is_valid() ? referrer.spec() - : std::string())); + json->SetString(kReferrerUrlKey, + (referrer.is_valid() ? referrer.spec() : std::string())); json->SetString(kFilenameKey, download_item->GetTargetFilePath().LossyDisplayName()); json->SetString(kDangerKey, DangerString(download_item->GetDangerType())); @@ -360,8 +364,10 @@ IconLoader::IconSize IconLoaderSizeFromPixelSize(int pixel_size) { switch (pixel_size) { - case 16: return IconLoader::SMALL; - case 32: return IconLoader::NORMAL; + case 16: + return IconLoader::SMALL; + case 32: + return IconLoader::NORMAL; default: NOTREACHED(); return IconLoader::NORMAL; @@ -495,15 +501,13 @@ }; void RecordApiFunctions(DownloadsFunctionName function) { - UMA_HISTOGRAM_ENUMERATION("Download.ApiFunctions", - function, + UMA_HISTOGRAM_ENUMERATION("Download.ApiFunctions", function, DOWNLOADS_FUNCTION_LAST); } -void CompileDownloadQueryOrderBy( - const std::vector<std::string>& order_by_strs, - std::string* error, - DownloadQuery* query) { +void CompileDownloadQueryOrderBy(const std::vector<std::string>& order_by_strs, + std::string* error, + DownloadQuery* query) { // TODO(benjhayden): Consider switching from LazyInstance to explicit string // comparisons. static base::LazyInstance<SortTypeMap>::DestructorAtExit sorter_types = @@ -521,8 +525,7 @@ direction = DownloadQuery::DESCENDING; term_str = term_str.substr(1); } - SortTypeMap::const_iterator sorter_type = - sorter_types.Get().find(term_str); + SortTypeMap::const_iterator sorter_type = sorter_types.Get().find(term_str); if (sorter_type == sorter_types.Get().end()) { *error = download_extension_errors::kInvalidOrderBy; return; @@ -531,12 +534,11 @@ } } -void RunDownloadQuery( - const downloads::DownloadQuery& query_in, - DownloadManager* manager, - DownloadManager* incognito_manager, - std::string* error, - DownloadQuery::DownloadVector* results) { +void RunDownloadQuery(const downloads::DownloadQuery& query_in, + DownloadManager* manager, + DownloadManager* incognito_manager, + std::string* error, + DownloadQuery::DownloadVector* results) { // TODO(benjhayden): Consider switching from LazyInstance to explicit string // comparisons. static base::LazyInstance<FilterTypeMap>::DestructorAtExit filter_types = @@ -567,8 +569,7 @@ } query_out.AddFilter(state); } - std::string danger_string = - downloads::ToString(query_in.danger); + std::string danger_string = downloads::ToString(query_in.danger); if (!danger_string.empty()) { download::DownloadDangerType danger_type = DangerEnumFromString(danger_string); @@ -632,8 +633,9 @@ public: static ExtensionDownloadsEventRouterData* Get(DownloadItem* download_item) { base::SupportsUserData::Data* data = download_item->GetUserData(kKey); - return (data == NULL) ? NULL : - static_cast<ExtensionDownloadsEventRouterData*>(data); + return (data == NULL) + ? NULL + : static_cast<ExtensionDownloadsEventRouterData*>(data); } static void Remove(DownloadItem* download_item) { @@ -702,9 +704,7 @@ base::TimeDelta::FromSeconds(determine_filename_timeout_s_)); } - void DetermineFilenameTimeout() { - CallFilenameCallback(); - } + void DetermineFilenameTimeout() { CallFilenameCallback(); } void CallFilenameCallback() { if (!filename_changed_) @@ -773,16 +773,14 @@ return creator_suggested_filename_; } - downloads::FilenameConflictAction - creator_conflict_action() const { + downloads::FilenameConflictAction creator_conflict_action() const { return creator_conflict_action_; } void ResetCreatorSuggestion() { DCHECK_CURRENTLY_ON(BrowserThread::UI); creator_suggested_filename_.clear(); - creator_conflict_action_ = - downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY; + creator_conflict_action_ = downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY; } // Returns false if this |extension_id| was not expected or if this @@ -808,16 +806,10 @@ WarningSet warnings; std::string winner_extension_id; ExtensionDownloadsEventRouter::DetermineFilenameInternal( - filename, - conflict_action, - determiners_[index].extension_id, - determiners_[index].install_time, - determiner_.extension_id, - determiner_.install_time, - &winner_extension_id, - &determined_filename_, - &determined_conflict_action_, - &warnings); + filename, conflict_action, determiners_[index].extension_id, + determiners_[index].install_time, determiner_.extension_id, + determiner_.install_time, &winner_extension_id, + &determined_filename_, &determined_conflict_action_, &warnings); if (!warnings.empty()) WarningService::NotifyWarningsOnUI(browser_context, warnings); if (winner_extension_id == determiners_[index].extension_id) @@ -837,8 +829,7 @@ struct DeterminerInfo { DeterminerInfo(); - DeterminerInfo(const std::string& e_id, - const base::Time& installed); + DeterminerInfo(const std::string& e_id, const base::Time& installed); ~DeterminerInfo(); std::string extension_id; @@ -884,11 +875,9 @@ DeterminerInfoVector determiners_; base::FilePath creator_suggested_filename_; - downloads::FilenameConflictAction - creator_conflict_action_; + downloads::FilenameConflictAction creator_conflict_action_; base::FilePath determined_filename_; - downloads::FilenameConflictAction - determined_conflict_action_; + downloads::FilenameConflictAction determined_conflict_action_; DeterminerInfo determiner_; // Whether a download is complete and whether the completed download is @@ -907,19 +896,15 @@ ExtensionDownloadsEventRouterData::DeterminerInfo::DeterminerInfo( const std::string& e_id, const base::Time& installed) - : extension_id(e_id), - install_time(installed), - reported(false) { -} + : extension_id(e_id), install_time(installed), reported(false) {} ExtensionDownloadsEventRouterData::DeterminerInfo::DeterminerInfo() - : reported(false) { -} + : reported(false) {} ExtensionDownloadsEventRouterData::DeterminerInfo::~DeterminerInfo() {} const char ExtensionDownloadsEventRouterData::kKey[] = - "DownloadItem ExtensionDownloadsEventRouterData"; + "DownloadItem ExtensionDownloadsEventRouterData"; bool OnDeterminingFilenameWillDispatchCallback( bool* any_determiners, @@ -936,9 +921,7 @@ return true; } -bool Fault(bool error, - const char* message_in, - std::string* message_out) { +bool Fault(bool error, const char* message_in, std::string* message_out) { if (!error) return false; *message_out = message_in; @@ -950,32 +933,23 @@ } bool IsDownloadDeltaField(const std::string& field) { - return ((field == kUrlKey) || - (field == kFinalUrlKey) || - (field == kFilenameKey) || - (field == kDangerKey) || - (field == kMimeKey) || - (field == kStartTimeKey) || - (field == kEndTimeKey) || - (field == kStateKey) || - (field == kCanResumeKey) || - (field == kPausedKey) || - (field == kErrorKey) || - (field == kTotalBytesKey) || - (field == kFileSizeKey) || - (field == kExistsKey)); + return ((field == kUrlKey) || (field == kFinalUrlKey) || + (field == kFilenameKey) || (field == kDangerKey) || + (field == kMimeKey) || (field == kStartTimeKey) || + (field == kEndTimeKey) || (field == kStateKey) || + (field == kCanResumeKey) || (field == kPausedKey) || + (field == kErrorKey) || (field == kTotalBytesKey) || + (field == kFileSizeKey) || (field == kExistsKey)); } } // namespace -const char DownloadedByExtension::kKey[] = - "DownloadItem DownloadedByExtension"; +const char DownloadedByExtension::kKey[] = "DownloadItem DownloadedByExtension"; DownloadedByExtension* DownloadedByExtension::Get( download::DownloadItem* item) { base::SupportsUserData::Data* data = item->GetUserData(kKey); - return (data == NULL) ? NULL : - static_cast<DownloadedByExtension*>(data); + return (data == NULL) ? NULL : static_cast<DownloadedByExtension*>(data); } DownloadedByExtension::DownloadedByExtension(download::DownloadItem* item, @@ -1068,8 +1042,7 @@ } } - std::string method_string = - downloads::ToString(options.method); + std::string method_string = downloads::ToString(options.method); if (!method_string.empty()) download_params->set_method(method_string); if (options.body.get()) { @@ -1110,8 +1083,8 @@ data = new ExtensionDownloadsEventRouterData( item, std::make_unique<base::DictionaryValue>()); } - data->CreatorSuggestedFilename( - creator_suggested_filename, creator_conflict_action); + data->CreatorSuggestedFilename(creator_suggested_filename, + creator_conflict_action); } new DownloadedByExtension(item, extension()->id(), extension()->name()); item->UpdateObservers(); @@ -1226,8 +1199,7 @@ EXTENSION_FUNCTION_VALIDATE(params.get()); DownloadItem* download_item = GetDownload( browser_context(), include_incognito_information(), params->download_id); - if (download_item && - (download_item->GetState() == DownloadItem::IN_PROGRESS)) + if (download_item && (download_item->GetState() == DownloadItem::IN_PROGRESS)) download_item->Cancel(true); // |download_item| can be NULL if the download ID was invalid or if the // download is not currently active. Either way, it's not a failure. @@ -1263,11 +1235,9 @@ OneArgument(base::Value::FromUniquePtrValue(std::move(json_results)))); } -DownloadsRemoveFileFunction::DownloadsRemoveFileFunction() { -} +DownloadsRemoveFileFunction::DownloadsRemoveFileFunction() {} -DownloadsRemoveFileFunction::~DownloadsRemoveFileFunction() { -} +DownloadsRemoveFileFunction::~DownloadsRemoveFileFunction() {} ExtensionFunction::ResponseAction DownloadsRemoveFileFunction::Run() { std::unique_ptr<downloads::RemoveFile::Params> params( @@ -1354,7 +1324,8 @@ } void DownloadsAcceptDangerFunction::DangerPromptCallback( - int download_id, DownloadDangerPrompt::Action action) { + int download_id, + DownloadDangerPrompt::Action action) { DCHECK_CURRENTLY_ON(BrowserThread::UI); DownloadItem* download_item = GetDownload( browser_context(), include_incognito_information(), download_id); @@ -1544,8 +1515,7 @@ } DownloadsGetFileIconFunction::DownloadsGetFileIconFunction() - : icon_extractor_(new DownloadFileIconExtractorImpl()) { -} + : icon_extractor_(new DownloadFileIconExtractorImpl()) {} DownloadsGetFileIconFunction::~DownloadsGetFileIconFunction() {} @@ -1559,8 +1529,7 @@ std::unique_ptr<downloads::GetFileIcon::Params> params( downloads::GetFileIcon::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); - const downloads::GetFileIconOptions* options = - params->options.get(); + const downloads::GetFileIconOptions* options = params->options.get(); int icon_size = kDefaultIconSize; if (options && options->size.get()) icon_size = *options->size; @@ -1577,8 +1546,7 @@ DCHECK(icon_extractor_.get()); DCHECK(icon_size == 16 || icon_size == 32); float scale = 1.0; - content::WebContents* web_contents = - dispatcher()->GetVisibleWebContents(); + content::WebContents* web_contents = dispatcher()->GetVisibleWebContents(); if (web_contents && web_contents->GetRenderWidgetHostView()) scale = web_contents->GetRenderWidgetHostView()->GetDeviceScaleFactor(); EXTENSION_FUNCTION_VALIDATE(icon_extractor_->ExtractIconURLForPath( @@ -1718,18 +1686,14 @@ if (suggesting_install_time < incumbent_install_time) { *winner_extension_id = incumbent_extension_id; warnings->insert(Warning::CreateDownloadFilenameConflictWarning( - suggesting_extension_id, - incumbent_extension_id, - filename, + suggesting_extension_id, incumbent_extension_id, filename, *determined_filename)); return; } *winner_extension_id = suggesting_extension_id; warnings->insert(Warning::CreateDownloadFilenameConflictWarning( - incumbent_extension_id, - suggesting_extension_id, - *determined_filename, + incumbent_extension_id, suggesting_extension_id, *determined_filename, filename)); *determined_filename = filename; *determined_conflict_action = conflict_action; @@ -1766,8 +1730,8 @@ FILE_PATH_LITERAL('\\'), FILE_PATH_LITERAL('/')); base::FilePath filename(filename_str); bool valid_filename = net::IsSafePortableRelativePath(filename); - filename = (valid_filename ? filename.NormalizePathSeparators() : - base::FilePath()); + filename = + (valid_filename ? filename.NormalizePathSeparators() : base::FilePath()); // If the invalid filename check is moved to before DeterminerCallback(), then // it will block forever waiting for this ext_id to report. if (Fault(!data->DeterminerCallback(browser_context, ext_id, filename, @@ -1785,18 +1749,17 @@ DownloadManager* manager = notifier_.GetManager(); if (!manager) return; - bool determiner_removed = ( - details.event_name == downloads::OnDeterminingFilename::kEventName); + bool determiner_removed = + (details.event_name == downloads::OnDeterminingFilename::kEventName); EventRouter* router = EventRouter::Get(profile_); bool any_listeners = - router->HasEventListener(downloads::OnChanged::kEventName) || - router->HasEventListener(downloads::OnDeterminingFilename::kEventName); + router->HasEventListener(downloads::OnChanged::kEventName) || + router->HasEventListener(downloads::OnDeterminingFilename::kEventName); if (!determiner_removed && any_listeners) return; DownloadManager::DownloadVector items; manager->GetAllDownloads(&items); - for (DownloadManager::DownloadVector::const_iterator iter = - items.begin(); + for (DownloadManager::DownloadVector::const_iterator iter = items.begin(); iter != items.end(); ++iter) { ExtensionDownloadsEventRouterData* data = ExtensionDownloadsEventRouterData::Get(*iter); @@ -1810,8 +1773,7 @@ // should proceed. data->DeterminerRemoved(details.extension_id); } - if (!any_listeners && - data->creator_suggested_filename().empty()) { + if (!any_listeners && data->creator_suggested_filename().empty()) { ExtensionDownloadsEventRouterData::Remove(*iter); } } @@ -1821,7 +1783,8 @@ // have to do with the other, less special events. void ExtensionDownloadsEventRouter::OnDownloadCreated( - DownloadManager* manager, DownloadItem* download_item) { + DownloadManager* manager, + DownloadItem* download_item) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (!ShouldExport(*download_item)) return; @@ -1829,11 +1792,10 @@ EventRouter* router = EventRouter::Get(profile_); // Avoid allocating a bunch of memory in DownloadItemToJSON if it isn't going // to be used. - if (!router || - (!router->HasEventListener(downloads::OnCreated::kEventName) && - !router->HasEventListener(downloads::OnChanged::kEventName) && - !router->HasEventListener( - downloads::OnDeterminingFilename::kEventName))) { + if (!router || (!router->HasEventListener(downloads::OnCreated::kEventName) && + !router->HasEventListener(downloads::OnChanged::kEventName) && + !router->HasEventListener( + downloads::OnDeterminingFilename::kEventName))) { return; } @@ -1856,11 +1818,12 @@ } void ExtensionDownloadsEventRouter::OnDownloadUpdated( - DownloadManager* manager, DownloadItem* download_item) { + DownloadManager* manager, + DownloadItem* download_item) { DCHECK_CURRENTLY_ON(BrowserThread::UI); EventRouter* router = EventRouter::Get(profile_); ExtensionDownloadsEventRouterData* data = - ExtensionDownloadsEventRouterData::Get(download_item); + ExtensionDownloadsEventRouterData::Get(download_item); if (!ShouldExport(*download_item) || !router->HasEventListener(downloads::OnChanged::kEventName)) { return; @@ -1947,7 +1910,8 @@ } void ExtensionDownloadsEventRouter::OnDownloadRemoved( - DownloadManager* manager, DownloadItem* download_item) { + DownloadManager* manager, + DownloadItem* download_item) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (!ShouldExport(*download_item)) return;
diff --git a/chrome/browser/extensions/api/image_writer_private/test_utils.cc b/chrome/browser/extensions/api/image_writer_private/test_utils.cc index 6e8f02e9..f45645b6 100644 --- a/chrome/browser/extensions/api/image_writer_private/test_utils.cc +++ b/chrome/browser/extensions/api/image_writer_private/test_utils.cc
@@ -243,12 +243,15 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) if (!chromeos::DBusThreadManager::IsInitialized()) { - std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter = - chromeos::DBusThreadManager::GetSetterForTesting(); - chromeos::ConciergeClient::InitializeFake(/*fake_cicerone_client=*/nullptr); - std::unique_ptr<chromeos::ImageBurnerClient> image_burner_fake( - new ImageWriterFakeImageBurnerClient()); - dbus_setter->SetImageBurnerClient(std::move(image_burner_fake)); + if (!is_browser_test) { + // For browser tests, chromeos::InitializeDBus() automatically does the + // same. + chromeos::DBusThreadManager::Initialize(); + chromeos::ConciergeClient::InitializeFake( + /*fake_cicerone_client=*/nullptr); + } + chromeos::DBusThreadManager::GetSetterForTesting()->SetImageBurnerClient( + std::make_unique<ImageWriterFakeImageBurnerClient>()); } FakeDiskMountManager* disk_manager = new FakeDiskMountManager(); @@ -271,6 +274,8 @@ void ImageWriterTestUtils::TearDown() { #if BUILDFLAG(IS_CHROMEOS_ASH) if (chromeos::DBusThreadManager::IsInitialized()) { + // When in browser_tests, this path is not taken. These clients have already + // been shut down by chromeos::ShutdownDBus(). chromeos::ConciergeClient::Shutdown(); chromeos::DBusThreadManager::Shutdown(); }
diff --git a/chrome/browser/extensions/api/proxy/proxy_apitest.cc b/chrome/browser/extensions/api/proxy/proxy_apitest.cc index c4ea6ef..96e48ce 100644 --- a/chrome/browser/extensions/api/proxy/proxy_apitest.cc +++ b/chrome/browser/extensions/api/proxy/proxy_apitest.cc
@@ -102,7 +102,7 @@ // Tests direct connection settings. IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, ProxyDirectSettings) { ASSERT_TRUE( - RunExtensionTest({.name = "proxy/direct"}, {.allow_in_incognito = true})) + RunExtensionTest("proxy/direct", {}, {.allow_in_incognito = true})) << message_; const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension); @@ -125,7 +125,7 @@ // disabled or enabled. IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, SettingsChangeOnDisableEnable) { ASSERT_TRUE( - RunExtensionTest({.name = "proxy/direct"}, {.allow_in_incognito = true})) + RunExtensionTest("proxy/direct", {}, {.allow_in_incognito = true})) << message_; const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension); @@ -146,7 +146,7 @@ // the extension is uninstalled. IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, SettingsRemovedOnUninstall) { ASSERT_TRUE( - RunExtensionTest({.name = "proxy/direct"}, {.allow_in_incognito = true})) + RunExtensionTest("proxy/direct", {}, {.allow_in_incognito = true})) << message_; const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension); @@ -165,7 +165,7 @@ IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, PRE_SettingsRemovedOnPolicyBlocklist) { ASSERT_TRUE( - RunExtensionTest({.name = "proxy/direct"}, {.allow_in_incognito = true})) + RunExtensionTest("proxy/direct", {}, {.allow_in_incognito = true})) << message_; const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension); @@ -205,8 +205,7 @@ // Tests auto-detect settings. IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, ProxyAutoSettings) { - ASSERT_TRUE( - RunExtensionTest({.name = "proxy/auto"}, {.allow_in_incognito = true})) + ASSERT_TRUE(RunExtensionTest("proxy/auto", {}, {.allow_in_incognito = true})) << message_; const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension); @@ -301,8 +300,8 @@ // Tests setting separate proxies for each scheme. IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, ProxyFixedIndividual) { - ASSERT_TRUE(RunExtensionTest({.name = "proxy/individual"}, - {.allow_in_incognito = true})) + ASSERT_TRUE( + RunExtensionTest("proxy/individual", {}, {.allow_in_incognito = true})) << message_; const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension); @@ -335,7 +334,7 @@ // Tests setting values only for incognito mode IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, ProxyFixedIndividualIncognitoOnly) { - ASSERT_TRUE(RunExtensionTest({.name = "proxy/individual_incognito_only"}, + ASSERT_TRUE(RunExtensionTest("proxy/individual_incognito_only", {}, {.allow_in_incognito = true})) << message_; const Extension* extension = GetSingleLoadedExtension(); @@ -362,7 +361,7 @@ // Tests setting values also for incognito mode IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, ProxyFixedIndividualIncognitoAlso) { - ASSERT_TRUE(RunExtensionTest({.name = "proxy/individual_incognito_also"}, + ASSERT_TRUE(RunExtensionTest("proxy/individual_incognito_also", {}, {.allow_in_incognito = true})) << message_; const Extension* extension = GetSingleLoadedExtension(); @@ -406,7 +405,7 @@ IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, ProxyBypass) { ASSERT_TRUE( - RunExtensionTest({.name = "proxy/bypass"}, {.allow_in_incognito = true})) + RunExtensionTest("proxy/bypass", {}, {.allow_in_incognito = true})) << message_; const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension); @@ -434,23 +433,23 @@ // then attempts to fetch "example.test", expecting the listeners of // chrome.proxy.onProxyError to fire with ERR_PROXY_CONNECTION_FAILED. IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, ProxyEventsInvalidProxy) { - ASSERT_TRUE(RunExtensionTest( - {.name = "proxy/events", .page_url = "invalid_proxy.html"})) + ASSERT_TRUE( + RunExtensionTest("proxy/events", {.page_url = "invalid_proxy.html"})) << message_; } // Tests error events: PAC script parse error. IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, ProxyEventsParseError) { - ASSERT_TRUE(RunExtensionTest( - {.name = "proxy/events", .page_url = "parse_error.html"})) + ASSERT_TRUE( + RunExtensionTest("proxy/events", {.page_url = "parse_error.html"})) << message_; } // Tests that chrome.proxy.onProxyError is NOT called in the case of a // non-proxy error. IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, ProxyEventsOtherError) { - ASSERT_TRUE(RunExtensionTest( - {.name = "proxy/events", .page_url = "other_error.html"})) + ASSERT_TRUE( + RunExtensionTest("proxy/events", {.page_url = "other_error.html"})) << message_; }
diff --git a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc index 82cbcbd..db74a99 100644 --- a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc +++ b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc
@@ -119,6 +119,8 @@ return "DANGEROUS_HOST"; case download::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED: return "POTENTIALLY_UNWANTED"; + case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE: + return "DANGEROUS_ACCOUNT_COMPROMISE"; default: // This can be reached when reporting an opened download that doesn't have // a verdict yet.
diff --git a/chrome/browser/extensions/api/search/search_api.cc b/chrome/browser/extensions/api/search/search_api.cc index 486ffbf..f4529ca5 100644 --- a/chrome/browser/extensions/api/search/search_api.cc +++ b/chrome/browser/extensions/api/search/search_api.cc
@@ -10,6 +10,7 @@ #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/common/extensions/api/search.h" #include "components/search_engines/util.h"
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc index 7ef1a96..bb9a05b 100644 --- a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc +++ b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
@@ -36,6 +36,7 @@ #include "extensions/common/features/simple_feature.h" #include "extensions/common/permissions/permissions_data.h" #include "extensions/common/switches.h" +#include "net/base/url_util.h" #include "services/network/public/cpp/is_potentially_trustworthy.h" using content::DesktopMediaID;
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc index 0ede4a0..66527ba 100644 --- a/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc +++ b/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc
@@ -153,8 +153,7 @@ // Tests API behaviors, including info queries, and constraints violations. IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, ApiTests) { AddExtensionToCommandLineAllowlist(); - ASSERT_TRUE( - RunExtensionTest({.name = "tab_capture", .page_url = "api_tests.html"})) + ASSERT_TRUE(RunExtensionTest("tab_capture", {.page_url = "api_tests.html"})) << message_; } @@ -162,8 +161,8 @@ // off-screen tabs. IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MaxOffscreenTabs) { AddExtensionToCommandLineAllowlist(); - ASSERT_TRUE(RunExtensionTest( - {.name = "tab_capture", .page_url = "max_offscreen_tabs.html"})) + ASSERT_TRUE( + RunExtensionTest("tab_capture", {.page_url = "max_offscreen_tabs.html"})) << message_; } @@ -181,8 +180,8 @@ // and color values can be off by a lot. That said, color accuracy is being // tested by a suite of content_browsertests. ASSERT_TRUE(RunExtensionTest( - {.name = "tab_capture", - .page_url = "end_to_end.html?method=local&colorDeviation=50"})) + "tab_capture", + {.page_url = "end_to_end.html?method=local&colorDeviation=50"})) << message_; } @@ -200,8 +199,8 @@ // See note in EndToEndWithoutRemoting test about why |colorDeviation| is // being set so high. ASSERT_TRUE(RunExtensionTest( - {.name = "tab_capture", - .page_url = "end_to_end.html?method=webrtc&colorDeviation=50"})) + "tab_capture", + {.page_url = "end_to_end.html?method=webrtc&colorDeviation=50"})) << message_; } @@ -213,8 +212,8 @@ return; } AddExtensionToCommandLineAllowlist(); - ASSERT_TRUE(RunExtensionTest( - {.name = "tab_capture", .page_url = "offscreen_end_to_end.html"})) + ASSERT_TRUE(RunExtensionTest("tab_capture", + {.page_url = "offscreen_end_to_end.html"})) << message_; // Verify that offscreen profile has been destroyed. ASSERT_FALSE(profile()->HasPrimaryOTRProfile()); @@ -227,8 +226,8 @@ return; } AddExtensionToCommandLineAllowlist(); - ASSERT_TRUE(RunExtensionTest( - {.name = "tab_capture", .page_url = "offscreen_evil_tests.html"})) + ASSERT_TRUE(RunExtensionTest("tab_capture", + {.page_url = "offscreen_evil_tests.html"})) << message_; // Verify that offscreen profile has been destroyed. ASSERT_FALSE(profile()->HasPrimaryOTRProfile()); @@ -238,8 +237,8 @@ IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, GetUserMediaTest) { ExtensionTestMessageListener listener("ready", true); - ASSERT_TRUE(RunExtensionTest( - {.name = "tab_capture", .page_url = "get_user_media_test.html"})) + ASSERT_TRUE( + RunExtensionTest("tab_capture", {.page_url = "get_user_media_test.html"})) << message_; EXPECT_TRUE(listener.WaitUntilSatisfied()); @@ -268,8 +267,8 @@ ExtensionTestMessageListener before_open_new_tab("ready3", true); ExtensionTestMessageListener before_allowlist_extension("ready4", true); - ASSERT_TRUE(RunExtensionTest( - {.name = "tab_capture", .page_url = "active_tab_permission_test.html"})) + ASSERT_TRUE(RunExtensionTest("tab_capture", + {.page_url = "active_tab_permission_test.html"})) << message_; // Open a new tab and make sure capture is denied. @@ -315,8 +314,8 @@ ExtensionTestMessageListener capture_started("tab_capture_started", false); ExtensionTestMessageListener entered_fullscreen("entered_fullscreen", false); - ASSERT_TRUE(RunExtensionTest( - {.name = "tab_capture", .page_url = "fullscreen_test.html"})) + ASSERT_TRUE( + RunExtensionTest("tab_capture", {.page_url = "fullscreen_test.html"})) << message_; EXPECT_TRUE(capture_started.WaitUntilSatisfied()); @@ -343,8 +342,8 @@ #endif IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_GrantForChromePages) { ExtensionTestMessageListener before_open_tab("ready1", true); - ASSERT_TRUE(RunExtensionTest( - {.name = "tab_capture", .page_url = "active_tab_chrome_pages.html"})) + ASSERT_TRUE(RunExtensionTest("tab_capture", + {.page_url = "active_tab_chrome_pages.html"})) << message_; EXPECT_TRUE(before_open_tab.WaitUntilSatisfied()); @@ -368,10 +367,10 @@ // Tests that a tab in incognito mode can be captured. IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, CaptureInSplitIncognitoMode) { AddExtensionToCommandLineAllowlist(); - ASSERT_TRUE(RunExtensionTest({.name = "tab_capture", - .page_url = "start_tab_capture.html", - .open_in_incognito = true}, - {.allow_in_incognito = true})) + ASSERT_TRUE(RunExtensionTest( + "tab_capture", + {.page_url = "start_tab_capture.html", .open_in_incognito = true}, + {.allow_in_incognito = true})) << message_; } @@ -379,8 +378,7 @@ // do not. IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, Constraints) { AddExtensionToCommandLineAllowlist(); - ASSERT_TRUE( - RunExtensionTest({.name = "tab_capture", .page_url = "constraints.html"})) + ASSERT_TRUE(RunExtensionTest("tab_capture", {.page_url = "constraints.html"})) << message_; } @@ -422,8 +420,8 @@ // Run an extension test that just turns on tab capture, which should cause // the indicator to turn on. AddExtensionToCommandLineAllowlist(); - ASSERT_TRUE(RunExtensionTest( - {.name = "tab_capture", .page_url = "start_tab_capture.html"})) + ASSERT_TRUE( + RunExtensionTest("tab_capture", {.page_url = "start_tab_capture.html"})) << message_; // Run the browser until the indicator turns on.
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 9e44a6e..63fad1ac 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -95,6 +95,7 @@ #include "components/prefs/scoped_user_pref_update.h" #include "components/safe_browsing/buildflags.h" #include "components/services/storage/public/mojom/indexed_db_control.mojom.h" +#include "components/services/storage/public/mojom/indexed_db_control_test.mojom.h" #include "components/services/storage/public/mojom/local_storage_control.mojom.h" #include "components/services/storage/public/mojom/storage_usage_info.mojom.h" #include "components/sync/model/string_ordinal.h"
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc index 7785d84..5bc2d64 100644 --- a/chrome/browser/extensions/extension_tab_util.cc +++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -28,6 +28,7 @@ #include "chrome/browser/resource_coordinator/tab_lifecycle_unit_external.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/recently_audible_helper.h"
diff --git a/chrome/browser/feedback/show_feedback_page.cc b/chrome/browser/feedback/show_feedback_page.cc index 249a87c..6390f93c 100644 --- a/chrome/browser/feedback/show_feedback_page.cc +++ b/chrome/browser/feedback/show_feedback_page.cc
@@ -31,6 +31,7 @@ #endif #if BUILDFLAG(IS_CHROMEOS_LACROS) +#include "chromeos/crosapi/mojom/feedback.mojom.h" #include "chromeos/lacros/lacros_service.h" #endif
diff --git a/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc b/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc index ea67c3b0..70cf099 100644 --- a/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc +++ b/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
@@ -38,6 +38,7 @@ #include "extensions/common/api/power.h" #include "extensions/common/extension.h" #include "extensions/common/extension_set.h" +#include "ui/display/types/display_constants.h" #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/public/ash_interfaces.h"
diff --git a/chrome/browser/feedback/system_logs/log_sources/crash_ids_source_unittest.cc b/chrome/browser/feedback/system_logs/log_sources/crash_ids_source_unittest.cc index 746faeed..24bfbdc 100644 --- a/chrome/browser/feedback/system_logs/log_sources/crash_ids_source_unittest.cc +++ b/chrome/browser/feedback/system_logs/log_sources/crash_ids_source_unittest.cc
@@ -59,8 +59,9 @@ TEST(CrashIdsSourceTest, CallsCrashSender) { content::BrowserTaskEnvironment task_environment; - auto setter = chromeos::DBusThreadManager::GetSetterForTesting(); - setter->SetDebugDaemonClient(std::make_unique<TestDebugDaemonClient>()); + chromeos::DBusThreadManager::Initialize(); + chromeos::DBusThreadManager::GetSetterForTesting()->SetDebugDaemonClient( + std::make_unique<TestDebugDaemonClient>()); CrashIdsSource source; source.SetUploadListForTesting(new StubUploadList());
diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc index 8b56e1e..aaf03c29 100644 --- a/chrome/browser/file_select_helper.cc +++ b/chrome/browser/file_select_helper.cc
@@ -104,6 +104,7 @@ case Result::UNCOMMON: case Result::DANGEROUS_HOST: case Result::POTENTIALLY_UNWANTED: + case Result::DANGEROUS_ACCOUNT_COMPROMISE: return false; // Safe Browsing should only return these results for client downloads, not @@ -158,7 +159,8 @@ } void FileSelectHelper::FileSelected(const base::FilePath& path, - int index, void* params) { + int index, + void* params) { FileSelectedWithExtraInfo(ui::SelectedFileInfo(path, path), index, params); } @@ -698,8 +700,7 @@ select_file_types_.get() && !select_file_types_->extensions.empty() ? 1 : 0, // 1-based index of default extension to show. - base::FilePath::StringType(), - owning_window, + base::FilePath::StringType(), owning_window, #if defined(OS_ANDROID) &accept_types); #else
diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc index fbf29367..f075a23 100644 --- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc +++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
@@ -366,6 +366,7 @@ case Result::BLOCKED_PASSWORD_PROTECTED: case Result::BLOCKED_TOO_LARGE: case Result::BLOCKED_UNSUPPORTED_FILE_TYPE: + case Result::DANGEROUS_ACCOUNT_COMPROMISE: return ChromeFileSystemAccessPermissionContext::AfterWriteCheckResult:: kBlock; @@ -723,7 +724,6 @@ return value; } - SEQUENCE_CHECKER(sequence_checker_); base::WeakPtr<ChromeFileSystemAccessPermissionContext> const context_; @@ -964,6 +964,70 @@ return existing_grant; } +// Returns non-expired persisted permissions. Active grants are ignored here, +// since persisted permissions are almost always a superset of active grants. +// The exception is when CONTENT_SETTING_ALLOW for an origin, which is only +// possible for System Web Apps. +std::vector<std::unique_ptr<permissions::ObjectPermissionContextBase::Object>> +ChromeFileSystemAccessPermissionContext::GetGrantedObjects( + const url::Origin& origin) { + std::vector<std::unique_ptr<Object>> objects = + ObjectPermissionContextBase::GetGrantedObjects(origin); + + bool is_installed_pwa = OriginIsInstalledPWA(origin); + // Filter out expired permissions. + objects.erase( + base::ranges::remove_if( + objects, + [this, &is_installed_pwa](const std::unique_ptr<Object>& object) { + auto last_activity_time = + util::ValueToTime( + object->value.FindKey(kPermissionLastUsedTimeKey)) + .value_or(base::Time::Min()); + return this->PersistentPermissionIsExpired(last_activity_time, + is_installed_pwa); + }), + objects.end()); + return objects; +} + +// Returns non-expired persisted permissions. Active grants are ignored here, +// since persisted permissions are almost always a superset of active grants. +// The exception is when CONTENT_SETTING_ALLOW for an origin, which is only +// possible for System Web Apps. +std::vector<std::unique_ptr<permissions::ObjectPermissionContextBase::Object>> +ChromeFileSystemAccessPermissionContext::GetAllGrantedObjects() { + std::vector<std::unique_ptr<Object>> objects = + GetAllGrantedOrExpiredObjects(); + + url::Origin origin; + GURL origin_as_url; + bool is_installed_pwa = false; + // Filter out expired permissions. + // Checking whether an origin has an installed PWA may be expensive. + // GetAllGrantedObjects() returns objects grouped by origin, so this should + // only check once per origin. + objects.erase(base::ranges::remove_if( + objects, + [this, &is_installed_pwa, &origin, + &origin_as_url](const std::unique_ptr<Object>& object) { + if (object->origin != origin_as_url) { + origin_as_url = object->origin; + origin = url::Origin::Create(object->origin); + is_installed_pwa = OriginIsInstalledPWA(origin); + } + auto last_activity_time = + util::ValueToTime( + object->value.FindKey(kPermissionLastUsedTimeKey)) + .value_or(base::Time::Min()); + return this->PersistentPermissionIsExpired( + last_activity_time, is_installed_pwa); + }), + objects.end()); + + return objects; +} + std::string ChromeFileSystemAccessPermissionContext::GetKeyForObject( const base::Value& object) { const auto optional_path = @@ -1419,7 +1483,7 @@ url::Origin origin; GURL origin_as_url; bool is_installed_pwa = false; - auto objects = GetAllGrantedObjects(); + auto objects = GetAllGrantedOrExpiredObjects(); for (const auto& object : objects) { // Checking whether an origin has an installed PWA may be expensive. // GetAllGrantedObjects() returns objects grouped by origin, so this should @@ -1442,7 +1506,10 @@ SCOPED_UMA_HISTOGRAM_TIMER( "Storage.FileSystemAccess.PersistedPermissions.SweepTime.Origin"); bool is_installed_pwa = OriginIsInstalledPWA(origin); - for (const auto& object : GetGrantedObjects(origin)) { + // Call the base class's version of this method, since this class overrides + // this method to filter out expired grants. + for (const auto& object : + ObjectPermissionContextBase::GetGrantedObjects(origin)) { MaybeRenewOrRevokePersistedPermission(origin, std::move(object->value), is_installed_pwa); } @@ -1526,6 +1593,11 @@ return std::move(object->value); } +std::vector<std::unique_ptr<permissions::ObjectPermissionContextBase::Object>> +ChromeFileSystemAccessPermissionContext::GetAllGrantedOrExpiredObjects() { + return ObjectPermissionContextBase::GetAllGrantedObjects(); +} + bool ChromeFileSystemAccessPermissionContext::HasPersistedPermissionForTesting( const url::Origin& origin, const base::FilePath& path,
diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h index 7396550..ec5ad28 100644 --- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h +++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h
@@ -56,6 +56,9 @@ ~ChromeFileSystemAccessPermissionContext() override; // permissions::ObjectPermissionContextBase + std::vector<std::unique_ptr<Object>> GetGrantedObjects( + const url::Origin& origin) override; + std::vector<std::unique_ptr<Object>> GetAllGrantedObjects() override; std::string GetKeyForObject(const base::Value& object) override; bool IsValidObject(const base::Value& object) override; std::u16string GetObjectDisplayName(const base::Value& object) override; @@ -138,6 +141,9 @@ void TriggerTimersForTesting(); + // Return all persisted objects, including those which have expired. + std::vector<std::unique_ptr<ObjectPermissionContextBase::Object>> + GetAllGrantedOrExpiredObjects(); void UpdatePersistedPermissionsForTesting(); bool HasPersistedPermissionForTesting(const url::Origin& origin, const base::FilePath& path,
diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context_unittest.cc b/chrome/browser/file_system_access/chrome_file_system_access_permission_context_unittest.cc index da01934c1..48b1b54 100644 --- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context_unittest.cc +++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context_unittest.cc
@@ -1305,7 +1305,7 @@ auto advance_once = Now(); // The active grant exists, so its timestamp should have been updated. permission_context()->UpdatePersistedPermissionsForTesting(); - auto objects = permission_context()->GetAllGrantedObjects(); + auto objects = permission_context()->GetAllGrantedOrExpiredObjects(); ASSERT_EQ(objects.size(), 1u); EXPECT_EQ(objects[0]->origin, kTestOrigin.GetURL()); EXPECT_EQ(util::ValueToTime(objects[0]->value.FindKey("time")), advance_once); @@ -1318,7 +1318,7 @@ kPersistentPermissionExpirationTimeoutNonPWA - base::TimeDelta::FromSeconds(1)); permission_context()->UpdatePersistedPermissionsForTesting(); - objects = permission_context()->GetAllGrantedObjects(); + objects = permission_context()->GetAllGrantedOrExpiredObjects(); ASSERT_EQ(objects.size(), 1u); EXPECT_EQ(objects[0]->origin, kTestOrigin.GetURL()); EXPECT_EQ(util::ValueToTime(objects[0]->value.FindKey("time")), advance_once); @@ -1328,14 +1328,21 @@ kPersistentPermissionExpirationTimeoutNonPWA + base::TimeDelta::FromSeconds(1)); permission_context()->UpdatePersistedPermissionsForTesting(); - objects = permission_context()->GetAllGrantedObjects(); + objects = permission_context()->GetAllGrantedOrExpiredObjects(); EXPECT_EQ(objects.size(), 1u); + // Get(All)GrantedObjects should not list permissions which are expired, + // including those in the grace period. + objects = permission_context()->GetAllGrantedObjects(); + EXPECT_EQ(objects.size(), 0u); + objects = permission_context()->GetGrantedObjects(kTestOrigin); + EXPECT_EQ(objects.size(), 0u); + Advance(ChromeFileSystemAccessPermissionContext:: kPersistentPermissionGracePeriod + base::TimeDelta::FromSeconds(1)); permission_context()->UpdatePersistedPermissionsForTesting(); - objects = permission_context()->GetAllGrantedObjects(); + objects = permission_context()->GetAllGrantedOrExpiredObjects(); EXPECT_EQ(objects.size(), 0u); } @@ -1353,7 +1360,7 @@ auto advance_once = Now(); // The active grant exists, so its timestamp should have been updated. permission_context()->UpdatePersistedPermissionsForTesting(); - auto objects = permission_context()->GetAllGrantedObjects(); + auto objects = permission_context()->GetAllGrantedOrExpiredObjects(); ASSERT_EQ(objects.size(), 1u); EXPECT_EQ(objects[0]->origin, kTestOrigin.GetURL()); EXPECT_EQ(util::ValueToTime(objects[0]->value.FindKey("time")), advance_once); @@ -1366,7 +1373,7 @@ kPersistentPermissionExpirationTimeoutNonPWA - base::TimeDelta::FromSeconds(1)); permission_context()->UpdatePersistedPermissionsForTesting(); - objects = permission_context()->GetAllGrantedObjects(); + objects = permission_context()->GetAllGrantedOrExpiredObjects(); ASSERT_EQ(objects.size(), 1u); EXPECT_EQ(objects[0]->origin, kTestOrigin.GetURL()); EXPECT_EQ(util::ValueToTime(objects[0]->value.FindKey("time")), advance_once); @@ -1376,14 +1383,21 @@ kPersistentPermissionExpirationTimeoutNonPWA + base::TimeDelta::FromSeconds(1)); permission_context()->UpdatePersistedPermissionsForTesting(); - objects = permission_context()->GetAllGrantedObjects(); + objects = permission_context()->GetAllGrantedOrExpiredObjects(); EXPECT_EQ(objects.size(), 1u); + // Get(All)GrantedObjects should not list permissions which are expired, + // including those in the grace period. + objects = permission_context()->GetAllGrantedObjects(); + EXPECT_EQ(objects.size(), 0u); + objects = permission_context()->GetGrantedObjects(kTestOrigin); + EXPECT_EQ(objects.size(), 0u); + Advance(ChromeFileSystemAccessPermissionContext:: kPersistentPermissionGracePeriod + base::TimeDelta::FromSeconds(1)); permission_context()->UpdatePersistedPermissionsForTesting(); - objects = permission_context()->GetAllGrantedObjects(); + objects = permission_context()->GetAllGrantedOrExpiredObjects(); EXPECT_EQ(objects.size(), 0u); } @@ -1431,10 +1445,20 @@ ExpectUmaEntryPersistedPermissionAge(Now() - initial_time, 1); EXPECT_EQ(PermissionStatus::GRANTED, grant2->GetStatus()); - // |grant1| should now be expired. + // |grant1| should now be expired, but not revoked. Advance(base::TimeDelta::FromSeconds(2)); EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); + objects = permission_context()->GetAllGrantedOrExpiredObjects(); + EXPECT_EQ(objects.size(), 2u); + + // Get(All)GrantedObjects only list permissions which are not expired. + objects = permission_context()->GetAllGrantedObjects(); + EXPECT_EQ(objects.size(), 1u); + objects = permission_context()->GetGrantedObjects(kTestOrigin); + EXPECT_EQ(objects.size(), 0u); + objects = permission_context()->GetGrantedObjects(kTestOrigin2); + EXPECT_EQ(objects.size(), 1u); // |grant1| should not be revoked until after the grace period. Advance(ChromeFileSystemAccessPermissionContext:: @@ -1444,13 +1468,19 @@ permission_context()->UpdatePersistedPermissionsForTesting(); // Only |grant2| should be persisted. - objects = permission_context()->GetAllGrantedObjects(); + objects = permission_context()->GetAllGrantedOrExpiredObjects(); ASSERT_EQ(objects.size(), 1u); EXPECT_EQ(objects[0]->origin, kTestOrigin2.GetURL()); EXPECT_FALSE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin, kTestPath, HandleType::kFile, GrantType::kWrite)); EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting( kTestOrigin2, kTestPath, HandleType::kFile, GrantType::kWrite)); + objects = permission_context()->GetAllGrantedObjects(); + EXPECT_EQ(objects.size(), 1u); + objects = permission_context()->GetGrantedObjects(kTestOrigin); + EXPECT_EQ(objects.size(), 0u); + objects = permission_context()->GetGrantedObjects(kTestOrigin2); + EXPECT_EQ(objects.size(), 1u); } TEST_F(ChromeFileSystemAccessPermissionContextTest, @@ -1485,7 +1515,7 @@ loop.Run(); // Only |grant2|'s timestamp should have been updated. - auto objects = permission_context()->GetAllGrantedObjects(); + auto objects = permission_context()->GetAllGrantedOrExpiredObjects(); ASSERT_EQ(objects.size(), 2u); EXPECT_EQ(objects[0]->origin, kTestOrigin.GetURL()); EXPECT_EQ(objects[1]->origin, kTestOrigin2.GetURL()); @@ -1516,7 +1546,7 @@ task_environment_.RunUntilIdle(); // The timestamp should not have been updated. - auto objects = permission_context()->GetAllGrantedObjects(); + auto objects = permission_context()->GetAllGrantedOrExpiredObjects(); ASSERT_EQ(objects.size(), 1u); EXPECT_EQ(objects[0]->origin, kTestOrigin.GetURL()); EXPECT_EQ(util::ValueToTime(objects[0]->value.FindKey("time")), initial_time); @@ -1534,7 +1564,7 @@ task_environment_.RunUntilIdle(); // The timestamp should not have been updated. - objects = permission_context()->GetAllGrantedObjects(); + objects = permission_context()->GetAllGrantedOrExpiredObjects(); ASSERT_EQ(objects.size(), 0u); // The two sweeps should have been recorded in UMA.
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index d648cd6..47e6d9b 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -1331,6 +1331,11 @@ "expiry_milestone": 82 }, { + "name": "enable-aura-window-subtree-capture", + "owners": [ "jophba" ], + "expiry_milestone": 102 + }, + { "name": "enable-auto-select", "owners": ["croissant-eng"], "expiry_milestone": 95 @@ -1691,16 +1696,6 @@ "expiry_milestone": 92 }, { - "name": "enable-ephemeral-tab", - "owners": [ "donnd", "jinsukkim" ], - "expiry_milestone": 92 - }, - { - "name": "enable-ephemeral-tab-bottom-sheet", - "owners": [ "donnd", "jinsukkim" ], - "expiry_milestone": 92 - }, - { "name": "enable-experimental-accessibility-dictation-extension", "owners": [ "akihiroota" ], "expiry_milestone": 92 @@ -4318,6 +4313,11 @@ "expiry_milestone": 99 }, { + "name": "pwa-update-dialog-for-name-and-icon", + "owners": [ "finnur", "beverloo" ], + "expiry_milestone": 99 + }, + { "name": "query-tiles", "owners": [ "shaktisahu", "qinmin" ], "expiry_milestone": 93
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 359f0dc..85ea603 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -2071,6 +2071,12 @@ "Pull-to-refresh gesture in response to vertical overscroll."; const char kPullToRefreshEnabledTouchscreen[] = "Enabled for touchscreen only"; +const char kPwaUpdateDialogForNameAndIconName[] = + "Enable PWA install update dialog for name/icon changes"; +const char kPwaUpdateDialogForNameAndIconDescription[] = + "Enable a confirmation dialog that shows up when a PWA changes its " + "icon/name"; + const char kQuicName[] = "Experimental QUIC protocol"; const char kQuicDescription[] = "Enable experimental QUIC protocol support."; @@ -3013,12 +3019,6 @@ const char kEnableUseAaudioDriverDescription[] = "Enable the use of AAudio, if supported by the current Android version."; -const char kEphemeralTabUsingBottomSheetName[] = - "An ephemeral Preview Tab using the bottom sheet"; -const char kEphemeralTabUsingBottomSheetDescription[] = - "Enable a 'Preview page/image' at a linked page into the bottom sheet. " - "No other flags are needed for this feature."; - const char kExploreSitesName[] = "Explore websites"; const char kExploreSitesDescription[] = "Enables portal from new tab page to explore websites."; @@ -5133,6 +5133,13 @@ "Enables additional keyboard shortcuts to help debugging."; #endif +#if BUILDFLAG(IS_CHROMEOS_ASH) +const char kAuraWindowSubtreeCaptureName[] = "ChromeOS Window Subtree Capture"; +const char kAuraWindowSubtreeCaptureDescription[] = + "Enables capture of ChromeOS Aura windows using subtree capture. When " + "disabled, the legacy slow capturer will be used."; +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + #if defined(WEBRTC_USE_PIPEWIRE) const char kWebrtcPipeWireCapturerName[] = "WebRTC PipeWire support"; const char kWebrtcPipeWireCapturerDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index e203545..14ece75 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -1195,6 +1195,9 @@ extern const char kPullToRefreshDescription[]; extern const char kPullToRefreshEnabledTouchscreen[]; +extern const char kPwaUpdateDialogForNameAndIconName[]; +extern const char kPwaUpdateDialogForNameAndIconDescription[]; + extern const char kQuicName[]; extern const char kQuicDescription[]; @@ -1743,9 +1746,6 @@ extern const char kEnableUseAaudioDriverName[]; extern const char kEnableUseAaudioDriverDescription[]; -extern const char kEphemeralTabUsingBottomSheetName[]; -extern const char kEphemeralTabUsingBottomSheetDescription[]; - extern const char kExploreSitesName[]; extern const char kExploreSitesDescription[]; @@ -3021,6 +3021,11 @@ extern const char kUIDebugToolsDescription[]; #endif +#if BUILDFLAG(IS_CHROMEOS_ASH) +extern const char kAuraWindowSubtreeCaptureName[]; +extern const char kAuraWindowSubtreeCaptureDescription[]; +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + #if defined(WEBRTC_USE_PIPEWIRE) extern const char kWebrtcPipeWireCapturerName[]; extern const char kWebrtcPipeWireCapturerDescription[];
diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc index f0c14581..d0b89b9 100644 --- a/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chrome/browser/flags/android/chrome_feature_list.cc
@@ -195,7 +195,6 @@ &kDownloadRename, &kDuetTabStripIntegrationAndroid, &kEnhancedProtectionPromoCard, - &kEphemeralTabUsingBottomSheet, &kExperimentsForAgsa, &kExploreSites, &kFocusOmniboxInIncognitoTabIntents, @@ -215,6 +214,7 @@ &kOmniboxSpareRenderer, &kPageAnnotationsService, &kProbabilisticCryptidRenderer, + &kPwaUpdateDialogForNameAndIcon, &kReachedCodeProfiler, &kReaderModeInCCT, &kReengagementNotification, @@ -540,9 +540,6 @@ const base::Feature kEnhancedProtectionPromoCard{ "EnhancedProtectionPromoCard", base::FEATURE_DISABLED_BY_DEFAULT}; -const base::Feature kEphemeralTabUsingBottomSheet{ - "EphemeralTabUsingBottomSheet", base::FEATURE_DISABLED_BY_DEFAULT}; - const base::Feature kExperimentsForAgsa{"ExperimentsForAgsa", base::FEATURE_ENABLED_BY_DEFAULT}; @@ -599,6 +596,9 @@ const base::Feature kProbabilisticCryptidRenderer{ "ProbabilisticCryptidRenderer", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kPwaUpdateDialogForNameAndIcon{ + "PwaUpdateDialogForNameAndIcon", base::FEATURE_DISABLED_BY_DEFAULT}; + const base::Feature kReachedCodeProfiler{"ReachedCodeProfiler", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/browser/flags/android/chrome_feature_list.h b/chrome/browser/flags/android/chrome_feature_list.h index 4b7aba1..6936959a 100644 --- a/chrome/browser/flags/android/chrome_feature_list.h +++ b/chrome/browser/flags/android/chrome_feature_list.h
@@ -80,7 +80,6 @@ extern const base::Feature kDownloadRename; extern const base::Feature kDuetTabStripIntegrationAndroid; extern const base::Feature kEnhancedProtectionPromoCard; -extern const base::Feature kEphemeralTabUsingBottomSheet; extern const base::Feature kExperimentsForAgsa; extern const base::Feature kExploreSites; extern const base::Feature kFocusOmniboxInIncognitoTabIntents; @@ -101,6 +100,7 @@ extern const base::Feature kOfflineMeasurementsBackgroundTask; extern const base::Feature kOmniboxSpareRenderer; extern const base::Feature kPageAnnotationsService; +extern const base::Feature kPwaUpdateDialogForNameAndIcon; extern const base::Feature kProbabilisticCryptidRenderer; extern const base::Feature kReachedCodeProfiler; extern const base::Feature kReengagementNotification;
diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java index d93b24d7..c6e2d6f 100644 --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java
@@ -335,7 +335,6 @@ public static final String EDIT_PASSWORDS_IN_SETTINGS = "EditPasswordsInSettings"; public static final String EARLY_LIBRARY_LOAD = "EarlyLibraryLoad"; public static final String ENHANCED_PROTECTION_PROMO_CARD = "EnhancedProtectionPromoCard"; - public static final String EPHEMERAL_TAB_USING_BOTTOM_SHEET = "EphemeralTabUsingBottomSheet"; public static final String EXPERIMENTS_FOR_AGSA = "ExperimentsForAgsa"; public static final String EXPLICIT_LANGUAGE_ASK = "ExplicitLanguageAsk"; public static final String EXPLORE_SITES = "ExploreSites"; @@ -420,6 +419,8 @@ public static final String PRIVACY_SANDBOX_SETTINGS_2 = "PrivacySandboxSettings2"; public static final String PROBABILISTIC_CRYPTID_RENDERER = "ProbabilisticCryptidRenderer"; public static final String PWA_INSTALL_USE_BOTTOMSHEET = "PwaInstallUseBottomSheet"; + public static final String PWA_UPDATE_DIALOG_FOR_NAME_AND_ICON = + "PwaUpdateDialogForNameAndIcon"; public static final String QUERY_TILES_GEO_FILTER = "QueryTilesGeoFilter"; public static final String QUERY_TILES = "QueryTiles"; public static final String QUERY_TILES_IN_NTP = "QueryTilesInNTP";
diff --git a/chrome/browser/lacros/browser_test_util.cc b/chrome/browser/lacros/browser_test_util.cc index 7a61ea9..08f0dac 100644 --- a/chrome/browser/lacros/browser_test_util.cc +++ b/chrome/browser/lacros/browser_test_util.cc
@@ -8,6 +8,7 @@ #include "base/run_loop.h" #include "base/time/time.h" #include "base/timer/timer.h" +#include "chromeos/crosapi/mojom/test_controller.mojom.h" #include "chromeos/lacros/lacros_service.h" #include "ui/aura/env.h" #include "ui/aura/window.h"
diff --git a/chrome/browser/lacros/web_contents_can_go_back_observer_browsertest.cc b/chrome/browser/lacros/web_contents_can_go_back_observer_browsertest.cc index 669eda4..df78beb 100644 --- a/chrome/browser/lacros/web_contents_can_go_back_observer_browsertest.cc +++ b/chrome/browser/lacros/web_contents_can_go_back_observer_browsertest.cc
@@ -12,6 +12,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "chromeos/crosapi/mojom/clipboard.mojom.h" +#include "chromeos/crosapi/mojom/test_controller.mojom.h" #include "chromeos/lacros/lacros_service.h" #include "content/public/test/browser_test.h" #include "mojo/public/cpp/bindings/sync_call_restrictions.h"
diff --git a/chrome/browser/locale/java/src/org/chromium/chrome/browser/locale/LocaleManagerDelegate.java b/chrome/browser/locale/java/src/org/chromium/chrome/browser/locale/LocaleManagerDelegate.java index 88da6ecc..746dfcf7 100644 --- a/chrome/browser/locale/java/src/org/chromium/chrome/browser/locale/LocaleManagerDelegate.java +++ b/chrome/browser/locale/java/src/org/chromium/chrome/browser/locale/LocaleManagerDelegate.java
@@ -84,7 +84,11 @@ mSearchEnginePromoCompleted = state == SearchEnginePromoState.CHECKED_AND_SHOWN; } - void setDefaulSearchEngineDelegate(DefaultSearchEngineDialogHelper.Delegate delegate) { + /** + * Sets the delegate for {@link DefaultSearchEngineDialogHelper}. + * @param delegate Delegate used to select/notify the default search engine. + */ + public void setDefaulSearchEngineDelegate(DefaultSearchEngineDialogHelper.Delegate delegate) { mSearchEngineHelperDelegate = delegate; }
diff --git a/chrome/browser/lookalikes/lookalike_url_navigation_throttle_browsertest.cc b/chrome/browser/lookalikes/lookalike_url_navigation_throttle_browsertest.cc index 45787c3..a8ff22cf 100644 --- a/chrome/browser/lookalikes/lookalike_url_navigation_throttle_browsertest.cc +++ b/chrome/browser/lookalikes/lookalike_url_navigation_throttle_browsertest.cc
@@ -29,6 +29,7 @@ #include "components/lookalikes/core/features.h" #include "components/lookalikes/core/lookalike_url_util.h" #include "components/network_session_configurator/common/network_switches.h" +#include "components/omnibox/browser/location_bar_model.h" #include "components/reputation/core/safety_tip_test_utils.h" #include "components/reputation/core/safety_tips_config.h" #include "components/security_interstitials/content/security_interstitial_page.h"
diff --git a/chrome/browser/media/cast_mirroring_service_host.cc b/chrome/browser/media/cast_mirroring_service_host.cc index 37aef84..630dfde 100644 --- a/chrome/browser/media/cast_mirroring_service_host.cc +++ b/chrome/browser/media/cast_mirroring_service_host.cc
@@ -36,6 +36,8 @@ #include "content/public/browser/service_process_host.h" #include "content/public/browser/video_capture_device_launcher.h" #include "content/public/browser/web_contents.h" +#include "media/audio/audio_device_description.h" +#include "media/mojo/mojom/audio_input_stream.mojom.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/network/public/mojom/network_context.mojom.h" #include "services/network/public/mojom/network_service.mojom.h"
diff --git a/chrome/browser/media/media_engagement_browsertest.cc b/chrome/browser/media/media_engagement_browsertest.cc index 7c337db..c49d4b6 100644 --- a/chrome/browser/media/media_engagement_browsertest.cc +++ b/chrome/browser/media/media_engagement_browsertest.cc
@@ -29,6 +29,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/recently_audible_helper.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/test/base/in_process_browser_test.h"
diff --git a/chrome/browser/media/router/providers/cast/mirroring_activity.h b/chrome/browser/media/router/providers/cast/mirroring_activity.h index a04436e..1c328799 100644 --- a/chrome/browser/media/router/providers/cast/mirroring_activity.h +++ b/chrome/browser/media/router/providers/cast/mirroring_activity.h
@@ -14,6 +14,7 @@ #include "chrome/browser/media/router/providers/cast/cast_session_tracker.h" #include "components/cast_channel/cast_message_handler.h" #include "components/media_router/common/media_route.h" +#include "components/media_router/common/mojom/logger.mojom.h" #include "components/media_router/common/mojom/media_router.mojom-forward.h" #include "components/mirroring/mojom/cast_message_channel.mojom.h" #include "components/mirroring/mojom/mirroring_service_host.mojom.h"
diff --git a/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.h b/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.h index 7a98c5d6..b78267f 100644 --- a/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.h +++ b/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.h
@@ -18,6 +18,7 @@ #include "chrome/browser/media/router/providers/wired_display/wired_display_presentation_receiver.h" #include "components/media_router/common/media_route_provider_helper.h" #include "components/media_router/common/mojom/media_router.mojom.h" +#include "components/media_router/common/mojom/media_status.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h"
diff --git a/chrome/browser/media/router/test/media_router_mojo_test.h b/chrome/browser/media/router/test/media_router_mojo_test.h index 828d3eb..81d3581 100644 --- a/chrome/browser/media/router/test/media_router_mojo_test.h +++ b/chrome/browser/media/router/test/media_router_mojo_test.h
@@ -18,6 +18,7 @@ #include "chrome/test/base/testing_profile.h" #include "components/media_router/browser/test/mock_media_router.h" #include "components/media_router/common/mojom/media_router.mojom.h" +#include "components/media_router/common/mojom/media_status.mojom.h" #include "content/public/test/browser_task_environment.h" #include "extensions/browser/event_page_tracker.h" #include "extensions/common/extension.h"
diff --git a/chrome/browser/nearby_sharing/fake_nearby_connections_manager.cc b/chrome/browser/nearby_sharing/fake_nearby_connections_manager.cc index 0f0ffbb0..eac0878 100644 --- a/chrome/browser/nearby_sharing/fake_nearby_connections_manager.cc +++ b/chrome/browser/nearby_sharing/fake_nearby_connections_manager.cc
@@ -3,7 +3,9 @@ // found in the LICENSE file. #include "chrome/browser/nearby_sharing/fake_nearby_connections_manager.h" + #include "base/containers/contains.h" +#include "base/threading/thread_restrictions.h" FakeNearbyConnectionsManager::FakeNearbyConnectionsManager() = default;
diff --git a/chrome/browser/nearby_sharing/nearby_sharing_service_impl.cc b/chrome/browser/nearby_sharing/nearby_sharing_service_impl.cc index 020e43c..5e70c43b 100644 --- a/chrome/browser/nearby_sharing/nearby_sharing_service_impl.cc +++ b/chrome/browser/nearby_sharing/nearby_sharing_service_impl.cc
@@ -47,6 +47,7 @@ #include "chrome/services/sharing/public/cpp/advertisement.h" #include "chrome/services/sharing/public/cpp/conversions.h" #include "chromeos/services/nearby/public/mojom/nearby_connections_types.mojom.h" +#include "chromeos/services/nearby/public/mojom/nearby_decoder.mojom.h" #include "chromeos/services/nearby/public/mojom/nearby_share_target_types.mojom.h" #include "components/prefs/pref_service.h" #include "content/public/browser/download_manager.h"
diff --git a/chrome/browser/net/private_network_access_browsertest.cc b/chrome/browser/net/private_network_access_browsertest.cc index 480194a..41308ea 100644 --- a/chrome/browser/net/private_network_access_browsertest.cc +++ b/chrome/browser/net/private_network_access_browsertest.cc
@@ -378,10 +378,10 @@ base::test::ScopedFeatureList features_; }; -// This test verifies that private network requests that are blocked do not -// result in a WebFeature being use-counted. +// This test verifies that private network requests that are blocked result in +// a WebFeature being use-counted. IN_PROC_BROWSER_TEST_F(PrivateNetworkAccessWithFeatureEnabledBrowserTest, - DoesNotRecordAddressSpaceFeatureForBlockedRequests) { + RecordsAddressSpaceFeatureForBlockedRequests) { base::HistogramTester histogram_tester; std::unique_ptr<net::EmbeddedTestServer> server = NewServer(); @@ -392,7 +392,10 @@ )")); EXPECT_TRUE(NavigateAndFlushHistograms()); - EXPECT_THAT(GetAddressSpaceFeatureBucketCounts(histogram_tester), IsEmpty()); + EXPECT_THAT( + GetAddressSpaceFeatureBucketCounts(histogram_tester), + ElementsAre(Pair( + WebFeature::kAddressSpacePublicNonSecureContextEmbeddedLocal, 1))); } // This test verifies that the chrome-untrusted:// scheme is considered local
diff --git a/chrome/browser/net/system_network_context_manager.h b/chrome/browser/net/system_network_context_manager.h index ba2ab4b9..7253080 100644 --- a/chrome/browser/net/system_network_context_manager.h +++ b/chrome/browser/net/system_network_context_manager.h
@@ -22,6 +22,7 @@ #include "services/network/public/mojom/network_context.mojom.h" #include "services/network/public/mojom/network_service.mojom-forward.h" #include "services/network/public/mojom/ssl_config.mojom-forward.h" +#include "services/network/public/mojom/url_loader_factory.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" class PrefRegistrySimple;
diff --git a/chrome/browser/notifications/platform_notification_service_interactive_uitest.cc b/chrome/browser/notifications/platform_notification_service_interactive_uitest.cc index a76a63c8..2cd4bfa 100644 --- a/chrome/browser/notifications/platform_notification_service_interactive_uitest.cc +++ b/chrome/browser/notifications/platform_notification_service_interactive_uitest.cc
@@ -32,6 +32,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_features.h" #include "chrome/test/base/in_process_browser_test.h"
diff --git a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc index 90cb969b..71ea49e 100644 --- a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc +++ b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
@@ -45,6 +45,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
diff --git a/chrome/browser/password_check/android/internal/java/src/org/chromium/chrome/browser/password_check/helper/PasswordCheckChangePasswordHelper.java b/chrome/browser/password_check/android/internal/java/src/org/chromium/chrome/browser/password_check/helper/PasswordCheckChangePasswordHelper.java index 00ba36f27..e779360 100644 --- a/chrome/browser/password_check/android/internal/java/src/org/chromium/chrome/browser/password_check/helper/PasswordCheckChangePasswordHelper.java +++ b/chrome/browser/password_check/android/internal/java/src/org/chromium/chrome/browser/password_check/helper/PasswordCheckChangePasswordHelper.java
@@ -36,6 +36,8 @@ private static final String INTENT = "PASSWORD_CHANGE"; private static final String START_IMMEDIATELY_PARAMETER = "START_IMMEDIATELY"; private static final String ORIGINAL_DEEPLINK_PARAMETER = "ORIGINAL_DEEPLINK"; + private static final String CALLER_PARAMETER = "CALLER"; + private static final int IN_CHROME_CALLER = 7; private static final String ENCODING = "UTF-8"; @@ -137,6 +139,7 @@ intent.putExtra(AUTOFILL_ASSISTANT_ENABLED_KEY, true); intent.putExtra(AUTOFILL_ASSISTANT_PACKAGE + INTENT_PARAMETER, INTENT); intent.putExtra(AUTOFILL_ASSISTANT_PACKAGE + START_IMMEDIATELY_PARAMETER, true); + intent.putExtra(AUTOFILL_ASSISTANT_PACKAGE + CALLER_PARAMETER, IN_CHROME_CALLER); // Note: All string-typed parameters must be URL-encoded, because the // corresponding extraction logic will URL-*de*code them before use, // see TriggerContext.java.
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc index fb7d2e8f..697c53c 100644 --- a/chrome/browser/password_manager/chrome_password_manager_client.cc +++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
@@ -932,9 +932,9 @@ void ChromePasswordManagerClient::AutomaticGenerationAvailable( const autofill::password_generation::PasswordGenerationUIData& ui_data) { - if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( + if (!password_manager::bad_message::CheckChildProcessSecurityPolicyForURL( password_generation_driver_receivers_.GetCurrentTargetFrame(), - base::make_span(&ui_data.form_data, 1), + ui_data.form_data.url, BadMessageReason:: CPMD_BAD_ORIGIN_AUTOMATIC_GENERATION_STATUS_CHANGED)) return; @@ -980,9 +980,9 @@ const autofill::FormData& form_data, autofill::FieldRendererId field_renderer_id, const std::u16string& password_value) { - if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( + if (!password_manager::bad_message::CheckChildProcessSecurityPolicyForURL( password_generation_driver_receivers_.GetCurrentTargetFrame(), - base::make_span(&form_data, 1), + form_data.url, BadMessageReason::CPMD_BAD_ORIGIN_SHOW_PASSWORD_EDITING_POPUP)) return; auto* driver = driver_factory_->GetDriverForFrame( @@ -1013,9 +1013,9 @@ void ChromePasswordManagerClient::PresaveGeneratedPassword( const autofill::FormData& form_data, const std::u16string& password_value) { - if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( + if (!password_manager::bad_message::CheckChildProcessSecurityPolicyForURL( password_generation_driver_receivers_.GetCurrentTargetFrame(), - base::make_span(&form_data, 1), + form_data.url, BadMessageReason::CPMD_BAD_ORIGIN_PRESAVE_GENERATED_PASSWORD)) { return; } @@ -1030,9 +1030,9 @@ void ChromePasswordManagerClient::PasswordNoLongerGenerated( const autofill::FormData& form_data) { - if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( + if (!password_manager::bad_message::CheckChildProcessSecurityPolicyForURL( password_generation_driver_receivers_.GetCurrentTargetFrame(), - base::make_span(&form_data, 1), + form_data.url, BadMessageReason::CPMD_BAD_ORIGIN_PASSWORD_NO_LONGER_GENERATED)) { return; }
diff --git a/chrome/browser/payments/secure_payment_confirmation_browsertest.cc b/chrome/browser/payments/secure_payment_confirmation_browsertest.cc index 8f0f81d..5ce362bc 100644 --- a/chrome/browser/payments/secure_payment_confirmation_browsertest.cc +++ b/chrome/browser/payments/secure_payment_confirmation_browsertest.cc
@@ -41,6 +41,7 @@ #include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_response.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/mojom/payments/payment_handler_host.mojom.h" namespace payments { namespace {
diff --git a/chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.cc b/chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.cc index b264d43..f993f92 100644 --- a/chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.cc +++ b/chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.cc
@@ -24,6 +24,7 @@ #include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/system/data_pipe.h" #include "services/network/public/mojom/content_security_policy.mojom.h" +#include "services/network/public/mojom/url_loader.mojom.h" #include "services/network/public/mojom/url_response_head.mojom.h" #include "third_party/blink/public/mojom/loader/transferrable_url_loader.mojom.h"
diff --git a/chrome/browser/policy/chrome_browser_policy_connector.cc b/chrome/browser/policy/chrome_browser_policy_connector.cc index 16846c2..f41ee18a 100644 --- a/chrome/browser/policy/chrome_browser_policy_connector.cc +++ b/chrome/browser/policy/chrome_browser_policy_connector.cc
@@ -169,7 +169,7 @@ base::flat_set<std::string> ChromeBrowserPolicyConnector::device_affiliation_ids() const { -#if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#if !BUILDFLAG(IS_CHROMEOS_ASH) if (!machine_level_user_cloud_policy_manager_ || !machine_level_user_cloud_policy_manager_->IsClientRegistered() || !machine_level_user_cloud_policy_manager_->core() || @@ -184,7 +184,7 @@ return {ids.begin(), ids.end()}; #else return {}; -#endif // !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) +#endif // !BUILDFLAG(IS_CHROMEOS_ASH) } std::vector<std::unique_ptr<policy::ConfigurationPolicyProvider>>
diff --git a/chrome/browser/prefetch/search_prefetch/search_prefetch_service_browsertest.cc b/chrome/browser/prefetch/search_prefetch/search_prefetch_service_browsertest.cc index 9b89f19..0e9aa13 100644 --- a/chrome/browser/prefetch/search_prefetch/search_prefetch_service_browsertest.cc +++ b/chrome/browser/prefetch/search_prefetch/search_prefetch_service_browsertest.cc
@@ -48,6 +48,7 @@ #include "content/public/test/browsing_data_remover_test_util.h" #include "content/public/test/content_mock_cert_verifier.h" #include "content/public/test/test_navigation_observer.h" +#include "net/base/url_util.h" #include "net/dns/mock_host_resolver.h" #include "net/http/http_status_code.h" #include "net/test/embedded_test_server/default_handlers.h"
diff --git a/chrome/browser/printing/cloud_print/privet_notifications.cc b/chrome/browser/printing/cloud_print/privet_notifications.cc index 2e319f2..ca87788 100644 --- a/chrome/browser/printing/cloud_print/privet_notifications.cc +++ b/chrome/browser/printing/cloud_print/privet_notifications.cc
@@ -25,6 +25,7 @@ #include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
diff --git a/chrome/browser/printing/print_backend_service_manager.cc b/chrome/browser/printing/print_backend_service_manager.cc index b9b7a65..9978d26 100644 --- a/chrome/browser/printing/print_backend_service_manager.cc +++ b/chrome/browser/printing/print_backend_service_manager.cc
@@ -6,6 +6,7 @@ #include <string> +#include "base/bind.h" #include "base/containers/flat_map.h" #include "base/containers/flat_set.h" #include "base/logging.h" @@ -57,7 +58,7 @@ } RemotesMap& remote = - sandbox_service_ ? sandbox_remotes_ : unsandboxed_remotes_; + sandbox_service_ ? sandboxed_remotes_ : unsandboxed_remotes_; std::string remote_id; #if defined(OS_WIN) // Windows drivers are not thread safe. Use a process per driver to prevent @@ -85,11 +86,13 @@ .Pass()); // Ensure that if the interface is ever disconnected (e.g. the service - // process crashes) or goes idle for a short period of time -- meaning - // there are no in-flight messages and no other interfaces bound through - // this one -- then we will reset `remote`, causing the service process to - // be terminated if it isn't already. - service.reset_on_disconnect(); + // process crashes) then we will drop our handle to the remote. + // Safe to use base::Unretained(this) since `this` is a global singleton + // which never goes away. + service.set_disconnect_handler( + base::BindOnce(&PrintBackendServiceManager::OnRemoteDisconnected, + base::Unretained(this), sandbox_service_, remote_id)); + // TODO(crbug.com/809738) Interactions with the service should be expected // as long as any Print Preview dialogs are open (and there could be more // than one preview open at a time). Keeping the service present as long @@ -98,7 +101,13 @@ // forever we make it go away after a short delay of idleness, but that // should be adjusted to happen only after all UI references have been // removed. - service.reset_on_idle_timeout(kResetOnIdleTimeout); + // Safe to use base::Unretained(this) since `this` is a global singleton + // which never goes away. + service.set_idle_handler( + kResetOnIdleTimeout, + base::BindRepeating(&PrintBackendServiceManager::OnIdleTimeout, + base::Unretained(this), sandbox_service_, + remote_id)); // Initialize the new service for the desired locale. service->Init(locale); @@ -107,6 +116,31 @@ return service; } +void PrintBackendServiceManager::OnIdleTimeout(bool sandboxed, + const std::string& remote_id) { + DVLOG(1) << "Print Backend service idle timeout for " + << (sandboxed ? "sandboxed" : "unsandboxed") << " remote id " + << remote_id; + if (sandboxed) { + sandboxed_remotes_.erase(remote_id); + } else { + unsandboxed_remotes_.erase(remote_id); + } +} + +void PrintBackendServiceManager::OnRemoteDisconnected( + bool sandboxed, + const std::string& remote_id) { + DVLOG(1) << "Print Backend service disconnected for " + << (sandboxed ? "sandboxed" : "unsandboxed") << " remote id " + << remote_id; + if (sandboxed) { + sandboxed_remotes_.erase(remote_id); + } else { + unsandboxed_remotes_.erase(remote_id); + } +} + bool PrintBackendServiceManager::PrinterDriverRequiresElevatedPrivilege( const std::string& printer_name) const { return drivers_requiring_elevated_privilege_.contains(printer_name);
diff --git a/chrome/browser/printing/print_backend_service_manager.h b/chrome/browser/printing/print_backend_service_manager.h index 0b2bb110..abe995f 100644 --- a/chrome/browser/printing/print_backend_service_manager.h +++ b/chrome/browser/printing/print_backend_service_manager.h
@@ -64,12 +64,22 @@ PrintBackendServiceManager(); ~PrintBackendServiceManager(); + // Callback when predetermined idle timeout occurs indicating no in-flight + // messages for a short period of time. `sandboxed` is used to distinguish + // which mapping of remotes the timeout applies to. + void OnIdleTimeout(bool sandboxed, const std::string& remote_id); + + // Callback when service has disconnected (e.g., process crashes). + // `sandboxed` is used to distinguish which mapping of remotes the + // disconnection applies to. + void OnRemoteDisconnected(bool sandboxed, const std::string& remote_id); + using RemotesMap = base::flat_map<std::string, mojo::Remote<printing::mojom::PrintBackendService>>; // Keep separate mapping of remotes for sandboxed vs. unsandboxed services. - RemotesMap sandbox_remotes_; + RemotesMap sandboxed_remotes_; RemotesMap unsandboxed_remotes_; // Track if next service started should be sandboxed.
diff --git a/chrome/browser/privacy_sandbox/android/BUILD.gn b/chrome/browser/privacy_sandbox/android/BUILD.gn index 39f2b28..9ce5ebf 100644 --- a/chrome/browser/privacy_sandbox/android/BUILD.gn +++ b/chrome/browser/privacy_sandbox/android/BUILD.gn
@@ -56,7 +56,6 @@ sources = [ "java/res/drawable-night/privacy_sandbox_illustration.xml", "java/res/drawable/privacy_sandbox_illustration.xml", - "java/res/layout/floc_button.xml", "java/res/layout/privacy_sandbox_header.xml", "java/res/values/dimens.xml", "java/res/xml/floc_preferences.xml",
diff --git a/chrome/browser/privacy_sandbox/android/java/res/layout/floc_button.xml b/chrome/browser/privacy_sandbox/android/java/res/layout/floc_button.xml deleted file mode 100644 index bc3ce99..0000000 --- a/chrome/browser/privacy_sandbox/android/java/res/layout/floc_button.xml +++ /dev/null
@@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2021 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. ---> - -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:gravity="start" - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:orientation="horizontal"> - - <org.chromium.ui.widget.ButtonCompat - android:id="@+id/floc_reset_button" - style="@style/FilledButton.Flat" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_margin="@dimen/floc_button_margin" - android:focusable="true" - android:text="@string/privacy_sandbox_floc_reset_button" /> - -</LinearLayout>
diff --git a/chrome/browser/privacy_sandbox/android/java/res/values/dimens.xml b/chrome/browser/privacy_sandbox/android/java/res/values/dimens.xml index d568c90..4a865aa 100644 --- a/chrome/browser/privacy_sandbox/android/java/res/values/dimens.xml +++ b/chrome/browser/privacy_sandbox/android/java/res/values/dimens.xml
@@ -4,7 +4,6 @@ found in the LICENSE file. --> <resources> - <dimen name="floc_button_margin">16dp</dimen> <dimen name="privacy_sandbox_illustration_height">120dp</dimen> <dimen name="privacy_sandbox_illustration_width">120dp</dimen> </resources>
diff --git a/chrome/browser/privacy_sandbox/android/java/res/xml/floc_preferences.xml b/chrome/browser/privacy_sandbox/android/java/res/xml/floc_preferences.xml index 8276a5f..da51ebd0 100644 --- a/chrome/browser/privacy_sandbox/android/java/res/xml/floc_preferences.xml +++ b/chrome/browser/privacy_sandbox/android/java/res/xml/floc_preferences.xml
@@ -32,4 +32,8 @@ android:summary="@string/privacy_sandbox_floc_reset_description" app:allowDividerBelow="false" /> + <org.chromium.components.browser_ui.settings.ButtonPreference + android:key="reset_floc_button" + app:allowDividerBelow="false" /> + </PreferenceScreen>
diff --git a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/FlocSettingsFragment.java b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/FlocSettingsFragment.java index 2deebfb2..546fe6b 100644 --- a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/FlocSettingsFragment.java +++ b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/FlocSettingsFragment.java
@@ -4,24 +4,44 @@ package org.chromium.chrome.browser.privacy_sandbox; +import android.content.Intent; +import android.net.Uri; import android.os.Bundle; +import android.provider.Browser; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; +import androidx.browser.customtabs.CustomTabsIntent; +import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; +import org.chromium.base.IntentUtils; +import org.chromium.components.browser_ui.settings.ChromeSwitchPreference; import org.chromium.components.browser_ui.settings.SettingsUtils; +import org.chromium.ui.text.NoUnderlineClickableSpan; +import org.chromium.ui.text.SpanApplier; +import org.chromium.ui.text.SpanApplier.SpanInfo; +import org.chromium.ui.widget.ButtonCompat; /** * Settings fragment for FLoC settings as part of Privacy Sandbox. */ -public class FlocSettingsFragment extends PreferenceFragmentCompat { +public class FlocSettingsFragment extends PreferenceFragmentCompat + implements Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener { + public static final String FLOC_REGIONS_DEFAULT_URL = "https://www.privacysandbox.com"; + public static final String FLOC_DESCRIPTION = "floc_description"; + public static final String FLOC_TOGGLE = "floc_toggle"; public static final String FLOC_STATUS = "floc_status"; public static final String FLOC_GROUP = "floc_group"; public static final String FLOC_UPDATE = "floc_update"; + public static final String RESET_FLOC_BUTTON = "reset_floc_button"; + + private PrivacySandboxHelpers.CustomTabIntentHelper mCustomTabHelper; + private PrivacySandboxHelpers.TrustedIntentHelper mTrustedIntentHelper; + private ButtonCompat mResetButton; /** * Initializes all the objects related to the preferences page. @@ -31,29 +51,84 @@ // Add all preferences and set the title. getActivity().setTitle(R.string.prefs_privacy_sandbox_floc); SettingsUtils.addPreferencesFromResource(this, R.xml.floc_preferences); - findPreference(FLOC_DESCRIPTION).setSummary(R.string.privacy_sandbox_floc_description); + findPreference(FLOC_DESCRIPTION) + .setSummary(SpanApplier.applySpans( + getContext().getString(R.string.privacy_sandbox_floc_description), + new SpanInfo("<link>", "</link>", + new NoUnderlineClickableSpan(getContext().getResources(), + (widget) -> openUrlInCct(getFlocRegionsUrl()))))); + // Configure the toggle. + ChromeSwitchPreference flocToggle = (ChromeSwitchPreference) findPreference(FLOC_TOGGLE); + flocToggle.setOnPreferenceChangeListener(this); + flocToggle.setChecked(PrivacySandboxBridge.isFlocEnabled()); + // Configure the reset button. + Preference resetButton = findPreference(RESET_FLOC_BUTTON); + resetButton.setOnPreferenceClickListener(this); + resetButton.setTitle(R.string.privacy_sandbox_floc_reset_button); + updateInformation(); } @Override - public View onCreateView( - LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - LinearLayout view = - (LinearLayout) super.onCreateView(inflater, container, savedInstanceState); - // Add a button to the bottom of the preferences view. - LinearLayout buttonView = - (LinearLayout) inflater.inflate(R.layout.floc_button, view, false); - view.addView(buttonView); - return view; + public boolean onPreferenceChange(Preference preference, Object newValue) { + String key = preference.getKey(); + if (!FLOC_TOGGLE.equals(key)) return true; + boolean enabled = (boolean) newValue; + PrivacySandboxBridge.setFlocEnabled(enabled); + updateInformation(); + return true; + } + + @Override + public boolean onPreferenceClick(Preference preference) { + String key = preference.getKey(); + if (!RESET_FLOC_BUTTON.equals(key)) return true; + PrivacySandboxBridge.resetFlocId(); + updateInformation(); + return true; + } + + /** + * Set the necessary CCT helpers to be able to natively open links. This is needed because the + * helpers are not modularized. + */ + public void setCctHelpers(PrivacySandboxHelpers.CustomTabIntentHelper tabHelper, + PrivacySandboxHelpers.TrustedIntentHelper intentHelper) { + mCustomTabHelper = tabHelper; + mTrustedIntentHelper = intentHelper; } private void updateInformation() { + findPreference(RESET_FLOC_BUTTON).setEnabled(PrivacySandboxBridge.isFlocIdResettable()); + findPreference(FLOC_STATUS) .setSummary(getContext().getString(R.string.privacy_sandbox_floc_status_title) + "\n" + PrivacySandboxBridge.getFlocStatusString()); findPreference(FLOC_GROUP) .setSummary(getContext().getString(R.string.privacy_sandbox_floc_group_title) + "\n" + PrivacySandboxBridge.getFlocGroupString()); - findPreference(FLOC_UPDATE).setSummary(R.string.privacy_sandbox_floc_update_title); + findPreference(FLOC_UPDATE) + .setSummary(getContext().getString(R.string.privacy_sandbox_floc_update_title) + + "\n" + PrivacySandboxBridge.getFlocUpdateString()); + } + + private String getFlocRegionsUrl() { + // TODO(crbug.com/1205781): use a FeatureParam to control this. + return FLOC_REGIONS_DEFAULT_URL; + } + + private void openUrlInCct(String url) { + assert (mCustomTabHelper != null) + && (mTrustedIntentHelper != null) + : "CCT helpers must be set on PrivacySandboxSettingsFragment before opening a link."; + CustomTabsIntent customTabIntent = + new CustomTabsIntent.Builder().setShowTitle(true).build(); + customTabIntent.intent.setData(Uri.parse(url)); + Intent intent = mCustomTabHelper.createCustomTabActivityIntent( + getContext(), customTabIntent.intent); + intent.setPackage(getContext().getPackageName()); + intent.putExtra(Browser.EXTRA_APPLICATION_ID, getContext().getPackageName()); + mTrustedIntentHelper.addTrustedIntentExtras(intent); + IntentUtils.safeStartActivity(getContext(), intent); } }
diff --git a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxBridge.java b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxBridge.java index 6b8904e6..cc943f22 100644 --- a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxBridge.java +++ b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxBridge.java
@@ -28,6 +28,18 @@ return PrivacySandboxBridgeJni.get().isFlocEnabled(); } + public static void setFlocEnabled(boolean enabled) { + PrivacySandboxBridgeJni.get().setFlocEnabled(enabled); + } + + public static boolean isFlocIdResettable() { + return PrivacySandboxBridgeJni.get().isFlocIdResettable(); + } + + public static void resetFlocId() { + PrivacySandboxBridgeJni.get().resetFlocId(); + } + public static String getFlocStatusString() { return PrivacySandboxBridgeJni.get().getFlocStatusString(); } @@ -36,6 +48,10 @@ return PrivacySandboxBridgeJni.get().getFlocGroupString(); } + public static String getFlocUpdateString() { + return PrivacySandboxBridgeJni.get().getFlocUpdateString(); + } + @NativeMethods interface Natives { boolean isPrivacySandboxSettingsFunctional(); @@ -43,7 +59,11 @@ boolean isPrivacySandboxManaged(); void setPrivacySandboxEnabled(boolean enabled); boolean isFlocEnabled(); + void setFlocEnabled(boolean enabled); + boolean isFlocIdResettable(); + void resetFlocId(); String getFlocStatusString(); String getFlocGroupString(); + String getFlocUpdateString(); } }
diff --git a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxSettingsFragment.java b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxSettingsFragment.java index d072955..7b99931 100644 --- a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxSettingsFragment.java +++ b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxSettingsFragment.java
@@ -68,17 +68,12 @@ SettingsUtils.addPreferencesFromResource(this, R.xml.privacy_sandbox_preferences); // Remove the FLoC page Preference if the Phase 2 flag is disabled. - Preference flocPreference = findPreference(FLOC_PREFERENCE); if (!phaseTwoEnabled()) { - getPreferenceScreen().removePreference(flocPreference); + getPreferenceScreen().removePreference(findPreference(FLOC_PREFERENCE)); } else { // Modify the Privacy Sandbox elements. getPreferenceScreen().removePreference(findPreference(EXPERIMENT_DESCRIPTION_TITLE)); - flocPreference.setSummary(PrivacySandboxBridge.getFlocStatusString()); - // When the entire Privacy Sandbox is disabled, deactivate the preference. - if (!PrivacySandboxBridge.isPrivacySandboxEnabled()) { - flocPreference.setEnabled(false); - } + updateFlocPreference(); } // Format the Privacy Sandbox description, which has a link. @@ -119,12 +114,7 @@ RecordUserAction.record(enabled ? "Settings.PrivacySandbox.ApisEnabled" : "Settings.PrivacySandbox.ApisDisabled"); PrivacySandboxBridge.setPrivacySandboxEnabled(enabled); - // Update the Preference linking to the FLoC page if shown. - Preference flocPreference = findPreference(FLOC_PREFERENCE); - if (flocPreference != null) { - flocPreference.setEnabled(enabled); - flocPreference.setSummary(PrivacySandboxBridge.getFlocStatusString()); - } + updateFlocPreference(); return true; } @@ -154,6 +144,12 @@ return false; } + @Override + public void onResume() { + super.onResume(); + updateFlocPreference(); + } + /** * Set the necessary CCT helpers to be able to natively open links. This is needed because the * helpers are not modularized. @@ -219,4 +215,13 @@ private boolean phaseTwoEnabled() { return ChromeFeatureList.isEnabled(ChromeFeatureList.PRIVACY_SANDBOX_SETTINGS_2); } + + private void updateFlocPreference() { + // Update the Preference linking to the FLoC page if shown. + Preference flocPreference = findPreference(FLOC_PREFERENCE); + if (flocPreference != null) { + flocPreference.setEnabled(PrivacySandboxBridge.isPrivacySandboxEnabled()); + flocPreference.setSummary(PrivacySandboxBridge.getFlocStatusString()); + } + } }
diff --git a/chrome/browser/privacy_sandbox/android/privacy_sandbox_bridge.cc b/chrome/browser/privacy_sandbox/android/privacy_sandbox_bridge.cc index 819c2259..1385570 100644 --- a/chrome/browser/privacy_sandbox/android/privacy_sandbox_bridge.cc +++ b/chrome/browser/privacy_sandbox/android/privacy_sandbox_bridge.cc
@@ -3,6 +3,8 @@ // found in the LICENSE file. #include "base/android/jni_string.h" +#include "base/time/time.h" +#include "chrome/browser/federated_learning/floc_id_provider_factory.h" #include "chrome/browser/privacy_sandbox/android/jni_headers/PrivacySandboxBridge_jni.h" #include "chrome/browser/privacy_sandbox/privacy_sandbox_settings.h" #include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h" @@ -41,7 +43,26 @@ static jboolean JNI_PrivacySandboxBridge_IsFlocEnabled(JNIEnv* env) { return PrivacySandboxSettingsFactory::GetForProfile( ProfileManager::GetActiveUserProfile()) - ->IsFlocAllowed(); + ->IsFlocPrefEnabled(); +} + +static void JNI_PrivacySandboxBridge_SetFlocEnabled(JNIEnv* env, + jboolean enabled) { + PrivacySandboxSettingsFactory::GetForProfile( + ProfileManager::GetActiveUserProfile()) + ->SetFlocPrefEnabled(enabled); +} + +static jboolean JNI_PrivacySandboxBridge_IsFlocIdResettable(JNIEnv* env) { + return PrivacySandboxSettingsFactory::GetForProfile( + ProfileManager::GetActiveUserProfile()) + ->IsFlocIdResettable(); +} + +static void JNI_PrivacySandboxBridge_ResetFlocId(JNIEnv* env) { + PrivacySandboxSettingsFactory::GetForProfile( + ProfileManager::GetActiveUserProfile()) + ->ResetFlocId(); } static ScopedJavaLocalRef<jstring> JNI_PrivacySandboxBridge_GetFlocStatusString( @@ -59,3 +80,14 @@ ProfileManager::GetActiveUserProfile()) ->GetFlocIdForDisplay()); } + +static ScopedJavaLocalRef<jstring> JNI_PrivacySandboxBridge_GetFlocUpdateString( + JNIEnv* env) { + Profile* profile = ProfileManager::GetActiveUserProfile(); + return ConvertUTF16ToJavaString( + env, + PrivacySandboxSettingsFactory::GetForProfile(profile) + ->GetFlocIdNextUpdateForDisplay( + federated_learning::FlocIdProviderFactory::GetForProfile(profile), + profile->GetOriginalProfile()->GetPrefs(), base::Time::Now())); +}
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc index b6faed17..b2fadf3d 100644 --- a/chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc +++ b/chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc
@@ -304,6 +304,14 @@ SetFlocDataAccessibleFromNow(/*reset_calculate_timer=*/true); } +bool PrivacySandboxSettings::IsFlocPrefEnabled() const { + return pref_service_->GetBoolean(prefs::kPrivacySandboxFlocEnabled); +} + +void PrivacySandboxSettings::SetFlocPrefEnabled(bool enabled) const { + pref_service_->SetBoolean(prefs::kPrivacySandboxFlocEnabled, enabled); +} + bool PrivacySandboxSettings::IsConversionMeasurementAllowed( const url::Origin& top_frame_origin, const url::Origin& reporting_origin) const {
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_settings.h b/chrome/browser/privacy_sandbox/privacy_sandbox_settings.h index 7a6ee4a..63bbceae 100644 --- a/chrome/browser/privacy_sandbox/privacy_sandbox_settings.h +++ b/chrome/browser/privacy_sandbox/privacy_sandbox_settings.h
@@ -113,6 +113,14 @@ // current time and resets the time to the next FLoC id calculation void ResetFlocId() const; + // Returns whether the FLoC preference is enabled. This should only be used + // for displaying the preference state to the user, and should *not* be used + // for determining whether FLoC is allowed or not. + bool IsFlocPrefEnabled() const; + + // Sets the FLoC preference to |enabled|. + void SetFlocPrefEnabled(bool enabled) const; + // Determines whether Conversion Measurement is allowable in a particular // context. Should be called at both impression & conversion. At each of these // points |top_frame_origin| is the same as either the impression origin or
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc index 36a5eaff..6d1cb922 100644 --- a/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc +++ b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc
@@ -1102,6 +1102,39 @@ EXPECT_FALSE(privacy_sandbox_settings()->IsFlocIdResettable()); } +TEST_F(PrivacySandboxSettingsTest, IsFlocPrefEnabled) { + // IsFlocPrefEnabled should directly reflect the state of the FLoC pref. + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, true); + EXPECT_TRUE(privacy_sandbox_settings()->IsFlocPrefEnabled()); + + // The Privacy Sandbox APIs pref should not impact the return value. + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, false); + EXPECT_TRUE(privacy_sandbox_settings()->IsFlocPrefEnabled()); + + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, false); + EXPECT_FALSE(privacy_sandbox_settings()->IsFlocPrefEnabled()); +} + +TEST_F(PrivacySandboxSettingsTest, SetFlocPrefEnabled) { + // The FLoc pref should always be updated by this function, regardless of + // other Sandbox State. + privacy_sandbox_settings()->SetFlocPrefEnabled(false); + EXPECT_FALSE(profile()->GetTestingPrefService()->GetBoolean( + prefs::kPrivacySandboxFlocEnabled)); + + // Disabling the sandbox shouldn't prevent the pref from being updated. This + // state is not directly allowable by the UI, but the state itself is valid + // as far as the PrivacySandboxSettings service is concerned. + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, false); + privacy_sandbox_settings()->SetFlocPrefEnabled(true); + EXPECT_TRUE(profile()->GetTestingPrefService()->GetBoolean( + prefs::kPrivacySandboxFlocEnabled)); +} + TEST_F(PrivacySandboxSettingsTest, ReconciliationOutcome) { // Check that reconciling preferences has the appropriate outcome based on // the current user cookie settings.
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index 5a188cc..f3d8a10d 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc
@@ -145,6 +145,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/constants/ash_switches.h" #include "chrome/browser/ash/account_manager/account_manager_policy_controller_factory.h" +#include "chrome/browser/ash/arc/policy/arc_policy_util.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/browser_process_platform_part_chromeos.h" #include "chromeos/dbus/dbus_thread_manager.h" @@ -174,6 +175,26 @@ namespace { +// Used in metrics for NukeProfileFromDisk(). Keep in sync with enums.xml. +// +// Entries should not be renumbered and numeric values should never be reused. +// +// Note: there are maximum 3 attempts to nuke a profile. +enum class NukeProfileResult { + // Success values. Make sure they are consecutive. + kSuccessFirstAttempt = 0, + kSuccessSecondAttempt = 1, + kSuccessThirdAttempt = 2, + + // Failure values. Make sure they are consecutive. + kFailureFirstAttempt = 10, + kFailureSecondAttempt = 11, + kFailureThirdAttempt = 12, + kMaxValue = kFailureThirdAttempt, +}; + +const size_t kNukeProfileMaxRetryCount = 3; + // Profile deletion can pass through two stages: enum class ProfileDeletionStage { // At SCHEDULING stage some actions are made before profile deletion, @@ -281,13 +302,63 @@ } #endif -// Physically remove deleted profile directories from disk. -void NukeProfileFromDisk(const base::FilePath& profile_path) { +NukeProfileResult GetNukeProfileResult(size_t retry_count, bool success) { + DCHECK_LT(retry_count, kNukeProfileMaxRetryCount); + const size_t value = + retry_count + + static_cast<size_t>(success ? NukeProfileResult::kSuccessFirstAttempt + : NukeProfileResult::kFailureFirstAttempt); + DCHECK_LE(value, static_cast<size_t>(NukeProfileResult::kMaxValue)); + return static_cast<NukeProfileResult>(value); +} + +// Implementation of NukeProfileFromDisk(), retrying at most |max_retry_count| +// times on failure. |retry_count| (initially 0) keeps track of the +// number of attempts so far. +void NukeProfileFromDiskImpl(const base::FilePath& profile_path, + size_t retry_count, + size_t max_retry_count, + base::OnceClosure done_callback) { + // TODO(crbug.com/1191455): Make FileSystemProxy/FileSystemImpl expose its + // LockTable, and/or fire events when locks are released. That way we could + // wait for all the locks in |profile_path| to be released, rather than having + // this retry logic. + const base::TimeDelta kRetryDelay = base::TimeDelta::FromSeconds(1); + // Delete both the profile directory and its corresponding cache. base::FilePath cache_path; chrome::GetUserCacheDirectory(profile_path, &cache_path); - base::DeletePathRecursively(profile_path); - base::DeletePathRecursively(cache_path); + + bool success = base::DeletePathRecursively(profile_path); + success = base::DeletePathRecursively(cache_path) && success; + + base::UmaHistogramEnumeration("Profile.NukeFromDisk.Result", + GetNukeProfileResult(retry_count, success)); + + if (!success && retry_count < max_retry_count - 1) { + // Failed, try again in |kRetryDelay| seconds. + base::ThreadPool::PostDelayedTask( + FROM_HERE, + {base::MayBlock(), base::TaskPriority::BEST_EFFORT, + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, + base::BindOnce(&NukeProfileFromDiskImpl, profile_path, retry_count + 1, + max_retry_count, std::move(done_callback)), + kRetryDelay); + return; + } + + if (done_callback) { + content::GetUIThreadTaskRunner({})->PostTask(FROM_HERE, + std::move(done_callback)); + } +} + +// Physically remove deleted profile directories from disk. Afterwards, calls +// |done_callback| on the UI thread. +void NukeProfileFromDisk(const base::FilePath& profile_path, + base::OnceClosure done_callback) { + NukeProfileFromDiskImpl(profile_path, /*retry_count=*/0, + kNukeProfileMaxRetryCount, std::move(done_callback)); } // Called after a deleted profile was checked and cleaned up. @@ -493,7 +564,8 @@ void ProfileManager::NukeDeletedProfilesFromDisk() { for (const auto& item : ProfilesToDelete()) { if (item.second == ProfileDeletionStage::MARKED) - NukeProfileFromDisk(item.first); + NukeProfileFromDiskImpl(item.first, /*retry_count=*/0, + /*max_retry_count=*/1, base::OnceClosure()); } ProfilesToDelete().clear(); } @@ -1094,7 +1166,8 @@ FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT, base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, - base::BindOnce(&NukeProfileFromDisk, profile_path)); + base::BindOnce(&NukeProfileFromDisk, profile_path, + base::OnceClosure())); storage.RemoveProfile(profile_path); } @@ -1115,12 +1188,12 @@ if (base::PathExists(*profile_path)) { LOG(WARNING) << "Files of a deleted profile still exist after restart. " "Cleaning up now."; - base::ThreadPool::PostTaskAndReply( + base::ThreadPool::PostTask( FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT, base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, - base::BindOnce(&NukeProfileFromDisk, *profile_path), - base::BindOnce(&ProfileCleanedUp, value.Clone())); + base::BindOnce(&NukeProfileFromDisk, *profile_path, + base::BindOnce(&ProfileCleanedUp, value.Clone()))); } else { // Everything is fine, the profile was removed on shutdown. content::GetUIThreadTaskRunner({})->PostTask( @@ -1156,6 +1229,9 @@ (user->GetType() == user_manager::USER_TYPE_CHILD); const bool profile_is_child = profile->IsChild(); const bool profile_is_new = profile->IsNewProfile(); + const bool profile_is_managed = !profile->IsOffTheRecord() && + arc::policy_util::IsAccountManaged(profile); + if (!profile_is_new && profile_is_child != user_is_child) { ProfileAttributesEntry* entry = storage.GetProfileAttributesWithPath(profile->GetPath()); @@ -1163,18 +1239,6 @@ LOG(WARNING) << "Profile child status has changed."; storage.RemoveProfile(profile->GetPath()); } - arc::ArcSupervisionTransition supervisionTransition; - if (!profile->GetPrefs()->GetBoolean(arc::prefs::kArcSignedIn)) { - // No transition is necessary if user never enabled ARC. - supervisionTransition = arc::ArcSupervisionTransition::NO_TRANSITION; - } else { - // Notify ARC about user type change via prefs if user enabled ARC. - supervisionTransition = - user_is_child ? arc::ArcSupervisionTransition::REGULAR_TO_CHILD - : arc::ArcSupervisionTransition::CHILD_TO_REGULAR; - } - profile->GetPrefs()->SetInteger(arc::prefs::kArcSupervisionTransition, - static_cast<int>(supervisionTransition)); ash::ChildAccountTypeChangedUserData::GetForProfile(profile)->SetValue( true); } else { @@ -1182,6 +1246,33 @@ false); } + // Notify ARC about transition via prefs if needed. + if (!profile_is_new) { + const bool arc_is_managed = + profile->GetPrefs()->GetBoolean(arc::prefs::kArcIsManaged); + + const bool arc_signed_in = + profile->GetPrefs()->GetBoolean(arc::prefs::kArcSignedIn); + + arc::ArcSupervisionTransition transition; + if (!arc_signed_in) { + // No transition is necessary if user never enabled ARC. + transition = arc::ArcSupervisionTransition::NO_TRANSITION; + } else if (profile_is_child != user_is_child) { + transition = user_is_child + ? arc::ArcSupervisionTransition::REGULAR_TO_CHILD + : arc::ArcSupervisionTransition::CHILD_TO_REGULAR; + } else if (profile_is_managed && !arc_is_managed) { + transition = arc::ArcSupervisionTransition::UNMANAGED_TO_MANAGED; + } else { + // User state has not changed. + transition = arc::ArcSupervisionTransition::NO_TRANSITION; + } + + profile->GetPrefs()->SetInteger(arc::prefs::kArcSupervisionTransition, + static_cast<int>(transition)); + } + if (user_is_child) { profile->GetPrefs()->SetString(prefs::kSupervisedUserId, supervised_users::kChildAccountSUID); @@ -1680,10 +1771,11 @@ // TODO(crbug.com/1191455): This can also fail if an object is holding a lock // to a file in the profile directory. This happens flakily, e.g. with the // LevelDB for GCMStore. The locked files don't get deleted properly. - base::ThreadPool::PostTask(FROM_HERE, - {base::MayBlock(), base::TaskPriority::BEST_EFFORT, - base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, - base::BindOnce(&NukeProfileFromDisk, profile_dir)); + base::ThreadPool::PostTask( + FROM_HERE, + {base::MayBlock(), base::TaskPriority::BEST_EFFORT, + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, + base::BindOnce(&NukeProfileFromDisk, profile_dir, base::OnceClosure())); } #endif // !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) @@ -1838,7 +1930,7 @@ FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT, base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, - base::BindOnce(&NukeProfileFromDisk, profile_dir)); + base::BindOnce(&NukeProfileFromDisk, profile_dir, base::OnceClosure())); } storage.RemoveProfile(profile_dir);
diff --git a/chrome/browser/profiles/profile_manager_browsertest.cc b/chrome/browser/profiles/profile_manager_browsertest.cc index 9c9e897..d467c8e 100644 --- a/chrome/browser/profiles/profile_manager_browsertest.cc +++ b/chrome/browser/profiles/profile_manager_browsertest.cc
@@ -14,6 +14,7 @@ #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" #include "base/test/bind.h" +#include "base/test/test_timeouts.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/apps/platform_apps/shortcut_manager.h" @@ -685,8 +686,16 @@ EXPECT_EQ(1U, browser_list->size()); EXPECT_EQ(initial_profile_count, storage.GetNumberOfProfiles()); - // TODO(crbug.com/1191455): Once RemoveProfile()/NukeProfileFromDisk() aren't - // flaky anymore, EXPECT_FALSE(PathExists(path_profile2)). + if (base::FeatureList::IsEnabled(features::kDestroyProfileOnBrowserClose)) { + // Check that NukeProfileFromDisk() works correctly. + base::ScopedAllowBlockingForTesting allow_blocking; + base::Time start = base::Time::Now(); + while (base::PathExists(path_profile2) && + base::Time::Now() - start < TestTimeouts::action_timeout()) { + base::RunLoop().RunUntilIdle(); + } + EXPECT_FALSE(base::PathExists(path_profile2)); + } } // The test makes sense on those platforms where the keychain exists.
diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc index a5a63877..13385ac 100644 --- a/chrome/browser/profiles/profile_manager_unittest.cc +++ b/chrome/browser/profiles/profile_manager_unittest.cc
@@ -26,6 +26,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/lifetime/application_lifetime.h" +#include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" #include "chrome/browser/profiles/profile.h" @@ -68,6 +69,7 @@ #include "chrome/browser/ash/settings/scoped_cros_settings_test_helper.h" #include "chrome/browser/ui/ash/test_wallpaper_controller.h" #include "chrome/browser/ui/ash/wallpaper_controller_client_impl.h" +#include "components/arc/arc_features.h" #include "components/arc/arc_prefs.h" #include "components/arc/session/arc_supervision_transition.h" #include "components/user_manager/scoped_user_manager.h" @@ -237,6 +239,45 @@ profile_helper->GetProfilePathByUserIdHash(user_id_hash)); } + std::unique_ptr<Profile> InitProfileForArcTransitionTest( + bool profile_is_new, + bool arc_signed_in, + bool profile_is_child, + bool user_is_child, + bool profile_is_managed, + bool arc_is_managed) { + chromeos::ProfileHelper* profile_helper = chromeos::ProfileHelper::Get(); + user_manager::UserManager* user_manager = user_manager::UserManager::Get(); + + const std::string user_email = "user_for_transition@example.com"; + const AccountId account_id = + AccountId::FromUserEmailGaiaId(user_email, "1"); + const std::string user_id_hash = + profile_helper->GetUserIdHashByUserIdForTesting(user_email); + const base::FilePath dest_path = + profile_helper->GetProfilePathByUserIdHash(user_id_hash); + + TestingProfile::Builder builder; + builder.SetPath(dest_path); + builder.SetIsNewProfile(profile_is_new); + + if (profile_is_child) { + builder.SetSupervisedUserId(supervised_users::kChildAccountSUID); + } + + builder.OverridePolicyConnectorIsManagedForTesting(profile_is_managed); + std::unique_ptr<Profile> profile = builder.Build(); + + profile->GetPrefs()->SetBoolean(arc::prefs::kArcSignedIn, arc_signed_in); + profile->GetPrefs()->SetBoolean(arc::prefs::kArcIsManaged, arc_is_managed); + + user_manager->UserLoggedIn(account_id, user_id_hash, + false /* browser_restart */, user_is_child); + g_browser_process->profile_manager()->InitProfileUserPrefs(profile.get()); + + return profile; + } + ash::ScopedCrosSettingsTestHelper cros_settings_test_helper_; #endif @@ -945,24 +986,10 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) TEST_F(ProfileManagerTest, InitProfileForChildOnFirstSignIn) { - chromeos::ProfileHelper* profile_helper = chromeos::ProfileHelper::Get(); - user_manager::UserManager* user_manager = user_manager::UserManager::Get(); - - const std::string user_email = "child@example.com"; - const AccountId account_id = AccountId::FromUserEmailGaiaId(user_email, "1"); - const std::string user_id_hash = - profile_helper->GetUserIdHashByUserIdForTesting(user_email); - const base::FilePath dest_path = - profile_helper->GetProfilePathByUserIdHash(user_id_hash); - - TestingProfile::Builder builder; - builder.SetPath(dest_path); - builder.SetIsNewProfile(true); - std::unique_ptr<Profile> profile = builder.Build(); - - user_manager->UserLoggedIn(account_id, user_id_hash, - false /* browser_restart */, true /* is_child */); - g_browser_process->profile_manager()->InitProfileUserPrefs(profile.get()); + std::unique_ptr<Profile> profile = InitProfileForArcTransitionTest( + true /* profile_is_new */, false /* arc_signed_in */, + false /* profile_is_child */, true /* user_is_child */, + false /* profile_is_managed */, false /* arc_is_managed */); EXPECT_EQ( profile->GetPrefs()->GetInteger(arc::prefs::kArcSupervisionTransition), @@ -972,25 +999,10 @@ } TEST_F(ProfileManagerTest, InitProfileForRegularToChildTransition) { - chromeos::ProfileHelper* profile_helper = chromeos::ProfileHelper::Get(); - user_manager::UserManager* user_manager = user_manager::UserManager::Get(); - - const std::string user_email = "child@example.com"; - const AccountId account_id = AccountId::FromUserEmailGaiaId(user_email, "1"); - const std::string user_id_hash = - profile_helper->GetUserIdHashByUserIdForTesting(user_email); - const base::FilePath dest_path = - profile_helper->GetProfilePathByUserIdHash(user_id_hash); - - TestingProfile::Builder builder; - builder.SetPath(dest_path); - builder.SetIsNewProfile(false); - std::unique_ptr<Profile> profile = builder.Build(); - profile->GetPrefs()->SetBoolean(arc::prefs::kArcSignedIn, true); - - user_manager->UserLoggedIn(account_id, user_id_hash, - false /* browser_restart */, true /* is_child */); - g_browser_process->profile_manager()->InitProfileUserPrefs(profile.get()); + std::unique_ptr<Profile> profile = InitProfileForArcTransitionTest( + false /* profile_is_new */, true /* arc_signed_in */, + false /* profile_is_child */, true /* user_is_child */, + false /* profile_is_managed */, false /* arc_is_managed */); EXPECT_EQ( profile->GetPrefs()->GetInteger(arc::prefs::kArcSupervisionTransition), @@ -1000,26 +1012,10 @@ } TEST_F(ProfileManagerTest, InitProfileForChildToRegularTransition) { - chromeos::ProfileHelper* profile_helper = chromeos::ProfileHelper::Get(); - user_manager::UserManager* user_manager = user_manager::UserManager::Get(); - - const std::string user_email = "child@example.com"; - const AccountId account_id = AccountId::FromUserEmailGaiaId(user_email, "1"); - const std::string user_id_hash = - profile_helper->GetUserIdHashByUserIdForTesting(user_email); - const base::FilePath dest_path = - profile_helper->GetProfilePathByUserIdHash(user_id_hash); - - TestingProfile::Builder builder; - builder.SetPath(dest_path); - builder.SetIsNewProfile(false); - builder.SetSupervisedUserId(supervised_users::kChildAccountSUID); - std::unique_ptr<Profile> profile = builder.Build(); - profile->GetPrefs()->SetBoolean(arc::prefs::kArcSignedIn, true); - - user_manager->UserLoggedIn(account_id, user_id_hash, - false /* browser_restart */, false /* is_child */); - g_browser_process->profile_manager()->InitProfileUserPrefs(profile.get()); + std::unique_ptr<Profile> profile = InitProfileForArcTransitionTest( + false /* profile_is_new */, true /* arc_signed_in */, + true /* profile_is_child */, false /* user_is_child */, + false /* profile_is_managed */, false /* arc_is_managed */); EXPECT_EQ( profile->GetPrefs()->GetInteger(arc::prefs::kArcSupervisionTransition), @@ -1027,28 +1023,42 @@ EXPECT_TRUE(profile->GetPrefs()->GetString(prefs::kSupervisedUserId).empty()); } +TEST_F(ProfileManagerTest, InitProfileForUnmanagedToManagedTransition) { + base::test::ScopedFeatureList features; + features.InitAndEnableFeature( + arc::kEnableUnmanagedToManagedTransitionFeature); + + std::unique_ptr<Profile> profile = InitProfileForArcTransitionTest( + false /* profile_is_new */, true /* arc_signed_in */, + false /* profile_is_child */, false /* user_is_child */, + true /* profile_is_managed */, false /* arc_is_managed */); + + EXPECT_EQ( + profile->GetPrefs()->GetInteger(arc::prefs::kArcSupervisionTransition), + static_cast<int>(arc::ArcSupervisionTransition::UNMANAGED_TO_MANAGED)); +} + +TEST_F(ProfileManagerTest, InitProfileForManagedUserOnFirstSignIn) { + base::test::ScopedFeatureList features; + features.InitAndEnableFeature( + arc::kEnableUnmanagedToManagedTransitionFeature); + + std::unique_ptr<Profile> profile = InitProfileForArcTransitionTest( + true /* profile_is_new */, false /* arc_signed_in */, + false /* profile_is_child */, false /* user_is_child */, + true /* profile_is_managed */, false /* arc_is_managed */); + + EXPECT_EQ( + profile->GetPrefs()->GetInteger(arc::prefs::kArcSupervisionTransition), + static_cast<int>(arc::ArcSupervisionTransition::NO_TRANSITION)); +} + TEST_F(ProfileManagerTest, InitProfileForChildToRegularTransitionArcNotSignedIn) { - chromeos::ProfileHelper* profile_helper = chromeos::ProfileHelper::Get(); - user_manager::UserManager* user_manager = user_manager::UserManager::Get(); - - const std::string user_email = "child@example.com"; - const AccountId account_id = AccountId::FromUserEmailGaiaId(user_email, "1"); - const std::string user_id_hash = - profile_helper->GetUserIdHashByUserIdForTesting(user_email); - const base::FilePath dest_path = - profile_helper->GetProfilePathByUserIdHash(user_id_hash); - - TestingProfile::Builder builder; - builder.SetPath(dest_path); - builder.SetIsNewProfile(false); - builder.SetSupervisedUserId(supervised_users::kChildAccountSUID); - std::unique_ptr<Profile> profile = builder.Build(); - profile->GetPrefs()->SetBoolean(arc::prefs::kArcSignedIn, false); - - user_manager->UserLoggedIn(account_id, user_id_hash, - false /* browser_restart */, false /* is_child */); - g_browser_process->profile_manager()->InitProfileUserPrefs(profile.get()); + std::unique_ptr<Profile> profile = InitProfileForArcTransitionTest( + false /* profile_is_new */, false /* arc_signed_in */, + true /* profile_is_child */, false /* user_is_child */, + false /* profile_is_managed */, false /* arc_is_managed */); EXPECT_EQ( profile->GetPrefs()->GetInteger(arc::prefs::kArcSupervisionTransition),
diff --git a/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc b/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc index 8270ec08..ea49fb2 100644 --- a/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc +++ b/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc
@@ -203,6 +203,10 @@ ui::ScopedClipboardWriter scw(ui::ClipboardBuffer::kCopyPaste, std::move(data_transfer_endpoint)); scw.WriteText(base::UTF8ToUTF16(generated_link_.value())); + + LogDesktopLinkGenerationCopiedLinkType( + shared_highlighting::LinkGenerationCopiedLinkType:: + kCopiedFromNewGeneration); } void LinkToTextMenuObserver::Timeout() { @@ -217,6 +221,13 @@ } void LinkToTextMenuObserver::ReshareLink() { + if (generated_selector_for_testing_.has_value()) { + std::vector<std::string> test_selectors{ + generated_selector_for_testing_.value()}; + OnGetExistingSelectorsComplete(test_selectors); + return; + } + GetRemote()->GetExistingSelectors( base::BindOnce(&LinkToTextMenuObserver::OnGetExistingSelectorsComplete, weak_ptr_factory_.GetWeakPtr())); @@ -239,6 +250,10 @@ url_to_share = shared_highlighting::AppendSelectors(url_to_share, selectors); scw.WriteText(base::UTF8ToUTF16(url_to_share.spec())); + + LogDesktopLinkGenerationCopiedLinkType( + shared_highlighting::LinkGenerationCopiedLinkType:: + kCopiedFromExistingHighlight); } void LinkToTextMenuObserver::RemoveHighlight() {
diff --git a/chrome/browser/renderer_context_menu/link_to_text_menu_observer_interactive_uitest.cc b/chrome/browser/renderer_context_menu/link_to_text_menu_observer_interactive_uitest.cc index 26fb37a..179993e 100644 --- a/chrome/browser/renderer_context_menu/link_to_text_menu_observer_interactive_uitest.cc +++ b/chrome/browser/renderer_context_menu/link_to_text_menu_observer_interactive_uitest.cc
@@ -7,6 +7,7 @@ #include "base/macros.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/metrics/histogram_tester.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/renderer_context_menu/mock_render_view_context_menu.h" @@ -15,6 +16,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/shared_highlighting/core/common/shared_highlighting_features.h" +#include "components/shared_highlighting/core/common/shared_highlighting_metrics.h" #include "content/public/browser/context_menu_params.h" #include "content/public/test/browser_test.h" #include "net/dns/mock_host_resolver.h" @@ -268,6 +270,51 @@ EXPECT_EQ(u"http://foo.com/#:~:text=hello%20world", text); } +IN_PROC_BROWSER_TEST_P(LinkToTextMenuObserverTest, + LinkGenerationCopiedLinkTypeMetric_NewGeneration) { + base::HistogramTester histogram_tester; + + content::BrowserTestClipboardScope test_clipboard_scope; + content::ContextMenuParams params; + params.page_url = GURL("http://foo.com/"); + params.selection_text = u"hello world"; + observer()->OverrideGeneratedSelectorForTesting("hello%20world"); + InitMenu(params); + menu()->ExecuteCommand(IDC_CONTENT_CONTEXT_COPYLINKTOTEXT, 0); + + // Verify that the copy type metric was correctly set + histogram_tester.ExpectTotalCount("SharedHighlights.Desktop.CopiedLinkType", + 1); + histogram_tester.ExpectBucketCount( + "SharedHighlights.Desktop.CopiedLinkType", + shared_highlighting::LinkGenerationCopiedLinkType:: + kCopiedFromNewGeneration, + 1); +} + +IN_PROC_BROWSER_TEST_P(LinkToTextMenuObserverTest, + LinkGenerationCopiedLinkTypeMetric_ReShare) { + base::HistogramTester histogram_tester; + + content::BrowserTestClipboardScope test_clipboard_scope; + content::ContextMenuParams params; + params.page_url = GURL("http://foo.com/#:~:text=hello%20world"); + params.selection_text = u""; + params.opened_from_highlight = true; + observer()->OverrideGeneratedSelectorForTesting("hello%20world"); + InitMenu(params); + menu()->ExecuteCommand(IDC_CONTENT_CONTEXT_COPYLINKTOTEXT, 0); + + // Verify that the copy type metric was correctly set + histogram_tester.ExpectTotalCount("SharedHighlights.Desktop.CopiedLinkType", + 1); + histogram_tester.ExpectBucketCount( + "SharedHighlights.Desktop.CopiedLinkType", + shared_highlighting::LinkGenerationCopiedLinkType:: + kCopiedFromExistingHighlight, + 1); +} + INSTANTIATE_TEST_SUITE_P(All, LinkToTextMenuObserverTest, ::testing::Values(true, false));
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 2e1aebb..0c9949e 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -73,8 +73,10 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/chrome_pages.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/keyboard_lock_controller.h" #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" #include "chrome/browser/ui/qrcode_generator/qrcode_generator_bubble_controller.h"
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 d3ddfb74..caa0e7d 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
@@ -35,6 +35,7 @@ #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h" #include "chrome/browser/web_applications/components/install_finalizer.h"
diff --git a/chrome/browser/resources/chromeos/accessibility/common/automation_util_test.js b/chrome/browser/resources/chromeos/accessibility/common/automation_util_test.js index 1295093..8d56b867 100644 --- a/chrome/browser/resources/chromeos/accessibility/common/automation_util_test.js +++ b/chrome/browser/resources/chromeos/accessibility/common/automation_util_test.js
@@ -80,8 +80,8 @@ function() { this.runWithLoadedTree( ` - <div aria-label="x"> - <div aria-label="y"> + <div tabindex="0" aria-label="x"> + <div tabindex="0" aria-label="y"> <p> <button>Hello world</div> </p> @@ -209,7 +209,8 @@ 'AccessibilityExtensionAutomationUtilE2ETest', 'FindLastNodeSimple', function() { this.runWithLoadedTree( - `<p aria-label=" "><div aria-label="x"></div></p>`, function(r) { + `<p aria-label=" "><div tabindex="0" aria-label="x"></div></p>`, + function(r) { assertEquals( 'x', AutomationUtil @@ -251,7 +252,7 @@ this.runWithLoadedTree( ` <p>start</p> - <div aria-label="outer"><div aria-label="inner"></div></div> + <div aria-label="outer"><div tabindex="0" aria-label="inner"></div></div> <p>end</p> `, function(r) {
diff --git a/chrome/browser/resources/chromeos/accessibility/switch_access/switch_access_predicate_test.js b/chrome/browser/resources/chromeos/accessibility/switch_access/switch_access_predicate_test.js index b285fce..44919c8 100644 --- a/chrome/browser/resources/chromeos/accessibility/switch_access/switch_access_predicate_test.js +++ b/chrome/browser/resources/chromeos/accessibility/switch_access/switch_access_predicate_test.js
@@ -25,21 +25,21 @@ // This page has a 1:1 correlation between DOM nodes and accessibility nodes. function testWebsite() { - return `<div aria-label="upper1"> - <div aria-label="lower1"> + return `<div aria-description="upper1"> + <div aria-description="lower1"> <button>leaf1</button> - <p aria-label="leaf2">leaf2</p> + <p aria-description="leaf2">leaf2</p> <button>leaf3</button> </div> - <div aria-label="lower2"> - <p aria-label="leaf4">leaf4</p> + <div aria-description="lower2"> + <p aria-description="leaf4">leaf4</p> <button>leaf5</button> </div> </div> - <div aria-label="upper2" role="button"> - <div aria-label="lower3" > - <p aria-label="leaf6">leaf6</p> - <p aria-label="leaf7">leaf7</p>`; + <div aria-description="upper2" role="button"> + <div aria-description="lower3" > + <p aria-description="leaf6">leaf6</p> + <p aria-description="leaf7">leaf7</p>`; } function getTree(loadedPage) { @@ -48,33 +48,33 @@ root.role === chrome.automation.RoleType.ROOT_WEB_AREA, 'We should receive the root web area'); assertTrue( - root.firstChild && root.firstChild.name === 'upper1', + root.firstChild && root.firstChild.description === 'upper1', 'First child should be upper1'); const upper1 = root.firstChild; - assertTrue(upper1 && upper1.name === 'upper1', 'Upper1 not found'); + assertTrue(upper1 && upper1.description === 'upper1', 'Upper1 not found'); const upper2 = upper1.nextSibling; - assertTrue(upper2 && upper2.name === 'upper2', 'Upper2 not found'); + assertTrue(upper2 && upper2.description === 'upper2', 'Upper2 not found'); const lower1 = upper1.firstChild; - assertTrue(lower1 && lower1.name === 'lower1', 'Lower1 not found'); + assertTrue(lower1 && lower1.description === 'lower1', 'Lower1 not found'); const lower2 = lower1.nextSibling; - assertTrue(lower2 && lower2.name === 'lower2', 'Lower2 not found'); + assertTrue(lower2 && lower2.description === 'lower2', 'Lower2 not found'); const lower3 = upper2.firstChild; - assertTrue(lower3 && lower3.name === 'lower3', 'Lower3 not found'); + assertTrue(lower3 && lower3.description === 'lower3', 'Lower3 not found'); const leaf1 = lower1.firstChild; assertTrue(leaf1 && leaf1.name === 'leaf1', 'Leaf1 not found'); const leaf2 = leaf1.nextSibling; - assertTrue(leaf2 && leaf2.name === 'leaf2', 'Leaf2 not found'); + assertTrue(leaf2 && leaf2.description === 'leaf2', 'Leaf2 not found'); const leaf3 = leaf2.nextSibling; assertTrue(leaf3 && leaf3.name === 'leaf3', 'Leaf3 not found'); const leaf4 = lower2.firstChild; - assertTrue(leaf4 && leaf4.name === 'leaf4', 'Leaf4 not found'); + assertTrue(leaf4 && leaf4.description === 'leaf4', 'Leaf4 not found'); const leaf5 = leaf4.nextSibling; assertTrue(leaf5 && leaf5.name === 'leaf5', 'Leaf5 not found'); const leaf6 = lower3.firstChild; - assertTrue(leaf6 && leaf6.name === 'leaf6', 'Leaf6 not found'); + assertTrue(leaf6 && leaf6.description === 'leaf6', 'Leaf6 not found'); const leaf7 = leaf6.nextSibling; - assertTrue(leaf7 && leaf7.name === 'leaf7', 'Leaf7 not found'); + assertTrue(leaf7 && leaf7.description === 'leaf7', 'Leaf7 not found'); return { root, @@ -249,7 +249,7 @@ <button>button3</button> <input type="range" aria-label="slider" value=5 min=0 max=10> <div id="clickable" role="listitem" onclick="2+2"></div> - <div aria-label="div1"><p>p1</p></div>`; + <div id="div1"><p>p1</p></div>`; this.runWithLoadedTree(treeString, (loadedPage) => { const cache = new SACache(); @@ -292,7 +292,7 @@ SwitchAccessPredicate.isActionable(clickable, cache), 'Clickable list items should be actionable'); - const div1 = this.findNodeByNameAndRole('div1', 'genericContainer'); + const div1 = this.findNodeById('div1'); assertFalse( SwitchAccessPredicate.isActionable(div1, cache), 'Divs should not generally be actionable');
diff --git a/chrome/browser/resources/downloads/constants.js b/chrome/browser/resources/downloads/constants.js index ed08b72..ff73445 100644 --- a/chrome/browser/resources/downloads/constants.js +++ b/chrome/browser/resources/downloads/constants.js
@@ -20,6 +20,7 @@ SENSITIVE_CONTENT_BLOCK: 'SENSITIVE_CONTENT_BLOCK', BLOCKED_TOO_LARGE: 'BLOCKED_TOO_LARGE', BLOCKED_PASSWORD_PROTECTED: 'BLOCKED_PASSWORD_PROTECTED', + DANGEROUS_ACCOUNT_COMPROMISE: 'DANGEROUS_ACCOUNT_COMPROMISE' }; /**
diff --git a/chrome/browser/resources/downloads/item.js b/chrome/browser/resources/downloads/item.js index f2dac48..0ba6b94 100644 --- a/chrome/browser/resources/downloads/item.js +++ b/chrome/browser/resources/downloads/item.js
@@ -287,6 +287,9 @@ case DangerType.SENSITIVE_CONTENT_WARNING: return loadTimeData.getString('sensitiveContentWarningDesc'); + + case DangerType.DANGEROUS_ACCOUNT_COMPROMISE: + return loadTimeData.getString('accountCompromiseDownloadDesc'); } break; @@ -417,7 +420,8 @@ (this.data.dangerType === DangerType.DANGEROUS_CONTENT || this.data.dangerType === DangerType.DANGEROUS_HOST || this.data.dangerType === DangerType.DANGEROUS_URL || - this.data.dangerType === DangerType.POTENTIALLY_UNWANTED); + this.data.dangerType === DangerType.POTENTIALLY_UNWANTED || + this.data.dangerType === DangerType.DANGEROUS_ACCOUNT_COMPROMISE); }, /** @private */
diff --git a/chrome/browser/resources/history/BUILD.gn b/chrome/browser/resources/history/BUILD.gn index 619f3692..e044e6b54 100644 --- a/chrome/browser/resources/history/BUILD.gn +++ b/chrome/browser/resources/history/BUILD.gn
@@ -159,6 +159,7 @@ ":constants", ":externs", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + "//ui/webui/resources/js:event_tracker.m", "//ui/webui/resources/js:icon.m", "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js/cr/ui:focus_row_behavior.m", @@ -220,6 +221,7 @@ ":externs", ":router", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + "//ui/webui/resources/js:event_tracker.m", ] }
diff --git a/chrome/browser/resources/history/history_item.js b/chrome/browser/resources/history/history_item.js index 64343e4..1f423d3e 100644 --- a/chrome/browser/resources/history/history_item.js +++ b/chrome/browser/resources/history/history_item.js
@@ -12,6 +12,7 @@ import {FocusRowBehavior} from 'chrome://resources/js/cr/ui/focus_row_behavior.m.js'; import {focusWithoutInk} from 'chrome://resources/js/cr/ui/focus_without_ink.m.js'; +import {EventTracker} from 'chrome://resources/js/event_tracker.m.js'; import {getFaviconForPageURL} from 'chrome://resources/js/icon.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {afterNextRender, html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; @@ -113,11 +114,8 @@ /** @private {boolean} */ this.isShiftKeyDown_ = false; - /** @private {?function(!Event)} */ - this.boundOnKeyDown_ = null; - - /** @private {?function()} */ - this.boundOnMouseOver_ = null; + /** @private {!EventTracker} */ + this.eventTracker_ = new EventTracker(); } /** @override */ @@ -129,16 +127,15 @@ afterNextRender(this, function() { // Adding listeners asynchronously to reduce blocking time, since these // history items are items in a potentially long list. - this.boundOnKeyDown_ = e => this.onCheckboxKeydown_(e); - this.$.checkbox.addEventListener('keydown', this.boundOnKeyDown_); + this.eventTracker_.add( + this.$.checkbox, 'keydown', e => this.onCheckboxKeydown_(e)); }); } /** @override */ disconnectedCallback() { super.disconnectedCallback(); - this.$.checkbox.removeEventListener('keydown', this.boundOnKeyDown_); - this.boundOnKeyDown_ = null; + this.eventTracker_.remove(this.$.checkbox, 'keydown'); } /** @@ -352,10 +349,8 @@ this.$.icon.style.backgroundImage = getFaviconForPageURL( this.item.url, this.item.isUrlInRemoteUserData, this.item.remoteIconUrlForUma); - - this.boundOnMouseOver_ = () => this.addTimeTitle_(); - this.$['time-accessed'].addEventListener( - 'mouseover', this.boundOnMouseOver_); + this.eventTracker_.add( + this.$['time-accessed'], 'mouseover', () => this.addTimeTitle_()); } /** @@ -380,8 +375,7 @@ addTimeTitle_() { const el = this.$['time-accessed']; el.setAttribute('title', new Date(this.item.time).toString()); - el.removeEventListener('mouseover', this.boundOnMouseOver_); - this.boundOnMouseOver_ = null; + this.eventTracker_.remove(el, 'mouseover'); } /**
diff --git a/chrome/browser/resources/history/query_manager.js b/chrome/browser/resources/history/query_manager.js index f29c923..7fbd9bb 100644 --- a/chrome/browser/resources/history/query_manager.js +++ b/chrome/browser/resources/history/query_manager.js
@@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {EventTracker} from 'chrome://resources/js/event_tracker.m.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {BrowserService} from './browser_service.js'; @@ -54,27 +55,23 @@ constructor() { super(); - /** @private {!Object<string, !function(!Event)>} */ - this.documentListeners_ = {}; + /** @private {!EventTracker} */ + this.eventTracker_ = new EventTracker(); } /** @override */ connectedCallback() { super.connectedCallback(); - this.documentListeners_['change-query'] = this.onChangeQuery_.bind(this); - this.documentListeners_['query-history'] = this.onQueryHistory_.bind(this); - - for (const e in this.documentListeners_) { - document.addEventListener(e, this.documentListeners_[e]); - } + this.eventTracker_.add( + document, 'change-query', this.onChangeQuery_.bind(this)); + this.eventTracker_.add( + document, 'query-history', this.onQueryHistory_.bind(this)); } /** @override */ disconnectedCallback() { super.disconnectedCallback(); - for (const e in this.documentListeners_) { - document.removeEventListener(e, this.documentListeners_[e]); - } + this.eventTracker_.removeAll(); } initialize() {
diff --git a/chrome/browser/resources/settings/BUILD.gn b/chrome/browser/resources/settings/BUILD.gn index cff740a3..9ec6334ca 100644 --- a/chrome/browser/resources/settings/BUILD.gn +++ b/chrome/browser/resources/settings/BUILD.gn
@@ -62,6 +62,8 @@ "images/permissions_banner.svg", "images/privacy_sandbox_banner_dark.svg", "images/privacy_sandbox_banner.svg", + "images/privacy_sandbox_floc_banner_dark.svg", + "images/privacy_sandbox_floc_banner.svg", "images/safe_browsing_banner_dark.svg", "images/safe_browsing_banner.svg", "images/sync_banner_dark.svg",
diff --git a/chrome/browser/resources/settings/images/privacy_sandbox_floc_banner.svg b/chrome/browser/resources/settings/images/privacy_sandbox_floc_banner.svg new file mode 100644 index 0000000..7af203e71 --- /dev/null +++ b/chrome/browser/resources/settings/images/privacy_sandbox_floc_banner.svg
@@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 140"><style>.st0{fill:#8ab4f8}.st1{fill:#a8dab5}.st2{fill:#34a853}</style><circle class="st0" cx="154.4" cy="39.7" r="10.8"/><path class="st0" d="M176.1 69.2c0-4.4-2.6-8.3-6.6-10-9.6-4.2-20.5-4.2-30.1 0-4 1.7-6.6 5.7-6.6 10v3.1h43.4l-.1-3.1z"/><circle class="st0" cx="277.9" cy="77.6" r="7.3"/><path class="st0" d="M292.4 97.3c0-2.9-1.7-5.6-4.4-6.7-6.4-2.8-13.8-2.8-20.2 0-2.7 1.1-4.4 3.8-4.4 6.7v2.1h29v-2.1z"/><circle class="st1" cx="105.2" cy="34" r="7.3"/><path class="st1" d="M119.7 53.8c0-2.9-1.7-5.6-4.4-6.7-6.4-2.8-13.8-2.8-20.2 0-2.7 1.1-4.4 3.8-4.4 6.7v2.1h29v-2.1z"/><circle class="st1" cx="319" cy="56.9" r="7.3"/><path class="st1" d="M333.6 76.6c0-2.9-1.7-5.6-4.4-6.7-6.4-2.8-13.8-2.8-20.2 0-2.7 1.1-4.4 3.8-4.4 6.7v2.1h29v-2.1z"/><circle class="st0" cx="81.2" cy="73.5" r="7.3"/><path class="st0" d="M95.7 93.2c0-2.9-1.7-5.6-4.4-6.7-6.4-2.8-13.8-2.8-20.2 0-2.7 1.1-4.4 3.8-4.4 6.7v2.1h29v-2.1z"/><circle class="st0" cx="241.4" cy="92" r="10.8"/><path class="st0" d="M263.1 121.5c0-4.4-2.6-8.3-6.6-10-9.6-4.2-20.5-4.2-30.1 0-4 1.7-6.6 5.7-6.6 10v3.1h43.4l-.1-3.1z"/><circle class="st1" cx="125.4" cy="84.9" r="9.1"/><path class="st1" d="M143.6 109.5c0-3.7-2.2-7-5.5-8.4-8.1-3.5-17.2-3.5-25.2 0-3.4 1.4-5.5 4.7-5.5 8.4v2.6h36.3l-.1-2.6z"/><circle class="st1" cx="257.7" cy="26.5" r="9.1"/><path class="st1" d="M275.9 51.2c0-3.7-2.2-7-5.5-8.4-8.1-3.5-17.2-3.5-25.2 0-3.4 1.4-5.5 4.7-5.5 8.4v2.6H276l-.1-2.6z"/><circle class="st2" cx="200" cy="60.3" r="10.8"/><path class="st2" d="M221.7 89.7c0-4.4-2.6-8.3-6.6-10-9.6-4.2-20.5-4.2-30.1 0-4 1.7-6.6 5.7-6.6 10v3.1h43.4l-.1-3.1z"/><path d="M223.3 104.9h-46.6c-5.8 0-10.5-4.7-10.5-10.5V45.6c0-5.8 4.7-10.5 10.5-10.5h46.6c5.8 0 10.5 4.7 10.5 10.5v48.8c0 5.8-4.7 10.5-10.5 10.5zm-46.6-68.8c-5.2 0-9.5 4.3-9.5 9.5v48.8c0 5.2 4.3 9.5 9.5 9.5h46.6c5.2 0 9.5-4.3 9.5-9.5V45.6c0-5.2-4.3-9.5-9.5-9.5h-46.6zm46.6 63.1h-46.6c-2.6 0-4.8-2.2-4.8-4.8V45.6c0-2.6 2.2-4.8 4.8-4.8h46.6c2.6 0 4.8 2.2 4.8 4.8v48.8c0 2.6-2.2 4.8-4.8 4.8zm0-57.4h-46.6c-2.1 0-3.8 1.7-3.8 3.8v48.8c0 2.1 1.7 3.8 3.8 3.8h46.6c2.1 0 3.8-1.7 3.8-3.8V45.6c0-2.1-1.7-3.8-3.8-3.8z" fill="#ceead6"/><path fill="none" d="M0 0h400v140H0z"/></svg> \ No newline at end of file
diff --git a/chrome/browser/resources/settings/images/privacy_sandbox_floc_banner_dark.svg b/chrome/browser/resources/settings/images/privacy_sandbox_floc_banner_dark.svg new file mode 100644 index 0000000..7d1c422d --- /dev/null +++ b/chrome/browser/resources/settings/images/privacy_sandbox_floc_banner_dark.svg
@@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 140"><circle cx="154.4" cy="39.7" r="10.8" fill="#185abc"/><path d="M176.1 69.2a10.821 10.821 0 0 0-6.6-10 37.528 37.528 0 0 0-30.1 0 10.925 10.925 0 0 0-6.6 10v3.1h43.4z" fill="#185abc"/><circle cx="277.9" cy="77.6" r="7.3" fill="#185abc"/><path d="M292.4 97.3a7.208 7.208 0 0 0-4.4-6.7 25.338 25.338 0 0 0-20.2 0 7.208 7.208 0 0 0-4.4 6.7v2.1h29z" fill="#185abc"/><circle cx="105.2" cy="34" r="7.3" fill="#34a853"/><path d="M119.7 53.8a7.208 7.208 0 0 0-4.4-6.7 25.338 25.338 0 0 0-20.2 0 7.208 7.208 0 0 0-4.4 6.7v2.1h29z" fill="#34a853"/><circle cx="319" cy="56.9" r="7.3" fill="#34a853"/><path d="M333.6 76.6a7.208 7.208 0 0 0-4.4-6.7 25.338 25.338 0 0 0-20.2 0 7.208 7.208 0 0 0-4.4 6.7v2.1h29z" fill="#34a853"/><circle cx="81.2" cy="73.5" r="7.3" fill="#185abc"/><path d="M95.7 93.2a7.208 7.208 0 0 0-4.4-6.7 25.338 25.338 0 0 0-20.2 0 7.208 7.208 0 0 0-4.4 6.7v2.1h29z" fill="#185abc"/><circle cx="241.4" cy="92" r="10.8" fill="#185abc"/><path d="M263.1 121.5a10.821 10.821 0 0 0-6.6-10 37.528 37.528 0 0 0-30.1 0 10.925 10.925 0 0 0-6.6 10v3.1h43.4z" fill="#185abc"/><circle cx="125.4" cy="84.9" r="9.1" fill="#34a853"/><path d="M143.6 109.5a9.11 9.11 0 0 0-5.5-8.4 31.552 31.552 0 0 0-25.2 0 8.957 8.957 0 0 0-5.5 8.4v2.6h36.3z" fill="#34a853"/><circle cx="257.7" cy="26.5" r="9.1" fill="#34a853"/><path d="M275.9 51.2a9.11 9.11 0 0 0-5.5-8.4 31.552 31.552 0 0 0-25.2 0 8.957 8.957 0 0 0-5.5 8.4v2.6H276z" fill="#34a853"/><circle cx="200" cy="60.3" r="10.8" fill="#34a853"/><path d="M221.7 89.7a10.821 10.821 0 0 0-6.6-10 37.528 37.528 0 0 0-30.1 0 10.925 10.925 0 0 0-6.6 10v3.1h43.4z" fill="#34a853"/><path d="M223.3 104.9h-46.6a10.499 10.499 0 0 1-10.5-10.5V45.6a10.499 10.499 0 0 1 10.5-10.5h46.6a10.499 10.499 0 0 1 10.5 10.5v48.8a10.499 10.499 0 0 1-10.5 10.5zm-46.6-68.8a9.56 9.56 0 0 0-9.5 9.5v48.8a9.56 9.56 0 0 0 9.5 9.5h46.6a9.56 9.56 0 0 0 9.5-9.5V45.6a9.56 9.56 0 0 0-9.5-9.5zm46.6 63.1h-46.6a4.867 4.867 0 0 1-4.8-4.8V45.6a4.867 4.867 0 0 1 4.8-4.8h46.6a4.867 4.867 0 0 1 4.8 4.8v48.8a4.867 4.867 0 0 1-4.8 4.8zm0-57.4h-46.6a3.798 3.798 0 0 0-3.8 3.8v48.8a3.798 3.798 0 0 0 3.8 3.8h46.6a3.798 3.798 0 0 0 3.8-3.8V45.6a3.798 3.798 0 0 0-3.8-3.8z" fill="#137333"/></svg> \ No newline at end of file
diff --git a/chrome/browser/resources/settings/privacy_sandbox/app.html b/chrome/browser/resources/settings/privacy_sandbox/app.html index 319062b..0505890 100644 --- a/chrome/browser/resources/settings/privacy_sandbox/app.html +++ b/chrome/browser/resources/settings/privacy_sandbox/app.html
@@ -17,6 +17,13 @@ flex: 1; } + .card-banner { + display: block; + margin-inline-end: auto; + margin-inline-start: auto; + max-width: 400px; + } + .label-wrapper { display: block; } @@ -111,8 +118,13 @@ </div> <template is="dom-if" if="[[privacySandboxSettings2Enabled_]]"> <div id="flocCard" class="card"> - <settings-toggle-button class="hr" - pref="{{prefs.generated.floc_enabled}}" + <picture> + <source class="card-banner" media="(prefers-color-scheme: dark)" + srcset="./images/privacy_sandbox_floc_banner_dark.svg"> + <img class="card-banner" alt="" + src="./images/privacy_sandbox_floc_banner.svg"> + </picture> + <settings-toggle-button pref="{{prefs.generated.floc_enabled}}" label="$i18n{privacySandboxPageFlocHeading}"> </settings-toggle-button> <div class="cr-row continuation"> @@ -120,14 +132,24 @@ </div> <div class="cr-row continuation"> <div class="label-wrapper"> - <div>$i18n{privacySandboxPageFlocCohort}</div> - <div id="flocId" class="cr-secondary-text">[[flocId_]]</div> + <div>$i18n{privacySandboxPageFlocStatus}</div> + <div id="flocStatus" class="cr-secondary-text"> + [[flocId_.trialStatus]] + </div> </div> </div> <div class="cr-row continuation"> <div class="label-wrapper"> - <div>$i18n{privacySandboxPageFlocCohortUpdated}</div> - <div class="cr-secondary-text">May 4th</div> + <div>$i18n{privacySandboxPageFlocCohort}</div> + <div id="flocId" class="cr-secondary-text">[[flocId_.cohort]]</div> + </div> + </div> + <div class="cr-row continuation"> + <div class="label-wrapper"> + <div>$i18n{privacySandboxPageFlocCohortNextUpdate}</div> + <div id="flocUpdatedOn" class="cr-secondary-text"> + [[flocId_.nextUpdate]] + </div> </div> </div> <div class="cr-row continuation"> @@ -135,7 +157,7 @@ </div> <div class="cr-row continuation box-last"> <cr-button id="resetFlocIdButton" class="cr-button" role="button" - on-click="onResetFlocClick_"> + disabled$="[[!flocId_.canReset]]" on-click="onResetFlocClick_"> $i18n{privacySandboxPageFlocResetCohort} </cr-button> </div>
diff --git a/chrome/browser/resources/settings/privacy_sandbox/app.js b/chrome/browser/resources/settings/privacy_sandbox/app.js index a84d8cc..28632f1 100644 --- a/chrome/browser/resources/settings/privacy_sandbox/app.js +++ b/chrome/browser/resources/settings/privacy_sandbox/app.js
@@ -14,7 +14,7 @@ // with |optimize_webui="true"|. import {CrSettingsPrefs, HatsBrowserProxyImpl, loadTimeData, MetricsBrowserProxy, MetricsBrowserProxyImpl, OpenWindowProxyImpl, PrefsBehavior} from '../settings.js'; -import {PrivacySandboxBrowserProxy, PrivacySandboxBrowserProxyImpl} from './privacy_sandbox_browser_proxy.js'; +import {FlocIdentifier, PrivacySandboxBrowserProxy, PrivacySandboxBrowserProxyImpl} from './privacy_sandbox_browser_proxy.js'; Polymer({ is: 'privacy-sandbox-app', @@ -32,10 +32,14 @@ value: () => loadTimeData.getBoolean('privacySandboxSettings2Enabled'), }, - /** @private */ - flocId_: String, + /** @private {!FlocIdentifier} */ + flocId_: { + type: Object, + }, }, + observers: ['onFlocChanged_(prefs.generated.floc_enabled.*)'], + /** @private {?MetricsBrowserProxy} */ metricsBrowserProxy_: null, @@ -77,6 +81,11 @@ }, /** @private */ + onFlocChanged_: function() { + this.privacySandboxBrowserProxy_.getFlocId().then(id => this.flocId_ = id); + }, + + /** @private */ onLearnMoreButtonClick_: function() { this.metricsBrowserProxy_.recordAction( 'Settings.PrivacySandbox.OpenExplainer');
diff --git a/chrome/browser/resources/settings/privacy_sandbox/privacy_sandbox_browser_proxy.js b/chrome/browser/resources/settings/privacy_sandbox/privacy_sandbox_browser_proxy.js index 9d8a010..ff1273f 100644 --- a/chrome/browser/resources/settings/privacy_sandbox/privacy_sandbox_browser_proxy.js +++ b/chrome/browser/resources/settings/privacy_sandbox/privacy_sandbox_browser_proxy.js
@@ -6,9 +6,21 @@ import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js'; // clang-format on +/** + * Information about the user's current FLoC cohort identifier. + * @typedef {{trialStatus: string, + * cohort: string, + * nextUpdate: string, + * canReset: boolean}} + */ +export let FlocIdentifier; + /** @interface */ export class PrivacySandboxBrowserProxy { - /** @return {!Promise<string>} The user's current FLoC cohort identifier. */ + /** + * Gets the user's current FLoC cohort identifier information. + * @return {!Promise<!FlocIdentifier>} + */ getFlocId() {} /** Resets the user's FLoC cohort identifier. */
diff --git a/chrome/browser/resources/welcome/set_as_default/nux_set_as_default.html b/chrome/browser/resources/welcome/set_as_default/nux_set_as_default.html index e89568ae..1fbbbe86 100644 --- a/chrome/browser/resources/welcome/set_as_default/nux_set_as_default.html +++ b/chrome/browser/resources/welcome/set_as_default/nux_set_as_default.html
@@ -3,24 +3,10 @@ text-align: center; } - .logo { - content: url(../images/module_icons/set_default_light.svg); - display: inline-block; - height: 38px; - margin-bottom: 16px; - width: 42px; - } - - @media (prefers-color-scheme: dark) { - .logo { - content: url(../images/module_icons/set_default_dark.svg); - } - } - .illustration { content: url(../images/set_default_light.svg); margin: auto; - width: 454px; + width: 320px; } @media (prefers-color-scheme: dark) { @@ -44,7 +30,6 @@ font-weight: unset; line-height: 1.875rem; margin: auto; - margin-bottom: 48px; margin-top: 16px; max-width: 400px; } @@ -52,7 +37,6 @@ .button-bar { display: flex; justify-content: space-between; - margin-top: 64px; } <if expr="is_win"> @@ -65,7 +49,6 @@ </if> </style> <div class="container"> - <div class="logo" aria-hidden="true"></div> <h1 tabindex="-1">[[subtitle]]</h1> <h2>$i18n{setDefaultSubHeader}</h2> <div class="illustration slide-in" aria-hidden="true"></div>
diff --git a/chrome/browser/safe_browsing/certificate_reporting_service_test_utils.cc b/chrome/browser/safe_browsing/certificate_reporting_service_test_utils.cc index 59de1cab..41ed554 100644 --- a/chrome/browser/safe_browsing/certificate_reporting_service_test_utils.cc +++ b/chrome/browser/safe_browsing/certificate_reporting_service_test_utils.cc
@@ -19,6 +19,7 @@ #include "mojo/public/cpp/bindings/remote.h" #include "net/http/http_response_headers.h" #include "services/network/public/cpp/resource_request.h" +#include "services/network/public/mojom/url_loader.mojom.h" #include "services/network/public/mojom/url_response_head.mojom.h" #include "services/network/test/test_utils.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/safe_browsing/download_protection/check_client_download_request.cc b/chrome/browser/safe_browsing/download_protection/check_client_download_request.cc index 2b3d1ba..771c3560 100644 --- a/chrome/browser/safe_browsing/download_protection/check_client_download_request.cc +++ b/chrome/browser/safe_browsing/download_protection/check_client_download_request.cc
@@ -58,6 +58,7 @@ // take precedence. case DownloadCheckResult::DANGEROUS_HOST: case DownloadCheckResult::DANGEROUS: + case DownloadCheckResult::DANGEROUS_ACCOUNT_COMPROMISE: callback.Run(deep_scan_result); return; @@ -77,6 +78,8 @@ callback.Run(DownloadCheckResult::POTENTIALLY_UNWANTED); else if (reason == REASON_DOWNLOAD_UNCOMMON) callback.Run(DownloadCheckResult::UNCOMMON); + else if (reason == REASON_DOWNLOAD_DANGEROUS_ACCOUNT_COMPROMISE) + callback.Run(DownloadCheckResult::DANGEROUS_ACCOUNT_COMPROMISE); else callback.Run(deep_scan_result); return; @@ -237,7 +240,8 @@ auto settings = DeepScanningRequest::ShouldUploadBinary(item_); if (settings && (reason == REASON_DOWNLOAD_DANGEROUS || reason == REASON_DOWNLOAD_DANGEROUS_HOST || - reason == REASON_ALLOWLISTED_URL)) { + reason == REASON_ALLOWLISTED_URL || + reason == REASON_DOWNLOAD_DANGEROUS_ACCOUNT_COMPROMISE)) { settings->tags.erase("malware"); if (settings->tags.empty()) return absl::nullopt; @@ -252,7 +256,8 @@ if (reason == REASON_DOWNLOAD_DANGEROUS || reason == REASON_DOWNLOAD_DANGEROUS_HOST || reason == REASON_DOWNLOAD_POTENTIALLY_UNWANTED || - reason == REASON_DOWNLOAD_UNCOMMON || reason == REASON_ALLOWLISTED_URL) { + reason == REASON_DOWNLOAD_UNCOMMON || reason == REASON_ALLOWLISTED_URL || + reason == REASON_DOWNLOAD_DANGEROUS_ACCOUNT_COMPROMISE) { service()->UploadForDeepScanning( item_, base::BindRepeating(&MaybeOverrideScanResult, reason, callback_), DeepScanningRequest::DeepScanTrigger::TRIGGER_POLICY,
diff --git a/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc b/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc index 9d7d059..225acbcc 100644 --- a/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc +++ b/chrome/browser/safe_browsing/download_protection/check_client_download_request_base.cc
@@ -575,6 +575,11 @@ reason = REASON_VERDICT_UNKNOWN; result = DownloadCheckResult::UNKNOWN; break; + case ClientDownloadResponse::DANGEROUS_ACCOUNT_COMPROMISE: + reason = REASON_DOWNLOAD_DANGEROUS_ACCOUNT_COMPROMISE; + result = DownloadCheckResult::DANGEROUS_ACCOUNT_COMPROMISE; + token = response.token(); + break; default: LOG(DFATAL) << "Unknown download response verdict: " << response.verdict();
diff --git a/chrome/browser/safe_browsing/download_protection/deep_scanning_browsertest.cc b/chrome/browser/safe_browsing/download_protection/deep_scanning_browsertest.cc index 9203859d..a176177 100644 --- a/chrome/browser/safe_browsing/download_protection/deep_scanning_browsertest.cc +++ b/chrome/browser/safe_browsing/download_protection/deep_scanning_browsertest.cc
@@ -1024,13 +1024,17 @@ return "POTENTIALLY_UNWANTED"; case ClientDownloadResponse::DANGEROUS_HOST: return "DANGEROUS_HOST"; + case ClientDownloadResponse::DANGEROUS_ACCOUNT_COMPROMISE: + return "DANGEROUS_ACCOUNT_COMPROMISE"; } } std::string expected_threat_type() const { // These results exempt the file from being deep scanned. if (metadata_check_verdict() == ClientDownloadResponse::DANGEROUS || - metadata_check_verdict() == ClientDownloadResponse::DANGEROUS_HOST) { + metadata_check_verdict() == ClientDownloadResponse::DANGEROUS_HOST || + metadata_check_verdict() == + ClientDownloadResponse::DANGEROUS_ACCOUNT_COMPROMISE) { return metadata_check_threat_type(); } switch (scanning_verdict()) { @@ -1051,6 +1055,9 @@ case ClientDownloadResponse::DANGEROUS_HOST: return download::DownloadDangerType:: DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST; + case ClientDownloadResponse::DANGEROUS_ACCOUNT_COMPROMISE: + return download::DownloadDangerType:: + DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE; case ClientDownloadResponse::UNCOMMON: if (scanning_verdict() != ScanningVerdict::MALWARE) { return download::DownloadDangerType:: @@ -1084,7 +1091,9 @@ bool deep_scan_needed() const { return metadata_check_verdict() != ClientDownloadResponse::DANGEROUS && - metadata_check_verdict() != ClientDownloadResponse::DANGEROUS_HOST; + metadata_check_verdict() != ClientDownloadResponse::DANGEROUS_HOST && + metadata_check_verdict() != + ClientDownloadResponse::DANGEROUS_ACCOUNT_COMPROMISE; } }; @@ -1097,7 +1106,8 @@ ClientDownloadResponse::UNCOMMON, ClientDownloadResponse::POTENTIALLY_UNWANTED, ClientDownloadResponse::DANGEROUS_HOST, - ClientDownloadResponse::UNKNOWN), + ClientDownloadResponse::UNKNOWN, + ClientDownloadResponse::DANGEROUS_ACCOUNT_COMPROMISE), testing::Values(ScanningVerdict::MALWARE, ScanningVerdict::UNWANTED, ScanningVerdict::SAFE),
diff --git a/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc b/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc index 5777a1e..b516abe 100644 --- a/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc +++ b/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc
@@ -124,6 +124,7 @@ // |download_restriction|. case DownloadCheckResult::DANGEROUS: case DownloadCheckResult::DANGEROUS_HOST: + case DownloadCheckResult::DANGEROUS_ACCOUNT_COMPROMISE: switch (download_restriction) { case DownloadPrefs::DownloadRestriction::ALL_FILES: case DownloadPrefs::DownloadRestriction::POTENTIALLY_DANGEROUS_FILES:
diff --git a/chrome/browser/safe_browsing/download_protection/download_feedback_service_unittest.cc b/chrome/browser/safe_browsing/download_protection/download_feedback_service_unittest.cc index 91c062c1..66c7e88 100644 --- a/chrome/browser/safe_browsing/download_protection/download_feedback_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection/download_feedback_service_unittest.cc
@@ -194,6 +194,9 @@ EXPECT_EQ(upload_requested, WillStorePings(DownloadCheckResult::POTENTIALLY_UNWANTED, upload_requested, ok_size)); + EXPECT_EQ(upload_requested, + WillStorePings(DownloadCheckResult::DANGEROUS_ACCOUNT_COMPROMISE, + upload_requested, ok_size)); // Bad sizes never upload EXPECT_FALSE( @@ -208,6 +211,9 @@ upload_requested, bad_size)); EXPECT_FALSE(WillStorePings(DownloadCheckResult::POTENTIALLY_UNWANTED, upload_requested, bad_size)); + EXPECT_FALSE( + WillStorePings(DownloadCheckResult::DANGEROUS_ACCOUNT_COMPROMISE, + upload_requested, bad_size)); } }
diff --git a/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc index 008dd053..08adc8b 100644 --- a/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc
@@ -1256,11 +1256,11 @@ MatchDownloadAllowlistUrl(_)) .WillRepeatedly(Return(false)); EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(tmp_path_, _)) - .Times(8); + .Times(9); EXPECT_CALL(*binary_feature_extractor_.get(), ExtractImageFeatures( tmp_path_, BinaryFeatureExtractor::kDefaultOptions, _, _)) - .Times(8); + .Times(9); std::string feedback_ping; std::string feedback_response; ClientDownloadResponse expected_response; @@ -1371,6 +1371,30 @@ EXPECT_TRUE(HasClientDownloadRequest()); ClearClientDownloadRequest(); } + + { + // If the response is dangerous_account_compromise the result should + // also be marked as dangerous_account_compromise. + + PrepareResponse(ClientDownloadResponse::DANGEROUS_ACCOUNT_COMPROMISE, + net::HTTP_OK, net::OK, true /* upload_requested */); + RunLoop run_loop; + download_service_->CheckClientDownload( + &item, + base::BindRepeating(&DownloadProtectionServiceTest::CheckDoneCallback, + base::Unretained(this), run_loop.QuitClosure())); + run_loop.Run(); + EXPECT_TRUE(IsResult(DownloadCheckResult::DANGEROUS_ACCOUNT_COMPROMISE)); + EXPECT_TRUE(DownloadFeedbackService::GetPingsForDownloadForTesting( + item, &feedback_ping, &feedback_response)); + expected_response.set_verdict( + ClientDownloadResponse::DANGEROUS_ACCOUNT_COMPROMISE); + expected_response.set_upload(true); + EXPECT_EQ(expected_response.SerializeAsString(), feedback_response); + EXPECT_TRUE(HasClientDownloadRequest()); + ClearClientDownloadRequest(); + } + { // If the response is POTENTIALLY_UNWANTED the result should also be marked // as POTENTIALLY_UNWANTED. @@ -2549,7 +2573,8 @@ {ClientDownloadResponse::POTENTIALLY_UNWANTED, DownloadCheckResult::POTENTIALLY_UNWANTED}, {ClientDownloadResponse::UNKNOWN, DownloadCheckResult::UNKNOWN}, - }; + {ClientDownloadResponse::DANGEROUS_ACCOUNT_COMPROMISE, + DownloadCheckResult::DANGEROUS_ACCOUNT_COMPROMISE}}; for (const auto& test_case : kExpectedResults) { sb_service_->test_url_loader_factory()->ClearResponses(); @@ -3454,11 +3479,11 @@ MatchDownloadAllowlistUrl(_)) .WillRepeatedly(Return(false)); EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(tmp_path_, _)) - .Times(8); + .Times(9); EXPECT_CALL(*binary_feature_extractor_.get(), ExtractImageFeatures( tmp_path_, BinaryFeatureExtractor::kDefaultOptions, _, _)) - .Times(8); + .Times(9); ClientDownloadResponse expected_response; { @@ -3501,6 +3526,8 @@ {ClientDownloadResponse::POTENTIALLY_UNWANTED, DownloadCheckResult::POTENTIALLY_UNWANTED}, {ClientDownloadResponse::UNKNOWN, DownloadCheckResult::UNKNOWN}, + {ClientDownloadResponse::DANGEROUS_ACCOUNT_COMPROMISE, + DownloadCheckResult::DANGEROUS_ACCOUNT_COMPROMISE}, }; for (const auto& test_case : kExpectedResults) { PrepareResponse(test_case.verdict, net::HTTP_OK, net::OK); @@ -4080,6 +4107,8 @@ {ClientDownloadResponse::POTENTIALLY_UNWANTED, DownloadCheckResult::POTENTIALLY_UNWANTED}, {ClientDownloadResponse::UNCOMMON, DownloadCheckResult::UNCOMMON}, + {ClientDownloadResponse::DANGEROUS_ACCOUNT_COMPROMISE, + DownloadCheckResult::DANGEROUS_ACCOUNT_COMPROMISE}, }; for (const auto& response : responses) { NiceMockDownloadItem item;
diff --git a/chrome/browser/safe_browsing/download_protection/download_protection_util.h b/chrome/browser/safe_browsing/download_protection/download_protection_util.h index 2167d68cf..7fb32a8 100644 --- a/chrome/browser/safe_browsing/download_protection/download_protection_util.h +++ b/chrome/browser/safe_browsing/download_protection/download_protection_util.h
@@ -32,7 +32,8 @@ DEEP_SCANNED_SAFE = 12, PROMPT_FOR_SCANNING = 13, BLOCKED_UNSUPPORTED_FILE_TYPE = 14, - kMaxValue = BLOCKED_UNSUPPORTED_FILE_TYPE, + DANGEROUS_ACCOUNT_COMPROMISE = 15, + kMaxValue = DANGEROUS_ACCOUNT_COMPROMISE, }; // Enum to keep track why a particular download verdict was chosen. @@ -74,6 +75,7 @@ REASON_DEEP_SCANNED_SAFE = 33, REASON_ADVANCED_PROTECTION_PROMPT = 34, REASON_BLOCKED_UNSUPPORTED_FILE_TYPE = 35, + REASON_DOWNLOAD_DANGEROUS_ACCOUNT_COMPROMISE = 36, REASON_MAX // Always add new values before this one. };
diff --git a/chrome/browser/safe_browsing/download_protection/download_reporter.cc b/chrome/browser/safe_browsing/download_protection/download_reporter.cc index 4d3d372..5c32a5e 100644 --- a/chrome/browser/safe_browsing/download_protection/download_reporter.cc +++ b/chrome/browser/safe_browsing/download_protection/download_reporter.cc
@@ -32,7 +32,9 @@ danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT || danger_type == download::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT || danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST || - danger_type == download::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED); + danger_type == download::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED || + danger_type == + download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE); } void MaybeReportDangerousDownloadWarning(download::DownloadItem* download) {
diff --git a/chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc b/chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc index 73a86ad3..fb573c8 100644 --- a/chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc +++ b/chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc
@@ -325,6 +325,8 @@ return DownloadCheckResult::DANGEROUS_HOST; case ClientDownloadResponse::UNKNOWN: return DownloadCheckResult::UNKNOWN; + case ClientDownloadResponse::DANGEROUS_ACCOUNT_COMPROMISE: + return DownloadCheckResult::DANGEROUS_ACCOUNT_COMPROMISE; } return DownloadCheckResult::UNKNOWN; }
diff --git a/chrome/browser/send_tab_to_self/receiving_ui_handler_registry.cc b/chrome/browser/send_tab_to_self/receiving_ui_handler_registry.cc index 34a9335..900814ea 100644 --- a/chrome/browser/send_tab_to_self/receiving_ui_handler_registry.cc +++ b/chrome/browser/send_tab_to_self/receiving_ui_handler_registry.cc
@@ -10,6 +10,8 @@ #include "build/build_config.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/send_tab_to_self/receiving_ui_handler.h" +#include "chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_button_controller.h" +#include "components/send_tab_to_self/features.h" #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || \ defined(OS_WIN) @@ -35,14 +37,36 @@ Profile* profile) { #if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || \ defined(OS_WIN) - applicable_handlers_.push_back( - std::make_unique<send_tab_to_self::DesktopNotificationHandler>(profile)); + + if (base::FeatureList::IsEnabled(kSendTabToSelfV2)) { + applicable_handlers_.push_back( + std::make_unique< + send_tab_to_self::SendTabToSelfToolbarButtonController>(profile)); + } else { + applicable_handlers_.push_back( + std::make_unique<send_tab_to_self::DesktopNotificationHandler>( + profile)); + } #elif defined(OS_ANDROID) applicable_handlers_.push_back( std::make_unique<AndroidNotificationHandler>()); #endif } +SendTabToSelfToolbarButtonController* +ReceivingUiHandlerRegistry::GetToolbarButtonControllerForProfile( + Profile* profile) { + for (const std::unique_ptr<ReceivingUiHandler>& handler : + applicable_handlers_) { + auto* button_controller = + static_cast<SendTabToSelfToolbarButtonController*>(handler.get()); + if (button_controller && button_controller->profile() == profile) { + return button_controller; + } + } + return nullptr; +} + const std::vector<std::unique_ptr<ReceivingUiHandler>>& ReceivingUiHandlerRegistry::GetHandlers() const { return applicable_handlers_;
diff --git a/chrome/browser/send_tab_to_self/receiving_ui_handler_registry.h b/chrome/browser/send_tab_to_self/receiving_ui_handler_registry.h index 45e5b3b2..3af8fbc 100644 --- a/chrome/browser/send_tab_to_self/receiving_ui_handler_registry.h +++ b/chrome/browser/send_tab_to_self/receiving_ui_handler_registry.h
@@ -20,6 +20,7 @@ namespace send_tab_to_self { class ReceivingUiHandler; +class SendTabToSelfToolbarButtonController; // Registry responsible for keeping track of which UI handlers are appropriate // for each platform. A platform can have multiple handlers which are @@ -35,6 +36,11 @@ // Called by the SendTabToSelfClientService. const std::vector<std::unique_ptr<ReceivingUiHandler>>& GetHandlers() const; + // Return the SendTabToSelfToolbarButtonController owned by the registry + // for the given |profile|. + SendTabToSelfToolbarButtonController* GetToolbarButtonControllerForProfile( + Profile* profile); + private: friend struct base::DefaultSingletonTraits<ReceivingUiHandlerRegistry>;
diff --git a/chrome/browser/send_tab_to_self/send_tab_to_self_client_service.cc b/chrome/browser/send_tab_to_self/send_tab_to_self_client_service.cc index 611d147b..edd53f2d 100644 --- a/chrome/browser/send_tab_to_self/send_tab_to_self_client_service.cc +++ b/chrome/browser/send_tab_to_self/send_tab_to_self_client_service.cc
@@ -12,6 +12,8 @@ #include "chrome/browser/send_tab_to_self/desktop_notification_handler.h" #include "chrome/browser/send_tab_to_self/receiving_ui_handler.h" #include "chrome/browser/send_tab_to_self/receiving_ui_handler_registry.h" +#include "chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_button_controller.h" +#include "components/send_tab_to_self/features.h" #include "components/send_tab_to_self/send_tab_to_self_model.h" namespace send_tab_to_self { @@ -51,10 +53,18 @@ // TODO(skare): ReceivingUiHandler should be able to filter at its level, // or the registry should not be a singleton so we don't need to filter at // all. This narrow patch is less risky, but we should make a larger change. - auto* desktop_handler = - static_cast<DesktopNotificationHandler*>(handler.get()); - if (desktop_handler && desktop_handler->GetProfile() == profile_) { - handler->DisplayNewEntries(new_entries); + if (base::FeatureList::IsEnabled(kSendTabToSelfV2)) { + auto* button_controller = + static_cast<SendTabToSelfToolbarButtonController*>(handler.get()); + if (button_controller && button_controller->profile() == profile_) { + handler->DisplayNewEntries(new_entries); + } + } else { + auto* desktop_handler = + static_cast<DesktopNotificationHandler*>(handler.get()); + if (desktop_handler && desktop_handler->GetProfile() == profile_) { + handler->DisplayNewEntries(new_entries); + } } #else handler->DisplayNewEntries(new_entries);
diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc index f773fcc3..ae500328 100644 --- a/chrome/browser/sessions/session_restore_browsertest.cc +++ b/chrome/browser/sessions/session_restore_browsertest.cc
@@ -49,6 +49,7 @@ #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window.h" @@ -57,6 +58,7 @@ #include "chrome/browser/ui/tabs/tab_group_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/ui_features.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h" #include "chrome/browser/web_applications/test/web_app_install_test_utils.h" #include "chrome/common/chrome_constants.h"
diff --git a/chrome/browser/sessions/session_service_base.cc b/chrome/browser/sessions/session_service_base.cc index 5019222..62d7947 100644 --- a/chrome/browser/sessions/session_service_base.cc +++ b/chrome/browser/sessions/session_service_base.cc
@@ -29,6 +29,7 @@ #include "chrome/browser/ui/startup/startup_browser_creator.h" #include "chrome/browser/ui/tabs/tab_group.h" #include "chrome/browser/ui/tabs/tab_group_model.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/web_applications/components/web_app_helpers.h" #include "components/sessions/content/content_serialized_navigation_builder.h" #include "components/sessions/content/session_tab_helper.h"
diff --git a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java index 862eb9e..6e13206 100644 --- a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java +++ b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java
@@ -441,8 +441,8 @@ .setIcon(R.drawable.webnote, R.string.sharing_webnotes_stylized) .setFeatureNameForMetrics("SharingHubAndroid.WebnotesStylize") .setOnClickCallback((view) -> { - NoteCreationCoordinator coordinator = - NoteCreationCoordinatorFactory.create(mActivity); + NoteCreationCoordinator coordinator = NoteCreationCoordinatorFactory.create( + mActivity, mShareParams.getText()); coordinator.showDialog(); }) .build();
diff --git a/chrome/browser/site_isolation/site_per_process_interactive_browsertest.cc b/chrome/browser/site_isolation/site_per_process_interactive_browsertest.cc index 45042416..d1459aa 100644 --- a/chrome/browser/site_isolation/site_per_process_interactive_browsertest.cc +++ b/chrome/browser/site_isolation/site_per_process_interactive_browsertest.cc
@@ -15,6 +15,7 @@ #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_test.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/test/base/in_process_browser_test.h"
diff --git a/chrome/browser/speech/on_device_speech_recognizer.h b/chrome/browser/speech/on_device_speech_recognizer.h index 067610e..7a4da8dc 100644 --- a/chrome/browser/speech/on_device_speech_recognizer.h +++ b/chrome/browser/speech/on_device_speech_recognizer.h
@@ -12,6 +12,8 @@ #include "chrome/browser/speech/speech_recognizer.h" #include "chrome/browser/speech/speech_recognizer_delegate.h" #include "media/mojo/mojom/speech_recognition_service.mojom.h" +#include "mojo/public/cpp/bindings/receiver.h" +#include "mojo/public/cpp/bindings/remote.h" class Profile; class SpeechRecognizerDelegate;
diff --git a/chrome/browser/ssl/chrome_security_blocking_page_factory.cc b/chrome/browser/ssl/chrome_security_blocking_page_factory.cc index e899308..109ec70 100644 --- a/chrome/browser/ssl/chrome_security_blocking_page_factory.cc +++ b/chrome/browser/ssl/chrome_security_blocking_page_factory.cc
@@ -18,6 +18,7 @@ #include "chrome/browser/ssl/insecure_form/insecure_form_controller_client.h" #include "chrome/browser/ssl/ssl_error_controller_client.h" #include "chrome/browser/ssl/stateful_ssl_host_state_delegate_factory.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/common/channel_info.h" #include "components/security_interstitials/content/content_metrics_helper.h" #include "components/security_interstitials/content/settings_page_helper.h"
diff --git a/chrome/browser/supervised_user/supervised_user_settings_service.cc b/chrome/browser/supervised_user/supervised_user_settings_service.cc index 6217f719..946ae59d 100644 --- a/chrome/browser/supervised_user/supervised_user_settings_service.cc +++ b/chrome/browser/supervised_user/supervised_user_settings_service.cc
@@ -144,7 +144,7 @@ if (sync_processor_) { base::RecordAction(UserMetricsAction("ManagedUsers_UploadItem_Syncing")); dict = GetDictionaryAndSplitKey(&key_suffix); - DCHECK(GetQueuedItems()->empty()); + DCHECK(GetQueuedItems()->DictEmpty()); SyncChangeList change_list; SyncData data = CreateSyncDataForSetting(key, *value); SyncChange::SyncChangeType change_type =
diff --git a/chrome/browser/sync/sync_ui_util.cc b/chrome/browser/sync/sync_ui_util.cc index 8a841a6f..620077d 100644 --- a/chrome/browser/sync/sync_ui_util.cc +++ b/chrome/browser/sync/sync_ui_util.cc
@@ -13,6 +13,7 @@ #include "chrome/browser/signin/signin_util.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/singleton_tabs.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h"
diff --git a/chrome/browser/sync/trusted_vault_client_android.cc b/chrome/browser/sync/trusted_vault_client_android.cc index 2a710b1..76a4ffa 100644 --- a/chrome/browser/sync/trusted_vault_client_android.cc +++ b/chrome/browser/sync/trusted_vault_client_android.cc
@@ -17,8 +17,21 @@ base::OnceCallback<void(const std::vector<std::vector<uint8_t>>&)> callback) : account_info(account_info), callback(std::move(callback)) {} +TrustedVaultClientAndroid::OngoingFetchKeys::OngoingFetchKeys( + OngoingFetchKeys&&) = default; + TrustedVaultClientAndroid::OngoingFetchKeys::~OngoingFetchKeys() = default; +TrustedVaultClientAndroid::OngoingMarkKeysAsStale::OngoingMarkKeysAsStale( + base::OnceCallback<void(bool)> callback) + : callback(std::move(callback)) {} + +TrustedVaultClientAndroid::OngoingMarkKeysAsStale::OngoingMarkKeysAsStale( + OngoingMarkKeysAsStale&&) = default; + +TrustedVaultClientAndroid::OngoingMarkKeysAsStale::~OngoingMarkKeysAsStale() = + default; + TrustedVaultClientAndroid::TrustedVaultClientAndroid() { JNIEnv* const env = base::android::AttachCurrentThread(); Java_TrustedVaultClient_registerNative(env, reinterpret_cast<intptr_t>(this)); @@ -32,35 +45,33 @@ void TrustedVaultClientAndroid::FetchKeysCompleted( JNIEnv* env, + jint request_id, const base::android::JavaParamRef<jstring>& gaia_id, const base::android::JavaParamRef<jobjectArray>& keys) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DCHECK(ongoing_fetch_keys_) << "No ongoing FetchKeys() request"; - DCHECK_EQ(ongoing_fetch_keys_->account_info.gaia, + + OngoingRequest ongoing_request = GetAndUnregisterOngoingRequest(request_id); + OngoingFetchKeys& ongoing_fetch_keys = + absl::get<OngoingFetchKeys>(ongoing_request); + + DCHECK_EQ(ongoing_fetch_keys.account_info.gaia, base::android::ConvertJavaStringToUTF8(env, gaia_id)) << "User mismatch in FetchKeys() response"; - // Make a copy of the callback and reset |ongoing_fetch_keys_| before invoking - // the callback, in case it has side effects. - base::OnceCallback<void(const std::vector<std::vector<uint8_t>>&)> cb = - std::move(ongoing_fetch_keys_->callback); - ongoing_fetch_keys_.reset(); - std::vector<std::vector<uint8_t>> converted_keys; JavaArrayOfByteArrayToBytesVector(env, keys, &converted_keys); - std::move(cb).Run(converted_keys); + std::move(ongoing_fetch_keys.callback).Run(converted_keys); } void TrustedVaultClientAndroid::MarkKeysAsStaleCompleted(JNIEnv* env, + jint request_id, jboolean result) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DCHECK(ongoing_mark_keys_as_stale_) << "No ongoing MarkKeysAsStale() request"; - // Make a copy of the callback and reset |ongoing_mark_keys_as_stale_| before - // invoking the callback, in case it has side effects. - base::OnceCallback<void(bool)> cb = std::move(ongoing_mark_keys_as_stale_); + OngoingRequest ongoing_request = GetAndUnregisterOngoingRequest(request_id); - std::move(cb).Run(!!result); + std::move(absl::get<OngoingMarkKeysAsStale>(ongoing_request).callback) + .Run(!!result); } void TrustedVaultClientAndroid::NotifyKeysChanged(JNIEnv* env) { @@ -81,14 +92,10 @@ const CoreAccountInfo& account_info, base::OnceCallback<void(const std::vector<std::vector<uint8_t>>&)> cb) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - DCHECK(!ongoing_fetch_keys_) - << "Only one FetchKeys() request is allowed at any time"; - DCHECK(!ongoing_mark_keys_as_stale_) - << "FetchKeys() not allowed while ongoing MarkKeysAsStale()"; // Store for later completion when Java invokes FetchKeysCompleted(). - ongoing_fetch_keys_ = - std::make_unique<OngoingFetchKeys>(account_info, std::move(cb)); + const RequestId request_id = + RegisterNewOngoingRequest(OngoingFetchKeys(account_info, std::move(cb))); JNIEnv* const env = base::android::AttachCurrentThread(); const base::android::ScopedJavaLocalRef<jobject> java_account_info = @@ -97,7 +104,7 @@ // Trigger the fetching keys from the implementation in Java, which will // eventually call FetchKeysCompleted(). Java_TrustedVaultClient_fetchKeys(env, reinterpret_cast<intptr_t>(this), - java_account_info); + request_id, java_account_info); } void TrustedVaultClientAndroid::StoreKeys( @@ -117,13 +124,10 @@ base::OnceCallback<void(bool)> cb) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK(cb); - DCHECK(!ongoing_mark_keys_as_stale_) - << "Only one MarkKeysAsStale() request is allowed at any time"; - DCHECK(!ongoing_fetch_keys_) - << "MarkKeysAsStale() not allowed while ongoing FetchKeys()"; // Store for later completion when Java invokes MarkKeysAsStaleCompleted(). - ongoing_mark_keys_as_stale_ = std::move(cb); + const RequestId request_id = + RegisterNewOngoingRequest(OngoingMarkKeysAsStale(std::move(cb))); JNIEnv* const env = base::android::AttachCurrentThread(); const base::android::ScopedJavaLocalRef<jobject> java_account_info = @@ -131,7 +135,7 @@ // The Java implementation will eventually call MarkKeysAsStaleCompleted(). Java_TrustedVaultClient_markKeysAsStale(env, reinterpret_cast<intptr_t>(this), - java_account_info); + request_id, java_account_info); } void TrustedVaultClientAndroid::GetIsRecoverabilityDegraded( @@ -151,3 +155,21 @@ NOTIMPLEMENTED(); std::move(cb).Run(); } + +TrustedVaultClientAndroid::RequestId +TrustedVaultClientAndroid::RegisterNewOngoingRequest(OngoingRequest request) { + ongoing_requests_.emplace(++last_request_id_, std::move(request)); + return last_request_id_; +} + +TrustedVaultClientAndroid::OngoingRequest +TrustedVaultClientAndroid::GetAndUnregisterOngoingRequest(RequestId id) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + auto it = ongoing_requests_.find(id); + DCHECK(it != ongoing_requests_.end()); + + OngoingRequest request = std::move(it->second); + ongoing_requests_.erase(it); + return request; +}
diff --git a/chrome/browser/sync/trusted_vault_client_android.h b/chrome/browser/sync/trusted_vault_client_android.h index 8b9ab92..aebe2f27 100644 --- a/chrome/browser/sync/trusted_vault_client_android.h +++ b/chrome/browser/sync/trusted_vault_client_android.h
@@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_SYNC_TRUSTED_VAULT_CLIENT_ANDROID_H_ #define CHROME_BROWSER_SYNC_TRUSTED_VAULT_CLIENT_ANDROID_H_ +#include <map> #include <memory> #include <string> #include <vector> @@ -16,6 +17,7 @@ #include "base/observer_list.h" #include "components/signin/public/identity_manager/account_info.h" #include "components/sync/driver/trusted_vault_client.h" +#include "third_party/abseil-cpp/absl/types/variant.h" // JNI bridge for a Java implementation of the TrustedVaultClient interface, // used on Android. @@ -31,17 +33,17 @@ delete; // Called from Java to notify the completion of a FetchKeys() operation - // previously initiated from C++. This must correspond to an ongoing - // FetchKeys() request, and |gaia_id| must match the user's ID. + // previously initiated from C++ and identified by |request_id|. |gaia_id| + // must match the user's ID. void FetchKeysCompleted( JNIEnv* env, + jint request_id, const base::android::JavaParamRef<jstring>& gaia_id, const base::android::JavaParamRef<jobjectArray>& keys); - // Called from Java to notify the completion of MarkKeysAsStale() - // operation previously initiated from C++. This must correspond to an - // ongoing MarkKeysAsStale() request. - void MarkKeysAsStaleCompleted(JNIEnv* env, jboolean result); + // Called from Java to notify the completion of a MarkKeysAsStale() operation + // previously initiated from C++ and identified by |request_id|. + void MarkKeysAsStaleCompleted(JNIEnv* env, jint request_id, jboolean result); // Called from Java to notify that the keys in the vault may have changed. void NotifyKeysChanged(JNIEnv* env); @@ -73,18 +75,33 @@ const CoreAccountInfo& account_info, base::OnceCallback<void(const std::vector<std::vector<uint8_t>>&)> callback); + OngoingFetchKeys(OngoingFetchKeys&&); ~OngoingFetchKeys(); const CoreAccountInfo account_info; base::OnceCallback<void(const std::vector<std::vector<uint8_t>>&)> callback; }; - // Null if no in-flight FetchKeys(). - std::unique_ptr<OngoingFetchKeys> ongoing_fetch_keys_; + // Struct representing an in-flight MarkKeysAsStale() call invoked from C++. + struct OngoingMarkKeysAsStale { + explicit OngoingMarkKeysAsStale(base::OnceCallback<void(bool)> callback); + OngoingMarkKeysAsStale(OngoingMarkKeysAsStale&&); + ~OngoingMarkKeysAsStale(); - // Completion callback of an in-flight MarkKeysAsStale() call invoked from - // C++. - base::OnceCallback<void(bool)> ongoing_mark_keys_as_stale_; + base::OnceCallback<void(bool)> callback; + }; + + using RequestId = int32_t; + using OngoingRequest = + absl::variant<OngoingFetchKeys, OngoingMarkKeysAsStale>; + + RequestId RegisterNewOngoingRequest(OngoingRequest request); + OngoingRequest GetAndUnregisterOngoingRequest(RequestId id); + + // Each in-flight request gets assigned an auto-increment ID and gets cached + // in a map, until the response from Java is received. + RequestId last_request_id_ = 0; + std::map<RequestId, OngoingRequest> ongoing_requests_; base::ObserverList<Observer> observer_list_; };
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 8ce51c5..c8f4158 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -3565,6 +3565,9 @@ "send_tab_to_self/send_tab_to_self_bubble_controller.cc", "send_tab_to_self/send_tab_to_self_bubble_controller.h", "send_tab_to_self/send_tab_to_self_bubble_view.h", + "send_tab_to_self/send_tab_to_self_toolbar_button_controller.cc", + "send_tab_to_self/send_tab_to_self_toolbar_button_controller.h", + "send_tab_to_self/send_tab_to_self_toolbar_button_controller_delegate.h", "sharing_hub/sharing_hub_bubble_controller.cc", "sharing_hub/sharing_hub_bubble_controller.h", "sharing_hub/sharing_hub_bubble_view.h", @@ -4171,6 +4174,8 @@ "views/send_tab_to_self/send_tab_to_self_bubble_view_impl.h", "views/send_tab_to_self/send_tab_to_self_icon_view.cc", "views/send_tab_to_self/send_tab_to_self_icon_view.h", + "views/send_tab_to_self/send_tab_to_self_toolbar_button_view.cc", + "views/send_tab_to_self/send_tab_to_self_toolbar_button_view.h", "views/session_crashed_bubble_view.cc", "views/session_crashed_bubble_view.h", "views/sharing/sharing_dialog_view.cc",
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd index a9c50f2..5f2223b5 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
@@ -832,7 +832,7 @@ FLoC </message> <message name="IDS_PRIVACY_SANDBOX_FLOC_DESCRIPTION" desc="Describes the FLoC technology as part of Privacy Sandbox."> - When on and the status is active, Chrome uses your browsing history over 7 days to determine a group, or “cohort”, that you’re in. Advertisers can select ads for the group. Your browsing history is not shared and is kept private on your device. In some regions, this trial is not active. + When on and the status is active, Chrome uses your browsing history over 7 days to determine a group, or “cohort”, that you’re in. Advertisers can select ads for the group. Your browsing history is kept private on your device. This trial is active only in <ph name="BEGIN_LINK"><link></ph>some regions<ph name="END_LINK"></link></ph>. </message> <message name="IDS_PRIVACY_SANDBOX_FLOC_STATUS_TITLE" desc="Title for FLoC experiment status."> Status
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_DESCRIPTION.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_DESCRIPTION.png.sha1 index 4a6ec44..86a2912 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_DESCRIPTION.png.sha1 +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_DESCRIPTION.png.sha1
@@ -1 +1 @@ -c5bb0dcbea93ce730deed86f56d47b5a1c0846d5 \ No newline at end of file +d73f9581cad19a89242451e66937341db113a2bd \ No newline at end of file
diff --git a/chrome/browser/ui/android/webid/BUILD.gn b/chrome/browser/ui/android/webid/BUILD.gn index 7661bbff..0516cea 100644 --- a/chrome/browser/ui/android/webid/BUILD.gn +++ b/chrome/browser/ui/android/webid/BUILD.gn
@@ -21,3 +21,32 @@ generate_jni("jni_headers") { sources = [ "internal/java/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionBridge.java" ] } + +java_library("junit") { + # Skip platform checks since Robolectric depends on requires_android targets. + bypass_platform_checks = true + + testonly = true + + sources = [ "junit/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionControllerTest.java" ] + + deps = [ + "//base:base_java", + "//base:base_java_test_support", + "//base:base_junit_test_support", + "//chrome/android:chrome_java", + "//chrome/android:chrome_test_util_java", + "//chrome/browser/flags:java", + "//chrome/browser/ui/android/webid:public_java", + "//chrome/browser/ui/android/webid/internal:java", + "//chrome/test/android:chrome_java_test_support", + "//components/browser_ui/bottomsheet/android:java", + "//components/module_installer/android:module_installer_java", + "//third_party/android_deps:robolectric_all_java", + "//third_party/androidx:androidx_annotation_annotation_java", + "//third_party/hamcrest:hamcrest_java", + "//third_party/junit", + "//third_party/mockito:mockito_java", + "//ui/android:ui_full_java", + ] +}
diff --git a/chrome/browser/ui/android/webid/README.md b/chrome/browser/ui/android/webid/README.md index e4cb4036..68ec12fc 100644 --- a/chrome/browser/ui/android/webid/README.md +++ b/chrome/browser/ui/android/webid/README.md
@@ -29,6 +29,18 @@ This folder contains a separate [README](internal/README.md) that explains in detail how the architecture looks like and how to extend the component further. +#### junit/ + +Contains Robolectric tests that test the delegate of the component. These tests +run without emulator which means that they are incredibly fast but cannot +instantiate or verify Android Views. The public build and run target is +`chrome_junit_tests`. Run them with: + +``` bash +./out/<OutDirectory>/bin/run_chrome_junit_tests -f*AccountSelection* +``` + + ## Example usage ``` java
diff --git a/chrome/browser/ui/android/webid/internal/README.md b/chrome/browser/ui/android/webid/internal/README.md index ed3ea2c..e7603a7d 100644 --- a/chrome/browser/ui/android/webid/internal/README.md +++ b/chrome/browser/ui/android/webid/internal/README.md
@@ -35,7 +35,17 @@ properties (and a simple factory method for the model) are located in the static `AccountSelectionProperties` class. -The details of the model will be added in follow up patches. +The model contains writable and readable properties. The readable properties are +guaranteed to never change for the lifetime of the Account Selection component: + + * **DISMISS_HANDLER** which is the listener that reacts to the view being + dismissed. The mediator implements this. + +The writable properties change over the course of the components lifetime: + + * **VISIBLE** which will trigger the component to render the bottom sheet or + hide it, if it was visible. + ## Controller
diff --git a/chrome/browser/ui/android/webid/internal/java/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionCoordinator.java b/chrome/browser/ui/android/webid/internal/java/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionCoordinator.java index 2c45ca0..3d00665 100644 --- a/chrome/browser/ui/android/webid/internal/java/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionCoordinator.java +++ b/chrome/browser/ui/android/webid/internal/java/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionCoordinator.java
@@ -17,7 +17,8 @@ */ public class AccountSelectionCoordinator implements AccountSelectionComponent { private final AccountSelectionMediator mMediator = new AccountSelectionMediator(); - private final PropertyModel mModel = AccountSelectionProperties.createDefaultModel(); + private final PropertyModel mModel = + AccountSelectionProperties.createDefaultModel(mMediator::onDismissed); @Override public void initialize(Context context, BottomSheetController sheetController,
diff --git a/chrome/browser/ui/android/webid/internal/java/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionMediator.java b/chrome/browser/ui/android/webid/internal/java/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionMediator.java index 3c9e51d2..bcb1d6a 100644 --- a/chrome/browser/ui/android/webid/internal/java/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionMediator.java +++ b/chrome/browser/ui/android/webid/internal/java/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionMediator.java
@@ -4,7 +4,10 @@ package org.chromium.chrome.browser.ui.android.webid; +import static org.chromium.chrome.browser.ui.android.webid.AccountSelectionProperties.VISIBLE; + import org.chromium.chrome.browser.ui.android.webid.data.Account; +import org.chromium.components.browser_ui.bottomsheet.BottomSheetController.StateChangeReason; import org.chromium.ui.modelutil.PropertyModel; import java.util.List; @@ -23,5 +26,19 @@ mModel = model; } - void showAccounts(String url, List<Account> accounts) {} + void showAccounts(String url, List<Account> accounts) { + mModel.set(VISIBLE, true); + // TODO (majidvp): Set the SHEET_ITEMS and show the view. + } + + void onAccountSelected(Account account) { + mModel.set(VISIBLE, false); + mDelegate.onAccountSelected(account); + } + + void onDismissed(@StateChangeReason int reason) { + if (!mModel.get(VISIBLE)) return; + mModel.set(VISIBLE, false); + mDelegate.onDismissed(); + } }
diff --git a/chrome/browser/ui/android/webid/internal/java/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionProperties.java b/chrome/browser/ui/android/webid/internal/java/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionProperties.java index 46fd688..e98e47e5 100644 --- a/chrome/browser/ui/android/webid/internal/java/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionProperties.java +++ b/chrome/browser/ui/android/webid/internal/java/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionProperties.java
@@ -4,14 +4,24 @@ package org.chromium.chrome.browser.ui.android.webid; +import org.chromium.base.Callback; import org.chromium.ui.modelutil.PropertyModel; /** * Properties defined here reflect the state of the AccountSelection-components. */ class AccountSelectionProperties { - static PropertyModel createDefaultModel() { - return new PropertyModel(); + static final PropertyModel.WritableBooleanPropertyKey VISIBLE = + new PropertyModel.WritableBooleanPropertyKey("visible"); + + static final PropertyModel.ReadableObjectPropertyKey<Callback<Integer>> DISMISS_HANDLER = + new PropertyModel.ReadableObjectPropertyKey<>("dismiss_handler"); + + static PropertyModel createDefaultModel(Callback<Integer> handler) { + return new PropertyModel.Builder(VISIBLE, DISMISS_HANDLER) + .with(VISIBLE, false) + .with(DISMISS_HANDLER, handler) + .build(); } private AccountSelectionProperties() {}
diff --git a/chrome/browser/ui/android/webid/junit/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionControllerTest.java b/chrome/browser/ui/android/webid/junit/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionControllerTest.java new file mode 100644 index 0000000..0359c8a1 --- /dev/null +++ b/chrome/browser/ui/android/webid/junit/src/org/chromium/chrome/browser/ui/android/webid/AccountSelectionControllerTest.java
@@ -0,0 +1,90 @@ +// Copyright 2021 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. + +package org.chromium.chrome.browser.ui.android.webid; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.verify; + +import static org.chromium.chrome.browser.ui.android.webid.AccountSelectionProperties.DISMISS_HANDLER; +import static org.chromium.chrome.browser.ui.android.webid.AccountSelectionProperties.VISIBLE; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.robolectric.annotation.Config; + +import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.base.test.util.JniMocker; +import org.chromium.chrome.browser.ui.android.webid.data.Account; +import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; +import org.chromium.ui.modelutil.PropertyModel; + +import java.util.Arrays; + +/** + * Controller tests verify that the Account Selection delegate modifies the model if the API is used + * properly. + */ +@RunWith(BaseRobolectricTestRunner.class) +@Config(manifest = Config.NONE) +public class AccountSelectionControllerTest { + private static final String TEST_URL = "https://www.example.xyz"; + private static final String TEST_SUBDOMAIN_URL = "https://subdomain.example.xyz"; + private static final String TEST_PROFILE_PIC = "https://www.example.xyz/profile/2"; + + private static final Account ANA = + new Account("Ana", "S3cr3t", "Ana Doe", "Ana", TEST_PROFILE_PIC, TEST_URL); + private static final Account BOB = + new Account("Bob", "*****", "Bob", "", TEST_PROFILE_PIC, TEST_SUBDOMAIN_URL); + + @Rule + public JniMocker mJniMocker = new JniMocker(); + + @Mock + private AccountSelectionComponent.Delegate mMockDelegate; + + private final AccountSelectionMediator mMediator = new AccountSelectionMediator(); + private final PropertyModel mModel = + AccountSelectionProperties.createDefaultModel(mMediator::onDismissed); + + @Before + public void setUp() { + MockitoAnnotations.initMocks(this); + mMediator.initialize(mMockDelegate, mModel); + } + + @Test + public void testCreatesValidDefaultModel() { + assertNotNull(mModel.get(DISMISS_HANDLER)); + assertThat(mModel.get(VISIBLE), is(false)); + } + + @Test + public void testShowAccountsSetsVisibile() { + mMediator.showAccounts(TEST_URL, Arrays.asList(ANA, BOB)); + assertThat(mModel.get(VISIBLE), is(true)); + } + + @Test + public void testCallsDelegateAndHidesOnDismiss() { + mMediator.showAccounts(TEST_URL, Arrays.asList(ANA, BOB)); + mMediator.onDismissed(BottomSheetController.StateChangeReason.BACK_PRESS); + verify(mMockDelegate).onDismissed(); + assertThat(mModel.get(VISIBLE), is(false)); + } + + @Test + public void testCallsDelegateAndHidesOnSelect() { + mMediator.showAccounts(TEST_URL, Arrays.asList(ANA, BOB)); + mMediator.onAccountSelected(ANA); + verify(mMockDelegate).onAccountSelected(ANA); + assertThat(mModel.get(VISIBLE), is(false)); + } +}
diff --git a/chrome/browser/ui/app_list/search/omnibox_result.cc b/chrome/browser/ui/app_list/search/omnibox_result.cc index 6de9d98..aa960dd 100644 --- a/chrome/browser/ui/app_list/search/omnibox_result.cc +++ b/chrome/browser/ui/app_list/search/omnibox_result.cc
@@ -93,7 +93,7 @@ case AutocompleteMatchType::PHYSICAL_WEB_OVERFLOW_DEPRECATED: case AutocompleteMatchType::TAB_SEARCH_DEPRECATED: case AutocompleteMatchType::DOCUMENT_SUGGESTION: - case AutocompleteMatchType::PEDAL: + case AutocompleteMatchType::PEDAL_DEPRECATED: return IconType::kDomain; case AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED: @@ -329,7 +329,7 @@ case AutocompleteMatchType::EXTENSION_APP_DEPRECATED: case AutocompleteMatchType::TAB_SEARCH_DEPRECATED: case AutocompleteMatchType::DOCUMENT_SUGGESTION: - case AutocompleteMatchType::PEDAL: + case AutocompleteMatchType::PEDAL_DEPRECATED: case AutocompleteMatchType::CLIPBOARD_TEXT: case AutocompleteMatchType::CLIPBOARD_IMAGE: case AutocompleteMatchType::HISTORY_BODY:
diff --git a/chrome/browser/ui/apps/chrome_app_delegate.cc b/chrome/browser/ui/apps/chrome_app_delegate.cc index 18484c30..f44d8e12 100644 --- a/chrome/browser/ui/apps/chrome_app_delegate.cc +++ b/chrome/browser/ui/apps/chrome_app_delegate.cc
@@ -25,6 +25,7 @@ #include "chrome/browser/profiles/scoped_profile_keep_alive.h" #include "chrome/browser/shell_integration.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window.h"
diff --git a/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu_browsertest.cc b/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu_browsertest.cc index a8356f8..8ae011b 100644 --- a/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu_browsertest.cc +++ b/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu_browsertest.cc
@@ -13,6 +13,7 @@ #include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h" #include "chrome/browser/web_applications/components/web_app_id.h" #include "chrome/browser/web_applications/components/web_application_info.h"
diff --git a/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.cc b/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.cc index b6c2a72..8453cdd 100644 --- a/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.cc +++ b/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.cc
@@ -29,6 +29,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/web_applications/components/app_registrar.h" #include "chrome/browser/web_applications/components/web_app_helpers.h" #include "chrome/browser/web_applications/components/web_app_provider_base.h"
diff --git a/chrome/browser/ui/ash/shelf/chrome_shelf_controller.cc b/chrome/browser/ui/ash/shelf/chrome_shelf_controller.cc index ae208212..982d2277 100644 --- a/chrome/browser/ui/ash/shelf/chrome_shelf_controller.cc +++ b/chrome/browser/ui/ash/shelf/chrome_shelf_controller.cc
@@ -31,6 +31,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h" +#include "base/task_runner_util.h" #include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
diff --git a/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc b/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc index b0d889c0..8741900 100644 --- a/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc +++ b/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc
@@ -30,6 +30,7 @@ #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/extensions/app_launch_params.h" #include "chrome/browser/ui/extensions/extension_enable_flow.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/web_applications/components/app_registrar.h" #include "chrome/browser/web_applications/components/web_app_helpers.h" #include "chrome/browser/web_applications/components/web_app_id.h"
diff --git a/chrome/browser/ui/autofill/address_editor_controller.cc b/chrome/browser/ui/autofill/address_editor_controller.cc index af72066..7d99cd3 100644 --- a/chrome/browser/ui/autofill/address_editor_controller.cc +++ b/chrome/browser/ui/autofill/address_editor_controller.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ui/autofill/address_editor_controller.h" +#include "base/strings/utf_string_conversions.h" #include "chrome/browser/autofill/personal_data_manager_factory.h" #include "chrome/browser/autofill/validation_rules_storage_factory.h" #include "chrome/browser/browser_process.h"
diff --git a/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl.cc b/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl.cc index 4066a17d..24b882e 100644 --- a/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl.cc +++ b/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl.cc
@@ -26,7 +26,14 @@ } SaveUpdateAddressProfileBubbleControllerImpl:: - ~SaveUpdateAddressProfileBubbleControllerImpl() = default; + ~SaveUpdateAddressProfileBubbleControllerImpl() { + // `address_profile_save_prompt_callback_` must have been invoked before + // destroying the controller to inform the backend of the output of the + // save/update flow. It's either invoked upon user action when accepting + // or rejecting the flow, or in cases when users ignore it, it's invoked + // when the web contents are destroyed. + DCHECK(address_profile_save_prompt_callback_.is_null()); +} void SaveUpdateAddressProfileBubbleControllerImpl::OfferSave( const AutofillProfile& profile, @@ -34,9 +41,13 @@ AutofillClient::SaveAddressProfilePromptOptions options, AutofillClient::AddressProfileSavePromptCallback address_profile_save_prompt_callback) { - // Don't show the bubble if it's already visible. - if (bubble_view()) + // Don't show the bubble if it's already visible, and inform the backend. + if (bubble_view()) { + std::move(address_profile_save_prompt_callback) + .Run(AutofillClient::SaveAddressProfileOfferUserDecision::kAutoDeclined, + profile); return; + } address_profile_ = profile; original_profile_ = base::OptionalFromPtr(original_profile); address_profile_save_prompt_callback_ = @@ -67,8 +78,10 @@ AutofillClient::SaveAddressProfileOfferUserDecision decision) { set_bubble_view(nullptr); - std::move(address_profile_save_prompt_callback_) - .Run(decision, address_profile_); + if (address_profile_save_prompt_callback_) { + std::move(address_profile_save_prompt_callback_) + .Run(decision, address_profile_); + } } void SaveUpdateAddressProfileBubbleControllerImpl::OnEditButtonClicked() { @@ -108,6 +121,12 @@ return bubble_view(); } +void SaveUpdateAddressProfileBubbleControllerImpl::WebContentsDestroyed() { + AutofillBubbleControllerBase::WebContentsDestroyed(); + + OnUserDecision(AutofillClient::SaveAddressProfileOfferUserDecision::kIgnored); +} + PageActionIconType SaveUpdateAddressProfileBubbleControllerImpl::GetPageActionIconType() { return PageActionIconType::kSaveAutofillAddress;
diff --git a/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl.h b/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl.h index ef85394e..61de1754 100644 --- a/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl.h +++ b/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl.h
@@ -60,6 +60,7 @@ protected: // AutofillBubbleControllerBase: + void WebContentsDestroyed() override; PageActionIconType GetPageActionIconType() override; void DoShowBubble() override;
diff --git a/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl_unittest.cc b/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl_unittest.cc index 057469d..ea04a97 100644 --- a/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl_unittest.cc +++ b/chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl_unittest.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ui/autofill/save_update_address_profile_bubble_controller_impl.h" +#include "base/callback_helpers.h" #include "base/test/mock_callback.h" #include "base/test/scoped_feature_list.h" #include "chrome/test/base/browser_with_test_window_test.h" @@ -71,16 +72,49 @@ AutofillClient::SaveAddressProfileOfferUserDecision::kDeclined); } -// This is testing that when the SaveAddressProfilePromptOptions has the -// show_prompt set to true, the bubble should be visible. +// This is testing that closing all tabs (which effectively destroys the web +// contents) will trigger the save callback with kIgnored decions if the users +// hasn't interacted with the prompt already. TEST_F(SaveUpdateAddressProfileBubbleControllerImplTest, - BubbleShouldBeVisibleWithShowPrompt) { + WebContentsDestroyedInvokesCallback) { AutofillProfile profile = test::GetFullProfile(); base::MockCallback<AutofillClient::AddressProfileSavePromptCallback> callback; controller()->OfferSave( profile, /*original_profile=*/nullptr, AutofillClient::SaveAddressProfilePromptOptions{.show_prompt = true}, callback.Get()); + + TabStripModel* tab_strip_model = browser()->tab_strip_model(); + // There is only now tab open, so the active web contents, are the + // controller's web contents. + content::WebContents* controller_web_contents = + tab_strip_model->GetActiveWebContents(); + + // Now add another tab, and close the controller tab to make sure the window + // remains open. This should destroy the web contents of the controller and + // invoke the callback with a decision kIgnored. + AddTab(browser(), GURL("http://foo.com/")); + EXPECT_EQ(2, tab_strip_model->count()); + EXPECT_CALL(callback, + Run(AutofillClient::SaveAddressProfileOfferUserDecision::kIgnored, + testing::_)); + // Close controller tab. + EXPECT_TRUE(browser()->tab_strip_model()->CloseWebContentsAt( + tab_strip_model->GetIndexOfWebContents(controller_web_contents), + TabStripModel::CloseTypes::CLOSE_USER_GESTURE)); + EXPECT_EQ(1, tab_strip_model->count()); +} + +// This is testing that when the SaveAddressProfilePromptOptions has the +// show_prompt set to true, the bubble should be visible. +TEST_F(SaveUpdateAddressProfileBubbleControllerImplTest, + BubbleShouldBeVisibleWithShowPrompt) { + AutofillProfile profile = test::GetFullProfile(); + controller()->OfferSave( + profile, /*original_profile=*/nullptr, + AutofillClient::SaveAddressProfilePromptOptions{.show_prompt = true}, + /*address_profile_save_prompt_callback=*/base::DoNothing()); + // Bubble is visible and active EXPECT_TRUE(controller()->GetSaveBubbleView()); EXPECT_TRUE(controller()->IsBubbleActive()); @@ -91,14 +125,37 @@ TEST_F(SaveUpdateAddressProfileBubbleControllerImplTest, BubbleShouldBeInvisibleWithoutShowPrompt) { AutofillProfile profile = test::GetFullProfile(); - base::MockCallback<AutofillClient::AddressProfileSavePromptCallback> callback; controller()->OfferSave( profile, /*original_profile=*/nullptr, AutofillClient::SaveAddressProfilePromptOptions{.show_prompt = false}, - callback.Get()); + /*address_profile_save_prompt_callback=*/base::DoNothing()); // Bubble is invisible but active EXPECT_FALSE(controller()->GetSaveBubbleView()); EXPECT_TRUE(controller()->IsBubbleActive()); } +// This is testing that when a second prompt comes while another prompt is +// shown, the controller will ignore it, and inform the backend that the second +// prompt has been auto declined. +TEST_F(SaveUpdateAddressProfileBubbleControllerImplTest, + SecondPromptWillBeAutoDeclined) { + AutofillProfile profile = test::GetFullProfile(); + + controller()->OfferSave( + profile, /*original_profile=*/nullptr, + AutofillClient::SaveAddressProfilePromptOptions{.show_prompt = true}, + /*address_profile_save_prompt_callback=*/base::DoNothing()); + + // Second prompt should be auto declined. + base::MockCallback<AutofillClient::AddressProfileSavePromptCallback> callback; + EXPECT_CALL( + callback, + Run(AutofillClient::SaveAddressProfileOfferUserDecision::kAutoDeclined, + testing::_)); + controller()->OfferSave( + profile, /*original_profile=*/nullptr, + AutofillClient::SaveAddressProfilePromptOptions{.show_prompt = true}, + callback.Get()); +} + } // namespace autofill
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 7c840e8..268f654 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc
@@ -78,6 +78,7 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_metrics.h" #include "chrome/browser/profiles/profiles_state.h" +#include "chrome/browser/profiles/scoped_profile_keep_alive.h" #include "chrome/browser/repost_form_warning_controller.h" #include "chrome/browser/resource_coordinator/tab_load_tracker.h" #include "chrome/browser/resource_coordinator/tab_manager_web_contents_data.h" @@ -116,6 +117,7 @@ #include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/chrome_select_file_policy.h" #include "chrome/browser/ui/color_chooser.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" #include "chrome/browser/ui/exclusive_access/mouse_lock_controller.h" #include "chrome/browser/ui/find_bar/find_bar.h" @@ -171,6 +173,7 @@ #include "components/keep_alive_registry/keep_alive_registry.h" #include "components/keep_alive_registry/keep_alive_types.h" #include "components/keep_alive_registry/scoped_keep_alive.h" +#include "components/omnibox/browser/location_bar_model.h" #include "components/omnibox/browser/location_bar_model_impl.h" #include "components/page_load_metrics/browser/metrics_web_contents_observer.h" #include "components/page_load_metrics/common/page_load_metrics.mojom.h"
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 2481cee..946c447a 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h
@@ -13,31 +13,22 @@ #include <vector> #include "base/callback.h" -#include "base/compiler_specific.h" #include "base/gtest_prod_util.h" #include "base/macros.h" +#include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" -#include "base/scoped_observer.h" +#include "base/time/time.h" #include "base/timer/elapsed_timer.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" -#include "chrome/browser/devtools/devtools_toggle_action.h" -#include "chrome/browser/profiles/scoped_profile_keep_alive.h" #include "chrome/browser/themes/theme_service_observer.h" #include "chrome/browser/ui/bookmarks/bookmark_bar.h" #include "chrome/browser/ui/bookmarks/bookmark_tab_helper_observer.h" -#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h" -#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" -#include "chrome/browser/ui/profile_chooser_constants.h" #include "chrome/browser/ui/signin_view_controller.h" #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" #include "chrome/browser/ui/unload_controller.h" -#include "chrome/browser/ui/web_applications/app_browser_controller.h" -#include "components/content_settings/core/common/content_settings.h" -#include "components/content_settings/core/common/content_settings_types.h" -#include "components/omnibox/browser/location_bar_model.h" #include "components/paint_preview/buildflags/buildflags.h" #include "components/prefs/pref_change_registrar.h" #include "components/sessions/core/session_id.h" @@ -46,10 +37,8 @@ #include "content/public/browser/page_navigator.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_delegate.h" -#include "content/public/common/page_zoom.h" #include "extensions/buildflags/buildflags.h" #include "printing/buildflags/buildflags.h" -#include "third_party/blink/public/mojom/frame/blocked_navigation_types.mojom.h" #include "ui/base/page_transition_types.h" #include "ui/base/ui_base_types.h" #include "ui/base/window_open_disposition.h" @@ -67,9 +56,12 @@ class BrowserLocationBarModelDelegate; class BrowserLiveTabContext; class BrowserWindow; +class ExclusiveAccessManager; class FindBarController; +class LocationBarModel; class Profile; class ScopedKeepAlive; +class ScopedProfileKeepAlive; class StatusBubble; class TabStripModel; class TabStripModelDelegate; @@ -99,10 +91,6 @@ struct SelectedFileInfo; } -namespace web_modal { -class WebContentsModalDialogHost; -} - namespace viz { class SurfaceId; } @@ -111,6 +99,10 @@ class AppBrowserController; } +namespace web_modal { +class WebContentsModalDialogHost; +} + class Browser : public TabStripModelObserver, public content::WebContentsDelegate, public ChromeWebModalDialogManagerDelegate,
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc index 8604e43..540d6d3 100644 --- a/chrome/browser/ui/browser_commands.cc +++ b/chrome/browser/ui/browser_commands.cc
@@ -49,11 +49,13 @@ #include "chrome/browser/ui/browser_command_controller.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/browser_live_tab_context.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/commander/commander.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" #include "chrome/browser/ui/find_bar/find_bar.h" #include "chrome/browser/ui/find_bar/find_bar_controller.h" @@ -162,6 +164,7 @@ #endif #if BUILDFLAG(IS_CHROMEOS_LACROS) +#include "chromeos/crosapi/mojom/task_manager.mojom.h" #include "chromeos/lacros/lacros_service.h" #endif
diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc index 764e590..26ada22 100644 --- a/chrome/browser/ui/browser_focus_uitest.cc +++ b/chrome/browser/ui/browser_focus_uitest.cc
@@ -19,6 +19,7 @@ #include "build/build_config.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window.h"
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index 77b90d5c..29890d8 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc
@@ -34,6 +34,7 @@ #include "chrome/browser/ui/status_bubble.h" #include "chrome/browser/ui/tab_helpers.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/system_web_app_ui_utils.h" #include "chrome/browser/web_applications/components/web_app_helpers.h" #include "chrome/common/url_constants.h"
diff --git a/chrome/browser/ui/chrome_pages.cc b/chrome/browser/ui/chrome_pages.cc index e733181..e86fe09 100644 --- a/chrome/browser/ui/chrome_pages.cc +++ b/chrome/browser/ui/chrome_pages.cc
@@ -25,6 +25,7 @@ #include "chrome/browser/signin/account_consistency_mode_manager.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
diff --git a/chrome/browser/ui/cocoa/share_menu_controller.mm b/chrome/browser/ui/cocoa/share_menu_controller.mm index f139ac6..5f5ddfd5 100644 --- a/chrome/browser/ui/cocoa/share_menu_controller.mm +++ b/chrome/browser/ui/cocoa/share_menu_controller.mm
@@ -18,6 +18,7 @@ #import "chrome/browser/ui/cocoa/accelerators_cocoa.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/grit/generated_resources.h" +#include "components/omnibox/browser/location_bar_model.h" #include "net/base/mac/url_conversions.h" #include "ui/base/accelerators/platform_accelerator_cocoa.h" #include "ui/base/l10n/l10n_util_mac.h"
diff --git a/chrome/browser/ui/cocoa/touchbar/browser_window_default_touch_bar_unittest.mm b/chrome/browser/ui/cocoa/touchbar/browser_window_default_touch_bar_unittest.mm index 9f8e2a6..1630233 100644 --- a/chrome/browser/ui/cocoa/touchbar/browser_window_default_touch_bar_unittest.mm +++ b/chrome/browser/ui/cocoa/touchbar/browser_window_default_touch_bar_unittest.mm
@@ -15,6 +15,7 @@ #include "chrome/browser/ui/browser_command_controller.h" #include "chrome/browser/ui/cocoa/test/cocoa_test_helper.h" #import "chrome/browser/ui/cocoa/touchbar/browser_window_default_touch_bar.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/browser_with_test_window_test.h"
diff --git a/chrome/browser/ui/exclusive_access/exclusive_access_test.cc b/chrome/browser/ui/exclusive_access/exclusive_access_test.cc index e530e55..1f39484 100644 --- a/chrome/browser/ui/exclusive_access/exclusive_access_test.cc +++ b/chrome/browser/ui/exclusive_access/exclusive_access_test.cc
@@ -15,6 +15,7 @@ #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" #include "chrome/browser/ui/exclusive_access/keyboard_lock_controller.h" #include "chrome/browser/ui/exclusive_access/mouse_lock_controller.h"
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc index 8dfbe55b..fe11f79 100644 --- a/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc
@@ -12,6 +12,7 @@ #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_test.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/test/base/interactive_test_utils.h"
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.cc index 34bf991..1d2c84c85 100644 --- a/chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.cc +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.cc
@@ -14,6 +14,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_test.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
diff --git a/chrome/browser/ui/extensions/application_launch.cc b/chrome/browser/ui/extensions/application_launch.cc index 9a1a7112..24099566a 100644 --- a/chrome/browser/ui/extensions/application_launch.cc +++ b/chrome/browser/ui/extensions/application_launch.cc
@@ -30,6 +30,7 @@ #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window.h"
diff --git a/chrome/browser/ui/fullscreen_keyboard_browsertest_base.cc b/chrome/browser/ui/fullscreen_keyboard_browsertest_base.cc index 19d69ad..e5df815 100644 --- a/chrome/browser/ui/fullscreen_keyboard_browsertest_base.cc +++ b/chrome/browser/ui/fullscreen_keyboard_browsertest_base.cc
@@ -15,6 +15,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_test.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/test/base/in_process_browser_test.h"
diff --git a/chrome/browser/ui/keyboard_lock_interactive_browsertest.cc b/chrome/browser/ui/keyboard_lock_interactive_browsertest.cc index 08d24393..8481fd0 100644 --- a/chrome/browser/ui/keyboard_lock_interactive_browsertest.cc +++ b/chrome/browser/ui/keyboard_lock_interactive_browsertest.cc
@@ -7,6 +7,7 @@ #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/fullscreen_keyboard_browsertest_base.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/interactive_test_utils.h"
diff --git a/chrome/browser/ui/login/login_handler_browsertest.cc b/chrome/browser/ui/login/login_handler_browsertest.cc index b8475f86..ec8ed41 100644 --- a/chrome/browser/ui/login/login_handler_browsertest.cc +++ b/chrome/browser/ui/login/login_handler_browsertest.cc
@@ -30,6 +30,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "components/no_state_prefetch/browser/no_state_prefetch_manager.h" #include "components/no_state_prefetch/common/prerender_origin.h" +#include "components/omnibox/browser/location_bar_model.h" #include "components/prefs/pref_service.h" #include "components/security_interstitials/content/security_interstitial_tab_helper.h" #include "components/security_interstitials/content/ssl_blocking_page.h"
diff --git a/chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_button_controller.cc b/chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_button_controller.cc new file mode 100644 index 0000000..f852b6d --- /dev/null +++ b/chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_button_controller.cc
@@ -0,0 +1,49 @@ +// Copyright 2021 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/ui/send_tab_to_self/send_tab_to_self_toolbar_button_controller.h" + +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_button_controller_delegate.h" +#include "components/send_tab_to_self/send_tab_to_self_entry.h" + +namespace send_tab_to_self { + +SendTabToSelfToolbarButtonController::SendTabToSelfToolbarButtonController( + Profile* profile) + : profile_(profile) {} + +void SendTabToSelfToolbarButtonController::DisplayNewEntries( + const std::vector<const SendTabToSelfEntry*>& new_entries) { + ShowToolbarButton(); +} + +void SendTabToSelfToolbarButtonController::DismissEntries( + const std::vector<std::string>& guids) { + NOTIMPLEMENTED(); +} + +void SendTabToSelfToolbarButtonController::ShowToolbarButton() { + if (!delegate_) + return; + + if (delegate_display_state_ != DisplayState::kShown) { + delegate_->Show(); + delegate_display_state_ = DisplayState::kShown; + } +} + +void SendTabToSelfToolbarButtonController::SetDelegate( + SendTabToSelfToolbarButtonControllerDelegate* delegate) { + delegate_ = delegate; +} + +void SendTabToSelfToolbarButtonController::UpdateToolbarButtonState() { + NOTIMPLEMENTED(); +} + +SendTabToSelfToolbarButtonController::~SendTabToSelfToolbarButtonController() = + default; + +} // namespace send_tab_to_self
diff --git a/chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_button_controller.h b/chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_button_controller.h new file mode 100644 index 0000000..ced31c46 --- /dev/null +++ b/chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_button_controller.h
@@ -0,0 +1,61 @@ +// Copyright 2021 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_UI_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_TOOLBAR_BUTTON_CONTROLLER_H_ +#define CHROME_BROWSER_UI_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_TOOLBAR_BUTTON_CONTROLLER_H_ + +#include "chrome/browser/send_tab_to_self/receiving_ui_handler.h" + +class Profile; + +namespace send_tab_to_self { + +class SendTabToSelfToolbarButtonControllerDelegate; + +// Controller for the SendTabToSelfToolbarButtonView that decides when to show +// or hide the icon from the toolbar. +// Owned by send_tab_to_self::ReceivingUiHandlerRegistry. +class SendTabToSelfToolbarButtonController + : public send_tab_to_self::ReceivingUiHandler { + public: + explicit SendTabToSelfToolbarButtonController(Profile* profile); + SendTabToSelfToolbarButtonController( + const SendTabToSelfToolbarButtonController&) = delete; + SendTabToSelfToolbarButtonController& operator=( + const SendTabToSelfToolbarButtonController&) = delete; + ~SendTabToSelfToolbarButtonController() override; + + // ReceivingUiHandler implementation. + void DisplayNewEntries( + const std::vector<const send_tab_to_self::SendTabToSelfEntry*>& + new_entries) override; + void DismissEntries(const std::vector<std::string>& guids) override; + + void ShowToolbarButton(); + + void SetDelegate(SendTabToSelfToolbarButtonControllerDelegate* delegate); + + Profile* profile() const { return profile_; } + + private: + // Tracks the current display state of the toolbar button delegate. + enum class DisplayState { + kShown, + kHidden, + }; + + void UpdateToolbarButtonState(); + + Profile* profile_; + + SendTabToSelfToolbarButtonControllerDelegate* delegate_; + + // The delegate starts hidden and isn't shown until a STTS + // notification is received. + DisplayState delegate_display_state_ = DisplayState::kHidden; +}; + +} // namespace send_tab_to_self + +#endif // CHROME_BROWSER_UI_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_TOOLBAR_BUTTON_CONTROLLER_H_
diff --git a/chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_button_controller_delegate.h b/chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_button_controller_delegate.h new file mode 100644 index 0000000..69f06437 --- /dev/null +++ b/chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_button_controller_delegate.h
@@ -0,0 +1,23 @@ +// Copyright 2021 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_UI_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_TOOLBAR_BUTTON_CONTROLLER_DELEGATE_H_ +#define CHROME_BROWSER_UI_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_TOOLBAR_BUTTON_CONTROLLER_DELEGATE_H_ + +namespace send_tab_to_self { + +// Delegate for SendTabToSelfToolbarButtonController that is told when to show +// by the controller. +class SendTabToSelfToolbarButtonControllerDelegate { + public: + virtual void Show() = 0; + virtual void Hide() = 0; + + protected: + virtual ~SendTabToSelfToolbarButtonControllerDelegate() = default; +}; + +} // namespace send_tab_to_self + +#endif // CHROME_BROWSER_UI_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_TOOLBAR_BUTTON_CONTROLLER_DELEGATE_H_
diff --git a/chrome/browser/ui/signin_reauth_view_controller.cc b/chrome/browser/ui/signin_reauth_view_controller.cc index 3cdf0f4..a5b1ec8b 100644 --- a/chrome/browser/ui/signin_reauth_view_controller.cc +++ b/chrome/browser/ui/signin_reauth_view_controller.cc
@@ -19,6 +19,7 @@ #include "chrome/browser/signin/signin_features.h" #include "chrome/browser/signin/signin_ui_util.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/webui/signin/signin_reauth_ui.h" #include "components/consent_auditor/consent_auditor.h"
diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc index 84b8122..247a351e 100644 --- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc +++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc
@@ -24,6 +24,7 @@ #include "chrome/browser/sessions/session_restore.h" #include "chrome/browser/sessions/tab_restore_service_factory.h" #include "chrome/browser/sync/session_sync_service_factory.h" +#include "chrome/browser/themes/theme_service.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_live_tab_context.h"
diff --git a/chrome/browser/ui/ui_features.cc b/chrome/browser/ui/ui_features.cc index e93aa5d..abb81207 100644 --- a/chrome/browser/ui/ui_features.cc +++ b/chrome/browser/ui/ui_features.cc
@@ -41,7 +41,7 @@ // Enables the reauth flow for authenticated profiles with invalid credentials // when the force sign-in policy is enabled. const base::Feature kForceSignInReauth{"ForceSignInReauth", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; // Enables the new profile picker. // https:://crbug.com/1063856
diff --git a/chrome/browser/ui/views/download/download_danger_prompt_views.cc b/chrome/browser/ui/views/download/download_danger_prompt_views.cc index 04c613e..3d005b9 100644 --- a/chrome/browser/ui/views/download/download_danger_prompt_views.cc +++ b/chrome/browser/ui/views/download/download_danger_prompt_views.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/compiler_specific.h" +#include "base/feature_list.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/download/download_danger_prompt.h" #include "chrome/browser/download/download_stats.h" @@ -17,6 +18,7 @@ #include "components/constrained_window/constrained_window_views.h" #include "components/download/public/common/download_danger_type.h" #include "components/download/public/common/download_item.h" +#include "components/safe_browsing/core/features.h" #include "components/strings/grit/components_strings.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" @@ -163,6 +165,15 @@ return l10n_util::GetStringUTF16(IDS_KEEP_DANGEROUS_DOWNLOAD_TITLE); case download::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT: return l10n_util::GetStringUTF16(IDS_KEEP_UNCOMMON_DOWNLOAD_TITLE); + case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE: { + if (base::FeatureList::IsEnabled( + safe_browsing::kSafeBrowsingCTDownloadWarning)) { + return l10n_util::GetStringUTF16( + IDS_CONFIRM_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE_TITLE); + } else { + return l10n_util::GetStringUTF16(IDS_KEEP_DANGEROUS_DOWNLOAD_TITLE); + } + } default: { return l10n_util::GetStringUTF16( IDS_CONFIRM_KEEP_DANGEROUS_DOWNLOAD_TITLE); @@ -197,6 +208,18 @@ IDS_PROMPT_MALICIOUS_DOWNLOAD_CONTENT, download_->GetFileNameToReportUser().LossyDisplayName()); } + case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE: { + if (base::FeatureList::IsEnabled( + safe_browsing::kSafeBrowsingCTDownloadWarning)) { + return l10n_util::GetStringFUTF16( + IDS_PROMPT_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE, + download_->GetFileNameToReportUser().LossyDisplayName()); + } else { + return l10n_util::GetStringFUTF16( + IDS_PROMPT_MALICIOUS_DOWNLOAD_CONTENT, + download_->GetFileNameToReportUser().LossyDisplayName()); + } + } case download::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT: { if (safe_browsing::AdvancedProtectionStatusManagerFactory:: GetForProfile(profile_) @@ -248,6 +271,14 @@ return l10n_util::GetStringUTF16( IDS_PROMPT_CONFIRM_KEEP_MALICIOUS_DOWNLOAD_BODY); } + case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE: { + return base::FeatureList::IsEnabled( + safe_browsing::kSafeBrowsingCTDownloadWarning) + ? l10n_util::GetStringUTF16( + IDS_PROMPT_CONFIRM_DANGEROUS_DOWNLOAD_ACCOUNT_COMPROMISE_BODY) + : l10n_util::GetStringUTF16( + IDS_PROMPT_CONFIRM_KEEP_MALICIOUS_DOWNLOAD_BODY); + } default: { return l10n_util::GetStringUTF16( IDS_PROMPT_CONFIRM_KEEP_DANGEROUS_DOWNLOAD); @@ -271,10 +302,10 @@ if (!download_->GetURL().is_empty() && !content::DownloadItemUtils::GetBrowserContext(download_) ->IsOffTheRecord()) { - ClientSafeBrowsingReportRequest::ReportType report_type - = show_context_ ? - ClientSafeBrowsingReportRequest::DANGEROUS_DOWNLOAD_BY_API : - ClientSafeBrowsingReportRequest::DANGEROUS_DOWNLOAD_RECOVERY; + ClientSafeBrowsingReportRequest::ReportType report_type = + show_context_ + ? ClientSafeBrowsingReportRequest::DANGEROUS_DOWNLOAD_BY_API + : ClientSafeBrowsingReportRequest::DANGEROUS_DOWNLOAD_RECOVERY; SendSafeBrowsingDownloadReport(report_type, accept, *download_); } }
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc index f296f7f..34c5bfc 100644 --- a/chrome/browser/ui/views/download/download_item_view.cc +++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -1023,6 +1023,7 @@ case download::DOWNLOAD_DANGER_TYPE_BLOCKED_TOO_LARGE: case download::DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED: case download::DOWNLOAD_DANGER_TYPE_SENSITIVE_CONTENT_BLOCK: + case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE: return kError; case download::DOWNLOAD_DANGER_TYPE_SENSITIVE_CONTENT_WARNING: return kWarning;
diff --git a/chrome/browser/ui/views/download/download_shelf_web_view.cc b/chrome/browser/ui/views/download/download_shelf_web_view.cc index de416bc7..51fa36b 100644 --- a/chrome/browser/ui/views/download/download_shelf_web_view.cc +++ b/chrome/browser/ui/views/download/download_shelf_web_view.cc
@@ -12,6 +12,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/common/webui_url_constants.h" +#include "ui/base/theme_provider.h" #include "ui/gfx/animation/animation.h" #include "ui/views/border.h"
diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc index 212c630..ae1ccd9 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc
@@ -12,6 +12,7 @@ #include "chrome/browser/platform_util.h" #include "chrome/browser/signin/signin_ui_util.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/extensions/extension_install_ui_default.h"
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos_browsertest.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos_browsertest.cc index 2039ed0..db62a95 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos_browsertest.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos_browsertest.cc
@@ -36,6 +36,7 @@ #include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_tabstrip.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_test.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" #include "chrome/browser/ui/passwords/passwords_client_ui_delegate.h"
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm index 2628c56..7834362 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm
@@ -13,6 +13,7 @@ #include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/ui/cocoa/fullscreen/fullscreen_menubar_tracker.h" #include "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" #include "chrome/browser/ui/layout_constants.h" #include "chrome/browser/ui/view_ids.h"
diff --git a/chrome/browser/ui/views/frame/browser_root_view.cc b/chrome/browser/ui/views/frame/browser_root_view.cc index 99d16d8..92dced6 100644 --- a/chrome/browser/ui/views/frame/browser_root_view.cc +++ b/chrome/browser/ui/views/frame/browser_root_view.cc
@@ -16,6 +16,7 @@ #include "chrome/browser/defaults.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_commands.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/ui_features.h" #include "chrome/browser/ui/views/frame/browser_frame.h"
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index cd14d1f..e852eb7 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -60,6 +60,7 @@ #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window_state.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/find_bar/find_bar.h" #include "chrome/browser/ui/find_bar/find_bar_controller.h" #include "chrome/browser/ui/layout_constants.h"
diff --git a/chrome/browser/ui/views/frame/browser_view_interactive_uitest.cc b/chrome/browser/ui/views/frame/browser_view_interactive_uitest.cc index c8d96dd..ab9cba2 100644 --- a/chrome/browser/ui/views/frame/browser_view_interactive_uitest.cc +++ b/chrome/browser/ui/views/frame/browser_view_interactive_uitest.cc
@@ -8,6 +8,7 @@ #include "build/build_config.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/ui/browser_commands.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/browser/ui/views/tabs/tab_strip.h"
diff --git a/chrome/browser/ui/views/frame/browser_view_layout.cc b/chrome/browser/ui/views/frame/browser_view_layout.cc index 7759e1e..0e81078 100644 --- a/chrome/browser/ui/views/frame/browser_view_layout.cc +++ b/chrome/browser/ui/views/frame/browser_view_layout.cc
@@ -30,6 +30,7 @@ #include "chrome/browser/ui/views/infobars/infobar_container_view.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "components/web_modal/web_contents_modal_dialog_host.h" #include "ui/base/hit_test.h" #include "ui/gfx/geometry/point.h"
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view_browsertest_win.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view_browsertest_win.cc index 446ef33..87d4b3d 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view_browsertest_win.cc +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view_browsertest_win.cc
@@ -15,6 +15,7 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_view.h" #include "chrome/browser/ui/views/web_apps/frame_toolbar/web_app_toolbar_button_container.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h" #include "chrome/browser/web_applications/components/web_application_info.h" #include "chrome/browser/web_applications/test/web_app_install_test_utils.h"
diff --git a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.cc b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.cc index 30cdda8..87cd4f4 100644 --- a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.cc +++ b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.cc
@@ -10,6 +10,7 @@ #include "base/time/time.h" #include "build/build_config.h" #include "chrome/browser/app_mode/app_mode_utils.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/common/channel_info.h"
diff --git a/chrome/browser/ui/views/intent_picker_bubble_view_browsertest.cc b/chrome/browser/ui/views/intent_picker_bubble_view_browsertest.cc index 480ab0fc..43a382e 100644 --- a/chrome/browser/ui/views/intent_picker_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/intent_picker_bubble_view_browsertest.cc
@@ -14,6 +14,7 @@ #include "chrome/browser/ui/views/location_bar/intent_picker_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/browser/ui/views/page_action/page_action_icon_view.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/test/web_app_navigation_browsertest.h" #include "chrome/browser/web_applications/components/web_application_info.h" #include "chrome/common/chrome_features.h"
diff --git a/chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc b/chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc index 5349b36f..1b34bcf 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc
@@ -7,6 +7,7 @@ #include "build/build_config.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/layout_constants.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_account_icon_container_view.h"
diff --git a/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc b/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc index f1ae7482..1f9eebd 100644 --- a/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc +++ b/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc
@@ -21,6 +21,7 @@ #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/toolbar_button_provider.h"
diff --git a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc index b7ea6d1..d62a28f 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_result_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_result_view.cc
@@ -267,8 +267,7 @@ match_.answer->second_line(), true); } else { const bool deemphasize = - match_.type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY || - match_.type == AutocompleteMatchType::PEDAL; + match_.type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY; suggestion_view_->description()->SetTextWithStyling( match_.description, match_.description_class, deemphasize); } @@ -330,8 +329,7 @@ OmniboxPart::RESULTS_TEXT_DEFAULT); suggestion_view_->description()->ApplyTextColor( OmniboxPart::RESULTS_TEXT_DEFAULT); - } else if (match_.type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY || - match_.type == AutocompleteMatchType::PEDAL) { + } else if (match_.type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY) { suggestion_view_->content()->ApplyTextColor( OmniboxPart::RESULTS_TEXT_DEFAULT); suggestion_view_->description()->ApplyTextColor(
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view.cc b/chrome/browser/ui/views/profiles/profile_menu_view.cc index 0f805bdb..751e4bf 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view.cc +++ b/chrome/browser/ui/views/profiles/profile_menu_view.cc
@@ -35,6 +35,7 @@ #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" #include "chrome/browser/ui/profile_picker.h"
diff --git a/chrome/browser/ui/views/profiles/profile_picker_sign_in_flow_controller.cc b/chrome/browser/ui/views/profiles/profile_picker_sign_in_flow_controller.cc index a21e4684..32151a5 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_sign_in_flow_controller.cc +++ b/chrome/browser/ui/views/profiles/profile_picker_sign_in_flow_controller.cc
@@ -18,6 +18,7 @@ #include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/toolbar_button_provider.h" #include "chrome/browser/ui/views/profiles/avatar_toolbar_button.h" @@ -35,6 +36,7 @@ #include "content/public/browser/web_contents.h" #include "google_apis/gaia/gaia_auth_util.h" #include "google_apis/gaia/gaia_urls.h" +#include "net/base/url_util.h" #include "ui/base/theme_provider.h" #include "ui/views/controls/webview/web_contents_set_background_color.h"
diff --git a/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_toolbar_button_view.cc b/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_toolbar_button_view.cc new file mode 100644 index 0000000..ef2ba9c8 --- /dev/null +++ b/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_toolbar_button_view.cc
@@ -0,0 +1,53 @@ +// Copyright 2021 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/ui/views/send_tab_to_self/send_tab_to_self_toolbar_button_view.h" + +#include "chrome/app/vector_icons/vector_icons.h" +#include "chrome/browser/send_tab_to_self/receiving_ui_handler_registry.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_button_controller.h" +#include "chrome/browser/ui/views/frame/browser_view.h" +#include "components/vector_icons/vector_icons.h" +#include "ui/views/controls/button/button_controller.h" + +namespace send_tab_to_self { + +SendTabToSelfToolbarButtonView::SendTabToSelfToolbarButtonView( + BrowserView* browser_view) + : ToolbarButton( + base::BindRepeating(&SendTabToSelfToolbarButtonView::ButtonPressed, + base::Unretained(this))), + browser_(browser_view->browser()) { + SetFlipCanvasOnPaintForRTLUI(false); + SetVectorIcons(kSendTabToSelfIcon, kSendTabToSelfIcon); + // TODO(crbug/1206381): SetTooltipText(...); + + // We start hidden and only show once the controller tells us to. + SetVisible(false); + + send_tab_to_self::ReceivingUiHandlerRegistry::GetInstance() + ->GetToolbarButtonControllerForProfile(browser_->profile()) + ->SetDelegate(this); +} + +SendTabToSelfToolbarButtonView::~SendTabToSelfToolbarButtonView() { + send_tab_to_self::ReceivingUiHandlerRegistry::GetInstance() + ->GetToolbarButtonControllerForProfile(browser_->profile()) + ->SetDelegate(nullptr); +} + +void SendTabToSelfToolbarButtonView::Show() { + SetVisible(true); +} + +void SendTabToSelfToolbarButtonView::Hide() { + SetVisible(false); +} + +void SendTabToSelfToolbarButtonView::ButtonPressed() { + NOTIMPLEMENTED(); +} + +} // namespace send_tab_to_self
diff --git a/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_toolbar_button_view.h b/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_toolbar_button_view.h new file mode 100644 index 0000000..16b2756 --- /dev/null +++ b/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_toolbar_button_view.h
@@ -0,0 +1,43 @@ +// Copyright 2021 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_UI_VIEWS_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_TOOLBAR_BUTTON_VIEW_H_ +#define CHROME_BROWSER_UI_VIEWS_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_TOOLBAR_BUTTON_VIEW_H_ + +#include "chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_button_controller_delegate.h" +#include "chrome/browser/ui/views/toolbar/toolbar_button.h" +#include "ui/base/metadata/metadata_header_macros.h" + +class Browser; +class BrowserView; + +namespace send_tab_to_self { + +// STTS icon shown in the trusted area of toolbar. Its lifetime is tied to that +// of its parent ToolbarView. The icon is made visible when there is a received +// STTS notification. +class SendTabToSelfToolbarButtonView + : public ToolbarButton, + public SendTabToSelfToolbarButtonControllerDelegate { + public: + explicit SendTabToSelfToolbarButtonView(BrowserView* browser_view); + SendTabToSelfToolbarButtonView(const SendTabToSelfToolbarButtonView&) = + delete; + SendTabToSelfToolbarButtonView& operator=( + const SendTabToSelfToolbarButtonView&) = delete; + ~SendTabToSelfToolbarButtonView() override; + + // SendTabToSelfToolbarButtonControllerDelegate implementation. + void Show() override; + void Hide() override; + + private: + void ButtonPressed(); + + const Browser* const browser_; +}; + +} // namespace send_tab_to_self + +#endif // CHROME_BROWSER_UI_VIEWS_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_TOOLBAR_BUTTON_VIEW_H_
diff --git a/chrome/browser/ui/views/storage/storage_pressure_bubble_view.cc b/chrome/browser/ui/views/storage/storage_pressure_bubble_view.cc index 3f714c55..0989203 100644 --- a/chrome/browser/ui/views/storage/storage_pressure_bubble_view.cc +++ b/chrome/browser/ui/views/storage/storage_pressure_bubble_view.cc
@@ -8,6 +8,7 @@ #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/frame/app_menu_button.h" #include "chrome/browser/ui/views/frame/browser_view.h"
diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc index bec396590..50c10d73 100644 --- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc +++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -43,6 +43,7 @@ #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" #include "chrome/browser/ui/views/user_education/feature_promo_controller_views.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h"
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc index a57538f..650fb98 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -50,6 +50,7 @@ #include "chrome/browser/ui/views/media_router/cast_toolbar_button.h" #include "chrome/browser/ui/views/page_action/page_action_icon_container.h" #include "chrome/browser/ui/views/page_action/page_action_icon_controller.h" +#include "chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_toolbar_button_view.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" #include "chrome/browser/ui/views/toolbar/app_menu.h" #include "chrome/browser/ui/views/toolbar/back_forward_button.h" @@ -72,6 +73,7 @@ #include "components/omnibox/browser/omnibox_view.h" #include "components/prefs/pref_service.h" #include "components/reading_list/features/reading_list_switches.h" +#include "components/send_tab_to_self/features.h" #include "components/signin/public/base/signin_buildflags.h" #include "components/strings/grit/components_strings.h" #include "content/public/browser/render_view_host.h" @@ -251,6 +253,14 @@ media_button = std::make_unique<MediaToolbarButtonView>(browser_view_); } + std::unique_ptr<send_tab_to_self::SendTabToSelfToolbarButtonView> + send_tab_to_self_button; + if (base::FeatureList::IsEnabled(send_tab_to_self::kSendTabToSelfV2)) { + send_tab_to_self_button = + std::make_unique<send_tab_to_self::SendTabToSelfToolbarButtonView>( + browser_view_); + } + std::unique_ptr<ToolbarAccountIconContainerView> toolbar_account_icon_container; bool show_avatar_toolbar_button = true; @@ -319,6 +329,9 @@ if (media_button) media_button_ = AddChildView(std::move(media_button)); + if (send_tab_to_self_button) + send_tab_to_self_button_ = AddChildView(std::move(send_tab_to_self_button)); + if (toolbar_account_icon_container) { toolbar_account_icon_container_ = AddChildView(std::move(toolbar_account_icon_container));
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.h b/chrome/browser/ui/views/toolbar/toolbar_view.h index cfface6..c232c1c 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_view.h +++ b/chrome/browser/ui/views/toolbar/toolbar_view.h
@@ -61,6 +61,10 @@ class CastToolbarButton; } +namespace send_tab_to_self { +class SendTabToSelfToolbarButtonView; +} + namespace views { class FlexLayout; } @@ -150,6 +154,10 @@ media_router::CastToolbarButton* cast_button() const { return cast_; } ToolbarButton* read_later_button() const { return read_later_button_; } MediaToolbarButtonView* media_button() const { return media_button_; } + send_tab_to_self::SendTabToSelfToolbarButtonView* send_tab_to_self_button() + const { + return send_tab_to_self_button_; + } ToolbarAccountIconContainerView* toolbar_account_icon_container() const { return toolbar_account_icon_container_; } @@ -271,6 +279,8 @@ ToolbarAccountIconContainerView* toolbar_account_icon_container_ = nullptr; AvatarToolbarButton* avatar_ = nullptr; MediaToolbarButtonView* media_button_ = nullptr; + send_tab_to_self::SendTabToSelfToolbarButtonView* send_tab_to_self_button_ = + nullptr; BrowserAppMenuButton* app_menu_button_ = nullptr; Browser* const browser_;
diff --git a/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_navigation_button_container.cc b/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_navigation_button_container.cc index b1e83cd..e72591e 100644 --- a/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_navigation_button_container.cc +++ b/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_navigation_button_container.cc
@@ -15,6 +15,7 @@ #include "chrome/browser/ui/views/toolbar/back_forward_button.h" #include "chrome/browser/ui/views/toolbar/reload_button.h" #include "chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_utils.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/system_web_app_ui_utils.h" #include "ui/base/hit_test.h" #include "ui/base/metadata/metadata_header_macros.h"
diff --git a/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_toolbar_button_container.cc b/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_toolbar_button_container.cc index 1a03b27..5c911aa 100644 --- a/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_toolbar_button_container.cc +++ b/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_toolbar_button_container.cc
@@ -19,6 +19,7 @@ #include "chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_utils.h" #include "chrome/browser/ui/views/web_apps/frame_toolbar/web_app_menu_button.h" #include "chrome/browser/ui/views/web_apps/frame_toolbar/web_app_origin_text.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/system_web_app_ui_utils.h" #include "chrome/common/chrome_features.h" #include "ui/base/hit_test.h"
diff --git a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.cc b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.cc index 85296a7..8505595 100644 --- a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.cc +++ b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_base.cc
@@ -23,6 +23,7 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/toolbar_button_provider.h" #include "chrome/browser/ui/views/page_action/page_action_icon_view.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h" #include "chrome/browser/ui/web_applications/web_app_dialog_utils.h" #include "chrome/browser/ui/web_applications/web_app_launch_utils.h"
diff --git a/chrome/browser/ui/web_applications/test/system_web_app_interactive_uitest.cc b/chrome/browser/ui/web_applications/test/system_web_app_interactive_uitest.cc index 3f24d713..d87bb29 100644 --- a/chrome/browser/ui/web_applications/test/system_web_app_interactive_uitest.cc +++ b/chrome/browser/ui/web_applications/test/system_web_app_interactive_uitest.cc
@@ -21,6 +21,7 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/location_bar/location_bar.h" #include "chrome/browser/ui/settings_window_manager_chromeos.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/system_web_app_ui_utils.h" #include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h" #include "chrome/browser/web_applications/system_web_apps/test/system_web_app_browsertest_base.h"
diff --git a/chrome/browser/ui/web_applications/web_app_launch_manager.cc b/chrome/browser/ui/web_applications/web_app_launch_manager.cc index 7eb3571..3af76c0 100644 --- a/chrome/browser/ui/web_applications/web_app_launch_manager.cc +++ b/chrome/browser/ui/web_applications/web_app_launch_manager.cc
@@ -27,6 +27,7 @@ #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/share_target_utils.h" #include "chrome/browser/ui/web_applications/system_web_app_ui_utils.h" #include "chrome/browser/ui/web_applications/web_app_launch_utils.h"
diff --git a/chrome/browser/ui/web_applications/web_app_launch_utils.cc b/chrome/browser/ui/web_applications/web_app_launch_utils.cc index 4a95ab3..42c7307 100644 --- a/chrome/browser/ui/web_applications/web_app_launch_utils.cc +++ b/chrome/browser/ui/web_applications/web_app_launch_utils.cc
@@ -17,6 +17,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/web_applications/components/app_registrar.h" #include "chrome/browser/web_applications/components/web_app_helpers.h" #include "chrome/browser/web_applications/components/web_app_provider_base.h"
diff --git a/chrome/browser/ui/web_applications/web_app_menu_model.cc b/chrome/browser/ui/web_applications/web_app_menu_model.cc index 3cc3b461..aebb6ab0 100644 --- a/chrome/browser/ui/web_applications/web_app_menu_model.cc +++ b/chrome/browser/ui/web_applications/web_app_menu_model.cc
@@ -19,6 +19,7 @@ #include "chrome/common/chrome_features.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" +#include "components/omnibox/browser/location_bar_model.h" #include "components/strings/grit/components_strings.h" #include "components/webapps/browser/installable/installable_metrics.h" #include "ui/base/accelerators/menu_label_accelerator_util.h"
diff --git a/chrome/browser/ui/webui/download_shelf/download_mojom_traits.h b/chrome/browser/ui/webui/download_shelf/download_mojom_traits.h index cc10d20..45c6220 100644 --- a/chrome/browser/ui/webui/download_shelf/download_mojom_traits.h +++ b/chrome/browser/ui/webui/download_shelf/download_mojom_traits.h
@@ -60,6 +60,9 @@ case DownloadDangerType:: DOWNLOAD_DANGER_TYPE_BLOCKED_UNSUPPORTED_FILETYPE: return MojoDangerType::kBlockedUnsupportedFileType; + case DownloadDangerType:: + DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE: + return MojoDangerType::kDangerousAccountCompromise; case DownloadDangerType::DOWNLOAD_DANGER_TYPE_MAX: break; } @@ -130,6 +133,10 @@ *out = DownloadDangerType:: DOWNLOAD_DANGER_TYPE_BLOCKED_UNSUPPORTED_FILETYPE; return true; + case MojoDangerType::kDangerousAccountCompromise: + *out = DownloadDangerType:: + DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE; + return true; } NOTREACHED(); return false;
diff --git a/chrome/browser/ui/webui/download_shelf/download_shelf.mojom b/chrome/browser/ui/webui/download_shelf/download_shelf.mojom index 32b4113..c43f1d6 100644 --- a/chrome/browser/ui/webui/download_shelf/download_shelf.mojom +++ b/chrome/browser/ui/webui/download_shelf/download_shelf.mojom
@@ -61,6 +61,9 @@ // should be blocked according to policy. See the BlockUnsupportedFiletypes // policy for details. kBlockedUnsupportedFileType = 18, + // SafeBrowsing download service has indicated that this file is associated + // with account compromise. + kDangerousAccountCompromise = 19 }; // The download state associated with a given download item. Maps to
diff --git a/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc b/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc index 839930a..f962631f 100644 --- a/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc +++ b/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc
@@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" +#include "base/feature_list.h" #include "base/i18n/rtl.h" #include "base/i18n/unicodestring.h" #include "base/strings/string_number_conversions.h" @@ -24,6 +25,7 @@ #include "chrome/browser/ui/webui/downloads/downloads.mojom.h" #include "components/download/public/common/download_danger_type.h" #include "components/download/public/common/download_item.h" +#include "components/safe_browsing/core/features.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/download_item_utils.h" #include "content/public/browser/download_manager.h" @@ -35,8 +37,8 @@ #include "ui/base/l10n/time_format.h" using content::BrowserContext; -using download::DownloadItem; using content::DownloadManager; +using download::DownloadItem; using DownloadVector = DownloadManager::DownloadVector; @@ -78,6 +80,11 @@ return "DEEP_SCANNED_OPENED_DANGEROUS"; case download::DOWNLOAD_DANGER_TYPE_BLOCKED_UNSUPPORTED_FILETYPE: return "BLOCKED_UNSUPPORTED_FILE_TYPE"; + case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE: + return base::FeatureList::IsEnabled( + safe_browsing::kSafeBrowsingCTDownloadWarning) + ? "DANGEROUS_ACCOUNT_COMPROMISE" + : "DANGEROUS_CONTENT"; case download::DOWNLOAD_DANGER_TYPE_PROMPT_FOR_SCANNING: case download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: case download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT: @@ -344,11 +351,11 @@ bool DownloadsListTracker::IsIncognito(const DownloadItem& item) const { return GetOriginalNotifierManager() && GetMainNotifierManager() && - GetMainNotifierManager()->GetDownload(item.GetId()) == &item; + GetMainNotifierManager()->GetDownload(item.GetId()) == &item; } -const DownloadItem* DownloadsListTracker::GetItemForTesting(size_t index) - const { +const DownloadItem* DownloadsListTracker::GetItemForTesting( + size_t index) const { if (index >= sorted_items_.size()) return nullptr;
diff --git a/chrome/browser/ui/webui/downloads/downloads_ui.cc b/chrome/browser/ui/webui/downloads/downloads_ui.cc index b40f016..280b856 100644 --- a/chrome/browser/ui/webui/downloads/downloads_ui.cc +++ b/chrome/browser/ui/webui/downloads/downloads_ui.cc
@@ -134,6 +134,8 @@ IDS_BLOCK_REASON_MIXED_CONTENT); source->AddLocalizedString("asyncScanningDownloadDesc", IDS_BLOCK_REASON_DEEP_SCANNING); + source->AddLocalizedString("accountCompromiseDownloadDesc", + IDS_BLOCK_REASON_ACCOUNT_COMPROMISE); if (browser_defaults::kDownloadPageHasShowInFolder) source->AddLocalizedString("controlShowInFolder", IDS_DOWNLOAD_LINK_SHOW);
diff --git a/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc b/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc index edb58b5..dd2f8d0 100644 --- a/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc +++ b/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc
@@ -57,9 +57,8 @@ void SetUp() override { fake_update_engine_client_ = new FakeUpdateEngineClient(); - std::unique_ptr<DBusThreadManagerSetter> dbus_setter = - DBusThreadManager::GetSetterForTesting(); - dbus_setter->SetUpdateEngineClient( + DBusThreadManager::Initialize(); + DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( std::unique_ptr<UpdateEngineClient>(fake_update_engine_client_)); EXPECT_CALL(*mock_user_manager_, IsCurrentUserOwner())
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc index 2641f05..058c76f2 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -89,6 +89,7 @@ #include "chrome/browser/ui/webui/signin/inline_login_dialog_chromeos.h" #elif BUILDFLAG(IS_CHROMEOS_LACROS) #include "chrome/browser/lacros/account_manager_util.h" +#include "chromeos/crosapi/mojom/local_printer.mojom.h" #include "chromeos/lacros/lacros_chrome_service_impl.h" #endif
diff --git a/chrome/browser/ui/webui/profile_helper_browsertest.cc b/chrome/browser/ui/webui/profile_helper_browsertest.cc index ba38e7e..4ccd5c8 100644 --- a/chrome/browser/ui/webui/profile_helper_browsertest.cc +++ b/chrome/browser/ui/webui/profile_helper_browsertest.cc
@@ -7,6 +7,7 @@ #include "base/files/file_util.h" #include "base/run_loop.h" #include "base/test/scoped_feature_list.h" +#include "base/test/test_timeouts.h" #include "build/build_config.h" #include "chrome/browser/apps/platform_apps/shortcut_manager.h" #include "chrome/browser/browser_features.h" @@ -267,8 +268,16 @@ EXPECT_TRUE(base::Contains(*browser_list, original_browser)); EXPECT_EQ(1u, storage.GetNumberOfProfiles()); - // TODO(crbug.com/1191455): Once RemoveProfile()/NukeProfileFromDisk() aren't - // flaky anymore, EXPECT_FALSE(PathExists(additional_profile_dir)). + if (destroy_profile) { + // Check that NukeProfileFromDisk() works correctly. + base::ScopedAllowBlockingForTesting allow_blocking; + base::Time start = base::Time::Now(); + while (base::PathExists(additional_profile_dir) && + base::Time::Now() - start < TestTimeouts::action_timeout()) { + base::RunLoop().RunUntilIdle(); + } + EXPECT_FALSE(base::PathExists(additional_profile_dir)); + } } #if defined(OS_CHROMEOS)
diff --git a/chrome/browser/ui/webui/settings/about_handler.cc b/chrome/browser/ui/webui/settings/about_handler.cc index d16782fe..748b410 100644 --- a/chrome/browser/ui/webui/settings/about_handler.cc +++ b/chrome/browser/ui/webui/settings/about_handler.cc
@@ -417,7 +417,7 @@ #endif void AboutHandler::HandleOpenFeedbackDialog(const base::ListValue* args) { - DCHECK(args->empty()); + DCHECK(args->GetList().empty()); Browser* browser = chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()); chrome::OpenFeedbackDialog(browser, @@ -425,7 +425,7 @@ } void AboutHandler::HandleOpenHelpPage(const base::ListValue* args) { - DCHECK(args->empty()); + DCHECK(args->GetList().empty()); Browser* browser = chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()); chrome::ShowHelp(browser, chrome::HELP_SOURCE_WEBUI); @@ -433,7 +433,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) void AboutHandler::HandleOpenDiagnostics(const base::ListValue* args) { - DCHECK(args->empty()); + DCHECK(args->GetList().empty()); chrome::ShowDiagnosticsApp(profile_); } @@ -451,7 +451,7 @@ } void AboutHandler::HandleLaunchReleaseNotes(const base::ListValue* args) { - DCHECK(args->empty()); + DCHECK(args->GetList().empty()); // We can always show the release notes since the Help app caches it, or can // show an appropriate error state (e.g. No internet connection). base::RecordAction(base::UserMetricsAction("ReleaseNotes.LaunchedAboutPage")); @@ -460,7 +460,7 @@ } void AboutHandler::HandleOpenOsHelpPage(const base::ListValue* args) { - DCHECK(args->empty()); + DCHECK(args->GetList().empty()); Browser* browser = chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()); chrome::ShowHelp(browser, chrome::HELP_SOURCE_WEBUI_CHROME_OS);
diff --git a/chrome/browser/ui/webui/settings/about_handler_unittest.cc b/chrome/browser/ui/webui/settings/about_handler_unittest.cc index b51c6091..ad4350b 100644 --- a/chrome/browser/ui/webui/settings/about_handler_unittest.cc +++ b/chrome/browser/ui/webui/settings/about_handler_unittest.cc
@@ -39,9 +39,9 @@ void SetUp() override { fake_update_engine_client_ = new FakeUpdateEngineClient(); + DBusThreadManager::Initialize(); DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( base::WrapUnique<UpdateEngineClient>(fake_update_engine_client_)); - DBusThreadManager::Initialize(); ConciergeClient::InitializeFake(/*fake_cicerone_client=*/nullptr); handler_ = std::make_unique<TestAboutHandler>(&profile_);
diff --git a/chrome/browser/ui/webui/settings/privacy_sandbox_handler.cc b/chrome/browser/ui/webui/settings/privacy_sandbox_handler.cc index e67fcec..266c7aa 100644 --- a/chrome/browser/ui/webui/settings/privacy_sandbox_handler.cc +++ b/chrome/browser/ui/webui/settings/privacy_sandbox_handler.cc
@@ -4,12 +4,45 @@ #include "chrome/browser/ui/webui/settings/privacy_sandbox_handler.h" +#include "chrome/browser/federated_learning/floc_id_provider_factory.h" #include "chrome/browser/privacy_sandbox/privacy_sandbox_settings.h" #include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h" #include "chrome/browser/profiles/profile.h" namespace settings { +namespace { + +// Keys of the dictionary returned by GetFlocIdInformation. +constexpr char kTrialStatus[] = "trialStatus"; +constexpr char kCohort[] = "cohort"; +constexpr char kNextUpdate[] = "nextUpdate"; +constexpr char kCanReset[] = "canReset"; + +base::Value GetFlocIdInformation(Profile* profile) { + auto* privacy_sandbox_settings = + PrivacySandboxSettingsFactory::GetForProfile(profile); + DCHECK(privacy_sandbox_settings); + + base::DictionaryValue floc_id_information; + floc_id_information.SetKey( + kTrialStatus, + base::Value(privacy_sandbox_settings->GetFlocStatusForDisplay())); + floc_id_information.SetKey( + kCohort, base::Value(privacy_sandbox_settings->GetFlocIdForDisplay())); + floc_id_information.SetKey( + kNextUpdate, + base::Value(PrivacySandboxSettings::GetFlocIdNextUpdateForDisplay( + federated_learning::FlocIdProviderFactory::GetForProfile(profile), + profile->GetPrefs(), base::Time::Now()))); + floc_id_information.SetKey( + kCanReset, base::Value(privacy_sandbox_settings->IsFlocIdResettable())); + + return std::move(floc_id_information); +} + +} // namespace + void PrivacySandboxHandler::RegisterMessages() { web_ui()->RegisterMessageCallback( "getFlocId", base::BindRepeating(&PrivacySandboxHandler::HandleGetFlocId, @@ -27,13 +60,8 @@ const base::Value* callback_id; CHECK(args->Get(0, &callback_id)); - auto* privacy_sandbox_settings = PrivacySandboxSettingsFactory::GetForProfile( - Profile::FromWebUI(web_ui())); - DCHECK(privacy_sandbox_settings); - - ResolveJavascriptCallback( - *callback_id, - base::Value(privacy_sandbox_settings->GetFlocIdForDisplay())); + ResolveJavascriptCallback(*callback_id, + GetFlocIdInformation(Profile::FromWebUI(web_ui()))); } void PrivacySandboxHandler::HandleResetFlocId(const base::ListValue* args) { @@ -51,9 +79,8 @@ // the appropriate invalid ID string. // TODO(crbug.com/1207891): Have this handler listen to an event directly // from the FLoC provider, rather than inferring behavior. - FireWebUIListener( - "floc-id-changed", - base::Value(privacy_sandbox_settings->GetFlocIdForDisplay())); + FireWebUIListener("floc-id-changed", + GetFlocIdInformation(Profile::FromWebUI(web_ui()))); } } // namespace settings
diff --git a/chrome/browser/ui/webui/settings/privacy_sandbox_handler_unittest.cc b/chrome/browser/ui/webui/settings/privacy_sandbox_handler_unittest.cc index 67fb10a5..844cff9 100644 --- a/chrome/browser/ui/webui/settings/privacy_sandbox_handler_unittest.cc +++ b/chrome/browser/ui/webui/settings/privacy_sandbox_handler_unittest.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ui/webui/settings/privacy_sandbox_handler.h" #include "base/strings/utf_string_conversions.h" +#include "chrome/browser/federated_learning/floc_id_provider_factory.h" #include "chrome/browser/privacy_sandbox/privacy_sandbox_settings.h" #include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h" #include "chrome/test/base/testing_profile.h" @@ -24,12 +25,38 @@ MOCK_METHOD1(OnFlocDataAccessibleSinceUpdated, void(bool)); }; +// Confirms that the |floc_id| dictionary provided matches the current FLoC +// information for |profile|. +void ValidateFlocId(const base::Value* floc_id, Profile* profile) { + auto* privacy_sandbox_settings = + PrivacySandboxSettingsFactory::GetForProfile(profile); + auto* floc_id_provider = + federated_learning::FlocIdProviderFactory::GetForProfile(profile); + + ASSERT_TRUE(floc_id->is_dict()); + EXPECT_EQ( + base::UTF16ToUTF8(privacy_sandbox_settings->GetFlocStatusForDisplay()), + *floc_id->FindStringPath("trialStatus")); + EXPECT_EQ(base::UTF16ToUTF8(privacy_sandbox_settings->GetFlocIdForDisplay()), + *floc_id->FindStringPath("cohort")); + EXPECT_EQ( + base::UTF16ToUTF8(PrivacySandboxSettings::GetFlocIdNextUpdateForDisplay( + floc_id_provider, profile->GetPrefs(), base::Time::Now())), + *floc_id->FindStringPath("nextUpdate")); + EXPECT_EQ(privacy_sandbox_settings->IsFlocIdResettable(), + floc_id->FindBoolPath("canReset")); +} + } // namespace namespace settings { class PrivacySandboxHandlerTest : public testing::Test { public: + PrivacySandboxHandlerTest() + : browser_task_environment_( + base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} + void SetUp() override { web_ui_ = std::make_unique<content::TestWebUI>(); web_ui_->set_web_contents(web_contents_.get()); @@ -74,9 +101,7 @@ EXPECT_EQ(kCallbackId, data.arg1()->GetString()); EXPECT_EQ("cr.webUIResponse", data.function_name()); ASSERT_TRUE(data.arg2()->GetBool()); - EXPECT_EQ( - base::UTF16ToUTF8(privacy_sandbox_settings()->GetFlocIdForDisplay()), - data.arg3()->GetString()); + ValidateFlocId(data.arg3(), profile()); } TEST_F(PrivacySandboxHandlerTest, ResetFlocId) { @@ -97,9 +122,7 @@ const content::TestWebUI::CallData& data = *web_ui()->call_data().back(); EXPECT_EQ("cr.webUIListenerCallback", data.function_name()); EXPECT_EQ("floc-id-changed", data.arg1()->GetString()); - EXPECT_EQ( - base::UTF16ToUTF8(privacy_sandbox_settings()->GetFlocIdForDisplay()), - data.arg2()->GetString()); + ValidateFlocId(data.arg2(), profile()); } } // namespace settings
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc index 44940e72..fa91c8b 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -1490,10 +1490,12 @@ IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_HEADING}, {"privacySandboxPageFlocExplanation", IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_EXPLANATION}, + {"privacySandboxPageFlocStatus", + IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_STATUS}, {"privacySandboxPageFlocCohort", IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_COHORT}, - {"privacySandboxPageFlocCohortUpdated", - IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_COHORT_UPDATED}, + {"privacySandboxPageFlocCohortNextUpdate", + IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_COHORT_NEXT_UPDATE}, {"privacySandboxPageFlocResetCohort", IDS_SETTINGS_PRIVACY_SANDBOX_PAGE_FLOC_RESET_COHORT}, };
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler.cc b/chrome/browser/ui/webui/settings/site_settings_handler.cc index da569d6..182e64b 100644 --- a/chrome/browser/ui/webui/settings/site_settings_handler.cc +++ b/chrome/browser/ui/webui/settings/site_settings_handler.cc
@@ -1187,6 +1187,15 @@ ? ContentSettingsPattern::Wildcard() : ContentSettingsPattern::FromString(secondary_pattern_string); + // Clear any existing embargo status if the new setting isn't block. + if (setting != CONTENT_SETTING_BLOCK) { + GURL url(primary_pattern.ToString()); + if (url.is_valid()) { + PermissionDecisionAutoBlockerFactory::GetForProfile(profile_) + ->RemoveEmbargoAndResetCounts(url, content_type); + } + } + permissions::PermissionUmaUtil::ScopedRevocationReporter scoped_revocation_reporter( profile, primary_pattern, secondary_pattern, content_type,
diff --git a/chrome/browser/ui/window_sizer/window_sizer_chromeos.cc b/chrome/browser/ui/window_sizer/window_sizer_chromeos.cc index e8ffe58..04240fcf 100644 --- a/chrome/browser/ui/window_sizer/window_sizer_chromeos.cc +++ b/chrome/browser/ui/window_sizer/window_sizer_chromeos.cc
@@ -11,6 +11,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "ui/aura/window.h" #include "ui/display/display.h" #include "ui/display/screen.h"
diff --git a/chrome/browser/upgrade_detector/installed_version_updater_chromeos_unittest.cc b/chrome/browser/upgrade_detector/installed_version_updater_chromeos_unittest.cc index 107b877..16d769d 100644 --- a/chrome/browser/upgrade_detector/installed_version_updater_chromeos_unittest.cc +++ b/chrome/browser/upgrade_detector/installed_version_updater_chromeos_unittest.cc
@@ -30,6 +30,7 @@ auto fake_update_engine_client = std::make_unique<chromeos::FakeUpdateEngineClient>(); fake_update_engine_client_ = fake_update_engine_client.get(); + chromeos::DBusThreadManager::Initialize(); chromeos::DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( std::move(fake_update_engine_client));
diff --git a/chrome/browser/upgrade_detector/upgrade_detector_chromeos_unittest.cc b/chrome/browser/upgrade_detector/upgrade_detector_chromeos_unittest.cc index d55b370..a09506ea 100644 --- a/chrome/browser/upgrade_detector/upgrade_detector_chromeos_unittest.cc +++ b/chrome/browser/upgrade_detector/upgrade_detector_chromeos_unittest.cc
@@ -78,9 +78,8 @@ std::make_unique<base::Value>(true)); fake_update_engine_client_ = new chromeos::FakeUpdateEngineClient(); - std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter = - chromeos::DBusThreadManager::GetSetterForTesting(); - dbus_setter->SetUpdateEngineClient( + chromeos::DBusThreadManager::Initialize(); + chromeos::DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( std::unique_ptr<chromeos::UpdateEngineClient>( fake_update_engine_client_));
diff --git a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc index f52ba76..9faf54d 100644 --- a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc +++ b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc
@@ -28,6 +28,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/system_web_app_ui_utils.h" #include "chrome/browser/web_applications/components/app_registrar.h" #include "chrome/browser/web_applications/components/web_app_constants.h"
diff --git a/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc b/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc index 9c7d24b1..97f698d 100644 --- a/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc +++ b/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc
@@ -15,6 +15,7 @@ #include "base/location.h" #include "base/stl_util.h" #include "base/strings/stringprintf.h" +#include "base/strings/utf_string_conversions.h" #include "base/time/time.h" #include "base/values.h" #include "build/build_config.h"
diff --git a/chrome/browser/webshare/store_file_task.cc b/chrome/browser/webshare/store_file_task.cc index a3295fd..df9e042 100644 --- a/chrome/browser/webshare/store_file_task.cc +++ b/chrome/browser/webshare/store_file_task.cc
@@ -6,6 +6,8 @@ #include "base/strings/string_util.h" #include "base/threading/scoped_blocking_call.h" +#include "mojo/public/cpp/bindings/remote.h" +#include "net/base/net_errors.h" namespace { bool g_skip_copying_for_testing = false;
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 510a36d..434ebf5 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-master-1621403949-728952e5b9fa3a5e8de4d892e513d355636fc8ed.profdata +chrome-win32-master-1621410951-b7677a4a5a50589ed33e1ed404c1e098a7189e08.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 798d1ae..acf2d178 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-master-1621403949-c7d4857399c6e2d53ca099fdb41b0ddae52ed7db.profdata +chrome-win64-master-1621435901-90994329b9c6299f68e9909710dedd7ebb7a6abc.profdata
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index d42db12..f4542e3 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc
@@ -13,6 +13,7 @@ #include <initializer_list> #include <memory> #include <string> +#include <utility> #include <vector> #include "base/base_paths.h" @@ -209,29 +210,18 @@ } } -// Deletes shortcuts at |install_level| from Start menu, Desktop, -// Quick Launch, taskbar, and secondary tiles on the Start Screen (Win8+). -// Only shortcuts pointing to |target_exe| will be removed. +// Deletes shortcuts from Start menu, Desktop, Quick Launch, taskbar, and +// secondary tiles on the Start Screen (Win8+). Only shortcuts pointing to any +// of |target_paths| will be removed. void DeleteShortcuts(const InstallerState& installer_state, - const base::FilePath& target_exe) { + const std::vector<base::FilePath>& target_paths) { // The per-user shortcut for this user, if present on a system-level install, // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks(). ShellUtil::ShellChange install_level = installer_state.system_install() ? ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER; - - // Delete and unpin all shortcuts that point to |target_exe| from all - // ShellUtil::ShortcutLocations. VLOG(1) << "Deleting shortcuts."; - for (int location = ShellUtil::SHORTCUT_LOCATION_FIRST; - location < ShellUtil::NUM_SHORTCUT_LOCATIONS; ++location) { - if (!ShellUtil::RemoveShortcuts( - static_cast<ShellUtil::ShortcutLocation>(location), install_level, - target_exe)) { - LOG(WARNING) << "Failed to delete shortcuts in ShortcutLocation: " - << location; - } - } + ShellUtil::RemoveAllShortcuts(install_level, target_paths); } bool ScheduleParentAndGrandparentForDeletion(const base::FilePath& path) { @@ -852,13 +842,17 @@ auto_launch_util::DisableBackgroundStartAtLogin(); + base::FilePath chrome_proxy_exe( + installer_state.target_path().Append(installer::kChromeProxyExe)); + // If user-level chrome is self-destructing as a result of encountering a // system-level chrome, retarget owned non-default shortcuts (app shortcuts, // profile shortcuts, etc.) to the system-level chrome. if (cmd_line.HasSwitch(installer::switches::kSelfDestruct) && !installer_state.system_install()) { + const base::FilePath system_install_path(GetChromeInstallPath(true)); const base::FilePath system_chrome_path( - GetChromeInstallPath(true).Append(installer::kChromeExe)); + system_install_path.Append(installer::kChromeExe)); VLOG(1) << "Retargeting user-generated Chrome shortcuts."; if (base::PathExists(system_chrome_path)) { RetargetUserShortcutsWithArgs(installer_state, chrome_exe, @@ -866,9 +860,20 @@ } else { LOG(ERROR) << "Retarget failed: system-level Chrome not found."; } + + // Retarget owned app shortcuts to the system-level chrome_proxy. + const base::FilePath system_chrome_proxy_path( + system_install_path.Append(installer::kChromeProxyExe)); + VLOG(1) << "Retargeting user-generated Chrome Proxy shortcuts."; + if (base::PathExists(system_chrome_proxy_path)) { + RetargetUserShortcutsWithArgs(installer_state, chrome_proxy_exe, + system_chrome_proxy_path); + } else { + LOG(ERROR) << "Retarget failed: system-level Chrome Proxy not found."; + } } - DeleteShortcuts(installer_state, chrome_exe); + DeleteShortcuts(installer_state, {chrome_exe, std::move(chrome_proxy_exe)}); // Delete the registry keys (Uninstall key and Version key). HKEY reg_root = installer_state.root_key();
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index d4b7a0f..4b04e6b 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc
@@ -1294,12 +1294,13 @@ base::RepeatingCallback<bool(const base::FilePath& shortcut_path, const std::wstring& args)>; -// FilterTargetEq is a shortcut filter that matches only shortcuts that have a -// specific target, and optionally matches shortcuts that have non-empty -// arguments. -class FilterTargetEq { +// FilterTargetContains is a shortcut filter that matches shortcuts that target +// any of a set of candidate files, and optionally matches shortcuts that have +// non-empty arguments. +class FilterTargetContains { public: - FilterTargetEq(const base::FilePath& desired_target_exe, bool require_args); + FilterTargetContains(const std::vector<base::FilePath>& target_paths, + bool require_args); // Returns true if filter rules are satisfied, i.e.: // - |target_path|'s target == |desired_target_compare_|, and @@ -1312,27 +1313,33 @@ ShortcutFilterCallback AsShortcutFilterCallback(); private: - InstallUtil::ProgramCompare desired_target_compare_; - + std::vector<InstallUtil::ProgramCompare> desired_target_compare_; bool require_args_; }; -FilterTargetEq::FilterTargetEq(const base::FilePath& desired_target_exe, - bool require_args) - : desired_target_compare_(desired_target_exe), +FilterTargetContains::FilterTargetContains( + const std::vector<base::FilePath>& target_paths, + bool require_args) + : desired_target_compare_(std::begin(target_paths), std::end(target_paths)), require_args_(require_args) {} -bool FilterTargetEq::Match(const base::FilePath& target_path, - const std::wstring& args) const { - if (!desired_target_compare_.EvaluatePath(target_path)) +bool FilterTargetContains::Match(const base::FilePath& target_path, + const std::wstring& args) const { + auto comparator = [&target_path](const auto& target_compare) { + return target_compare.EvaluatePath(target_path); + }; + if (std::none_of(std::begin(desired_target_compare_), + std::end(desired_target_compare_), comparator)) { return false; + } if (require_args_ && args.empty()) return false; return true; } -ShortcutFilterCallback FilterTargetEq::AsShortcutFilterCallback() { - return base::BindRepeating(&FilterTargetEq::Match, base::Unretained(this)); +ShortcutFilterCallback FilterTargetContains::AsShortcutFilterCallback() { + return base::BindRepeating(&FilterTargetContains::Match, + base::Unretained(this)); } // Shortcut operations for BatchShortcutAction(). @@ -1352,7 +1359,7 @@ bool ShortcutOpDelete(const base::FilePath& shortcut_path) { bool ret = base::DeleteFile(shortcut_path); - LOG_IF(ERROR, !ret) << "Failed to remove " << shortcut_path.value(); + PLOG_IF(ERROR, !ret) << "Failed to remove " << shortcut_path.value(); return ret; } @@ -2446,13 +2453,14 @@ } // static -bool ShellUtil::RemoveShortcuts(ShortcutLocation location, - ShellChange level, - const base::FilePath& target_exe) { +bool ShellUtil::RemoveShortcuts( + ShortcutLocation location, + ShellChange level, + const std::vector<base::FilePath>& target_paths) { if (!ShortcutLocationIsSupported(location)) return true; // Vacuous success. - FilterTargetEq shortcut_filter(target_exe, false); + FilterTargetContains shortcut_filter(target_paths, false); // Main operation to apply to each shortcut in the directory specified. ShortcutOperationCallback shortcut_operation = location == SHORTCUT_LOCATION_TASKBAR_PINS @@ -2472,6 +2480,19 @@ } // static +void ShellUtil::RemoveAllShortcuts( + ShellChange level, + const std::vector<base::FilePath>& target_paths) { + // Delete and unpin all shortcuts that point to |target_paths| from all + // ShellUtil::ShortcutLocations for the given |level|. + for (int location = SHORTCUT_LOCATION_FIRST; + location < NUM_SHORTCUT_LOCATIONS; ++location) { + RemoveShortcuts(static_cast<ShortcutLocation>(location), level, + target_paths); + } +} + +// static bool ShellUtil::RetargetShortcutsWithArgs( ShortcutLocation location, ShellChange level, @@ -2480,7 +2501,7 @@ if (!ShortcutLocationIsSupported(location)) return true; // Vacuous success. - FilterTargetEq shortcut_filter(old_target_exe, true); + FilterTargetContains shortcut_filter({old_target_exe}, true); ShortcutOperationCallback shortcut_operation = base::BindRepeating(&ShortcutOpRetarget, old_target_exe, new_target_exe); return BatchShortcutAction(shortcut_filter.AsShortcutFilterCallback(), @@ -2497,7 +2518,7 @@ std::vector<std::pair<base::FilePath, std::wstring>>* shortcuts) { if (!ShortcutLocationIsSupported(location)) return false; - FilterTargetEq shortcut_filter(chrome_exe, true); + FilterTargetContains shortcut_filter({chrome_exe}, true); ShortcutOperationCallback shortcut_operation = base::BindRepeating( &ShortcutOpListOrRemoveUnknownArgs, do_removal, shortcuts); return BatchShortcutAction(shortcut_filter.AsShortcutFilterCallback(), @@ -2510,7 +2531,7 @@ const base::FilePath& chrome_exe) { if (!ShortcutLocationIsSupported(location)) return false; - FilterTargetEq shortcut_filter(chrome_exe, /*require_args=*/false); + FilterTargetContains shortcut_filter({chrome_exe}, /*require_args=*/false); ShortcutOperationCallback shortcut_operation = base::BindRepeating(&ShortcutOpResetAttributes); return BatchShortcutAction(shortcut_filter.AsShortcutFilterCallback(),
diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h index 2d1ace0..bca7750 100644 --- a/chrome/installer/util/shell_util.h +++ b/chrome/installer/util/shell_util.h
@@ -589,14 +589,23 @@ // Removes installed shortcut(s) at |location|. // |level|: CURRENT_USER to remove per-user shortcuts, or SYSTEM_LEVEL to // remove all-users shortcuts. - // |target_exe|: Shortcut target exe; shortcuts will only be deleted when - // their target is |target_exe|. + // |target_paths|: A vector of shortcut target exe paths; shortcuts will only + // be deleted when their target is one of |target_paths|. // If |location| is a Chrome-specific folder, it will be deleted as well. // Returns true if all shortcuts pointing to |target_exe| are successfully // deleted, including the case where no such shortcuts are found. static bool RemoveShortcuts(ShortcutLocation location, ShellChange level, - const base::FilePath& target_exe); + const std::vector<base::FilePath>& target_paths); + + // Removes installed shortcut(s) from all ShellUtil::ShortcutLocations. + // |level|: CURRENT_USER to remove per-user shortcuts, or SYSTEM_LEVEL to + // remove all-users shortcuts. + // |target_paths|: A vector of shortcut target exe paths; shortcuts will only + // be deleted when their target is one of |target_paths|. + static void RemoveAllShortcuts( + ShellChange level, + const std::vector<base::FilePath>& target_paths); // Updates the target of all shortcuts in |location| that satisfy the // following:
diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc index 97526c1e..b840d0e 100644 --- a/chrome/installer/util/shell_util_unittest.cc +++ b/chrome/installer/util/shell_util_unittest.cc
@@ -61,6 +61,9 @@ chrome_exe_ = temp_dir_.GetPath().Append(installer::kChromeExe); EXPECT_EQ(0, base::WriteFile(chrome_exe_, "", 0)); + chrome_proxy_exe_ = temp_dir_.GetPath().Append(installer::kChromeProxyExe); + EXPECT_EQ(0, base::WriteFile(chrome_proxy_exe_, "", 0)); + manganese_exe_ = temp_dir_.GetPath().Append(kManganeseExe); EXPECT_EQ(0, base::WriteFile(manganese_exe_, "", 0)); @@ -221,6 +224,7 @@ std::unique_ptr<base::ScopedPathOverride> common_startup_override_; base::FilePath chrome_exe_; + base::FilePath chrome_proxy_exe_; base::FilePath manganese_exe_; base::FilePath iron_exe_; base::FilePath other_ico_; @@ -419,7 +423,8 @@ ASSERT_TRUE(base::PathExists(shortcut_path)); ASSERT_TRUE(ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_DESKTOP, - ShellUtil::CURRENT_USER, chrome_exe_)); + ShellUtil::CURRENT_USER, + {chrome_exe_})); ASSERT_FALSE(base::PathExists(shortcut_path)); ASSERT_TRUE(base::PathExists(shortcut_path.DirName())); } @@ -434,7 +439,8 @@ ASSERT_TRUE(base::PathExists(shortcut_path)); ASSERT_TRUE(ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_DESKTOP, - ShellUtil::SYSTEM_LEVEL, chrome_exe_)); + ShellUtil::SYSTEM_LEVEL, + {chrome_exe_})); ASSERT_FALSE(base::PathExists(shortcut_path)); ASSERT_TRUE(base::PathExists(shortcut_path.DirName())); } @@ -474,13 +480,232 @@ // Remove shortcuts that target "chrome.exe". ASSERT_TRUE(ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_DESKTOP, - ShellUtil::CURRENT_USER, chrome_exe_)); + ShellUtil::CURRENT_USER, + {chrome_exe_})); ASSERT_FALSE(base::PathExists(shortcut1_path)); ASSERT_FALSE(base::PathExists(shortcut2_path)); ASSERT_TRUE(base::PathExists(shortcut3_path)); ASSERT_TRUE(base::PathExists(shortcut1_path.DirName())); } +TEST_F(ShellUtilShortcutTest, RemoveMultiTargetShortcuts) { + // Shortcut 1: targets "chrome.exe"; no arguments. + test_properties_.set_shortcut_name(L"Chrome 1"); + test_properties_.set_arguments(L""); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut1_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut1_path)); + + // Shortcut 2: targets "chrome_proxy.exe"; no arguments. + test_properties_.set_shortcut_name(L"Chrome Proxy 2"); + test_properties_.set_target(chrome_proxy_exe_); + test_properties_.set_arguments(L""); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut2_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut2_path)); + + // Shortcut 3: targets "chrome_proxy.exe"; has arguments; icon set to + // "other.ico". + test_properties_.set_shortcut_name(L"Chrome Proxy 3"); + test_properties_.set_target(chrome_proxy_exe_); + test_properties_.set_arguments(L"--profile-directory=\"Profile 2\""); + test_properties_.set_icon(other_ico_, 0); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut3_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut3_path)); + + // Shortcut 4: targets "iron.exe"; has arguments; icon set to "chrome.exe". + test_properties_.set_shortcut_name(L"Iron 4"); + test_properties_.set_target(iron_exe_); + test_properties_.set_icon(chrome_exe_, 3); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut4_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut4_path)); + + // Shortcut 5: targets "manganese.exe"; has arguments; icon set to + // "chrome.exe". + test_properties_.set_shortcut_name(L"Manganese 5"); + test_properties_.set_target(manganese_exe_); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut5_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut5_path)); + + // Remove per-user shortcuts that target "chrome.exe", "chrome_proxy.exe" and + // "iron.exe". + ASSERT_TRUE(ShellUtil::RemoveShortcuts( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, ShellUtil::CURRENT_USER, + {chrome_exe_, chrome_proxy_exe_, iron_exe_})); + ASSERT_FALSE(base::PathExists(shortcut1_path)); + ASSERT_FALSE(base::PathExists(shortcut2_path)); + ASSERT_FALSE(base::PathExists(shortcut3_path)); + ASSERT_FALSE(base::PathExists(shortcut4_path)); + ASSERT_TRUE(base::PathExists(shortcut5_path)); +} + +TEST_F(ShellUtilShortcutTest, RemoveSystemLevelMultiTargetShortcuts) { + test_properties_.level = ShellUtil::SYSTEM_LEVEL; + // Shortcut 1: targets "chrome.exe"; no arguments. + test_properties_.set_shortcut_name(L"Chrome 1"); + test_properties_.set_arguments(L""); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut1_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut1_path)); + + // Shortcut 2: targets "chrome_proxy.exe"; no arguments. + test_properties_.set_shortcut_name(L"Chrome Proxy 2"); + test_properties_.set_target(chrome_proxy_exe_); + test_properties_.set_arguments(L""); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut2_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut2_path)); + + // Shortcut 3: targets "chrome_proxy.exe"; has arguments; icon set to + // "other.ico". + test_properties_.set_shortcut_name(L"Chrome Proxy 3"); + test_properties_.set_target(chrome_proxy_exe_); + test_properties_.set_arguments(L"--profile-directory=\"Profile 2\""); + test_properties_.set_icon(other_ico_, 0); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut3_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut3_path)); + + // Shortcut 4: targets "iron.exe"; has arguments; icon set to "chrome.exe". + test_properties_.set_shortcut_name(L"Iron 4"); + test_properties_.set_target(iron_exe_); + test_properties_.set_icon(chrome_exe_, 3); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut4_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut4_path)); + + // Shortcut 5: targets "manganese.exe"; has arguments; icon set to + // "chrome.exe". + test_properties_.set_shortcut_name(L"Manganese 5"); + test_properties_.set_target(manganese_exe_); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut5_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut5_path)); + + // Remove system level shortcuts that target "chrome.exe", "chrome_proxy.exe" + // and "iron.exe". + ASSERT_TRUE(ShellUtil::RemoveShortcuts( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, ShellUtil::SYSTEM_LEVEL, + {chrome_exe_, chrome_proxy_exe_, iron_exe_})); + ASSERT_FALSE(base::PathExists(shortcut1_path)); + ASSERT_FALSE(base::PathExists(shortcut2_path)); + ASSERT_FALSE(base::PathExists(shortcut3_path)); + ASSERT_FALSE(base::PathExists(shortcut4_path)); + ASSERT_TRUE(base::PathExists(shortcut5_path)); +} + +TEST_F(ShellUtilShortcutTest, RemoveAllShortcutsMultipleLocations) { + // Shortcut 1: targets "chrome.exe"; desktop shortcut. + test_properties_.set_shortcut_name(L"Chrome Desktop 1"); + test_properties_.set_target(chrome_exe_); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut1_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut1_path)); + + // Shortcut 2: targets "chrome_proxy.exe"; start menu shortcut. + test_properties_.set_shortcut_name(L"Chrome Proxy Startup 2"); + test_properties_.set_target(chrome_proxy_exe_); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut2_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut2_path)); + + // Shortcut 3: targets "iron.exe"; has arguments; icon set to "chrome.exe". + test_properties_.set_shortcut_name(L"Iron 3"); + test_properties_.set_target(iron_exe_); + test_properties_.set_icon(chrome_exe_, 3); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut3_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut3_path)); + + ShellUtil::RemoveAllShortcuts(ShellUtil::CURRENT_USER, + {chrome_exe_, chrome_proxy_exe_}); + ASSERT_FALSE(base::PathExists(shortcut1_path)); + ASSERT_FALSE(base::PathExists(shortcut2_path)); + ASSERT_TRUE(base::PathExists(shortcut3_path)); +} + +TEST_F(ShellUtilShortcutTest, RemoveAllShortcutsSystemLevelMultipleLocations) { + test_properties_.level = ShellUtil::SYSTEM_LEVEL; + // Shortcut 1: targets "chrome.exe"; desktop shortcut. + test_properties_.set_shortcut_name(L"Chrome Desktop 1"); + test_properties_.set_target(chrome_exe_); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut1_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut1_path)); + + // Shortcut 2: targets "chrome_proxy.exe"; start menu shortcut. + test_properties_.set_shortcut_name(L"Chrome Proxy Startup 2"); + test_properties_.set_target(chrome_proxy_exe_); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut2_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut2_path)); + + // Shortcut 3: targets "iron.exe"; has arguments; icon set to "chrome.exe". + test_properties_.set_shortcut_name(L"Iron 3"); + test_properties_.set_target(iron_exe_); + test_properties_.set_icon(chrome_exe_, 3); + ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_, + ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); + base::FilePath shortcut3_path = GetExpectedShortcutPath( + ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_); + ASSERT_TRUE(base::PathExists(shortcut3_path)); + + ShellUtil::RemoveAllShortcuts(ShellUtil::SYSTEM_LEVEL, + {chrome_exe_, chrome_proxy_exe_}); + ASSERT_FALSE(base::PathExists(shortcut1_path)); + ASSERT_FALSE(base::PathExists(shortcut2_path)); + ASSERT_TRUE(base::PathExists(shortcut3_path)); +} + TEST_F(ShellUtilShortcutTest, RetargetShortcutsWithArgs) { ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( ShellUtil::SHORTCUT_LOCATION_DESKTOP, test_properties_, @@ -777,13 +1002,13 @@ ASSERT_TRUE(base::PathExists(chrome_shortcut_folder)); ASSERT_TRUE(ShellUtil::RemoveShortcuts( ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED, - ShellUtil::CURRENT_USER, chrome_exe_)); + ShellUtil::CURRENT_USER, {chrome_exe_})); ASSERT_FALSE(base::PathExists(chrome_shortcut_folder)); ASSERT_TRUE(base::PathExists(chrome_apps_shortcut_folder)); ASSERT_TRUE(ShellUtil::RemoveShortcuts( ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, - ShellUtil::CURRENT_USER, chrome_exe_)); + ShellUtil::CURRENT_USER, {chrome_exe_})); ASSERT_FALSE(base::PathExists(chrome_apps_shortcut_folder)); } @@ -802,7 +1027,7 @@ ASSERT_TRUE(base::PathExists(shortcut_path)); ASSERT_TRUE( ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, - ShellUtil::CURRENT_USER, chrome_exe_)); + ShellUtil::CURRENT_USER, {chrome_exe_})); // The shortcut should be removed but the "Start Menu" root directory should // remain. ASSERT_TRUE(base::PathExists(fake_start_menu_.GetPath())); @@ -831,7 +1056,8 @@ // |other_chrome_exe| and RemoveChromeShortcut() is being told that the // removed shortcut should point to |chrome_exe_|. ASSERT_TRUE(ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_DESKTOP, - ShellUtil::CURRENT_USER, chrome_exe_)); + ShellUtil::CURRENT_USER, + {chrome_exe_})); ASSERT_TRUE(base::PathExists(shortcut_path)); ASSERT_TRUE(base::PathExists(shortcut_path.DirName())); }
diff --git a/chrome/services/sharing/nearby/nearby_connections.cc b/chrome/services/sharing/nearby/nearby_connections.cc index 61719f6d..a0a1144 100644 --- a/chrome/services/sharing/nearby/nearby_connections.cc +++ b/chrome/services/sharing/nearby/nearby_connections.cc
@@ -13,6 +13,8 @@ #include "chrome/services/sharing/nearby/nearby_connections_conversions.h" #include "chrome/services/sharing/nearby/platform/input_file.h" #include "chromeos/services/nearby/public/mojom/nearby_connections_types.mojom.h" +#include "chromeos/services/nearby/public/mojom/webrtc.mojom.h" +#include "services/network/public/mojom/p2p.mojom.h" #include "third_party/nearby/src/cpp/core/core.h" #include "third_party/nearby/src/cpp/core/internal/offline_service_controller.h"
diff --git a/chrome/test/base/web_ui_browser_test.cc b/chrome/test/base/web_ui_browser_test.cc index 2f5f24d..c646825 100644 --- a/chrome/test/base/web_ui_browser_test.cc +++ b/chrome/test/base/web_ui_browser_test.cc
@@ -24,6 +24,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" +#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/webui/web_ui_test_handler.h"
diff --git a/chrome/test/data/extensions/api_test/automation/sites/attributes.html b/chrome/test/data/extensions/api_test/automation/sites/attributes.html index 78ead95..f6664f2 100644 --- a/chrome/test/data/extensions/api_test/automation/sites/attributes.html +++ b/chrome/test/data/extensions/api_test/automation/sites/attributes.html
@@ -52,7 +52,7 @@ aria-valuemax="1.0" aria-orientation="vertical" aria-controls="main" id="scrollbar-role"></div> - <div id="main" aria-label="main">Content for scrollbar to control</div> + <div id="main" role="group" aria-label="main">Content for scrollbar to control</div> <!-- table and cell attributes --> <!-- The first 100 rows and the first 50 columns are missing. --> @@ -77,7 +77,7 @@ <div id="check-test-1" aria-label="check-test-1" role="checkbox" aria-checked="true">Checked</div> <div id="check-test-2" aria-label="check-test-2" role="checkbox" aria-checked="false">Unchecked</div> <div id="check-test-3" aria-label="check-test-3" role="checkbox" aria-checked="mixed">Mixed</div> - <div id="check-test-4" aria-label="check-test-4" aria-checked="true">Not a checkbox</div> + <div id="check-test-4" aria-label="check-test-4" role="group" aria-checked="true">Not a checkbox</div> <div id="check-test-5" aria-label="check-test-5" role="treeitem" aria-checked="true">Checked treeitem</div> <div id="check-test-6" aria-label="check-test-6" role="button" aria-pressed="true">Pressed button</div>
diff --git a/chrome/test/data/extensions/api_test/automation/tests/tabs/enum_validity.html b/chrome/test/data/extensions/api_test/automation/tests/tabs/enum_validity.html new file mode 100644 index 0000000..66e2cb4 --- /dev/null +++ b/chrome/test/data/extensions/api_test/automation/tests/tabs/enum_validity.html
@@ -0,0 +1,7 @@ +<!-- + * Copyright 2021 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. +--> +<script src="common.js"></script> +<script src="enum_validity.js"></script>
diff --git a/chrome/test/data/extensions/api_test/automation/tests/tabs/enum_validity.js b/chrome/test/data/extensions/api_test/automation/tests/tabs/enum_validity.js new file mode 100644 index 0000000..4232c0c --- /dev/null +++ b/chrome/test/data/extensions/api_test/automation/tests/tabs/enum_validity.js
@@ -0,0 +1,22 @@ +// Copyright 2021 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. + +var allTests = [function testAutomationNodeProperties() { + const automationRootNode = rootNode; + const automationNode = automationRootNode.firstChild; + + // Property accesses on this node will trigger native C++ property getters + // which should not crash. + for (let name in automationRootNode) { + automationRootNode[name]; + } + + for (let name in automationNode) { + automationNode[name]; + } + + chrome.test.succeed(); +}]; + +setUpAndRunTests(allTests, 'attributes.html');
diff --git a/chrome/test/data/webui/settings/privacy_sandbox_test.js b/chrome/test/data/webui/settings/privacy_sandbox_test.js index 07783593a..393f74b 100644 --- a/chrome/test/data/webui/settings/privacy_sandbox_test.js +++ b/chrome/test/data/webui/settings/privacy_sandbox_test.js
@@ -121,6 +121,15 @@ */ let testPrivacySandboxBrowserProxy; + function setDefaultFlocID() { + testPrivacySandboxBrowserProxy.setResultFor('getFlocId', Promise.resolve({ + trialStatus: 'test-trial-status', + cohort: 'test-id', + nextUpdate: 'test-time', + canReset: true, + })); + } + suiteSetup(function() { loadTimeData.overrideValues({ privacySandboxSettings2Enabled: true, @@ -134,13 +143,14 @@ TestBrowserProxy.fromClass(PrivacySandboxBrowserProxy); PrivacySandboxBrowserProxyImpl.instance_ = testPrivacySandboxBrowserProxy; - testPrivacySandboxBrowserProxy.setResultFor( - 'getFlocId', Promise.resolve('test-id')); + setDefaultFlocID(); page = /** @type {!PrivacySandboxAppElement} */ (document.createElement('privacy-sandbox-app')); document.body.appendChild(page); + page.prefs = {generated: {floc_enabled: {value: true}}}; + return flushTasks(); }); @@ -149,16 +159,44 @@ }); test('flocId', async function() { + // The page should automatically retrieve the FLoC state when it is attached + // to the document. await testPrivacySandboxBrowserProxy.whenCalled('getFlocId'); - assertEquals('test-id', page.$$('#flocId').textContent); + assertEquals( + 'test-trial-status', page.$$('#flocStatus').textContent.trim()); + assertEquals('test-id', page.$$('#flocId').textContent.trim()); + assertEquals('test-time', page.$$('#flocUpdatedOn').textContent.trim()); + assertFalse(page.$$('#resetFlocIdButton').disabled); - webUIListenerCallback('floc-id-changed', 'new-test-id'); + // The page should listen for changes via a WebUI listener. + webUIListenerCallback('floc-id-changed', { + trialStatus: 'new-test-trial-status', + cohort: 'new-test-id', + nextUpdate: 'new-test-time', + canReset: false, + }); + await flushTasks(); - assertEquals('new-test-id', page.$$('#flocId').textContent); + assertEquals( + 'new-test-trial-status', page.$$('#flocStatus').textContent.trim()); + assertEquals('new-test-id', page.$$('#flocId').textContent.trim()); + assertEquals('new-test-time', page.$$('#flocUpdatedOn').textContent.trim()); + assertTrue(page.$$('#resetFlocIdButton').disabled); }); test('resetFlocId', function() { page.$$('#resetFlocIdButton').click(); return testPrivacySandboxBrowserProxy.whenCalled('resetFlocId'); }); + + test('prefObserver', async function() { + await testPrivacySandboxBrowserProxy.whenCalled('getFlocId'); + testPrivacySandboxBrowserProxy.resetResolver('getFlocId'); + + // When the FLoC generated preference is changed, the page should re-query + // for the FLoC id. + setDefaultFlocID(); + page.set('prefs.generated.floc_enabled.value', false); + await testPrivacySandboxBrowserProxy.whenCalled('getFlocId'); + }); });
diff --git a/chromecast/browser/cast_network_contexts.h b/chromecast/browser/cast_network_contexts.h index 7ec7b98d..22942dd5 100644 --- a/chromecast/browser/cast_network_contexts.h +++ b/chromecast/browser/cast_network_contexts.h
@@ -18,6 +18,7 @@ #include "services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom-forward.h" #include "services/network/public/mojom/network_service.mojom.h" #include "services/network/public/mojom/proxy_config.mojom.h" +#include "services/network/public/mojom/url_loader_factory.mojom.h" class PrefProxyConfigTracker;
diff --git a/chromeos/components/phonehub/DEPS b/chromeos/components/phonehub/DEPS index 3653ddc..0f749fe 100644 --- a/chromeos/components/phonehub/DEPS +++ b/chromeos/components/phonehub/DEPS
@@ -11,5 +11,6 @@ "+device/bluetooth", "+net", "+services/data_decoder/public/cpp", + "+services/data_decoder/public/mojom", "+ui/gfx", ]
diff --git a/chromeos/components/phonehub/notification_processor.h b/chromeos/components/phonehub/notification_processor.h index aa25de7..e3c38a7f 100644 --- a/chromeos/components/phonehub/notification_processor.h +++ b/chromeos/components/phonehub/notification_processor.h
@@ -13,6 +13,7 @@ #include "base/memory/weak_ptr.h" #include "chromeos/components/phonehub/proto/phonehub_api.pb.h" #include "services/data_decoder/public/cpp/data_decoder.h" +#include "services/data_decoder/public/mojom/image_decoder.mojom.h" #include "ui/gfx/image/image.h" using google::protobuf::RepeatedPtrField; @@ -133,4 +134,4 @@ } // namespace phonehub } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_PHONEHUB_NOTIFICATION_PROCESSOR_H_ \ No newline at end of file +#endif // CHROMEOS_COMPONENTS_PHONEHUB_NOTIFICATION_PROCESSOR_H_
diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc index 9ad3233..a3134e3 100644 --- a/chromeos/dbus/dbus_thread_manager.cc +++ b/chromeos/dbus/dbus_thread_manager.cc
@@ -48,7 +48,7 @@ namespace chromeos { static DBusThreadManager* g_dbus_thread_manager = nullptr; -static bool g_using_dbus_thread_manager_for_testing = false; +static DBusThreadManagerSetter* g_setter = nullptr; DBusThreadManager::DBusThreadManager(ClientSet client_set, bool use_real_clients) @@ -89,25 +89,18 @@ dbus_thread_->Stop(); dbus::statistics::Shutdown(); - - if (!g_dbus_thread_manager) - return; // Called form Shutdown() or local test instance. - - // There should never be both a global instance and a local instance. - CHECK_EQ(this, g_dbus_thread_manager); - if (g_using_dbus_thread_manager_for_testing) { - g_dbus_thread_manager = nullptr; - g_using_dbus_thread_manager_for_testing = false; - VLOG(1) << "DBusThreadManager destroyed"; - } else { - LOG(FATAL) << "~DBusThreadManager() called outside of Shutdown()"; - } } dbus::Bus* DBusThreadManager::GetSystemBus() { return system_bus_.get(); } +// Returns a client that is set via DBusThreadManagerSetter when available. +#define RETURN_DBUS_CLIENT(name) \ + return (g_setter && g_setter->name) \ + ? g_setter->name.get() \ + : (clients_browser_ ? clients_browser_->name.get() : nullptr) + AnomalyDetectorClient* DBusThreadManager::GetAnomalyDetectorClient() { return clients_browser_ ? clients_browser_->anomaly_detector_client_.get() : nullptr; @@ -147,13 +140,11 @@ } CrosDisksClient* DBusThreadManager::GetCrosDisksClient() { - return clients_browser_ ? clients_browser_->cros_disks_client_.get() - : nullptr; + RETURN_DBUS_CLIENT(cros_disks_client_); } DebugDaemonClient* DBusThreadManager::GetDebugDaemonClient() { - return clients_browser_ ? clients_browser_->debug_daemon_client_.get() - : nullptr; + RETURN_DBUS_CLIENT(debug_daemon_client_); } EasyUnlockClient* DBusThreadManager::GetEasyUnlockClient() { @@ -162,7 +153,7 @@ } GnubbyClient* DBusThreadManager::GetGnubbyClient() { - return clients_browser_ ? clients_browser_->gnubby_client_.get() : nullptr; + RETURN_DBUS_CLIENT(gnubby_client_); } ShillDeviceClient* DBusThreadManager::GetShillDeviceClient() { @@ -191,13 +182,11 @@ } ImageBurnerClient* DBusThreadManager::GetImageBurnerClient() { - return clients_browser_ ? clients_browser_->image_burner_client_.get() - : nullptr; + RETURN_DBUS_CLIENT(image_burner_client_); } ImageLoaderClient* DBusThreadManager::GetImageLoaderClient() { - return clients_browser_ ? clients_browser_->image_loader_client_.get() - : nullptr; + RETURN_DBUS_CLIENT(image_loader_client_); } LorgnetteManagerClient* DBusThreadManager::GetLorgnetteManagerClient() { @@ -219,8 +208,7 @@ } SmbProviderClient* DBusThreadManager::GetSmbProviderClient() { - return clients_browser_ ? clients_browser_->smb_provider_client_.get() - : nullptr; + RETURN_DBUS_CLIENT(smb_provider_client_); } SMSClient* DBusThreadManager::GetSMSClient() { @@ -228,8 +216,7 @@ } UpdateEngineClient* DBusThreadManager::GetUpdateEngineClient() { - return clients_browser_ ? clients_browser_->update_engine_client_.get() - : nullptr; + RETURN_DBUS_CLIENT(update_engine_client_); } VirtualFileProviderClient* DBusThreadManager::GetVirtualFileProviderClient() { @@ -243,6 +230,8 @@ : nullptr; } +#undef RETURN_DBUS_CLIENT + void DBusThreadManager::InitializeClients() { // Some clients call DBusThreadManager::Get() during initialization. DCHECK(g_dbus_thread_manager); @@ -266,11 +255,6 @@ // static void DBusThreadManager::Initialize(ClientSet client_set) { - // If we initialize DBusThreadManager twice we may also be shutting it down - // early; do not allow that. - if (g_using_dbus_thread_manager_for_testing) - return; - CHECK(!g_dbus_thread_manager); #if defined(USE_REAL_DBUS_CLIENTS) bool use_real_clients = true; @@ -291,19 +275,10 @@ } // static -std::unique_ptr<DBusThreadManagerSetter> -DBusThreadManager::GetSetterForTesting() { - if (!g_using_dbus_thread_manager_for_testing) { - g_using_dbus_thread_manager_for_testing = true; - CHECK(!g_dbus_thread_manager); - // TODO(jamescook): Don't initialize clients as a side-effect of using a - // test API. For now, assume the caller wants all clients. - g_dbus_thread_manager = - new DBusThreadManager(kAll, false /* use_real_clients */); - g_dbus_thread_manager->InitializeClients(); - } - - return base::WrapUnique(new DBusThreadManagerSetter()); +DBusThreadManagerSetter* DBusThreadManager::GetSetterForTesting() { + if (!g_setter) + g_setter = new DBusThreadManagerSetter(); + return g_setter; } // static @@ -321,8 +296,11 @@ DBusThreadManager* dbus_thread_manager = g_dbus_thread_manager; g_dbus_thread_manager = nullptr; - g_using_dbus_thread_manager_for_testing = false; delete dbus_thread_manager; + + delete g_setter; + g_setter = nullptr; + VLOG(1) << "DBusThreadManager Shutdown completed"; } @@ -337,58 +315,39 @@ DBusThreadManagerSetter::~DBusThreadManagerSetter() = default; -void DBusThreadManagerSetter::SetChunneldClient( - std::unique_ptr<ChunneldClient> client) { - DBusThreadManager::Get()->clients_browser_->chunneld_client_ = - std::move(client); -} - void DBusThreadManagerSetter::SetCrosDisksClient( std::unique_ptr<CrosDisksClient> client) { - DBusThreadManager::Get()->clients_browser_->cros_disks_client_ = - std::move(client); + cros_disks_client_ = std::move(client); } void DBusThreadManagerSetter::SetDebugDaemonClient( std::unique_ptr<DebugDaemonClient> client) { - DBusThreadManager::Get()->clients_browser_->debug_daemon_client_ = - std::move(client); + debug_daemon_client_ = std::move(client); } void DBusThreadManagerSetter::SetGnubbyClient( std::unique_ptr<GnubbyClient> client) { - DBusThreadManager::Get()->clients_browser_->gnubby_client_ = - std::move(client); -} - -void DBusThreadManagerSetter::SetRuntimeProbeClient( - std::unique_ptr<RuntimeProbeClient> client) { - DBusThreadManager::Get()->clients_browser_->runtime_probe_client_ = - std::move(client); + gnubby_client_ = std::move(client); } void DBusThreadManagerSetter::SetImageBurnerClient( std::unique_ptr<ImageBurnerClient> client) { - DBusThreadManager::Get()->clients_browser_->image_burner_client_ = - std::move(client); + image_burner_client_ = std::move(client); } void DBusThreadManagerSetter::SetImageLoaderClient( std::unique_ptr<ImageLoaderClient> client) { - DBusThreadManager::Get()->clients_browser_->image_loader_client_ = - std::move(client); + image_loader_client_ = std::move(client); } void DBusThreadManagerSetter::SetSmbProviderClient( std::unique_ptr<SmbProviderClient> client) { - DBusThreadManager::Get()->clients_browser_->smb_provider_client_ = - std::move(client); + smb_provider_client_ = std::move(client); } void DBusThreadManagerSetter::SetUpdateEngineClient( std::unique_ptr<UpdateEngineClient> client) { - DBusThreadManager::Get()->clients_browser_->update_engine_client_ = - std::move(client); + update_engine_client_ = std::move(client); } } // namespace chromeos
diff --git a/chromeos/dbus/dbus_thread_manager.h b/chromeos/dbus/dbus_thread_manager.h index 594e6ad..5ff8f9c 100644 --- a/chromeos/dbus/dbus_thread_manager.h +++ b/chromeos/dbus/dbus_thread_manager.h
@@ -89,10 +89,12 @@ // Equivalent to Initialize(kAll). static void Initialize(); - // Returns a DBusThreadManagerSetter instance that allows tests to - // replace individual D-Bus clients with their own implementations. - // Also initializes the main DBusThreadManager for testing if necessary. - static std::unique_ptr<DBusThreadManagerSetter> GetSetterForTesting(); + // Returns a DBusThreadManagerSetter instance that allows tests to replace + // individual D-Bus clients with their own implementations. The returned + // object will be destroyed in DBusThreadManager::Shutdown(). This method + // can be called before calling DBusThreadManager::Initialize() which is + // useful for browser tests, but does NOT initialize the manager itself. + static DBusThreadManagerSetter* GetSetterForTesting(); // Returns true if DBusThreadManager has been initialized. Call this to // avoid initializing + shutting down DBusThreadManager more than once. @@ -148,8 +150,6 @@ ShillThirdPartyVpnDriverClient* GetShillThirdPartyVpnDriverClient(); private: - friend class DBusThreadManagerSetter; - // Creates dbus clients based on |client_set|. Creates real clients if // |use_real_clients| is set, otherwise creates fakes. DBusThreadManager(ClientSet client_set, bool use_real_clients); @@ -174,15 +174,11 @@ // TODO(jamescook): Replace these with FooClient::InitializeForTesting(). class COMPONENT_EXPORT(CHROMEOS_DBUS) DBusThreadManagerSetter { public: - ~DBusThreadManagerSetter(); - - void SetChunneldClient(std::unique_ptr<ChunneldClient> client); void SetCrosDisksClient(std::unique_ptr<CrosDisksClient> client); void SetDebugDaemonClient(std::unique_ptr<DebugDaemonClient> client); void SetGnubbyClient(std::unique_ptr<GnubbyClient> client); void SetImageBurnerClient(std::unique_ptr<ImageBurnerClient> client); void SetImageLoaderClient(std::unique_ptr<ImageLoaderClient> client); - void SetRuntimeProbeClient(std::unique_ptr<RuntimeProbeClient> client); void SetSmbProviderClient(std::unique_ptr<SmbProviderClient> client); void SetUpdateEngineClient(std::unique_ptr<UpdateEngineClient> client); @@ -190,6 +186,15 @@ friend class DBusThreadManager; DBusThreadManagerSetter(); + ~DBusThreadManagerSetter(); + + std::unique_ptr<CrosDisksClient> cros_disks_client_; + std::unique_ptr<DebugDaemonClient> debug_daemon_client_; + std::unique_ptr<GnubbyClient> gnubby_client_; + std::unique_ptr<ImageBurnerClient> image_burner_client_; + std::unique_ptr<ImageLoaderClient> image_loader_client_; + std::unique_ptr<SmbProviderClient> smb_provider_client_; + std::unique_ptr<UpdateEngineClient> update_engine_client_; DISALLOW_COPY_AND_ASSIGN(DBusThreadManagerSetter); };
diff --git a/chromeos/disks/disk_mount_manager_unittest.cc b/chromeos/disks/disk_mount_manager_unittest.cc index c5ca1ad..701909a6 100644 --- a/chromeos/disks/disk_mount_manager_unittest.cc +++ b/chromeos/disks/disk_mount_manager_unittest.cc
@@ -522,6 +522,7 @@ // Adds a test observer to the disk mount manager. void SetUp() override { fake_cros_disks_client_ = new FakeCrosDisksClient; + DBusThreadManager::Initialize(); DBusThreadManager::GetSetterForTesting()->SetCrosDisksClient( std::unique_ptr<CrosDisksClient>(fake_cros_disks_client_)); PowerManagerClient::InitializeFake();
diff --git a/chromeos/lacros/BUILD.gn b/chromeos/lacros/BUILD.gn index fa4892a..95ea798f 100644 --- a/chromeos/lacros/BUILD.gn +++ b/chromeos/lacros/BUILD.gn
@@ -72,7 +72,7 @@ ] } - lacros_tast_tests("lacros_all_tast_tests") { + lacros_tast_tests("lacros_fyi_tast_tests") { # The following expression filters out all non-critical tests. See the link # below for more details: # https://chromium.googlesource.com/chromiumos/platform/tast/+/main/docs/test_attributes.md
diff --git a/chromeos/lacros/lacros_chrome_service_impl.cc b/chromeos/lacros/lacros_chrome_service_impl.cc index ff1d44ba..6f558f8ff 100644 --- a/chromeos/lacros/lacros_chrome_service_impl.cc +++ b/chromeos/lacros/lacros_chrome_service_impl.cc
@@ -15,10 +15,19 @@ #include "base/task/thread_pool.h" #include "build/chromeos_buildflags.h" #include "chromeos/crosapi/cpp/crosapi_constants.h" +#include "chromeos/crosapi/mojom/app_service.mojom.h" +#include "chromeos/crosapi/mojom/automation.mojom.h" +#include "chromeos/crosapi/mojom/cert_database.mojom.h" +#include "chromeos/crosapi/mojom/clipboard.mojom.h" +#include "chromeos/crosapi/mojom/clipboard_history.mojom.h" #include "chromeos/crosapi/mojom/content_protection.mojom.h" #include "chromeos/crosapi/mojom/crosapi.mojom.h" +#include "chromeos/crosapi/mojom/download_controller.mojom.h" +#include "chromeos/crosapi/mojom/feedback.mojom.h" +#include "chromeos/crosapi/mojom/file_manager.mojom.h" #include "chromeos/crosapi/mojom/holding_space_service.mojom.h" #include "chromeos/crosapi/mojom/keystore_service.mojom.h" +#include "chromeos/crosapi/mojom/local_printer.mojom.h" #include "chromeos/crosapi/mojom/message_center.mojom.h" #include "chromeos/crosapi/mojom/metrics_reporting.mojom.h" #include "chromeos/crosapi/mojom/prefs.mojom.h"
diff --git a/chromeos/memory/memory_ablation_study.cc b/chromeos/memory/memory_ablation_study.cc index ec4f74a..4b3c8d9 100644 --- a/chromeos/memory/memory_ablation_study.cc +++ b/chromeos/memory/memory_ablation_study.cc
@@ -10,6 +10,7 @@ #include "base/debug/alias.h" #include "base/feature_list.h" #include "base/metrics/field_trial_params.h" +#include "base/system/sys_info.h" #include "base/timer/timer.h" #include "crypto/random.h" @@ -39,6 +40,11 @@ } // namespace MemoryAblationStudy::MemoryAblationStudy() { + // We restrict the memory ablation study to 4GB+ devices. There's some + // variance on exact RAM values, so we use 3500 as a rough threshold. + if (base::SysInfo::AmountOfPhysicalMemoryMB() < 3500) + return; + // This class does nothing if the study is disabled. if (!base::FeatureList::IsEnabled(kCrosMemoryAblationStudy)) { return;
diff --git a/chromeos/services/assistant/assistant_host.h b/chromeos/services/assistant/assistant_host.h index 30b4ef5..e05381f 100644 --- a/chromeos/services/assistant/assistant_host.h +++ b/chromeos/services/assistant/assistant_host.h
@@ -8,6 +8,7 @@ #include "base/threading/thread.h" #include "chromeos/services/libassistant/public/mojom/audio_input_controller.mojom.h" #include "chromeos/services/libassistant/public/mojom/conversation_controller.mojom.h" +#include "chromeos/services/libassistant/public/mojom/display_controller.mojom.h" #include "chromeos/services/libassistant/public/mojom/media_controller.mojom.h" #include "chromeos/services/libassistant/public/mojom/notification_delegate.mojom.h" #include "chromeos/services/libassistant/public/mojom/platform_delegate.mojom.h"
diff --git a/chromeos/services/libassistant/libassistant_service.cc b/chromeos/services/libassistant/libassistant_service.cc index e83fc5b5..1a7df56 100644 --- a/chromeos/services/libassistant/libassistant_service.cc +++ b/chromeos/services/libassistant/libassistant_service.cc
@@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" #include "chromeos/services/libassistant/libassistant_factory.h" +#include "chromeos/services/libassistant/public/mojom/speech_recognition_observer.mojom.h" #include "libassistant/shared/internal_api/assistant_manager_internal.h" #include "libassistant/shared/public/assistant_manager.h"
diff --git a/chromeos/services/machine_learning/public/cpp/fake_service_connection.h b/chromeos/services/machine_learning/public/cpp/fake_service_connection.h index c8eef87..22280c4 100644 --- a/chromeos/services/machine_learning/public/cpp/fake_service_connection.h +++ b/chromeos/services/machine_learning/public/cpp/fake_service_connection.h
@@ -19,6 +19,7 @@ #include "chromeos/services/machine_learning/public/mojom/model.mojom.h" #include "chromeos/services/machine_learning/public/mojom/tensor.mojom.h" #include "chromeos/services/machine_learning/public/mojom/text_classifier.mojom.h" +#include "chromeos/services/machine_learning/public/mojom/text_suggester.mojom.h" #include "chromeos/services/machine_learning/public/mojom/web_platform_handwriting.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver_set.h"
diff --git a/chromeos/services/tts/DEPS b/chromeos/services/tts/DEPS index 9ccf2ca..7c5ea03 100644 --- a/chromeos/services/tts/DEPS +++ b/chromeos/services/tts/DEPS
@@ -1,5 +1,6 @@ include_rules = [ "+media/base", + "+media/mojo", "+mojo/public", "+sandbox", "+sandbox/policy",
diff --git a/chromeos/services/tts/tts_service_unittest.cc b/chromeos/services/tts/tts_service_unittest.cc index 28f37fa..77010e4 100644 --- a/chromeos/services/tts/tts_service_unittest.cc +++ b/chromeos/services/tts/tts_service_unittest.cc
@@ -8,6 +8,8 @@ #include "base/strings/utf_string_conversions.h" #include "base/test/task_environment.h" #include "chromeos/services/tts/public/mojom/tts_service.mojom.h" +#include "media/mojo/mojom/audio_data_pipe.mojom.h" +#include "media/mojo/mojom/audio_stream_factory.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h"
diff --git a/components/android_autofill/android/autofill_provider_android.cc b/components/android_autofill/android/autofill_provider_android.cc index b6da0fe..f38a27a 100644 --- a/components/android_autofill/android/autofill_provider_android.cc +++ b/components/android_autofill/android/autofill_provider_android.cc
@@ -25,6 +25,7 @@ using base::android::ConvertJavaStringToUTF16; using base::android::ConvertUTF16ToJavaString; using base::android::ConvertUTF8ToJavaString; +using base::android::JavaParamRef; using base::android::JavaRef; using base::android::ScopedJavaLocalRef; using base::android::ToJavaArrayOfStrings; @@ -36,38 +37,52 @@ using mojom::SubmissionSource; +static jlong JNI_AutofillProvider_Init( + JNIEnv* env, + const JavaParamRef<jobject>& jcaller, + const JavaParamRef<jobject>& jweb_contents) { + auto* web_contents = content::WebContents::FromJavaWebContents(jweb_contents); + DCHECK(web_contents); + auto* provider = AutofillProvider::FromWebContents(web_contents); + if (provider) { + static_cast<AutofillProviderAndroid*>(provider) + ->AttachToJavaAutofillProvider(env, jcaller); + return reinterpret_cast<intptr_t>(provider); + } + return reinterpret_cast<intptr_t>( + AutofillProviderAndroid::Create(env, jcaller, web_contents)); +} + static jboolean JNI_AutofillProvider_IsQueryServerFieldTypesEnabled( JNIEnv* env) { return base::FeatureList::IsEnabled( features::kAndroidAutofillQueryServerFieldTypes); } +// Static +AutofillProviderAndroid* AutofillProviderAndroid::Create( + JNIEnv* env, + const JavaRef<jobject>& jcaller, + content::WebContents* web_contents) { + DCHECK(!FromWebContents(web_contents)); + // This object is owned by WebContents. + return new AutofillProviderAndroid(env, jcaller, web_contents); +} + +AutofillProviderAndroid* AutofillProviderAndroid::FromWebContents( + content::WebContents* web_contents) { + return static_cast<AutofillProviderAndroid*>( + AutofillProvider::FromWebContents(web_contents)); +} + AutofillProviderAndroid::AutofillProviderAndroid( + JNIEnv* env, const JavaRef<jobject>& jcaller, content::WebContents* web_contents) - : id_(kNoQueryId), web_contents_(web_contents), check_submission_(false) { - OnJavaAutofillProviderChanged(AttachCurrentThread(), jcaller); -} - -void AutofillProviderAndroid::OnJavaAutofillProviderChanged( - JNIEnv* env, - const JavaRef<jobject>& jcaller) { - // If the current Java object isn't null (e.g., because it hasn't been - // garbage-collected yet), clear its reference to this object. - ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); - if (!obj.is_null()) { - Java_AutofillProvider_setNativeAutofillProvider(env, obj, 0); - } - - java_ref_ = JavaObjectWeakGlobalRef(env, jcaller); - - // If the new Java object isn't null, set its native object to |this|. - obj = java_ref_.get(env); - if (!obj.is_null()) { - Java_AutofillProvider_setNativeAutofillProvider( - env, obj, reinterpret_cast<jlong>(this)); - } -} + : AutofillProvider(web_contents), + id_(kNoQueryId), + java_ref_(JavaObjectWeakGlobalRef(env, jcaller)), + check_submission_(false) {} AutofillProviderAndroid::~AutofillProviderAndroid() { JNIEnv* env = AttachCurrentThread(); @@ -79,6 +94,18 @@ Java_AutofillProvider_setNativeAutofillProvider(env, obj, 0); } +void AutofillProviderAndroid::AttachToJavaAutofillProvider( + JNIEnv* env, + const JavaRef<jobject>& jcaller) { + DCHECK(java_ref_.get(env).is_null()); + java_ref_ = JavaObjectWeakGlobalRef(env, jcaller); +} + +void AutofillProviderAndroid::DetachFromJavaAutofillProvider(JNIEnv* env) { + // Reset the reference to Java peer. + java_ref_.reset(); +} + void AutofillProviderAndroid::OnQueryFormFieldAutofill( AndroidAutofillManager* manager, int32_t id, @@ -190,7 +217,7 @@ jfloat y, jfloat width, jfloat height) { - ui::ViewAndroid* view_android = web_contents_->GetNativeView(); + ui::ViewAndroid* view_android = web_contents()->GetNativeView(); if (!view_android) return; @@ -434,7 +461,7 @@ gfx::RectF AutofillProviderAndroid::ToClientAreaBound( const gfx::RectF& bounding_box) { - gfx::Rect client_area = web_contents_->GetContainerBounds(); + gfx::Rect client_area = web_contents()->GetContainerBounds(); return bounding_box + client_area.OffsetFromOrigin(); }
diff --git a/components/android_autofill/android/autofill_provider_android.h b/components/android_autofill/android/autofill_provider_android.h index 6145877..64af979 100644 --- a/components/android_autofill/android/autofill_provider_android.h +++ b/components/android_autofill/android/autofill_provider_android.h
@@ -20,17 +20,28 @@ // Android implementation of AutofillProvider, it has one instance per // WebContents, this class is native peer of AutofillProvider.java. +// This class is always instantialized by AutofillProvider Java object. class AutofillProviderAndroid : public AutofillProvider { public: - AutofillProviderAndroid(const base::android::JavaRef<jobject>& jcaller, - content::WebContents* web_contents); - // Invoked when the Java-side AutofillProvider counterpart of this object - // has been changed (either to null or to a new object). - void OnJavaAutofillProviderChanged( + static AutofillProviderAndroid* Create( + JNIEnv* env, + const base::android::JavaRef<jobject>& jcaller, + content::WebContents* web_contents); + + static AutofillProviderAndroid* FromWebContents( + content::WebContents* web_contents); + + ~AutofillProviderAndroid() override; + + // Attach this detached object to |jcaller|. + void AttachToJavaAutofillProvider( JNIEnv* env, const base::android::JavaRef<jobject>& jcaller); - ~AutofillProviderAndroid() override; + // Invoked when the WebContents that associates with Java AutofillProvider + // is changed or Java AutofillProvider is destroyed, it indicates this + // AutofillProviderAndroid object shall not talk to its Java peer anymore. + void DetachFromJavaAutofillProvider(JNIEnv* env); // AutofillProvider: void OnQueryFormFieldAutofill( @@ -88,6 +99,10 @@ jfloat height); private: + AutofillProviderAndroid(JNIEnv* env, + const base::android::JavaRef<jobject>& jcaller, + content::WebContents* web_contents); + void FireSuccessfulSubmission(mojom::SubmissionSource source); void OnFocusChanged(bool focus_on_form, size_t index, @@ -117,7 +132,6 @@ FieldGlobalId field_id_; base::WeakPtr<AndroidAutofillManager> manager_; JavaObjectWeakGlobalRef java_ref_; - content::WebContents* web_contents_; bool check_submission_; // Valid only if check_submission_ is true. mojom::SubmissionSource pending_submission_source_;
diff --git a/components/android_autofill/android/java/src/org/chromium/components/autofill/AutofillProvider.java b/components/android_autofill/android/java/src/org/chromium/components/autofill/AutofillProvider.java index 926b12fa..70de09b 100644 --- a/components/android_autofill/android/java/src/org/chromium/components/autofill/AutofillProvider.java +++ b/components/android_autofill/android/java/src/org/chromium/components/autofill/AutofillProvider.java
@@ -322,7 +322,9 @@ private WebContentsAccessibility mWebContentsAccessibility; private View mAnchorView; - public AutofillProvider(Context context, ViewGroup containerView, String providerName) { + public AutofillProvider(Context context, ViewGroup containerView, WebContents webContents, + String providerName) { + mWebContents = webContents; mProviderName = providerName; try (ScopedSysTraceEvent e = ScopedSysTraceEvent.scoped("AutofillProvider.constructor")) { assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.O; @@ -347,6 +349,12 @@ mAutofillManager.addInputUIObserver(mInputUIObserver); mContext = context; } + mNativeAutofillProvider = initializeNativeAutofillProvider(webContents); + } + + public void destroy() { + detachFromJavaAutofillProvider(); + mAutofillManager.destroy(); } /** @@ -541,6 +549,11 @@ mRequest.setFocusField(new FocusField(focusField.fieldIndex, absBound)); } + // Add a specific method in order to mock it in test. + protected long initializeNativeAutofillProvider(WebContents webContents) { + return AutofillProviderJni.get().init(this, webContents); + } + private boolean isDatalistField(int childId) { FormFieldData field = mRequest.getField((short) childId); return field.mControlType == FormFieldData.ControlType.DATALIST; @@ -734,12 +747,16 @@ } private void onSuggestionSelected(String value) { - acceptDataListSuggestion(mNativeAutofillProvider, value); + if (mNativeAutofillProvider != 0) { + acceptDataListSuggestion(mNativeAutofillProvider, value); + } hidePopup(); } private void setAnchorViewRect(RectF rect) { - setAnchorViewRect(mNativeAutofillProvider, mAnchorView, rect); + if (mNativeAutofillProvider != 0) { + setAnchorViewRect(mNativeAutofillProvider, mAnchorView, rect); + } } /** @@ -765,13 +782,24 @@ // in AutofillManagerWrapper.destroy(). if (mNativeAutofillProvider != 0) mRequest = null; mNativeAutofillProvider = nativeAutofillProvider; - if (nativeAutofillProvider == 0) mAutofillManager.destroy(); + } + + private void detachFromJavaAutofillProvider() { + if (mNativeAutofillProvider == 0) return; + // Makes sure this is the last call to mNativeAutofillProvider. + long nativeAutofillProvider = mNativeAutofillProvider; + mNativeAutofillProvider = 0; + AutofillProviderJni.get().detachFromJavaAutofillProvider(nativeAutofillProvider); } public void setWebContents(WebContents webContents) { if (webContents == mWebContents) return; if (mWebContents != null) mRequest = null; mWebContents = webContents; + detachFromJavaAutofillProvider(); + if (mWebContents != null) { + initializeNativeAutofillProvider(webContents); + } } @CalledByNative @@ -880,15 +908,14 @@ @NativeMethods interface Natives { + long init(AutofillProvider caller, WebContents webContents); + void detachFromJavaAutofillProvider(long nativeAutofillProviderAndroid); void onAutofillAvailable( long nativeAutofillProviderAndroid, AutofillProvider caller, FormData formData); - void onAcceptDataListSuggestion( long nativeAutofillProviderAndroid, AutofillProvider caller, String value); - void setAnchorViewRect(long nativeAutofillProviderAndroid, AutofillProvider caller, View anchorView, float x, float y, float width, float height); - boolean isQueryServerFieldTypesEnabled(); } }
diff --git a/components/android_autofill/android/junit/src/org/chromium/components/autofill/AutofillProviderTest.java b/components/android_autofill/android/junit/src/org/chromium/components/autofill/AutofillProviderTest.java index 87c7302..672961d 100644 --- a/components/android_autofill/android/junit/src/org/chromium/components/autofill/AutofillProviderTest.java +++ b/components/android_autofill/android/junit/src/org/chromium/components/autofill/AutofillProviderTest.java
@@ -48,6 +48,7 @@ private ViewGroup mContainerView; private AutofillProvider mAutofillProvider; private DisplayAndroid mDisplayAndroid; + private long mMockedNativeAutofillProviderAndroid = 1; @Before public void setUp() { @@ -57,8 +58,14 @@ mDisplayAndroid = Mockito.mock(DisplayAndroid.class); mWebContents = Mockito.mock(WebContents.class); mContainerView = Mockito.mock(ViewGroup.class); - mAutofillProvider = new AutofillProvider(mContext, mContainerView, "AutofillProviderTest"); - mAutofillProvider.setWebContents(mWebContents); + + mAutofillProvider = new AutofillProvider( + mContext, mContainerView, mWebContents, "AutofillProviderTest") { + @Override + protected long initializeNativeAutofillProvider(WebContents webContents) { + return mMockedNativeAutofillProviderAndroid; + } + }; when(mWebContents.getTopLevelNativeWindow()).thenReturn(mWindowAndroid); when(mWindowAndroid.getDisplay()).thenReturn(mDisplayAndroid);
diff --git a/components/android_autofill/browser/BUILD.gn b/components/android_autofill/browser/BUILD.gn index 848581b..560d173 100644 --- a/components/android_autofill/browser/BUILD.gn +++ b/components/android_autofill/browser/BUILD.gn
@@ -10,6 +10,10 @@ "autofill_provider.h", ] public_deps = [ "//components/autofill/core/browser" ] + deps = [ + "//components/autofill/content/browser", + "//content/public/browser", + ] } source_set("unit_tests") { @@ -26,4 +30,5 @@ testonly = true sources = [ "test_autofill_provider.h" ] public_deps = [ ":browser" ] + deps = [ "//content/public/browser" ] }
diff --git a/components/android_autofill/browser/android_autofill_manager.cc b/components/android_autofill/browser/android_autofill_manager.cc index 6edcc106c..62a08cf 100644 --- a/components/android_autofill/browser/android_autofill_manager.cc +++ b/components/android_autofill/browser/android_autofill_manager.cc
@@ -6,32 +6,31 @@ #include "base/memory/ptr_util.h" #include "components/android_autofill/browser/autofill_provider.h" - +#include "components/autofill/content/browser/content_autofill_driver.h" +#include "content/public/browser/render_frame_host.h" +#include "content/public/browser/web_contents.h" namespace autofill { using base::TimeTicks; // static std::unique_ptr<AutofillManager> AndroidAutofillManager::Create( - AutofillProvider* provider, AutofillDriver* driver, AutofillClient* client, const std::string& /*app_locale*/, AutofillManager::AutofillDownloadManagerState enable_download_manager) { - return base::WrapUnique(new AndroidAutofillManager(driver, client, provider, - enable_download_manager)); + return base::WrapUnique( + new AndroidAutofillManager(driver, client, enable_download_manager)); } AndroidAutofillManager::AndroidAutofillManager( AutofillDriver* driver, AutofillClient* client, - AutofillProvider* provider, AutofillManager::AutofillDownloadManagerState enable_download_manager) : AutofillManager(driver, client, enable_download_manager, - version_info::Channel::UNKNOWN), - provider_(provider) {} + version_info::Channel::UNKNOWN) {} AndroidAutofillManager::~AndroidAutofillManager() = default; @@ -39,7 +38,8 @@ const FormData& form, bool known_success, mojom::SubmissionSource source) { - provider_->OnFormSubmitted(this, form, known_success, source); + if (auto* provider = GetAutofillProvider()) + provider->OnFormSubmitted(this, form, known_success, source); } void AndroidAutofillManager::OnTextFieldDidChangeImpl( @@ -47,14 +47,16 @@ const FormFieldData& field, const gfx::RectF& bounding_box, const TimeTicks timestamp) { - provider_->OnTextFieldDidChange(this, form, field, bounding_box, timestamp); + if (auto* provider = GetAutofillProvider()) + provider->OnTextFieldDidChange(this, form, field, bounding_box, timestamp); } void AndroidAutofillManager::OnTextFieldDidScrollImpl( const FormData& form, const FormFieldData& field, const gfx::RectF& bounding_box) { - provider_->OnTextFieldDidScroll(this, form, field, bounding_box); + if (auto* provider = GetAutofillProvider()) + provider->OnTextFieldDidScroll(this, form, field, bounding_box); } void AndroidAutofillManager::OnQueryFormFieldAutofillImpl( @@ -63,44 +65,52 @@ const FormFieldData& field, const gfx::RectF& bounding_box, bool autoselect_first_suggestion) { - provider_->OnQueryFormFieldAutofill(this, query_id, form, field, bounding_box, - autoselect_first_suggestion); + if (auto* provider = GetAutofillProvider()) { + provider->OnQueryFormFieldAutofill( + this, query_id, form, field, bounding_box, autoselect_first_suggestion); + } } void AndroidAutofillManager::OnFocusOnFormFieldImpl( const FormData& form, const FormFieldData& field, const gfx::RectF& bounding_box) { - provider_->OnFocusOnFormField(this, form, field, bounding_box); + if (auto* provider = GetAutofillProvider()) + provider->OnFocusOnFormField(this, form, field, bounding_box); } void AndroidAutofillManager::OnSelectControlDidChangeImpl( const FormData& form, const FormFieldData& field, const gfx::RectF& bounding_box) { - provider_->OnSelectControlDidChange(this, form, field, bounding_box); + if (auto* provider = GetAutofillProvider()) + provider->OnSelectControlDidChange(this, form, field, bounding_box); } bool AndroidAutofillManager::ShouldParseForms( const std::vector<FormData>& forms) { - provider_->OnFormsSeen(this, forms); + if (auto* provider = GetAutofillProvider()) + provider->OnFormsSeen(this, forms); // Need to parse the |forms| to FormStructure, so heuristic_type can be // retrieved later. return true; } void AndroidAutofillManager::OnFocusNoLongerOnForm(bool had_interacted_form) { - provider_->OnFocusNoLongerOnForm(this, had_interacted_form); + if (auto* provider = GetAutofillProvider()) + provider->OnFocusNoLongerOnForm(this, had_interacted_form); } void AndroidAutofillManager::OnDidFillAutofillFormData( const FormData& form, const base::TimeTicks timestamp) { - provider_->OnDidFillAutofillFormData(this, form, timestamp); + if (auto* provider = GetAutofillProvider()) + provider->OnDidFillAutofillFormData(this, form, timestamp); } void AndroidAutofillManager::OnHidePopup() { - provider_->OnHidePopup(this); + if (auto* provider = GetAutofillProvider()) + provider->OnHidePopup(this); } void AndroidAutofillManager::SelectFieldOptionsDidChange(const FormData& form) { @@ -110,20 +120,37 @@ content::RenderFrameHost* rfh, const std::vector<FormStructure*>& forms) { has_server_prediction_ = true; - provider_->OnServerPredictionsAvailable(this); + if (auto* provider = GetAutofillProvider()) + provider->OnServerPredictionsAvailable(this); } void AndroidAutofillManager::OnServerRequestError( FormSignature form_signature, AutofillDownloadManager::RequestType request_type, int http_error) { - provider_->OnServerQueryRequestError(this, form_signature); + if (auto* provider = GetAutofillProvider()) + provider->OnServerQueryRequestError(this, form_signature); } void AndroidAutofillManager::Reset() { AutofillManager::Reset(); has_server_prediction_ = false; - provider_->Reset(this); + if (auto* provider = GetAutofillProvider()) + provider->Reset(this); +} + +AutofillProvider* AndroidAutofillManager::GetAutofillProvider() { + if (autofill_provider_for_testing_) + return autofill_provider_for_testing_; + if (auto* rfh = + static_cast<ContentAutofillDriver*>(driver())->render_frame_host()) { + if (rfh->IsCurrent()) { + if (auto* web_contents = content::WebContents::FromRenderFrameHost(rfh)) { + return AutofillProvider::FromWebContents(web_contents); + } + } + } + return nullptr; } } // namespace autofill
diff --git a/components/android_autofill/browser/android_autofill_manager.h b/components/android_autofill/browser/android_autofill_manager.h index db17120..c6f6055f 100644 --- a/components/android_autofill/browser/android_autofill_manager.h +++ b/components/android_autofill/browser/android_autofill_manager.h
@@ -17,7 +17,6 @@ class AndroidAutofillManager : public AutofillManager { public: static std::unique_ptr<AutofillManager> Create( - AutofillProvider* provider, AutofillDriver* driver, AutofillClient* client, const std::string& app_locale, @@ -47,7 +46,6 @@ AndroidAutofillManager( AutofillDriver* driver, AutofillClient* client, - AutofillProvider* provider, AutofillManager::AutofillDownloadManagerState enable_download_manager); void OnFormSubmittedImpl(const FormData& form, @@ -95,9 +93,19 @@ AutofillDownloadManager::RequestType request_type, int http_error) override; + protected: +#ifdef UNIT_TEST + // For the unit tests where WebContents isn't available. + void set_autofill_provider_for_testing(AutofillProvider* autofill_provider) { + autofill_provider_for_testing_ = autofill_provider; + } +#endif // UNIT_TEST + private: + AutofillProvider* GetAutofillProvider(); + bool has_server_prediction_ = false; - AutofillProvider* provider_; + AutofillProvider* autofill_provider_for_testing_ = nullptr; base::WeakPtrFactory<AndroidAutofillManager> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(AndroidAutofillManager);
diff --git a/components/android_autofill/browser/autofill_provider.cc b/components/android_autofill/browser/autofill_provider.cc index feff330..0c31539 100644 --- a/components/android_autofill/browser/autofill_provider.cc +++ b/components/android_autofill/browser/autofill_provider.cc
@@ -4,14 +4,18 @@ #include "components/android_autofill/browser/autofill_provider.h" +#include "base/memory/ptr_util.h" #include "components/android_autofill/browser/android_autofill_manager.h" +#include "content/public/browser/web_contents.h" namespace autofill { namespace { -bool g_is_download_manager_disabled_for_testing = false; -} -// static +bool g_is_download_manager_disabled_for_testing = false; +} // namespace + +WEB_CONTENTS_USER_DATA_KEY_IMPL(AutofillProvider) + bool AutofillProvider::is_download_manager_disabled_for_testing() { return g_is_download_manager_disabled_for_testing; } @@ -20,7 +24,10 @@ g_is_download_manager_disabled_for_testing = true; } -AutofillProvider::AutofillProvider() = default; +AutofillProvider::AutofillProvider(content::WebContents* web_contents) + : web_contents_(web_contents) { + web_contents->SetUserData(UserDataKey(), base::WrapUnique(this)); +} AutofillProvider::~AutofillProvider() = default;
diff --git a/components/android_autofill/browser/autofill_provider.h b/components/android_autofill/browser/autofill_provider.h index 616d23e..11a6496 100644 --- a/components/android_autofill/browser/autofill_provider.h +++ b/components/android_autofill/browser/autofill_provider.h
@@ -5,26 +5,30 @@ #ifndef COMPONENTS_ANDROID_AUTOFILL_BROWSER_AUTOFILL_PROVIDER_H_ #define COMPONENTS_ANDROID_AUTOFILL_BROWSER_AUTOFILL_PROVIDER_H_ -#include "base/supports_user_data.h" #include "base/time/time.h" #include "components/autofill/core/common/form_data.h" #include "components/autofill/core/common/mojom/autofill_types.mojom.h" #include "components/autofill/core/common/signatures.h" +#include "content/public/browser/web_contents_user_data.h" + +namespace content { +class WebContents; +} // namespace content namespace gfx { class RectF; -} +} // namespace gfx namespace autofill { class AndroidAutofillManager; // This class defines the interface for the autofill implementation other than -// default BrowserAutofillManager. -class AutofillProvider { +// default BrowserAutofillManager. Unlike BrowserAutofillManager, this class +// has one instance per WebContents. +class AutofillProvider : public content::WebContentsUserData<AutofillProvider> { public: - AutofillProvider(); - virtual ~AutofillProvider(); + ~AutofillProvider() override; static bool is_download_manager_disabled_for_testing(); static void set_is_download_manager_disabled_for_testing(); @@ -91,6 +95,23 @@ void RendererShouldAcceptDataListSuggestion(AndroidAutofillManager* manager, const FieldGlobalId& field_id, const std::u16string& value); + + protected: + // WebContents takes the ownership of AutofillProvider. + explicit AutofillProvider(content::WebContents* web_contents); + friend class content::WebContentsUserData<AutofillProvider>; + +#ifdef UNIT_TEST + // For the unit tests where WebContents isn't available. + AutofillProvider() = default; +#endif // UNIT_TEST + + content::WebContents* web_contents() { return web_contents_; } + + private: + content::WebContents* web_contents_; + + WEB_CONTENTS_USER_DATA_KEY_DECL(); }; } // namespace autofill
diff --git a/components/android_autofill/browser/autofill_provider_unittest.cc b/components/android_autofill/browser/autofill_provider_unittest.cc index 02ed4333..9859562 100644 --- a/components/android_autofill/browser/autofill_provider_unittest.cc +++ b/components/android_autofill/browser/autofill_provider_unittest.cc
@@ -13,8 +13,9 @@ explicit AndroidAutofillManagerTestHelper(AutofillProvider* autofill_provider) : AndroidAutofillManager(nullptr, nullptr, - autofill_provider, - DISABLE_AUTOFILL_DOWNLOAD_MANAGER) {} + DISABLE_AUTOFILL_DOWNLOAD_MANAGER) { + set_autofill_provider_for_testing(autofill_provider); + } void SimulatePropagateAutofillPredictions() { PropagateAutofillPredictions(nullptr, std::vector<FormStructure*>());
diff --git a/components/android_autofill/browser/test_autofill_provider.h b/components/android_autofill/browser/test_autofill_provider.h index 53bb938..4f4c2c2cc0 100644 --- a/components/android_autofill/browser/test_autofill_provider.h +++ b/components/android_autofill/browser/test_autofill_provider.h
@@ -7,11 +7,22 @@ #include "components/android_autofill/browser/autofill_provider.h" +#include "content/public/browser/web_contents.h" + namespace autofill { class TestAutofillProvider : public AutofillProvider { public: - ~TestAutofillProvider() override {} +#ifdef UNIT_TEST + // For unit testing only. + TestAutofillProvider() = default; +#endif // UNIT_TEST + + // Create a instance owned by |web_contents|. + explicit TestAutofillProvider(content::WebContents* web_contents) + : AutofillProvider(web_contents) {} + + ~TestAutofillProvider() override = default; // AutofillProvider: void OnQueryFormFieldAutofill(AndroidAutofillManager* manager,
diff --git a/components/arc/arc_prefs.cc b/components/arc/arc_prefs.cc index b835ed3..afabaf8 100644 --- a/components/arc/arc_prefs.cc +++ b/components/arc/arc_prefs.cc
@@ -107,6 +107,9 @@ // GuestOsEngagementMetrics. const char kEngagementPrefsPrefix[] = "arc.metrics"; +// A boolean preference that indicates ARC management state. +const char kArcIsManaged[] = "arc.is_managed"; + // ======== LOCAL STATE PREFS ======== // A boolean preference that indicates whether this device has run with the @@ -161,6 +164,8 @@ kArcSupervisionTransition, static_cast<int>(ArcSupervisionTransition::NO_TRANSITION)); + registry->RegisterBooleanPref(kArcIsManaged, false); + guest_os::prefs::RegisterEngagementProfilePrefs(registry, kEngagementPrefsPrefix);
diff --git a/components/arc/arc_prefs.h b/components/arc/arc_prefs.h index 9d496f0..cd14b7b 100644 --- a/components/arc/arc_prefs.h +++ b/components/arc/arc_prefs.h
@@ -40,6 +40,7 @@ ARC_EXPORT extern const char kArcTermsAccepted[]; ARC_EXPORT extern const char kArcTermsShownInOobe[]; ARC_EXPORT extern const char kArcVisibleExternalStorages[]; +ARC_EXPORT extern const char kArcIsManaged[]; ARC_EXPORT extern const char kEcryptfsMigrationStrategy[]; ARC_EXPORT extern const char kEngagementPrefsPrefix[];
diff --git a/components/arc/session/arc_bridge_host_impl.cc b/components/arc/session/arc_bridge_host_impl.cc index 80fd0dd..9cec61a 100644 --- a/components/arc/session/arc_bridge_host_impl.cc +++ b/components/arc/session/arc_bridge_host_impl.cc
@@ -33,6 +33,7 @@ #include "components/arc/mojom/disk_quota.mojom.h" #include "components/arc/mojom/enterprise_reporting.mojom.h" #include "components/arc/mojom/file_system.mojom.h" +#include "components/arc/mojom/iio_sensor.mojom.h" #include "components/arc/mojom/ime.mojom.h" #include "components/arc/mojom/input_method_manager.mojom.h" #include "components/arc/mojom/intent_helper.mojom.h"
diff --git a/components/arc/session/arc_client_adapter_unittest.cc b/components/arc/session/arc_client_adapter_unittest.cc index 69d30f3..ab19e34 100644 --- a/components/arc/session/arc_client_adapter_unittest.cc +++ b/components/arc/session/arc_client_adapter_unittest.cc
@@ -30,6 +30,7 @@ void ArcInstanceStopped() override {} void SetUp() override { + chromeos::DBusThreadManager::Initialize(); chromeos::DBusThreadManager::GetSetterForTesting()->SetDebugDaemonClient( std::make_unique<chromeos::FakeDebugDaemonClient>()); chromeos::ConciergeClient::InitializeFake(/*fake_cicerone_client=*/nullptr);
diff --git a/components/arc/session/arc_vm_client_adapter_unittest.cc b/components/arc/session/arc_vm_client_adapter_unittest.cc index d229542..542cb24 100644 --- a/components/arc/session/arc_vm_client_adapter_unittest.cc +++ b/components/arc/session/arc_vm_client_adapter_unittest.cc
@@ -293,6 +293,7 @@ logging::SetMinLogLevel(-1); // Create and set new fake clients every time to reset clients' status. + chromeos::DBusThreadManager::Initialize(); chromeos::DBusThreadManager::GetSetterForTesting()->SetDebugDaemonClient( std::make_unique<TestDebugDaemonClient>()); TestConciergeClient::Initialize();
diff --git a/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios.cc b/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios.cc index a4baf9f..6d56793 100644 --- a/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios.cc +++ b/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios.cc
@@ -31,7 +31,14 @@ address_profile_save_prompt_callback_(std::move(callback)) {} AutofillSaveUpdateAddressProfileDelegateIOS:: - ~AutofillSaveUpdateAddressProfileDelegateIOS() = default; + ~AutofillSaveUpdateAddressProfileDelegateIOS() { + // If the user has navigated away without saving the modal, then the + // |address_profile_save_prompt_callback_| is run here. + if (!address_profile_save_prompt_callback_.is_null()) { + modal_was_shown_ = false; + InfoBarDismissed(); + } +} // static AutofillSaveUpdateAddressProfileDelegateIOS* @@ -117,10 +124,9 @@ } void AutofillSaveUpdateAddressProfileDelegateIOS::InfoBarDismissed() { - // If the address profile modal dialog is presented, the user will be asked to - // save or cancel the address profile. In case the user cancels, then - // InfoBarDismissed() will be called. - if (modal_is_shown_ && !modal_is_dismissed_) + // If the address profile modal dialog is presented, InfoBarDismissed is + // called due to BannerVisibilityChanged. + if (modal_was_shown_) return; RunSaveAddressProfilePromptCallback( @@ -183,8 +189,7 @@ std::move(address_profile_save_prompt_callback_).Run(decision, profile_); // Reset the modal dialog flags. - modal_is_shown_ = false; - modal_is_dismissed_ = false; + modal_was_shown_ = false; } } // namespace autofill
diff --git a/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios.h b/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios.h index a360c41b0..ae3378a 100644 --- a/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios.h +++ b/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios.h
@@ -69,9 +69,8 @@ const autofill::AutofillProfile* GetProfile() const; const autofill::AutofillProfile* GetOriginalProfile() const; - void set_modal_is_shown_to_true() { modal_is_shown_ = true; } - - void set_modal_is_dismissed_to_true() { modal_is_dismissed_ = true; } + bool modal_was_shown() { return modal_was_shown_; } + void set_modal_was_shown_to_true() { modal_was_shown_ = true; } // ConfirmInfoBarDelegate int GetIconId() const override; @@ -103,11 +102,8 @@ AutofillClient::AddressProfileSavePromptCallback address_profile_save_prompt_callback_; - // True if the AddressProfile modal dialog is shown. - bool modal_is_shown_ = false; - - // True if the modal dialog was presented and then dismissed by the user. - bool modal_is_dismissed_ = false; + // True if the AddressProfile modal dialog was shown. + bool modal_was_shown_ = false; }; } // namespace autofill
diff --git a/components/autofill_assistant/browser/actions/action_delegate_util.cc b/components/autofill_assistant/browser/actions/action_delegate_util.cc index 4fd27b1..5033cdb 100644 --- a/components/autofill_assistant/browser/actions/action_delegate_util.cc +++ b/components/autofill_assistant/browser/actions/action_delegate_util.cc
@@ -322,7 +322,7 @@ base::BindOnce(&WebController::FocusField, delegate->GetWebController()->GetWeakPtr())); } else { - AddClickOrTapSequence(delegate, ClickType::CLICK, /* on_top=*/SKIP_STEP, + AddClickOrTapSequence(delegate, ClickType::TAP, /* on_top=*/SKIP_STEP, actions.get()); } actions->emplace_back(base::BindOnce(
diff --git a/components/autofill_assistant/browser/actions/set_form_field_value_action_unittest.cc b/components/autofill_assistant/browser/actions/set_form_field_value_action_unittest.cc index 8b100ea..78bded62 100644 --- a/components/autofill_assistant/browser/actions/set_form_field_value_action_unittest.cc +++ b/components/autofill_assistant/browser/actions/set_form_field_value_action_unittest.cc
@@ -396,7 +396,7 @@ .WillOnce(RunOnceCallback<2>(OkClientStatus())); EXPECT_CALL( mock_web_controller_, - ClickOrTapElement(ClickType::CLICK, EqualsElement(expected_element), _)) + ClickOrTapElement(ClickType::TAP, EqualsElement(expected_element), _)) .WillOnce(RunOnceCallback<2>(OkClientStatus())); EXPECT_CALL(mock_web_controller_, SendKeyboardInput(UTF8ToUnicode(keyboard_input), _,
diff --git a/components/autofill_assistant/browser/actions/show_generic_ui_action_unittest.cc b/components/autofill_assistant/browser/actions/show_generic_ui_action_unittest.cc index 1f5eed8b..3e817fa 100644 --- a/components/autofill_assistant/browser/actions/show_generic_ui_action_unittest.cc +++ b/components/autofill_assistant/browser/actions/show_generic_ui_action_unittest.cc
@@ -341,6 +341,8 @@ autofill::test::SetCreditCardInfo(&credit_card_a, "Marion Mitchell", "4111 1111 1111 1111", "01", "2050", profile_a.guid()); + AutofillCreditCardProto credit_card_a_proto; + credit_card_a_proto.set_guid(credit_card_a.guid()); ON_CALL(mock_personal_data_manager_, GetCreditCards) .WillByDefault( Return(std::vector<autofill::CreditCard*>({&credit_card_a}))); @@ -350,7 +352,7 @@ auto action = Run(); EXPECT_THAT( - user_model_.GetCreditCard(credit_card_a.guid())->Compare(credit_card_a), + user_model_.GetCreditCard(credit_card_a_proto)->Compare(credit_card_a), Eq(0)); ValueProto expected_value; expected_value.set_is_client_side_only(true); @@ -368,15 +370,17 @@ autofill::test::SetCreditCardInfo(&credit_card_b, "John Doe", "4111 1111 1111 1111", "01", "2050", profile_b.guid()); + AutofillCreditCardProto credit_card_b_proto; + credit_card_b_proto.set_guid(credit_card_b.guid()); ON_CALL(mock_personal_data_manager_, GetCreditCards) .WillByDefault(Return(std::vector<autofill::CreditCard*>( {&credit_card_a, &credit_card_b}))); mock_personal_data_manager_.NotifyPersonalDataObserver(); EXPECT_THAT( - user_model_.GetCreditCard(credit_card_a.guid())->Compare(credit_card_a), + user_model_.GetCreditCard(credit_card_a_proto)->Compare(credit_card_a), Eq(0)); EXPECT_THAT( - user_model_.GetCreditCard(credit_card_b.guid())->Compare(credit_card_b), + user_model_.GetCreditCard(credit_card_b_proto)->Compare(credit_card_b), Eq(0)); expected_value.mutable_credit_cards()->add_values()->set_guid( credit_card_b.guid()); @@ -389,9 +393,9 @@ .WillByDefault( Return(std::vector<autofill::CreditCard*>({&credit_card_b}))); mock_personal_data_manager_.NotifyPersonalDataObserver(); - EXPECT_EQ(user_model_.GetCreditCard(credit_card_a.guid()), nullptr); + EXPECT_EQ(user_model_.GetCreditCard(credit_card_a_proto), nullptr); EXPECT_THAT( - user_model_.GetCreditCard(credit_card_b.guid())->Compare(credit_card_b), + user_model_.GetCreditCard(credit_card_b_proto)->Compare(credit_card_b), Eq(0)); expected_value.Clear(); expected_value.set_is_client_side_only(true); @@ -407,9 +411,9 @@ .WillByDefault(Return(std::vector<autofill::CreditCard*>( {&credit_card_a, &credit_card_b}))); mock_personal_data_manager_.NotifyPersonalDataObserver(); - EXPECT_EQ(user_model_.GetCreditCard(credit_card_a.guid()), nullptr); + EXPECT_EQ(user_model_.GetCreditCard(credit_card_a_proto), nullptr); EXPECT_THAT( - user_model_.GetCreditCard(credit_card_b.guid())->Compare(credit_card_b), + user_model_.GetCreditCard(credit_card_b_proto)->Compare(credit_card_b), Eq(0)); expected_value.Clear(); expected_value.set_is_client_side_only(true);
diff --git a/components/autofill_assistant/browser/actions/use_credit_card_action.cc b/components/autofill_assistant/browser/actions/use_credit_card_action.cc index 3589f3b..d7949db 100644 --- a/components/autofill_assistant/browser/actions/use_credit_card_action.cc +++ b/components/autofill_assistant/browser/actions/use_credit_card_action.cc
@@ -73,9 +73,9 @@ << *credit_card_value; } auto* credit_card = delegate_->GetUserModel()->GetCreditCard( - credit_card_value->credit_cards().values(0).guid()); + credit_card_value->credit_cards().values(0)); if (credit_card == nullptr) { - VLOG(1) << "UseCreditCard failed: card not found for guid " + VLOG(1) << "UseCreditCard failed: card not found for: " << *credit_card_value; EndAction(ClientStatus(PRECONDITION_FAILED)); return;
diff --git a/components/autofill_assistant/browser/basic_interactions.cc b/components/autofill_assistant/browser/basic_interactions.cc index dc73b0e..161b643 100644 --- a/components/autofill_assistant/browser/basic_interactions.cc +++ b/components/autofill_assistant/browser/basic_interactions.cc
@@ -161,7 +161,7 @@ return false; } auto* credit_card = - user_model->GetCreditCard(value->credit_cards().values(i).guid()); + user_model->GetCreditCard(value->credit_cards().values(i)); if (!credit_card) { DVLOG(2) << "Error evaluating " << __func__ << ": credit card not found"; @@ -350,7 +350,7 @@ } auto* credit_card = - user_model->GetCreditCard(value->credit_cards().values(0).guid()); + user_model->GetCreditCard(value->credit_cards().values(0)); if (!credit_card) { DVLOG(2) << "Error evaluating " << __func__ << ": card not found for guid " << value->credit_cards().values(0).guid();
diff --git a/components/autofill_assistant/browser/devtools/BUILD.gn b/components/autofill_assistant/browser/devtools/BUILD.gn index 08a398a..dcc65ba 100644 --- a/components/autofill_assistant/browser/devtools/BUILD.gn +++ b/components/autofill_assistant/browser/devtools/BUILD.gn
@@ -2,8 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/python.gni") - devtools_domains = [ "accessibility", "animation", @@ -53,8 +51,7 @@ ] } -# TODO(crbug.com/1112471): Get this to run cleanly under Python 3. -python2_action("gen_devtools_client_api") { +action("gen_devtools_client_api") { script = "devtools_api/client_api_generator.py" deps = [ "//third_party/blink/public/devtools_protocol:protocol_version" ] inputs = [
diff --git a/components/autofill_assistant/browser/devtools/devtools_api/client_api_generator.py b/components/autofill_assistant/browser/devtools/devtools_api/client_api_generator.py index 853b5b92..72fed74 100644 --- a/components/autofill_assistant/browser/devtools/devtools_api/client_api_generator.py +++ b/components/autofill_assistant/browser/devtools/devtools_api/client_api_generator.py
@@ -435,7 +435,7 @@ if not isinstance(json, dict): return - for value in json.itervalues(): + for value in json.values(): GetDomainDepsFromRefs(domain_name, value) if '$ref' in json:
diff --git a/components/autofill_assistant/browser/model.proto b/components/autofill_assistant/browser/model.proto index f597857..1533088 100644 --- a/components/autofill_assistant/browser/model.proto +++ b/components/autofill_assistant/browser/model.proto
@@ -83,6 +83,10 @@ repeated LoginOptionProto values = 1; } +// Can be used to indicate the presence of a field, without the ambiguity that +// a boolean field would have. +message Empty {} + // Next: 29 enum ProcessedActionStatusProto { UNKNOWN_ACTION_STATUS = 0; @@ -361,8 +365,13 @@ } message AutofillCreditCardProto { - // The GUID of the card. - optional string guid = 1; + oneof identifier { + // The GUID of the card. + string guid = 1; + // The currently selected credit card. Only works if a card was selected in + // a previous |CollectUserData| action. + Empty selected_credit_card = 2; + } } message CreditCardResponseProto { @@ -373,7 +382,8 @@ oneof identifier { // The GUID of the profile. string guid = 1; - // The selected profile for the given profile name. + // The selected profile for the given profile name. Only works if a profile + // was selected in a previous |CollectUserData| action. string selected_profile_name = 2; } }
diff --git a/components/autofill_assistant/browser/service.proto b/components/autofill_assistant/browser/service.proto index 76e08ae..189c012 100644 --- a/components/autofill_assistant/browser/service.proto +++ b/components/autofill_assistant/browser/service.proto
@@ -537,10 +537,6 @@ reserved 1, 6 to 10; } -// Can be used to indicate the presence of a field, without the ambiguity that -// a boolean field would have. -message Empty {} - // RPC request to fetch the available trigger scripts for a particular domain. message GetTriggerScriptsRequestProto { // The exact url for which to fetch the trigger scripts.
diff --git a/components/autofill_assistant/browser/user_model.cc b/components/autofill_assistant/browser/user_model.cc index cde6943..7cc584b 100644 --- a/components/autofill_assistant/browser/user_model.cc +++ b/components/autofill_assistant/browser/user_model.cc
@@ -206,12 +206,20 @@ } const autofill::CreditCard* UserModel::GetCreditCard( - const std::string& guid) const { - auto it = credit_cards_.find(guid); - if (it == credit_cards_.end()) { - return nullptr; + const AutofillCreditCardProto& proto) const { + switch (proto.identifier_case()) { + case AutofillCreditCardProto::kGuid: { + auto it = credit_cards_.find(proto.guid()); + if (it == credit_cards_.end()) { + return nullptr; + } + return it->second.get(); + } + case AutofillCreditCardProto::kSelectedCreditCard: + return GetSelectedCreditCard(); + case AutofillCreditCardProto::IDENTIFIER_NOT_SET: + return nullptr; } - return it->second.get(); } const autofill::CreditCard* UserModel::GetSelectedCreditCard() const {
diff --git a/components/autofill_assistant/browser/user_model.h b/components/autofill_assistant/browser/user_model.h index 6c54a43d..f920ae3 100644 --- a/components/autofill_assistant/browser/user_model.h +++ b/components/autofill_assistant/browser/user_model.h
@@ -103,8 +103,10 @@ void SetCurrentURL(GURL current_url); - // Returns the credit card with |guid| or nullptr if there is no such card. - const autofill::CreditCard* GetCreditCard(const std::string& guid) const; + // Returns the credit card specified by |proto| or nullptr if there is no such + // card. + const autofill::CreditCard* GetCreditCard( + const AutofillCreditCardProto& proto) const; // Returns the selected credit card or nullptr if no card has been selected. const autofill::CreditCard* GetSelectedCreditCard() const;
diff --git a/components/autofill_assistant/browser/user_model_unittest.cc b/components/autofill_assistant/browser/user_model_unittest.cc index ffa865f2..15c4262 100644 --- a/components/autofill_assistant/browser/user_model_unittest.cc +++ b/components/autofill_assistant/browser/user_model_unittest.cc
@@ -313,9 +313,14 @@ autofill::CreditCard credit_card_a(base::GenerateGUID(), kFakeUrl); autofill::test::SetCreditCardInfo(&credit_card_a, "Marion Mitchell", "4111 1111 1111 1111", "01", "2050", ""); + AutofillCreditCardProto credit_card_a_proto; + credit_card_a_proto.set_guid(credit_card_a.guid()); autofill::CreditCard credit_card_b(base::GenerateGUID(), kFakeUrl); autofill::test::SetCreditCardInfo(&credit_card_b, "John Doe", "4111 1111 1111 1111", "01", "2050", ""); + AutofillCreditCardProto credit_card_b_proto; + credit_card_b_proto.set_guid(credit_card_b.guid()); + auto credit_cards = std::make_unique<std::vector<std::unique_ptr<autofill::CreditCard>>>(); credit_cards->emplace_back( @@ -323,12 +328,10 @@ credit_cards->emplace_back( std::make_unique<autofill::CreditCard>(credit_card_b)); model_.SetAutofillCreditCards(std::move(credit_cards)); - EXPECT_THAT( - model_.GetCreditCard(credit_card_a.guid())->Compare(credit_card_a), - Eq(0)); - EXPECT_THAT( - model_.GetCreditCard(credit_card_b.guid())->Compare(credit_card_b), - Eq(0)); + EXPECT_THAT(model_.GetCreditCard(credit_card_a_proto)->Compare(credit_card_a), + Eq(0)); + EXPECT_THAT(model_.GetCreditCard(credit_card_b_proto)->Compare(credit_card_b), + Eq(0)); } TEST_F(UserModelTest, SetProfiles) { @@ -405,6 +408,20 @@ EXPECT_THAT(model_.GetProfile(profile_proto)->Compare(profile), Eq(0)); } +TEST_F(UserModelTest, GetSelectedCardWithProto) { + autofill::CreditCard credit_card(base::GenerateGUID(), kFakeUrl); + autofill::test::SetCreditCardInfo(&credit_card, "Marion Mitchell", + "4111 1111 1111 1111", "01", "2050", ""); + UserData user_data; + model_.SetSelectedCreditCard( + std::make_unique<autofill::CreditCard>(credit_card), &user_data); + AutofillCreditCardProto credit_card_proto; + EXPECT_THAT(model_.GetCreditCard(credit_card_proto), IsNull()); + credit_card_proto.mutable_selected_credit_card(); + EXPECT_THAT(model_.GetCreditCard(credit_card_proto)->Compare(credit_card), + Eq(0)); +} + TEST_F(UserModelTest, SetSelectedCreditCard) { autofill::CreditCard credit_card(base::GenerateGUID(), kFakeUrl); autofill::test::SetCreditCardInfo(&credit_card, "Marion Mitchell",
diff --git a/components/autofill_assistant/browser/value_util.cc b/components/autofill_assistant/browser/value_util.cc index de8730c..d701062 100644 --- a/components/autofill_assistant/browser/value_util.cc +++ b/components/autofill_assistant/browser/value_util.cc
@@ -163,7 +163,16 @@ bool operator==(const AutofillCreditCardProto& value_a, const AutofillCreditCardProto& value_b) { - return value_a.guid() == value_b.guid(); + if (value_a.identifier_case() != value_b.identifier_case()) + return false; + + switch (value_a.identifier_case()) { + case AutofillCreditCardProto::kGuid: + return value_a.guid() == value_b.guid(); + case AutofillCreditCardProto::kSelectedCreditCard: + case AutofillCreditCardProto::IDENTIFIER_NOT_SET: + return true; + } } bool operator==(const AutofillProfileProto& value_a, @@ -232,7 +241,16 @@ std::ostream& operator<<(std::ostream& out, const AutofillCreditCardProto& value) { - out << value.guid(); + switch (value.identifier_case()) { + case AutofillCreditCardProto::kGuid: + out << "guid:" << value.guid(); + break; + case AutofillCreditCardProto::kSelectedCreditCard: + out << "selected credit card"; + break; + case AutofillCreditCardProto::IDENTIFIER_NOT_SET: + break; + } return out; }
diff --git a/components/autofill_assistant/browser/value_util_unittest.cc b/components/autofill_assistant/browser/value_util_unittest.cc index e580b728..149844b 100644 --- a/components/autofill_assistant/browser/value_util_unittest.cc +++ b/components/autofill_assistant/browser/value_util_unittest.cc
@@ -427,5 +427,31 @@ EXPECT_FALSE(profile_a == profile_b); } +TEST_F(ValueUtilTest, TestEqualOperatorForAutofillCreditCard) { + AutofillCreditCardProto credit_card_a; + AutofillCreditCardProto credit_card_b; + EXPECT_TRUE(credit_card_a == credit_card_b); + + credit_card_a.set_guid("guid_a"); + EXPECT_FALSE(credit_card_a == credit_card_b); + + credit_card_b.set_guid("guid_b"); + EXPECT_FALSE(credit_card_a == credit_card_b); + + credit_card_b.set_guid("guid_a"); + EXPECT_TRUE(credit_card_a == credit_card_b); + + credit_card_a.clear_guid(); + credit_card_a.mutable_selected_credit_card(); + EXPECT_FALSE(credit_card_a == credit_card_b); + + credit_card_b.clear_guid(); + credit_card_b.mutable_selected_credit_card(); + EXPECT_TRUE(credit_card_a == credit_card_b); + + credit_card_a.clear_selected_credit_card(); + EXPECT_FALSE(credit_card_a == credit_card_b); +} + } // namespace value_util } // namespace autofill_assistant
diff --git a/components/background_fetch/background_fetch_delegate_base.cc b/components/background_fetch/background_fetch_delegate_base.cc index 7088939..c95e9cd 100644 --- a/components/background_fetch/background_fetch_delegate_base.cc +++ b/components/background_fetch/background_fetch_delegate_base.cc
@@ -28,6 +28,7 @@ #include "mojo/public/cpp/bindings/remote.h" #include "services/network/public/mojom/data_pipe_getter.mojom.h" #include "third_party/blink/public/mojom/background_fetch/background_fetch.mojom.h" +#include "third_party/blink/public/mojom/blob/blob.mojom.h" #include "ui/gfx/geometry/size.h" namespace background_fetch {
diff --git a/components/browser_ui/strings/android/browser_ui_strings.grd b/components/browser_ui/strings/android/browser_ui_strings.grd index 6c82eb7..04731069 100644 --- a/components/browser_ui/strings/android/browser_ui_strings.grd +++ b/components/browser_ui/strings/android/browser_ui_strings.grd
@@ -762,6 +762,38 @@ Drag from top and touch the back button to exit full screen. </message> + <!-- WebApk name/icon update dialog --> + <message name="IDS_WEBAPK_UPDATE_DIALOG_TITLE_NAME" desc="The title at the top of the dialog when only the name changed."> + Update name on your homescreen? + </message> + <message name="IDS_WEBAPK_UPDATE_DIALOG_TITLE_ICON" desc="The title at the top of the dialog when only the icon changed."> + Update icon on your homescreen? + </message> + <message name="IDS_WEBAPK_UPDATE_DIALOG_TITLE_NAME_AND_ICON" desc="The title at the top of the dialog when the name and icon changed."> + Update name & icon on your homescreen? + </message> + <message name="IDS_WEBAPK_UPDATE_EXPLANATION_NAME" desc="The text at the top of the dialog, explaining that an app has changed its name."> + A web app that you installed has changed its name. + </message> + <message name="IDS_WEBAPK_UPDATE_EXPLANATION_ICON" desc="The text at the top of the dialog, explaining that an app has changed its icon."> + A web app that you installed has changed its icon. + </message> + <message name="IDS_WEBAPK_UPDATE_EXPLANATION_NAME_AND_ICON" desc="The text at the top of the dialog, explaining that an app has changed its name and icon."> + A web app that you installed has changed its name and icon. + </message> + <message name="IDS_WEBAPK_UPDATE_BUTTON_UPDATE" desc="The text in the confirm button that starts an update of the WebApk."> + Update + </message> + <message name="IDS_WEBAPK_UPDATE_BUTTON_CLOSE" desc="The text for the cancel button, allowing the user to close and report the app to the abuse team."> + Close and report abuse + </message> + <message name="IDS_UPDATE_WEBAPK_CURRENT_ICON" desc="The accessibility string explaining which icon is the current icon."> + Current icon + </message> + <message name="IDS_UPDATE_WEBAPK_UPDATED_ICON" desc="The accessibility string explaining which icon is the new icon."> + New icon + </message> + <!-- Messages --> <message name="IDS_MESSAGE_SCREEN_POSITION" desc="Accessibility label to inform users about the Message location"> Option available near top of the screen
diff --git a/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_UPDATE_WEBAPK_CURRENT_ICON.png.sha1 b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_UPDATE_WEBAPK_CURRENT_ICON.png.sha1 new file mode 100644 index 0000000..abbd7ff --- /dev/null +++ b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_UPDATE_WEBAPK_CURRENT_ICON.png.sha1
@@ -0,0 +1 @@ +486cf2f888e86268022ae78cfcafce0e77d8fb81 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_UPDATE_WEBAPK_UPDATED_ICON.png.sha1 b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_UPDATE_WEBAPK_UPDATED_ICON.png.sha1 new file mode 100644 index 0000000..abbd7ff --- /dev/null +++ b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_UPDATE_WEBAPK_UPDATED_ICON.png.sha1
@@ -0,0 +1 @@ +486cf2f888e86268022ae78cfcafce0e77d8fb81 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_BUTTON_CLOSE.png.sha1 b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_BUTTON_CLOSE.png.sha1 new file mode 100644 index 0000000..abbd7ff --- /dev/null +++ b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_BUTTON_CLOSE.png.sha1
@@ -0,0 +1 @@ +486cf2f888e86268022ae78cfcafce0e77d8fb81 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_BUTTON_UPDATE.png.sha1 b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_BUTTON_UPDATE.png.sha1 new file mode 100644 index 0000000..abbd7ff --- /dev/null +++ b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_BUTTON_UPDATE.png.sha1
@@ -0,0 +1 @@ +486cf2f888e86268022ae78cfcafce0e77d8fb81 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_DIALOG_TITLE_ICON.png.sha1 b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_DIALOG_TITLE_ICON.png.sha1 new file mode 100644 index 0000000..3a9ed5a --- /dev/null +++ b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_DIALOG_TITLE_ICON.png.sha1
@@ -0,0 +1 @@ +f827a1c422903ccb691056fe1de1820dce493b41 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_DIALOG_TITLE_NAME.png.sha1 b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_DIALOG_TITLE_NAME.png.sha1 new file mode 100644 index 0000000..09fc14a --- /dev/null +++ b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_DIALOG_TITLE_NAME.png.sha1
@@ -0,0 +1 @@ +caa7951c95ac81e521d62554104f2595c1812d85 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_DIALOG_TITLE_NAME_AND_ICON.png.sha1 b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_DIALOG_TITLE_NAME_AND_ICON.png.sha1 new file mode 100644 index 0000000..abbd7ff --- /dev/null +++ b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_DIALOG_TITLE_NAME_AND_ICON.png.sha1
@@ -0,0 +1 @@ +486cf2f888e86268022ae78cfcafce0e77d8fb81 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_EXPLANATION_ICON.png.sha1 b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_EXPLANATION_ICON.png.sha1 new file mode 100644 index 0000000..3a9ed5a --- /dev/null +++ b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_EXPLANATION_ICON.png.sha1
@@ -0,0 +1 @@ +f827a1c422903ccb691056fe1de1820dce493b41 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_EXPLANATION_NAME.png.sha1 b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_EXPLANATION_NAME.png.sha1 new file mode 100644 index 0000000..09fc14a --- /dev/null +++ b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_EXPLANATION_NAME.png.sha1
@@ -0,0 +1 @@ +caa7951c95ac81e521d62554104f2595c1812d85 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_EXPLANATION_NAME_AND_ICON.png.sha1 b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_EXPLANATION_NAME_AND_ICON.png.sha1 new file mode 100644 index 0000000..abbd7ff --- /dev/null +++ b/components/browser_ui/strings/android/browser_ui_strings_grd/IDS_WEBAPK_UPDATE_EXPLANATION_NAME_AND_ICON.png.sha1
@@ -0,0 +1 @@ +486cf2f888e86268022ae78cfcafce0e77d8fb81 \ No newline at end of file
diff --git a/components/content_creation/notes/android/BUILD.gn b/components/content_creation/notes/android/BUILD.gn index cc037a4..9e3f5250 100644 --- a/components/content_creation/notes/android/BUILD.gn +++ b/components/content_creation/notes/android/BUILD.gn
@@ -13,6 +13,7 @@ "java/src/org/chromium/components/content_creation/notes/models/Background.java", "java/src/org/chromium/components/content_creation/notes/models/FooterStyle.java", "java/src/org/chromium/components/content_creation/notes/models/NoteTemplate.java", + "java/src/org/chromium/components/content_creation/notes/models/TextAlignment.java", "java/src/org/chromium/components/content_creation/notes/models/TextStyle.java", ]
diff --git a/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/bridges/NoteTemplateConversionBridge.java b/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/bridges/NoteTemplateConversionBridge.java index 0c45394..3d073bb 100644 --- a/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/bridges/NoteTemplateConversionBridge.java +++ b/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/bridges/NoteTemplateConversionBridge.java
@@ -12,6 +12,7 @@ import org.chromium.components.content_creation.notes.models.Background; import org.chromium.components.content_creation.notes.models.FooterStyle; import org.chromium.components.content_creation.notes.models.NoteTemplate; +import org.chromium.components.content_creation.notes.models.TextAlignment; import org.chromium.components.content_creation.notes.models.TextStyle; import java.util.ArrayList; @@ -39,8 +40,9 @@ @CalledByNative private static TextStyle createTextStyle( - String fontName, @ColorInt int fontColor, int weight, boolean allCaps) { - return new TextStyle(fontName, fontColor, weight, allCaps); + String fontName, @ColorInt int fontColor, int weight, boolean allCaps, int alignment) { + return new TextStyle( + fontName, fontColor, weight, allCaps, TextAlignment.fromInteger(alignment)); } @CalledByNative
diff --git a/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/models/TextAlignment.java b/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/models/TextAlignment.java new file mode 100644 index 0000000..8c881e4 --- /dev/null +++ b/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/models/TextAlignment.java
@@ -0,0 +1,26 @@ +// Copyright 2021 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. + +package org.chromium.components.content_creation.notes.models; + +/** + * Enum with values corresponding to the C++ TextAlignment enum class. + */ +public enum TextAlignment { + INVALID, + START, + CENTER, + END; + public static TextAlignment fromInteger(int x) { + switch (x) { + case 1: + return START; + case 2: + return CENTER; + case 3: + return END; + } + return INVALID; + } +} \ No newline at end of file
diff --git a/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/models/TextStyle.java b/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/models/TextStyle.java index 4cada0c..3cdb36a 100644 --- a/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/models/TextStyle.java +++ b/components/content_creation/notes/android/java/src/org/chromium/components/content_creation/notes/models/TextStyle.java
@@ -14,12 +14,15 @@ public final @ColorInt int fontColor; public final int weight; public final boolean allCaps; + public final TextAlignment alignment; /** Constructor. */ - public TextStyle(String fontName, @ColorInt int fontColor, int weight, boolean allCaps) { + public TextStyle(String fontName, @ColorInt int fontColor, int weight, boolean allCaps, + TextAlignment alignment) { this.fontName = fontName; this.fontColor = fontColor; this.weight = weight; this.allCaps = allCaps; + this.alignment = alignment; } }
diff --git a/components/content_creation/notes/android/note_template_conversion_bridge.cc b/components/content_creation/notes/android/note_template_conversion_bridge.cc index ef9b8ed..68b0979c 100644 --- a/components/content_creation/notes/android/note_template_conversion_bridge.cc +++ b/components/content_creation/notes/android/note_template_conversion_bridge.cc
@@ -25,7 +25,8 @@ const TextStyle& text_style) { return Java_NoteTemplateConversionBridge_createTextStyle( env, ConvertUTF8ToJavaString(env, text_style.font_name()), - text_style.font_color(), text_style.weight(), text_style.all_caps()); + text_style.font_color(), text_style.weight(), text_style.all_caps(), + static_cast<uint16_t>(text_style.alignment())); } ScopedJavaLocalRef<jobject> CreateJavaFooterStyle(
diff --git a/components/content_creation/notes/core/templates/template_constants.cc b/components/content_creation/notes/core/templates/template_constants.cc index e3e27d26c..c2d3d1d 100644 --- a/components/content_creation/notes/core/templates/template_constants.cc +++ b/components/content_creation/notes/core/templates/template_constants.cc
@@ -59,7 +59,7 @@ Background(/*color=*/kGrey900Color), TextStyle(kSourceSerifProFontName, /*font_color=*/kWhiteColor, k700Weight, - /*all_caps=*/false), + /*all_caps=*/false, TextAlignment::kStart), /*footer_style=*/CreateDarkBackgroundFooterStyle()); } @@ -70,7 +70,7 @@ Background(/*color=*/kGreen50Color), TextStyle(kSourceSerifProFontName, /*font_color=*/kGreen900Color, k400Weight, - /*all_caps=*/false), + /*all_caps=*/false, TextAlignment::kStart), /*footer_style=*/CreateLightBackgroundFooterStyle()); } @@ -82,7 +82,7 @@ Background(/*color=*/kYellow400Color), TextStyle(kRobotoCondensedFontName, /*font_color=*/kBlackColor, k400Weight, - /*all_caps=*/true), + /*all_caps=*/true, TextAlignment::kStart), /*footer_style=*/CreateLightBackgroundFooterStyle()); } @@ -95,7 +95,7 @@ Background(/*color=*/kGrey200Color), TextStyle(kBebasNeueFontName, /*font_color=*/kBlackColor, k400Weight, - /*all_caps=*/true), + /*all_caps=*/true, TextAlignment::kCenter), /*footer_style=*/CreateLightBackgroundFooterStyle()); } @@ -107,7 +107,7 @@ Background(/*color=*/kBlackColor), TextStyle(kBebasNeueFontName, /*font_color=*/kWhiteColor, k400Weight, - /*all_caps=*/true), + /*all_caps=*/true, TextAlignment::kCenter), /*footer_style=*/CreateDarkBackgroundFooterStyle()); } @@ -119,7 +119,7 @@ Background(/*color=*/kWhiteColor), TextStyle(kBebasNeueFontName, /*font_color=*/kBlackColor, k400Weight, - /*all_caps=*/true), + /*all_caps=*/true, TextAlignment::kCenter), /*footer_style=*/CreateLightBackgroundFooterStyle()); }
diff --git a/components/content_creation/notes/core/templates/template_types.cc b/components/content_creation/notes/core/templates/template_types.cc index f1438f1..2a3d76f 100644 --- a/components/content_creation/notes/core/templates/template_types.cc +++ b/components/content_creation/notes/core/templates/template_types.cc
@@ -11,11 +11,13 @@ TextStyle::TextStyle(const std::string& font_name, ARGBColor font_color, uint16_t weight, - bool all_caps) + bool all_caps, + TextAlignment alignment) : font_name_(font_name), font_color_(font_color), weight_(weight), - all_caps_(all_caps) {} + all_caps_(all_caps), + alignment_(alignment) {} FooterStyle::FooterStyle(ARGBColor text_color, ARGBColor logo_color) : text_color_(text_color), logo_color_(logo_color) {}
diff --git a/components/content_creation/notes/core/templates/template_types.h b/components/content_creation/notes/core/templates/template_types.h index 93d09fc2..c92424a 100644 --- a/components/content_creation/notes/core/templates/template_types.h +++ b/components/content_creation/notes/core/templates/template_types.h
@@ -39,24 +39,31 @@ ARGBColor color_; }; +// Represents the different supported text alignment. Keep this enum in sync with its Java +// counterpart of the same name. +enum class TextAlignment { kInvalid = 0, kStart = 1, kCenter = 2, kEnd = 3 }; + // Parameters dictating how to display text. class TextStyle { public: explicit TextStyle(const std::string& font_name, ARGBColor font_color, uint16_t weight, - bool all_caps); + bool all_caps, + TextAlignment alignment); const std::string font_name() const { return font_name_; } ARGBColor font_color() const { return font_color_; } uint16_t weight() const { return weight_; } bool all_caps() const { return all_caps_; } + TextAlignment alignment() const { return alignment_; } private: std::string font_name_; ARGBColor font_color_; uint16_t weight_; bool all_caps_; + TextAlignment alignment_; }; // Parameters to control the appearance of the elements in a note's footer.
diff --git a/components/continuous_search/browser/search_result_extractor_client_status.h b/components/continuous_search/browser/search_result_extractor_client_status.h index df0a29a..3a5e27c0 100644 --- a/components/continuous_search/browser/search_result_extractor_client_status.h +++ b/components/continuous_search/browser/search_result_extractor_client_status.h
@@ -19,6 +19,7 @@ kNativeNotInitialized, kAlreadyCapturing, kWebContentsHasNonSrpUrl, + kNotEnoughResults, kMaxValue, };
diff --git a/components/download/internal/common/download_item_impl.cc b/components/download/internal/common/download_item_impl.cc index 689dcdc2..c3beb2e4 100644 --- a/components/download/internal/common/download_item_impl.cc +++ b/components/download/internal/common/download_item_impl.cc
@@ -153,6 +153,8 @@ return "POTENTIALLY_UNWANTED"; case DOWNLOAD_DANGER_TYPE_ALLOWLISTED_BY_POLICY: return "ALLOWLISTED_BY_POLICY"; + case DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE: + return "DANGEROUS_ACCOUNT_COMPROMISE"; default: NOTREACHED(); return "UNKNOWN_DANGER_TYPE"; @@ -1000,7 +1002,8 @@ danger_type_ == DOWNLOAD_DANGER_TYPE_BLOCKED_TOO_LARGE || danger_type_ == DOWNLOAD_DANGER_TYPE_SENSITIVE_CONTENT_WARNING || danger_type_ == DOWNLOAD_DANGER_TYPE_SENSITIVE_CONTENT_BLOCK || - danger_type_ == DOWNLOAD_DANGER_TYPE_PROMPT_FOR_SCANNING; + danger_type_ == DOWNLOAD_DANGER_TYPE_PROMPT_FOR_SCANNING || + danger_type_ == DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE; } bool DownloadItemImpl::IsMixedContent() const { @@ -1630,7 +1633,7 @@ job_->Start(download_file_.get(), base::BindRepeating(&DownloadItemImpl::OnDownloadFileInitialized, - weak_ptr_factory_.GetWeakPtr()), + weak_ptr_factory_.GetWeakPtr()), GetReceivedSlices()); } @@ -1666,7 +1669,7 @@ download_source_); delegate_->DetermineDownloadTarget( this, base::BindOnce(&DownloadItemImpl::OnDownloadTargetDetermined, - weak_ptr_factory_.GetWeakPtr())); + weak_ptr_factory_.GetWeakPtr())); } // Called by delegate_ when the download target path has been determined. @@ -1756,7 +1759,7 @@ DCHECK(!IsSavePackageDownload()); DownloadFile::RenameCompletionCallback callback = base::BindOnce(&DownloadItemImpl::OnDownloadRenamedToIntermediateName, - weak_ptr_factory_.GetWeakPtr()); + weak_ptr_factory_.GetWeakPtr()); #if defined(OS_ANDROID) if ((download_type_ == TYPE_ACTIVE_DOWNLOAD && !transient_ && DownloadCollectionBridge::ShouldPublishDownload(GetTargetFilePath())) ||
diff --git a/components/download/public/common/download_danger_type.h b/components/download/public/common/download_danger_type.h index 237e874..348e9bf 100644 --- a/components/download/public/common/download_danger_type.h +++ b/components/download/public/common/download_danger_type.h
@@ -81,6 +81,10 @@ // policy for details. DOWNLOAD_DANGER_TYPE_BLOCKED_UNSUPPORTED_FILETYPE = 18, + // SafeBrowsing download service has classified this file as being associated + // with account compromise through stealing cookies. + DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE = 19, + // Memory space for histograms is determined by the max. // ALWAYS ADD NEW VALUES BEFORE THIS ONE. DOWNLOAD_DANGER_TYPE_MAX
diff --git a/components/history/content/browser/download_conversions.cc b/components/history/content/browser/download_conversions.cc index 62f3e900..256fecf 100644 --- a/components/history/content/browser/download_conversions.cc +++ b/components/history/content/browser/download_conversions.cc
@@ -91,6 +91,8 @@ return download::DOWNLOAD_DANGER_TYPE_PROMPT_FOR_SCANNING; case DownloadDangerType::BLOCKED_UNSUPPORTED_FILETYPE: return download::DOWNLOAD_DANGER_TYPE_BLOCKED_UNSUPPORTED_FILETYPE; + case DownloadDangerType::DANGEROUS_ACCOUNT_COMRPOMISE: + return download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE; case DownloadDangerType::INVALID: NOTREACHED(); return download::DOWNLOAD_DANGER_TYPE_MAX; @@ -140,7 +142,8 @@ return DownloadDangerType::PROMPT_FOR_SCANNING; case download::DOWNLOAD_DANGER_TYPE_BLOCKED_UNSUPPORTED_FILETYPE: return DownloadDangerType::BLOCKED_UNSUPPORTED_FILETYPE; - + case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE: + return DownloadDangerType::DANGEROUS_ACCOUNT_COMRPOMISE; default: NOTREACHED(); return DownloadDangerType::INVALID;
diff --git a/components/history/core/browser/download_constants.h b/components/history/core/browser/download_constants.h index 2bda18a..bb82bcdc 100644 --- a/components/history/core/browser/download_constants.h +++ b/components/history/core/browser/download_constants.h
@@ -45,6 +45,7 @@ DEEP_SCANNED_OPENED_DANGEROUS = 16, PROMPT_FOR_SCANNING = 17, BLOCKED_UNSUPPORTED_FILETYPE = 18, + DANGEROUS_ACCOUNT_COMRPOMISE = 19, }; // DownloadId represents the id of a DownloadRow into the DownloadDatabase. @@ -52,6 +53,6 @@ // kInvalidDownloadId. extern const DownloadId kInvalidDownloadId; -} // namespace +} // namespace history #endif // COMPONENTS_HISTORY_CORE_BROWSER_DOWNLOAD_CONSTANTS_H_
diff --git a/components/history/core/browser/download_types.cc b/components/history/core/browser/download_types.cc index a95682a5..b6b413f 100644 --- a/components/history/core/browser/download_types.cc +++ b/components/history/core/browser/download_types.cc
@@ -74,6 +74,7 @@ case DownloadDangerType::DEEP_SCANNED_OPENED_DANGEROUS: case DownloadDangerType::PROMPT_FOR_SCANNING: case DownloadDangerType::BLOCKED_UNSUPPORTED_FILETYPE: + case DownloadDangerType::DANGEROUS_ACCOUNT_COMRPOMISE: return static_cast<DownloadDangerType>(danger_type); case DownloadDangerType::INVALID: @@ -134,6 +135,9 @@ case DownloadDangerType::BLOCKED_UNSUPPORTED_FILETYPE: return stream << "history::DownloadDangerType::BLOCKED_UNSUPPORTED_FILETYPE"; + case DownloadDangerType::DANGEROUS_ACCOUNT_COMRPOMISE: + return stream + << "history::DownloadDangerType::DANGEROUS_ACCOUNT_COMRPOMISE"; } NOTREACHED(); return stream;
diff --git a/components/metrics/metrics_service_client.cc b/components/metrics/metrics_service_client.cc index 4ccfcd59..5054743 100644 --- a/components/metrics/metrics_service_client.cc +++ b/components/metrics/metrics_service_client.cc
@@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" +#include "build/build_config.h" #include "components/metrics/metrics_switches.h" #include "components/metrics/url_constants.h" @@ -25,7 +26,12 @@ // then we will discard the log, and not try to retransmit it. We also don't // persist the log to the prefs for transmission during the next chrome session // if this limit is exceeded. +#if defined(OS_CHROMEOS) +// Increase CrOS limit to accommodate SampledProfile data (crbug.com/1210595). +constexpr size_t kMaxOngoingLogSize = 1024 * 1024; // 1 MiB +#else constexpr size_t kMaxOngoingLogSize = 100 * 1024; // 100 KiB +#endif // defined(OS_CHROMEOS) // The number of bytes of logs to save of each type (initial/ongoing). This // ensures that a reasonable amount of history will be stored even if there is a
diff --git a/components/omnibox/browser/actions/omnibox_action.cc b/components/omnibox/browser/actions/omnibox_action.cc index 367a08c..6251e119 100644 --- a/components/omnibox/browser/actions/omnibox_action.cc +++ b/components/omnibox/browser/actions/omnibox_action.cc
@@ -83,16 +83,15 @@ void OmniboxAction::OpenURL(OmniboxAction::ExecutionContext& context, const GURL& url) const { - // destination_url_entered_without_scheme is used to determine whether + // Set `match_type` as if the user just typed |url| verbatim. + // `destination_url_entered_without_scheme` is used to determine whether // navigations typed without a scheme and upgraded to HTTPS should fall back // to HTTP. The URL might have been entered without a scheme, but Action // destination URLs don't need a fallback so it's fine to pass false here. - // - // TODO(tommycli): Update the AutocompleteMatchType to not be a PEDAL - // for non-Pedal actions, once they exist. context.controller_.OnAutocompleteAccept( url, nullptr, WindowOpenDisposition::CURRENT_TAB, - ui::PAGE_TRANSITION_GENERATED, AutocompleteMatchType::PEDAL, + ui::PAGE_TRANSITION_GENERATED, + /*match_type=*/AutocompleteMatchType::URL_WHAT_YOU_TYPED, context.match_selection_timestamp_, /*destination_url_entered_without_scheme=*/false); }
diff --git a/components/omnibox/browser/autocomplete_match.cc b/components/omnibox/browser/autocomplete_match.cc index 2638b801..984621d 100644 --- a/components/omnibox/browser/autocomplete_match.cc +++ b/components/omnibox/browser/autocomplete_match.cc
@@ -397,6 +397,7 @@ case Type::SEARCH_OTHER_ENGINE: case Type::CONTACT_DEPRECATED: case Type::VOICE_SUGGEST: + case Type::PEDAL_DEPRECATED: case Type::CLIPBOARD_TEXT: case Type::CLIPBOARD_IMAGE: case Type::TILE_SUGGESTION: @@ -441,9 +442,6 @@ return omnibox::kPageIcon; } - case Type::PEDAL: - return (pedal ? pedal->GetVectorIcon() : omnibox::kPedalIcon); - case Type::NUM_TYPES: // TODO(https://crbug.com/1024114): Replace with NOTREACHED() once fixed. CHECK(false); @@ -490,8 +488,8 @@ return false; // Prefer URL autocompleted default matches if the appropriate param is true. - if (OmniboxFieldTrial:: - RichAutocompletionAutocompletePreferUrlsOverPrefixes()) { + if (OmniboxFieldTrial::kRichAutocompletionAutocompletePreferUrlsOverPrefixes + .Get()) { if (match1.additional_text.empty() && !match2.additional_text.empty()) return true; if (!match1.additional_text.empty() && match2.additional_text.empty()) @@ -1010,10 +1008,6 @@ return OmniboxEventProto::Suggestion::CLIPBOARD_URL; case AutocompleteMatchType::DOCUMENT_SUGGESTION: return OmniboxEventProto::Suggestion::DOCUMENT; - case AutocompleteMatchType::PEDAL: - // TODO(orinj): Add a new OmniboxEventProto type for Pedals. - // return OmniboxEventProto::Suggestion::PEDAL; - return OmniboxEventProto::Suggestion::NAVSUGGEST; case AutocompleteMatchType::CLIPBOARD_TEXT: return OmniboxEventProto::Suggestion::CLIPBOARD_TEXT; case AutocompleteMatchType::CLIPBOARD_IMAGE: @@ -1029,6 +1023,7 @@ case AutocompleteMatchType::PHYSICAL_WEB_DEPRECATED: case AutocompleteMatchType::PHYSICAL_WEB_OVERFLOW_DEPRECATED: case AutocompleteMatchType::TAB_SEARCH_DEPRECATED: + case AutocompleteMatchType::PEDAL_DEPRECATED: case AutocompleteMatchType::NUM_TYPES: break; } @@ -1221,7 +1216,8 @@ if (!OmniboxFieldTrial::IsRichAutocompletionEnabled()) return false; - bool counterfactual = OmniboxFieldTrial::RichAutocompletionCounterfactual(); + bool counterfactual = + OmniboxFieldTrial::kRichAutocompletionCounterfactual.Get(); if (input.prevent_inline_autocomplete()) return false; @@ -1246,19 +1242,20 @@ } const bool can_autocomplete_titles = RichAutocompletionApplicable( - OmniboxFieldTrial::RichAutocompletionAutocompleteTitles(), - OmniboxFieldTrial::RichAutocompletionAutocompleteTitlesShortcutProvider(), - OmniboxFieldTrial::RichAutocompletionAutocompleteTitlesMinChar(), - OmniboxFieldTrial:: - RichAutocompletionAutocompleteTitlesNoInputsWithSpaces(), + OmniboxFieldTrial::kRichAutocompletionAutocompleteTitles.Get(), + OmniboxFieldTrial::kRichAutocompletionAutocompleteTitlesShortcutProvider + .Get(), + OmniboxFieldTrial::kRichAutocompletionAutocompleteTitlesMinChar.Get(), + OmniboxFieldTrial::kRichAutocompletionAutocompleteTitlesNoInputsWithSpaces + .Get(), shortcut_provider, input.text()); const bool can_autocomplete_non_prefix = RichAutocompletionApplicable( - OmniboxFieldTrial::RichAutocompletionAutocompleteNonPrefixAll(), + OmniboxFieldTrial::kRichAutocompletionAutocompleteNonPrefixAll.Get(), OmniboxFieldTrial:: - RichAutocompletionAutocompleteNonPrefixShortcutProvider(), - OmniboxFieldTrial::RichAutocompletionAutocompleteNonPrefixMinChar(), + kRichAutocompletionAutocompleteNonPrefixShortcutProvider.Get(), + OmniboxFieldTrial::kRichAutocompletionAutocompleteNonPrefixMinChar.Get(), OmniboxFieldTrial:: - RichAutocompletionAutocompleteNonPrefixNoInputsWithSpaces(), + kRichAutocompletionAutocompleteNonPrefixNoInputsWithSpaces.Get(), shortcut_provider, input.text()); // All else equal, prefer matching primary over secondary texts and prefixes @@ -1266,7 +1263,8 @@ // determines whether to prefer matching primary text non-prefixes or // secondary text prefixes. bool prefer_primary_non_prefix_over_secondary_prefix = - OmniboxFieldTrial::RichAutocompletionAutocompletePreferUrlsOverPrefixes(); + OmniboxFieldTrial::kRichAutocompletionAutocompletePreferUrlsOverPrefixes + .Get(); size_t find_index; @@ -1336,9 +1334,11 @@ } const bool can_autocomplete_split_url = - OmniboxFieldTrial::RichAutocompletionSplitUrlCompletion() && + OmniboxFieldTrial::kRichAutocompletionSplitUrlCompletion.Get() && input.text().size() >= - OmniboxFieldTrial::RichAutocompletionSplitCompletionMinChar(); + static_cast<size_t>( + OmniboxFieldTrial::kRichAutocompletionSplitCompletionMinChar + .Get()); // Try split matching (see comments for |split_autocompletion|) with // |primary_text|. @@ -1361,9 +1361,11 @@ // Try split matching (see comments for |split_autocompletion|) with // |secondary_text|. const bool can_autocomplete_split_title = - OmniboxFieldTrial::RichAutocompletionSplitTitleCompletion() && + OmniboxFieldTrial::kRichAutocompletionSplitTitleCompletion.Get() && input.text().size() >= - OmniboxFieldTrial::RichAutocompletionSplitCompletionMinChar(); + static_cast<size_t>( + OmniboxFieldTrial::kRichAutocompletionSplitCompletionMinChar + .Get()); if (can_autocomplete_split_title && !(input_words = FindWordsSequentiallyAtWordbreak(secondary_text_lower,
diff --git a/components/omnibox/browser/autocomplete_match.h b/components/omnibox/browser/autocomplete_match.h index c398253..82570e1 100644 --- a/components/omnibox/browser/autocomplete_match.h +++ b/components/omnibox/browser/autocomplete_match.h
@@ -517,14 +517,12 @@ void UpgradeMatchWithPropertiesFrom(AutocompleteMatch& duplicate_match); // Tries, in order, to: - // - Prefix autocomplete |primary_text|, - // - Prefix autocomplete |secondary_text|, - // - Non-prefix autocomplete |primary_text|, and - // - Non-prefix autocomplete |secondary_text|. - // Midword and title autocompletion are only attempted if - // |OmniboxFieldTrial::RichAutocompletionAutocompleteTitles()| and - // |OmniboxFieldTrial::RichAutocompletionAutocompleteNonPrefix*()| are true - // respectively. + // - Prefix autocomplete |primary_text| + // - Prefix autocomplete |secondary_text| + // - Non-prefix autocomplete |primary_text| + // - Non-prefix autocomplete |secondary_text| + // - Split autocomplete |primary_text| + // - Split autocomplete |secondary_text| // Returns false if none of the autocompletions were appropriate (or the // features were disabled). bool TryRichAutocompletion(const std::u16string& primary_text,
diff --git a/components/omnibox/browser/autocomplete_match_type.h b/components/omnibox/browser/autocomplete_match_type.h index 0cb90ed..6c2022dc 100644 --- a/components/omnibox/browser/autocomplete_match_type.h +++ b/components/omnibox/browser/autocomplete_match_type.h
@@ -68,7 +68,9 @@ TAB_SEARCH_DEPRECATED = 23, // A suggested open tab, based on its // URL or title, via HQP (deprecated). DOCUMENT_SUGGESTION = 24, // A suggested document. - PEDAL = 25, // An omnibox pedal suggestion. + PEDAL_DEPRECATED = 25, // An omnibox pedal match (deprecated). + // Pedals are now just action buttons + // attached to search matches. CLIPBOARD_TEXT = 26, // Text based on the clipboard. CLIPBOARD_IMAGE = 27, // An image based on the clipboard. TILE_SUGGESTION = 28, // A suggestion containing query tiles.
diff --git a/components/omnibox/browser/bookmark_provider_unittest.cc b/components/omnibox/browser/bookmark_provider_unittest.cc index bb32044e..048e4a7 100644 --- a/components/omnibox/browser/bookmark_provider_unittest.cc +++ b/components/omnibox/browser/bookmark_provider_unittest.cc
@@ -621,13 +621,13 @@ base::test::ScopedFeatureList feature_list; feature_list.InitAndEnableFeatureWithParameters( omnibox::kRichAutocompletion, - {{OmniboxFieldTrial::kRichAutocompletionAutocompleteTitlesMinCharParam, + {{OmniboxFieldTrial::kRichAutocompletionAutocompleteTitlesMinChar.name, "4"}, - {OmniboxFieldTrial:: - kRichAutocompletionAutocompleteNonPrefixMinCharParam, + {OmniboxFieldTrial::kRichAutocompletionAutocompleteNonPrefixMinChar + .name, "5"}, {OmniboxFieldTrial:: - kRichAutocompletionAutocompleteNonPrefixShortcutProviderParam, + kRichAutocompletionAutocompleteNonPrefixShortcutProvider.name, "true"}}); TestNumMatchesAndTriggeredFeature("te", 0); TestNumMatchesAndTriggeredFeature("te ", 0); @@ -641,12 +641,12 @@ base::test::ScopedFeatureList feature_list; feature_list.InitAndEnableFeatureWithParameters( omnibox::kRichAutocompletion, - {{OmniboxFieldTrial::kRichAutocompletionAutocompleteTitlesMinCharParam, + {{OmniboxFieldTrial::kRichAutocompletionAutocompleteTitlesMinChar.name, "4"}, - {OmniboxFieldTrial:: - kRichAutocompletionAutocompleteNonPrefixMinCharParam, + {OmniboxFieldTrial::kRichAutocompletionAutocompleteNonPrefixMinChar + .name, "5"}, - {OmniboxFieldTrial::kRichAutocompletionAutocompleteNonPrefixAllParam, + {OmniboxFieldTrial::kRichAutocompletionAutocompleteNonPrefixAll.name, "true"}}); TestNumMatchesAndTriggeredFeature("te", 0); TestNumMatchesAndTriggeredFeature("te ", 0); @@ -660,12 +660,12 @@ base::test::ScopedFeatureList feature_list; feature_list.InitAndEnableFeatureWithParameters( omnibox::kRichAutocompletion, - {{OmniboxFieldTrial::kRichAutocompletionAutocompleteTitlesMinCharParam, + {{OmniboxFieldTrial::kRichAutocompletionAutocompleteTitlesMinChar.name, "4"}, - {OmniboxFieldTrial:: - kRichAutocompletionAutocompleteNonPrefixMinCharParam, + {OmniboxFieldTrial::kRichAutocompletionAutocompleteNonPrefixMinChar + .name, "5"}, - {OmniboxFieldTrial::kRichAutocompletionAutocompleteTitlesParam, + {OmniboxFieldTrial::kRichAutocompletionAutocompleteTitles.name, "true"}}); TestNumMatchesAndTriggeredFeature("te", 0); TestNumMatchesAndTriggeredFeature("te ", 0); @@ -681,15 +681,15 @@ base::test::ScopedFeatureList feature_list; feature_list.InitAndEnableFeatureWithParameters( omnibox::kRichAutocompletion, - {{OmniboxFieldTrial::kRichAutocompletionAutocompleteTitlesMinCharParam, + {{OmniboxFieldTrial::kRichAutocompletionAutocompleteTitlesMinChar.name, "4"}, - {OmniboxFieldTrial:: - kRichAutocompletionAutocompleteNonPrefixMinCharParam, + {OmniboxFieldTrial::kRichAutocompletionAutocompleteNonPrefixMinChar + .name, "5"}, - {OmniboxFieldTrial:: - kRichAutocompletionAutocompleteNonPrefixMinCharParam, + {OmniboxFieldTrial::kRichAutocompletionAutocompleteNonPrefixMinChar + .name, "true"}, - {OmniboxFieldTrial::kRichAutocompletionAutocompleteTitlesParam, + {OmniboxFieldTrial::kRichAutocompletionAutocompleteTitles.name, "true"}}); TestNumMatchesAndTriggeredFeature("te", 0); TestNumMatchesAndTriggeredFeature("te ", 0);
diff --git a/components/omnibox/browser/omnibox_field_trial.cc b/components/omnibox/browser/omnibox_field_trial.cc index b4aa194..c464c58 100644 --- a/components/omnibox/browser/omnibox_field_trial.cc +++ b/components/omnibox/browser/omnibox_field_trial.cc
@@ -606,8 +606,8 @@ return base::FeatureList::IsEnabled( omnibox::kShortBookmarkSuggestionsByTotalInputLength) || (IsRichAutocompletionEnabled() && - (RichAutocompletionAutocompleteTitles() || - RichAutocompletionAutocompleteNonPrefixAll())); + (kRichAutocompletionAutocompleteTitles.Get() || + kRichAutocompletionAutocompleteNonPrefixAll.Get())); } bool OmniboxFieldTrial:: @@ -626,14 +626,14 @@ if (!base::FeatureList::IsEnabled( omnibox::kShortBookmarkSuggestionsByTotalInputLength) && IsRichAutocompletionEnabled()) { - if (RichAutocompletionAutocompleteTitles() && - RichAutocompletionAutocompleteNonPrefixAll()) { - return std::min(RichAutocompletionAutocompleteTitlesMinChar(), - RichAutocompletionAutocompleteNonPrefixMinChar()); - } else if (RichAutocompletionAutocompleteTitles()) - return RichAutocompletionAutocompleteTitlesMinChar(); - else if (RichAutocompletionAutocompleteNonPrefixAll()) - return RichAutocompletionAutocompleteNonPrefixMinChar(); + if (kRichAutocompletionAutocompleteTitles.Get() && + kRichAutocompletionAutocompleteNonPrefixAll.Get()) { + return std::min(kRichAutocompletionAutocompleteTitlesMinChar.Get(), + kRichAutocompletionAutocompleteNonPrefixMinChar.Get()); + } else if (kRichAutocompletionAutocompleteTitles.Get()) + return kRichAutocompletionAutocompleteTitlesMinChar.Get(); + else if (kRichAutocompletionAutocompleteNonPrefixAll.Get()) + return kRichAutocompletionAutocompleteNonPrefixMinChar.Get(); } return base::GetFieldTrialParamByFeatureAsInt( @@ -671,99 +671,96 @@ return base::FeatureList::IsEnabled(omnibox::kOmniboxRefinedFocusState); } -bool OmniboxFieldTrial::IsRichAutocompletionEnabled() { +namespace OmniboxFieldTrial { + +bool IsRichAutocompletionEnabled() { return base::FeatureList::IsEnabled(omnibox::kRichAutocompletion); } -bool OmniboxFieldTrial::RichAutocompletionAutocompleteTitles() { - return base::GetFieldTrialParamByFeatureAsBool( - omnibox::kRichAutocompletion, kRichAutocompletionAutocompleteTitlesParam, - false); +// Rich autocompletion + +const base::FeatureParam<bool> kRichAutocompletionAutocompleteTitles( + &omnibox::kRichAutocompletion, + "RichAutocompletionAutocompleteTitles", + false); + +const base::FeatureParam<bool> + kRichAutocompletionAutocompleteTitlesShortcutProvider( + &omnibox::kRichAutocompletion, + "RichAutocompletionAutocompleteTitlesShortcutProvider", + false); + +const base::FeatureParam<bool> + kRichAutocompletionAutocompleteTitlesNoInputsWithSpaces( + &omnibox::kRichAutocompletion, + "RichAutocompletionAutocompleteTitlesNoInputsWithSpaces", + false); + +const base::FeatureParam<int> kRichAutocompletionAutocompleteTitlesMinChar( + &omnibox::kRichAutocompletion, + "RichAutocompletionAutocompleteTitlesMinChar", + 0); + +const base::FeatureParam<bool> kRichAutocompletionAutocompleteNonPrefixAll( + &omnibox::kRichAutocompletion, + "RichAutocompletionAutocompleteNonPrefixAll", + false); + +const base::FeatureParam<bool> + kRichAutocompletionAutocompleteNonPrefixShortcutProvider( + &omnibox::kRichAutocompletion, + "RichAutocompletionAutocompleteNonPrefixShortcutProvider", + false); + +const base::FeatureParam<bool> + kRichAutocompletionAutocompleteNonPrefixNoInputsWithSpaces( + &omnibox::kRichAutocompletion, + "RichAutocompletionAutocompleteNonPrefixNoInputsWithSpaces", + false); + +const base::FeatureParam<int> kRichAutocompletionAutocompleteNonPrefixMinChar( + &omnibox::kRichAutocompletion, + "RichAutocompletionAutocompleteNonPrefixMinChar", + 0); + +namespace { +const base::FeatureParam<bool> kRichAutocompletionShowAdditionalText( + &omnibox::kRichAutocompletion, + "RichAutocompletionAutocompleteShowAdditionalText", + true); +} // namespace +bool RichAutocompletionShowAdditionalText() { + return IsRichAutocompletionEnabled() && + kRichAutocompletionShowAdditionalText.Get(); } -bool OmniboxFieldTrial::RichAutocompletionAutocompleteTitlesShortcutProvider() { - return base::GetFieldTrialParamByFeatureAsBool( - omnibox::kRichAutocompletion, - kRichAutocompletionAutocompleteTitlesShortcutProviderParam, false); -} +const base::FeatureParam<bool> kRichAutocompletionSplitTitleCompletion( + &omnibox::kRichAutocompletion, + "RichAutocompletionSplitTitleCompletion", + false); -bool OmniboxFieldTrial:: - RichAutocompletionAutocompleteTitlesNoInputsWithSpaces() { - return base::GetFieldTrialParamByFeatureAsBool( - omnibox::kRichAutocompletion, - kRichAutocompletionAutocompleteTitlesNoInputsWithSpacesParam, false); -} +const base::FeatureParam<bool> kRichAutocompletionSplitUrlCompletion( + &omnibox::kRichAutocompletion, + "RichAutocompletionSplitUrlCompletion", + false); -size_t OmniboxFieldTrial::RichAutocompletionAutocompleteTitlesMinChar() { - return base::GetFieldTrialParamByFeatureAsInt( - omnibox::kRichAutocompletion, - kRichAutocompletionAutocompleteTitlesMinCharParam, 0); -} +const base::FeatureParam<int> kRichAutocompletionSplitCompletionMinChar( + &omnibox::kRichAutocompletion, + "RichAutocompletionSplitCompletionMinChar", + 0); -bool OmniboxFieldTrial::RichAutocompletionAutocompleteNonPrefixAll() { - return base::GetFieldTrialParamByFeatureAsBool( - omnibox::kRichAutocompletion, - kRichAutocompletionAutocompleteNonPrefixAllParam, false); -} +const base::FeatureParam<bool> kRichAutocompletionCounterfactual( + &omnibox::kRichAutocompletion, + "RichAutocompletionCounterfactual", + false); -bool OmniboxFieldTrial:: - RichAutocompletionAutocompleteNonPrefixShortcutProvider() { - return base::GetFieldTrialParamByFeatureAsBool( - omnibox::kRichAutocompletion, - kRichAutocompletionAutocompleteNonPrefixShortcutProviderParam, false); -} +const base::FeatureParam<bool> + kRichAutocompletionAutocompletePreferUrlsOverPrefixes( + &omnibox::kRichAutocompletion, + "RichAutocompletionAutocompletePreferUrlsOverPrefixes", + false); -bool OmniboxFieldTrial:: - RichAutocompletionAutocompleteNonPrefixNoInputsWithSpaces() { - return base::GetFieldTrialParamByFeatureAsBool( - omnibox::kRichAutocompletion, - kRichAutocompletionAutocompleteNonPrefixNoInputsWithSpacesParam, false); -} - -size_t OmniboxFieldTrial::RichAutocompletionAutocompleteNonPrefixMinChar() { - return base::GetFieldTrialParamByFeatureAsInt( - omnibox::kRichAutocompletion, - kRichAutocompletionAutocompleteNonPrefixMinCharParam, 0); -} - -bool OmniboxFieldTrial::RichAutocompletionShowAdditionalText() { - return OmniboxFieldTrial::IsRichAutocompletionEnabled() && - base::GetFieldTrialParamByFeatureAsBool( - omnibox::kRichAutocompletion, - kRichAutocompletionShowAdditionalTextParam, true); -} - -bool OmniboxFieldTrial::RichAutocompletionSplitTitleCompletion() { - return OmniboxFieldTrial::IsRichAutocompletionEnabled() && - base::GetFieldTrialParamByFeatureAsBool( - omnibox::kRichAutocompletion, - kRichAutocompletionSplitTitleCompletionParam, false); -} - -bool OmniboxFieldTrial::RichAutocompletionSplitUrlCompletion() { - return OmniboxFieldTrial::IsRichAutocompletionEnabled() && - base::GetFieldTrialParamByFeatureAsBool( - omnibox::kRichAutocompletion, - kRichAutocompletionSplitUrlCompletionParam, false); -} - -size_t OmniboxFieldTrial::RichAutocompletionSplitCompletionMinChar() { - return base::GetFieldTrialParamByFeatureAsInt( - omnibox::kRichAutocompletion, - kRichAutocompletionSplitCompletionMinCharParam, 0); -} - -bool OmniboxFieldTrial::RichAutocompletionCounterfactual() { - return base::GetFieldTrialParamByFeatureAsBool( - omnibox::kRichAutocompletion, kRichAutocompletionCounterfactualParam, - false); -} - -bool OmniboxFieldTrial::RichAutocompletionAutocompletePreferUrlsOverPrefixes() { - return base::GetFieldTrialParamByFeatureAsBool( - omnibox::kRichAutocompletion, - kRichAutocompletionAutocompletePreferUrlsOverPrefixesParam, false); -} +} // namespace OmniboxFieldTrial bool OmniboxFieldTrial::IsOnDeviceHeadSuggestEnabledForIncognito() { return base::FeatureList::IsEnabled(omnibox::kOnDeviceHeadProviderIncognito); @@ -959,43 +956,6 @@ kShortBookmarkSuggestionsByTotalInputLengthThresholdParam[] = "ShortBookmarkSuggestionsByTotalInputLengthThreshold"; -const char OmniboxFieldTrial::kRichAutocompletionAutocompleteTitlesParam[] = - "RichAutocompletionAutocompleteTitles"; -const char OmniboxFieldTrial:: - kRichAutocompletionAutocompleteTitlesShortcutProviderParam[] = - "RichAutocompletionAutocompleteTitlesShortcutProvider"; -const char OmniboxFieldTrial:: - kRichAutocompletionAutocompleteTitlesNoInputsWithSpacesParam[] = - "RichAutocompletionAutocompleteTitlesNoInputsWithSpaces"; -const char - OmniboxFieldTrial::kRichAutocompletionAutocompleteTitlesMinCharParam[] = - "RichAutocompletionAutocompleteTitlesMinChar"; -const char - OmniboxFieldTrial::kRichAutocompletionAutocompleteNonPrefixAllParam[] = - "RichAutocompletionAutocompleteNonPrefixAll"; -const char OmniboxFieldTrial:: - kRichAutocompletionAutocompleteNonPrefixShortcutProviderParam[] = - "RichAutocompletionAutocompleteNonPrefixShortcutProvider"; -const char OmniboxFieldTrial:: - kRichAutocompletionAutocompleteNonPrefixNoInputsWithSpacesParam[] = - "RichAutocompletionAutocompleteNonPrefixNoInputsWithSpaces"; -const char - OmniboxFieldTrial::kRichAutocompletionAutocompleteNonPrefixMinCharParam[] = - "RichAutocompletionAutocompleteNonPrefixMinChar"; -const char OmniboxFieldTrial::kRichAutocompletionShowAdditionalTextParam[] = - "RichAutocompletionAutocompleteShowAdditionalText"; -const char OmniboxFieldTrial::kRichAutocompletionSplitTitleCompletionParam[] = - "RichAutocompletionSplitTitleCompletion"; -const char OmniboxFieldTrial::kRichAutocompletionSplitUrlCompletionParam[] = - "RichAutocompletionSplitUrlCompletion"; -const char OmniboxFieldTrial::kRichAutocompletionSplitCompletionMinCharParam[] = - "RichAutocompletionSplitCompletionMinChar"; -const char OmniboxFieldTrial::kRichAutocompletionCounterfactualParam[] = - "RichAutocompletionCounterfactual"; -const char OmniboxFieldTrial:: - kRichAutocompletionAutocompletePreferUrlsOverPrefixesParam[] = - "RichAutocompletionAutocompletePreferUrlsOverPrefixes"; - const char OmniboxFieldTrial::kOmniboxUIUnelideURLOnHoverThresholdMsParam[] = "OmniboxUIUnelideURLOnHoverThresholdMsdMs";
diff --git a/components/omnibox/browser/omnibox_field_trial.h b/components/omnibox/browser/omnibox_field_trial.h index c9d7d27..c75db9ce 100644 --- a/components/omnibox/browser/omnibox_field_trial.h +++ b/components/omnibox/browser/omnibox_field_trial.h
@@ -14,6 +14,7 @@ #include <vector> #include "base/macros.h" +#include "base/metrics/field_trial_params.h" #include "components/omnibox/browser/autocomplete_input.h" #include "components/omnibox/browser/autocomplete_match_type.h" #include "components/omnibox/browser/autocomplete_provider.h" @@ -390,20 +391,28 @@ // Rich autocompletion. bool IsRichAutocompletionEnabled(); -bool RichAutocompletionAutocompleteTitles(); -bool RichAutocompletionAutocompleteTitlesShortcutProvider(); -bool RichAutocompletionAutocompleteTitlesNoInputsWithSpaces(); -size_t RichAutocompletionAutocompleteTitlesMinChar(); -bool RichAutocompletionAutocompleteNonPrefixAll(); -bool RichAutocompletionAutocompleteNonPrefixShortcutProvider(); -bool RichAutocompletionAutocompleteNonPrefixNoInputsWithSpaces(); -size_t RichAutocompletionAutocompleteNonPrefixMinChar(); +extern const base::FeatureParam<bool> kRichAutocompletionAutocompleteTitles; +extern const base::FeatureParam<bool> + kRichAutocompletionAutocompleteTitlesShortcutProvider; +extern const base::FeatureParam<bool> + kRichAutocompletionAutocompleteTitlesNoInputsWithSpaces; +extern const base::FeatureParam<int> + kRichAutocompletionAutocompleteTitlesMinChar; +extern const base::FeatureParam<bool> + kRichAutocompletionAutocompleteNonPrefixAll; +extern const base::FeatureParam<bool> + kRichAutocompletionAutocompleteNonPrefixShortcutProvider; +extern const base::FeatureParam<bool> + kRichAutocompletionAutocompleteNonPrefixNoInputsWithSpaces; +extern const base::FeatureParam<int> + kRichAutocompletionAutocompleteNonPrefixMinChar; bool RichAutocompletionShowAdditionalText(); -bool RichAutocompletionSplitTitleCompletion(); -bool RichAutocompletionSplitUrlCompletion(); -size_t RichAutocompletionSplitCompletionMinChar(); -bool RichAutocompletionCounterfactual(); -bool RichAutocompletionAutocompletePreferUrlsOverPrefixes(); +extern const base::FeatureParam<bool> kRichAutocompletionSplitTitleCompletion; +extern const base::FeatureParam<bool> kRichAutocompletionSplitUrlCompletion; +extern const base::FeatureParam<int> kRichAutocompletionSplitCompletionMinChar; +extern const base::FeatureParam<bool> kRichAutocompletionCounterfactual; +extern const base::FeatureParam<bool> + kRichAutocompletionAutocompletePreferUrlsOverPrefixes; // On Device Head Suggestions feature and its helper functions. bool IsOnDeviceHeadSuggestEnabledForIncognito(); @@ -528,25 +537,6 @@ kShortBookmarkSuggestionsByTotalInputLengthCounterfactualParam[]; extern const char kShortBookmarkSuggestionsByTotalInputLengthThresholdParam[]; -// Parameter names used for rich autocompletion variations. -extern const char kRichAutocompletionAutocompleteTitlesParam[]; -extern const char kRichAutocompletionAutocompleteTitlesShortcutProviderParam[]; -extern const char - kRichAutocompletionAutocompleteTitlesNoInputsWithSpacesParam[]; -extern const char kRichAutocompletionAutocompleteTitlesMinCharParam[]; -extern const char kRichAutocompletionAutocompleteNonPrefixAllParam[]; -extern const char - kRichAutocompletionAutocompleteNonPrefixShortcutProviderParam[]; -extern const char - kRichAutocompletionAutocompleteNonPrefixNoInputsWithSpacesParam[]; -extern const char kRichAutocompletionAutocompleteNonPrefixMinCharParam[]; -extern const char kRichAutocompletionShowAdditionalTextParam[]; -extern const char kRichAutocompletionSplitTitleCompletionParam[]; -extern const char kRichAutocompletionSplitUrlCompletionParam[]; -extern const char kRichAutocompletionSplitCompletionMinCharParam[]; -extern const char kRichAutocompletionCounterfactualParam[]; -extern const char kRichAutocompletionAutocompletePreferUrlsOverPrefixesParam[]; - // Parameter names used by omnibox experiments that hide the path (and // optionally subdomains) in the steady state. extern const char kOmniboxUIUnelideURLOnHoverThresholdMsParam[];
diff --git a/components/omnibox/browser/omnibox_prefs.cc b/components/omnibox/browser/omnibox_prefs.cc index 8804a4a3..9aeeffeb 100644 --- a/components/omnibox/browser/omnibox_prefs.cc +++ b/components/omnibox/browser/omnibox_prefs.cc
@@ -9,6 +9,7 @@ #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/values.h" +#include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" #include "components/prefs/scoped_user_pref_update.h" @@ -47,7 +48,9 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) { registry->RegisterDictionaryPref(kSuggestionGroupVisibility); - registry->RegisterBooleanPref(kKeywordSpaceTriggeringEnabled, true); + registry->RegisterBooleanPref( + kKeywordSpaceTriggeringEnabled, true, + user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); } SuggestionGroupVisibility GetUserPreferenceForSuggestionGroupVisibility(
diff --git a/components/omnibox/browser/omnibox_view.cc b/components/omnibox/browser/omnibox_view.cc index dae56f0c..c0bd69ec 100644 --- a/components/omnibox/browser/omnibox_view.cc +++ b/components/omnibox/browser/omnibox_view.cc
@@ -35,11 +35,11 @@ // Return true if either non prefix or split autocompletion is enabled. bool RichAutocompletionEitherNonPrefixOrSplitEnabled() { - return OmniboxFieldTrial::RichAutocompletionAutocompleteNonPrefixAll() || + return OmniboxFieldTrial::kRichAutocompletionAutocompleteNonPrefixAll.Get() || OmniboxFieldTrial:: - RichAutocompletionAutocompleteNonPrefixShortcutProvider() || - OmniboxFieldTrial::RichAutocompletionSplitTitleCompletion() || - OmniboxFieldTrial::RichAutocompletionSplitUrlCompletion(); + kRichAutocompletionAutocompleteNonPrefixShortcutProvider.Get() || + OmniboxFieldTrial::kRichAutocompletionSplitTitleCompletion.Get() || + OmniboxFieldTrial::kRichAutocompletionSplitUrlCompletion.Get(); } } // namespace
diff --git a/components/omnibox/browser/omnibox_view_unittest.cc b/components/omnibox/browser/omnibox_view_unittest.cc index 65acfb1..0790503af 100644 --- a/components/omnibox/browser/omnibox_view_unittest.cc +++ b/components/omnibox/browser/omnibox_view_unittest.cc
@@ -270,7 +270,7 @@ base::test::ScopedFeatureList feature_list; feature_list.InitAndEnableFeatureWithParameters( omnibox::kRichAutocompletion, - {{OmniboxFieldTrial::kRichAutocompletionAutocompleteNonPrefixAllParam, + {{OmniboxFieldTrial::kRichAutocompletionAutocompleteNonPrefixAll.name, "true"}}); // Cases with single selection
diff --git a/components/password_manager/content/browser/bad_message.cc b/components/password_manager/content/browser/bad_message.cc index a308fb8..d68b2f9 100644 --- a/components/password_manager/content/browser/bad_message.cc +++ b/components/password_manager/content/browser/bad_message.cc
@@ -56,19 +56,36 @@ return true; } +bool CheckChildProcessSecurityPolicy(content::RenderFrameHost* frame, + const PasswordForm& password_form, + BadMessageReason reason) { + return CheckChildProcessSecurityPolicyForURL(frame, password_form.url, + reason) && + CheckChildProcessSecurityPolicyForURL( + frame, GURL(password_form.signon_realm), reason) && + CheckChildProcessSecurityPolicyForURL( + frame, password_form.form_data.url, reason); +} + +bool CheckChildProcessSecurityPolicy(content::RenderFrameHost* frame, + const std::vector<PasswordForm>& forms, + BadMessageReason reason) { + for (const auto& form : forms) { + if (!bad_message::CheckChildProcessSecurityPolicy(frame, form, reason)) + return false; + } + return true; +} + bool CheckChildProcessSecurityPolicy( content::RenderFrameHost* frame, - base::span<const autofill::FormData> forms_data, + const std::vector<autofill::FormData>& forms_data, BadMessageReason reason) { for (const auto& form_data : forms_data) { if (!bad_message::CheckChildProcessSecurityPolicyForURL( frame, form_data.url, reason)) { return false; } - if (!bad_message::CheckChildProcessSecurityPolicyForURL( - frame, form_data.full_url, reason)) { - return false; - } } return true; }
diff --git a/components/password_manager/content/browser/bad_message.h b/components/password_manager/content/browser/bad_message.h index 52caae8..06b2f97 100644 --- a/components/password_manager/content/browser/bad_message.h +++ b/components/password_manager/content/browser/bad_message.h
@@ -5,7 +5,8 @@ #ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_BAD_MESSAGE_H_ #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_BAD_MESSAGE_H_ -#include "base/containers/span.h" +#include <vector> + #include "components/autofill/core/common/form_data.h" namespace content { @@ -14,6 +15,8 @@ namespace password_manager { +struct PasswordForm; + // The browser process often chooses to terminate a renderer if it receives // a bad IPC message. The reasons are tracked for metrics. // @@ -36,8 +39,6 @@ CPMD_BAD_ORIGIN_SHOW_MANUAL_PASSWORD_GENERATION_POPUP = 11, CPMD_BAD_ORIGIN_SHOW_PASSWORD_EDITING_POPUP = 12, CPMD_BAD_ORIGIN_GENERATION_AVAILABLE_FOR_FORM = 13, - CPMD_BAD_ORIGIN_PASSWORD_FORM_CLEARED = 14, - CPMD_BAD_ORIGIN_CHECK_SAFE_BROWSING_REPUTATION = 15, // Please add new elements here. The naming convention is abbreviated class // name (e.g. ContentPasswordManagerDriver becomes CPMD) plus a unique @@ -56,9 +57,23 @@ const GURL& form_url, BadMessageReason reason); +// Returns true if the renderer for |frame| is allowed to perform an operation +// on |password_form|. If the origin mismatches, the process for |frame| is +// terminated and the function returns false. +// TODO: Delete this signature after transferring all driver calls to FormData +bool CheckChildProcessSecurityPolicy(content::RenderFrameHost* frame, + const PasswordForm& password_form, + BadMessageReason reason); + +// Same as above but checks every form in |forms|. +// TODO: Delete this signature after transferring all driver calls to FormData +bool CheckChildProcessSecurityPolicy(content::RenderFrameHost* frame, + const std::vector<PasswordForm>& forms, + BadMessageReason reason); + bool CheckChildProcessSecurityPolicy( content::RenderFrameHost* frame, - base::span<const autofill::FormData> forms_data, + const std::vector<autofill::FormData>& forms_data, BadMessageReason reason); } // namespace bad_message
diff --git a/components/password_manager/content/browser/content_password_manager_driver.cc b/components/password_manager/content/browser/content_password_manager_driver.cc index e3f83a1..6121030 100644 --- a/components/password_manager/content/browser/content_password_manager_driver.cc +++ b/components/password_manager/content/browser/content_password_manager_driver.cc
@@ -216,7 +216,7 @@ void ContentPasswordManagerDriver::PasswordFormsParsed( const std::vector<autofill::FormData>& forms_data) { if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( - render_frame_host_, base::make_span(forms_data), + render_frame_host_, forms_data, BadMessageReason::CPMD_BAD_ORIGIN_FORMS_PARSED)) return; GetPasswordManager()->OnPasswordFormsParsed(this, forms_data); @@ -226,7 +226,7 @@ const std::vector<autofill::FormData>& visible_forms_data, bool did_stop_loading) { if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( - render_frame_host_, base::make_span(visible_forms_data), + render_frame_host_, visible_forms_data, BadMessageReason::CPMD_BAD_ORIGIN_FORMS_RENDERED)) return; GetPasswordManager()->OnPasswordFormsRendered(this, visible_forms_data, @@ -235,8 +235,8 @@ void ContentPasswordManagerDriver::PasswordFormSubmitted( const autofill::FormData& form_data) { - if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( - render_frame_host_, base::make_span(&form_data, 1), + if (!password_manager::bad_message::CheckChildProcessSecurityPolicyForURL( + render_frame_host_, form_data.url, BadMessageReason::CPMD_BAD_ORIGIN_FORM_SUBMITTED)) return; GetPasswordManager()->OnPasswordFormSubmitted(this, form_data); @@ -246,8 +246,8 @@ void ContentPasswordManagerDriver::InformAboutUserInput( const autofill::FormData& form_data) { - if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( - render_frame_host_, base::make_span(&form_data, 1), + if (!password_manager::bad_message::CheckChildProcessSecurityPolicyForURL( + render_frame_host_, form_data.url, BadMessageReason::CPMD_BAD_ORIGIN_UPON_USER_INPUT_CHANGE)) return; GetPasswordManager()->OnInformAboutUserInput(this, form_data); @@ -276,10 +276,6 @@ void ContentPasswordManagerDriver::PasswordFormCleared( const autofill::FormData& form_data) { - if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( - render_frame_host_, base::make_span(&form_data, 1), - BadMessageReason::CPMD_BAD_ORIGIN_PASSWORD_FORM_CLEARED)) - return; GetPasswordManager()->OnPasswordFormCleared(this, form_data); } @@ -317,10 +313,6 @@ void ContentPasswordManagerDriver::CheckSafeBrowsingReputation( const GURL& form_action, const GURL& frame_url) { - if (!password_manager::bad_message::CheckChildProcessSecurityPolicyForURL( - render_frame_host_, frame_url, - BadMessageReason::CPMD_BAD_ORIGIN_CHECK_SAFE_BROWSING_REPUTATION)) - return; // Despite the name, this method is only called on password fields. // (See PasswordAutofillAgent::MaybeCheckSafeBrowsingReputation()) if (client_->GetMetricsRecorder()) {
diff --git a/components/payments/content/payment_app.h b/components/payments/content/payment_app.h index d47b706..9836d0e 100644 --- a/components/payments/content/payment_app.h +++ b/components/payments/content/payment_app.h
@@ -17,6 +17,7 @@ #include "components/payments/core/payer_data.h" #include "services/metrics/public/cpp/ukm_source_id.h" #include "third_party/blink/public/mojom/payments/payment_app.mojom.h" +#include "third_party/blink/public/mojom/payments/payment_handler_host.mojom.h" #include "third_party/skia/include/core/SkBitmap.h" namespace payments {
diff --git a/components/permissions/permission_request_id.cc b/components/permissions/permission_request_id.cc index cc9a91e..fee82df 100644 --- a/components/permissions/permission_request_id.cc +++ b/components/permissions/permission_request_id.cc
@@ -4,6 +4,7 @@ #include "components/permissions/permission_request_id.h" +#include <inttypes.h> #include <stdint.h> #include "base/strings/stringprintf.h"
diff --git a/components/plugins/OWNERS b/components/plugins/OWNERS index 94de159..c5978ea 100644 --- a/components/plugins/OWNERS +++ b/components/plugins/OWNERS
@@ -1 +1,2 @@ tommycli@chromium.org +dtapuska@chromium.org
diff --git a/components/plugins/renderer/webview_plugin.cc b/components/plugins/renderer/webview_plugin.cc index 1708309..330c99f8 100644 --- a/components/plugins/renderer/webview_plugin.cc +++ b/components/plugins/renderer/webview_plugin.cc
@@ -60,7 +60,7 @@ focused_(false), is_painting_(false), is_resizing_(false), - web_view_helper_(this, preferences) {} + web_view_helper_(this, preferences, web_view->GetRendererPreferences()) {} // static WebViewPlugin* WebViewPlugin::Create(WebView* web_view, @@ -258,8 +258,10 @@ error_ = std::make_unique<WebURLError>(error); } -WebViewPlugin::WebViewHelper::WebViewHelper(WebViewPlugin* plugin, - const WebPreferences& preferences) +WebViewPlugin::WebViewHelper::WebViewHelper( + WebViewPlugin* plugin, + const WebPreferences& parent_web_preferences, + const blink::RendererPreferences& parent_renderer_preferences) : plugin_(plugin), agent_group_scheduler_( blink::scheduler::WebThreadScheduler::MainThreadScheduler() @@ -275,11 +277,10 @@ /*session_storage_namespace_id=*/base::EmptyString()); // ApplyWebPreferences before making a WebLocalFrame so that the frame sees a // consistent view of our preferences. - blink::WebView::ApplyWebPreferences(preferences, web_view_); + blink::WebView::ApplyWebPreferences(parent_web_preferences, web_view_); // Turn off AcceptLoadDrops for this plugin webview. - blink::RendererPreferences renderer_preferences = - web_view_->GetRendererPreferences(); + blink::RendererPreferences renderer_preferences = parent_renderer_preferences; renderer_preferences.can_accept_load_drops = false; web_view_->SetRendererPreferences(renderer_preferences);
diff --git a/components/plugins/renderer/webview_plugin.h b/components/plugins/renderer/webview_plugin.h index 431cebf..6607978 100644 --- a/components/plugins/renderer/webview_plugin.h +++ b/components/plugins/renderer/webview_plugin.h
@@ -160,8 +160,10 @@ public blink::WebLocalFrameClient, public blink::mojom::WidgetHost { public: - WebViewHelper(WebViewPlugin* plugin, - const blink::web_pref::WebPreferences& preferences); + WebViewHelper( + WebViewPlugin* plugin, + const blink::web_pref::WebPreferences& parent_web_preferences, + const blink::RendererPreferences& parent_renderer_preferences); ~WebViewHelper() override; blink::WebView* web_view() { return web_view_; }
diff --git a/components/policy/core/common/cloud/machine_level_user_cloud_policy_store.cc b/components/policy/core/common/cloud/machine_level_user_cloud_policy_store.cc index f5ed0c6..2fd8000a 100644 --- a/components/policy/core/common/cloud/machine_level_user_cloud_policy_store.cc +++ b/components/policy/core/common/cloud/machine_level_user_cloud_policy_store.cc
@@ -8,6 +8,7 @@ #include "base/files/file_path.h" #include "base/logging.h" +#include "build/build_config.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h" #include "components/policy/core/common/cloud/cloud_policy_util.h" #include "components/policy/core/common/cloud/dm_token.h" @@ -92,10 +93,28 @@ } void MachineLevelUserCloudPolicyStore::LoadImmediately() { - // There is no global dm token, stop loading the policy cache. The policy will - // be fetched in the end of enrollment process. + // There is no global dm token, stop loading the policy cache in order to + // avoid an unnecessary disk access. Policies will be fetched after enrollment + // succeeded. if (!machine_dm_token_.is_valid()) { VLOG(1) << "LoadImmediately ignored, no DM token present."; +#if defined(OS_ANDROID) + // On Android, some dependencies (e.g. FirstRunActivity) are blocked until + // the PolicyService is initialized, which waits on all policy providers to + // indicate that policies are available. + // + // When cloud enrollment is not mandatory, machine-level cloud policies are + // loaded asynchronously and will be applied once they are fetched from the + // server. To avoid blocking those dependencies on Android, notify that the + // PolicyService initialization doesn't need to wait on cloud policies by + // sending out an empty policy set. + // + // The call to |PolicyLoaded| is exactly the same that would happen if this + // disk access optimization was not implemented. + PolicyLoadResult result; + result.status = policy::LOAD_RESULT_NO_POLICY_FILE; + PolicyLoaded(/*validate_in_background=*/false, result); +#endif // defined(OS_ANDROID) return; } VLOG(1) << "Load policy cache Immediately.";
diff --git a/components/policy/core/common/cloud/machine_level_user_cloud_policy_store_unittest.cc b/components/policy/core/common/cloud/machine_level_user_cloud_policy_store_unittest.cc index ad7f366..f7966b5 100644 --- a/components/policy/core/common/cloud/machine_level_user_cloud_policy_store_unittest.cc +++ b/components/policy/core/common/cloud/machine_level_user_cloud_policy_store_unittest.cc
@@ -11,6 +11,7 @@ #include "base/run_loop.h" #include "base/test/task_environment.h" #include "base/threading/thread_task_runner_handle.h" +#include "build/build_config.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h" #include "components/policy/core/common/cloud/cloud_policy_util.h" #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" @@ -138,7 +139,11 @@ EXPECT_FALSE(store_->policy()); EXPECT_TRUE(store_->policy_map().empty()); +#if defined(OS_ANDROID) + EXPECT_CALL(observer_, OnStoreLoaded(_)).Times(1); +#else EXPECT_CALL(observer_, OnStoreLoaded(_)).Times(0); +#endif EXPECT_CALL(observer_, OnStoreError(_)).Times(0); store_->LoadImmediately();
diff --git a/components/power_scheduler/power_mode_arbiter_unittest.cc b/components/power_scheduler/power_mode_arbiter_unittest.cc index 3bfa784..c2a5b88 100644 --- a/components/power_scheduler/power_mode_arbiter_unittest.cc +++ b/components/power_scheduler/power_mode_arbiter_unittest.cc
@@ -64,54 +64,154 @@ // Charging trumps anything. vote_and_expect(PowerMode::kCharging, PowerMode::kIdle, PowerMode::kCharging); + vote_and_expect(PowerMode::kCharging, PowerMode::kNopAnimation, + PowerMode::kCharging); vote_and_expect(PowerMode::kCharging, PowerMode::kAudible, PowerMode::kCharging); + vote_and_expect(PowerMode::kCharging, PowerMode::kVideoPlayback, + PowerMode::kCharging); + vote_and_expect(PowerMode::kCharging, PowerMode::kMainThreadAnimation, + PowerMode::kCharging); vote_and_expect(PowerMode::kCharging, PowerMode::kLoading, PowerMode::kCharging); vote_and_expect(PowerMode::kCharging, PowerMode::kAnimation, PowerMode::kCharging); + vote_and_expect(PowerMode::kCharging, PowerMode::kLoadingAnimation, + PowerMode::kCharging); vote_and_expect(PowerMode::kCharging, PowerMode::kResponse, PowerMode::kCharging); + vote_and_expect(PowerMode::kCharging, PowerMode::kNonWebActivity, + PowerMode::kCharging); vote_and_expect(PowerMode::kCharging, PowerMode::kBackground, PowerMode::kCharging); // Background trumps remaining modes, but not audible. vote_and_expect(PowerMode::kBackground, PowerMode::kIdle, PowerMode::kBackground); + vote_and_expect(PowerMode::kBackground, PowerMode::kNopAnimation, + PowerMode::kBackground); vote_and_expect(PowerMode::kBackground, PowerMode::kAudible, PowerMode::kAudible); + vote_and_expect(PowerMode::kBackground, PowerMode::kVideoPlayback, + PowerMode::kBackground); + vote_and_expect(PowerMode::kBackground, PowerMode::kMainThreadAnimation, + PowerMode::kBackground); vote_and_expect(PowerMode::kBackground, PowerMode::kLoading, PowerMode::kBackground); vote_and_expect(PowerMode::kBackground, PowerMode::kAnimation, PowerMode::kBackground); + vote_and_expect(PowerMode::kBackground, PowerMode::kLoadingAnimation, + PowerMode::kBackground); vote_and_expect(PowerMode::kBackground, PowerMode::kResponse, PowerMode::kBackground); + vote_and_expect(PowerMode::kBackground, PowerMode::kNonWebActivity, + PowerMode::kBackground); + + // NonWebActivity trumps remaining modes. + vote_and_expect(PowerMode::kNonWebActivity, PowerMode::kIdle, + PowerMode::kNonWebActivity); + vote_and_expect(PowerMode::kNonWebActivity, PowerMode::kNopAnimation, + PowerMode::kNonWebActivity); + vote_and_expect(PowerMode::kNonWebActivity, PowerMode::kAudible, + PowerMode::kNonWebActivity); + vote_and_expect(PowerMode::kNonWebActivity, PowerMode::kVideoPlayback, + PowerMode::kNonWebActivity); + vote_and_expect(PowerMode::kNonWebActivity, PowerMode::kMainThreadAnimation, + PowerMode::kNonWebActivity); + vote_and_expect(PowerMode::kNonWebActivity, PowerMode::kLoading, + PowerMode::kNonWebActivity); + vote_and_expect(PowerMode::kNonWebActivity, PowerMode::kAnimation, + PowerMode::kNonWebActivity); + vote_and_expect(PowerMode::kNonWebActivity, PowerMode::kLoadingAnimation, + PowerMode::kNonWebActivity); + vote_and_expect(PowerMode::kNonWebActivity, PowerMode::kResponse, + PowerMode::kNonWebActivity); // Response trumps remaining modes. vote_and_expect(PowerMode::kResponse, PowerMode::kIdle, PowerMode::kResponse); + vote_and_expect(PowerMode::kResponse, PowerMode::kNopAnimation, + PowerMode::kResponse); vote_and_expect(PowerMode::kResponse, PowerMode::kAudible, PowerMode::kResponse); + vote_and_expect(PowerMode::kResponse, PowerMode::kVideoPlayback, + PowerMode::kResponse); + vote_and_expect(PowerMode::kResponse, PowerMode::kMainThreadAnimation, + PowerMode::kResponse); vote_and_expect(PowerMode::kResponse, PowerMode::kLoading, PowerMode::kResponse); vote_and_expect(PowerMode::kResponse, PowerMode::kAnimation, PowerMode::kResponse); + vote_and_expect(PowerMode::kResponse, PowerMode::kLoadingAnimation, + PowerMode::kResponse); + + // LoadingAnimation trumps remaining modes. + vote_and_expect(PowerMode::kLoadingAnimation, PowerMode::kIdle, + PowerMode::kLoadingAnimation); + vote_and_expect(PowerMode::kLoadingAnimation, PowerMode::kNopAnimation, + PowerMode::kLoadingAnimation); + vote_and_expect(PowerMode::kLoadingAnimation, PowerMode::kAudible, + PowerMode::kLoadingAnimation); + vote_and_expect(PowerMode::kLoadingAnimation, PowerMode::kVideoPlayback, + PowerMode::kLoadingAnimation); + vote_and_expect(PowerMode::kLoadingAnimation, PowerMode::kMainThreadAnimation, + PowerMode::kLoadingAnimation); + vote_and_expect(PowerMode::kLoadingAnimation, PowerMode::kLoading, + PowerMode::kLoadingAnimation); + vote_and_expect(PowerMode::kLoadingAnimation, PowerMode::kAnimation, + PowerMode::kLoadingAnimation); // Animation trumps remaining modes. vote_and_expect(PowerMode::kAnimation, PowerMode::kIdle, PowerMode::kAnimation); + vote_and_expect(PowerMode::kAnimation, PowerMode::kNopAnimation, + PowerMode::kAnimation); vote_and_expect(PowerMode::kAnimation, PowerMode::kAudible, PowerMode::kAnimation); + vote_and_expect(PowerMode::kAnimation, PowerMode::kVideoPlayback, + PowerMode::kAnimation); + vote_and_expect(PowerMode::kAnimation, PowerMode::kMainThreadAnimation, + PowerMode::kAnimation); // Animation while loading breaks out into a separate mode. vote_and_expect(PowerMode::kAnimation, PowerMode::kLoading, PowerMode::kLoadingAnimation); // Loading trumps remaining modes. vote_and_expect(PowerMode::kLoading, PowerMode::kIdle, PowerMode::kLoading); + vote_and_expect(PowerMode::kLoading, PowerMode::kNopAnimation, + PowerMode::kLoading); vote_and_expect(PowerMode::kLoading, PowerMode::kAudible, PowerMode::kLoading); + vote_and_expect(PowerMode::kLoading, PowerMode::kVideoPlayback, + PowerMode::kLoading); + vote_and_expect(PowerMode::kLoading, PowerMode::kMainThreadAnimation, + PowerMode::kLoading); - // Audible trumps idle. + // MainThreadAnimation trumps remaining modes. + vote_and_expect(PowerMode::kMainThreadAnimation, PowerMode::kIdle, + PowerMode::kMainThreadAnimation); + vote_and_expect(PowerMode::kMainThreadAnimation, PowerMode::kNopAnimation, + PowerMode::kMainThreadAnimation); + vote_and_expect(PowerMode::kMainThreadAnimation, PowerMode::kAudible, + PowerMode::kMainThreadAnimation); + vote_and_expect(PowerMode::kMainThreadAnimation, PowerMode::kVideoPlayback, + PowerMode::kMainThreadAnimation); + + // VideoPlayback trumps remaining modes. + vote_and_expect(PowerMode::kVideoPlayback, PowerMode::kIdle, + PowerMode::kVideoPlayback); + vote_and_expect(PowerMode::kVideoPlayback, PowerMode::kNopAnimation, + PowerMode::kVideoPlayback); + vote_and_expect(PowerMode::kVideoPlayback, PowerMode::kAudible, + PowerMode::kVideoPlayback); + + // Audible trumps idle and no-op animation. vote_and_expect(PowerMode::kAudible, PowerMode::kIdle, PowerMode::kAudible); + vote_and_expect(PowerMode::kAudible, PowerMode::kNopAnimation, + PowerMode::kAudible); + + // NopAnimation trumps idle. + vote_and_expect(PowerMode::kNopAnimation, PowerMode::kIdle, + PowerMode::kNopAnimation); } namespace {
diff --git a/components/safe_browsing/content/web_ui/safe_browsing_ui.cc b/components/safe_browsing/content/web_ui/safe_browsing_ui.cc index dae6302..17cfe58 100644 --- a/components/safe_browsing/content/web_ui/safe_browsing_ui.cc +++ b/components/safe_browsing/content/web_ui/safe_browsing_ui.cc
@@ -790,6 +790,8 @@ return "DANGEROUS_HOST"; case ClientDownloadResponse::UNKNOWN: return "UNKNOWN"; + case ClientDownloadResponse::DANGEROUS_ACCOUNT_COMPROMISE: + return "DANGEROUS_ACCOUNT_COMPROMISE"; } }
diff --git a/components/safe_browsing/core/features.cc b/components/safe_browsing/core/features.cc index 08818a1..f07f934 100644 --- a/components/safe_browsing/core/features.cc +++ b/components/safe_browsing/core/features.cc
@@ -92,6 +92,9 @@ const base::Feature kPromptEsbForDeepScanning{ "SafeBrowsingPromptEsbForDeepScanning", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kSafeBrowsingCTDownloadWarning{ + "SafeBrowsingCTDownloadWarning", base::FEATURE_DISABLED_BY_DEFAULT}; + const base::Feature kSafeBrowsingEnterpriseCsd{ "SafeBrowsingEnterpriseCsd", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/components/safe_browsing/core/features.h b/components/safe_browsing/core/features.h index 8676247..576d43f 100644 --- a/components/safe_browsing/core/features.h +++ b/components/safe_browsing/core/features.h
@@ -83,8 +83,12 @@ // scanning. extern const base::Feature kPromptEsbForDeepScanning; -// Controls whether we are performing enterprise download checks for users with -// the appropriate policies enabled. +// Contros whether users will see an account compromise specific warning +// when Safe Browsing determines a file is associated with stealing cookies. +extern const base::Feature kSafeBrowsingCTDownloadWarning; + +// Controls whether we are performing enterprise download checks for users +// with the appropriate policies enabled. extern const base::Feature kSafeBrowsingEnterpriseCsd; // Controls whether we are disabling consumer download checks for users using
diff --git a/components/safe_browsing/core/proto/csd.proto b/components/safe_browsing/core/proto/csd.proto index d413eda..7fcd43a 100644 --- a/components/safe_browsing/core/proto/csd.proto +++ b/components/safe_browsing/core/proto/csd.proto
@@ -981,6 +981,9 @@ // The backend doesn't have confidence in its verdict of this file. // Chrome should show the default warning if configured for this file type. UNKNOWN = 5; + // Download is associated with stealing cookies and account compromise. + // Chrome should show a severe warning. + DANGEROUS_ACCOUNT_COMPROMISE = 8; } optional Verdict verdict = 1 [default = SAFE];
diff --git a/components/services/filesystem/directory_impl_unittest.cc b/components/services/filesystem/directory_impl_unittest.cc index e84a376..66c4279e 100644 --- a/components/services/filesystem/directory_impl_unittest.cc +++ b/components/services/filesystem/directory_impl_unittest.cc
@@ -13,6 +13,7 @@ #include "base/test/task_environment.h" #include "components/services/filesystem/directory_test_helper.h" #include "components/services/filesystem/public/mojom/directory.mojom.h" +#include "components/services/filesystem/public/mojom/file.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/remote.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/components/services/filesystem/file_impl.h b/components/services/filesystem/file_impl.h index f48dc58..f8864bb3 100644 --- a/components/services/filesystem/file_impl.h +++ b/components/services/filesystem/file_impl.h
@@ -12,6 +12,7 @@ #include "base/macros.h" #include "build/build_config.h" #include "components/services/filesystem/public/mojom/directory.mojom.h" +#include "components/services/filesystem/public/mojom/file.mojom.h" namespace base { class FilePath;
diff --git a/components/services/filesystem/file_impl_unittest.cc b/components/services/filesystem/file_impl_unittest.cc index 2553c24..97f7710 100644 --- a/components/services/filesystem/file_impl_unittest.cc +++ b/components/services/filesystem/file_impl_unittest.cc
@@ -12,6 +12,7 @@ #include "base/test/task_environment.h" #include "components/services/filesystem/directory_test_helper.h" #include "components/services/filesystem/public/mojom/directory.mojom.h" +#include "components/services/filesystem/public/mojom/file.mojom.h" #include "mojo/public/cpp/bindings/remote.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/components/shared_highlighting/core/common/shared_highlighting_metrics.cc b/components/shared_highlighting/core/common/shared_highlighting_metrics.cc index a30e7833..ba30c06a 100644 --- a/components/shared_highlighting/core/common/shared_highlighting_metrics.cc +++ b/components/shared_highlighting/core/common/shared_highlighting_metrics.cc
@@ -22,6 +22,11 @@ } // namespace +void LogDesktopLinkGenerationCopiedLinkType(LinkGenerationCopiedLinkType type) { + base::UmaHistogramEnumeration("SharedHighlights.Desktop.CopiedLinkType", + type); +} + void LogLinkGenerationErrorReason(LinkGenerationError reason) { base::UmaHistogramEnumeration("SharedHighlights.LinkGenerated.Error", reason); }
diff --git a/components/shared_highlighting/core/common/shared_highlighting_metrics.h b/components/shared_highlighting/core/common/shared_highlighting_metrics.h index ce3ff6f..ec12893 100644 --- a/components/shared_highlighting/core/common/shared_highlighting_metrics.h +++ b/components/shared_highlighting/core/common/shared_highlighting_metrics.h
@@ -14,6 +14,16 @@ // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. +// The type of copied Shared Highlighting Link on Desktop. +// Update corresponding |LinkGenerationCopiedLinkType| in enums.xml. +enum class LinkGenerationCopiedLinkType { + kCopiedFromNewGeneration = 0, + kCopiedFromExistingHighlight = 1, + kMaxValue = kCopiedFromExistingHighlight +}; + +// These values are persisted to logs. Entries should not be renumbered and +// numeric values should never be reused. // The type of errors that can happen during link generation. // Update corresponding |LinkGenerationError| in enums.xml. enum class LinkGenerationError { @@ -55,6 +65,9 @@ kMaxValue = kSearchEngine, }; +// Records the type of link generation that was copied on desktop. +void LogDesktopLinkGenerationCopiedLinkType(LinkGenerationCopiedLinkType type); + // Records the reason why the link generation failed. void LogLinkGenerationErrorReason(LinkGenerationError reason);
diff --git a/components/sync/driver/trusted_vault_client.h b/components/sync/driver/trusted_vault_client.h index 68be0fe0..f2f46e7 100644 --- a/components/sync/driver/trusted_vault_client.h +++ b/components/sync/driver/trusted_vault_client.h
@@ -46,8 +46,6 @@ // Attempts to fetch decryption keys, required by sync to resume. // Implementations are expected to NOT prompt the user for actions. |cb| is // called on completion with known keys or an empty list if none known. - // Concurrent calls to FetchKeys() must not be issued since implementations - // may not support them. virtual void FetchKeys( const CoreAccountInfo& account_info, base::OnceCallback<void(const std::vector<std::vector<uint8_t>>&)> @@ -58,8 +56,10 @@ // the provided keys are not up-to-date. |cb| is run upon completion and // returns false if the call did not make any difference (e.g. the operation // is unsupported) or true if some change may have occurred (which indicates a - // second FetchKeys() attempt is worth). Concurrent calls to MarkKeysAsStale() - // must not be issued since implementations may not support them. + // second FetchKeys() attempt is worth). During the execution, before |cb| is + // invoked, the behavior is unspecified if FetchKeys() is invoked, that is, + // FetchKeys() may or may not treat existing keys as stale (only guaranteed + // upon completion of MarkKeysAsStale()). virtual void MarkKeysAsStale(const CoreAccountInfo& account_info, base::OnceCallback<void(bool)> cb) = 0;
diff --git a/components/sync/engine/sync_manager_impl_unittest.cc b/components/sync/engine/sync_manager_impl_unittest.cc index dfced03..b0b1466 100644 --- a/components/sync/engine/sync_manager_impl_unittest.cc +++ b/components/sync/engine/sync_manager_impl_unittest.cc
@@ -17,6 +17,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/test/gmock_move_support.h" +#include "base/test/mock_callback.h" #include "base/test/task_environment.h" #include "base/test/values_test_util.h" #include "base/values.h" @@ -41,7 +42,6 @@ #include "components/sync/protocol/preference_specifics.pb.h" #include "components/sync/protocol/proto_value_conversions.h" #include "components/sync/protocol/sync.pb.h" -#include "components/sync/test/callback_counter.h" #include "components/sync/test/engine/fake_sync_scheduler.h" #include "components/sync/test/engine/test_engine_components_factory.h" #include "components/sync/test/fake_sync_encryption_handler.h" @@ -52,12 +52,7 @@ #include "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h" #include "url/gurl.h" -using base::ExpectDictStringValue; using testing::_; -using testing::DoAll; -using testing::InSequence; -using testing::Return; -using testing::SaveArg; using testing::StrictMock; namespace syncer { @@ -101,15 +96,10 @@ OnSyncCycleCompleted, (const SyncCycleSnapshot&), (override)); - // NOLINT MOCK_METHOD(void, OnConnectionStatusChange, (ConnectionStatus), (override)); - // NOLINT MOCK_METHOD(void, OnActionableError, (const SyncProtocolError&), (override)); - // NOLINT MOCK_METHOD(void, OnMigrationRequested, (ModelTypeSet), (override)); - // NOLINT MOCK_METHOD(void, OnProtocolEvent, (const ProtocolEvent&), (override)); - // NOLINT }; class SyncEncryptionHandlerObserverMock @@ -119,52 +109,72 @@ OnPassphraseRequired, (const KeyDerivationParams&, const sync_pb::EncryptedData&), (override)); - // NOLINT MOCK_METHOD(void, OnPassphraseAccepted, (), (override)); - // NOLINT MOCK_METHOD(void, OnTrustedVaultKeyRequired, (), (override)); - // NOLINT MOCK_METHOD(void, OnTrustedVaultKeyAccepted, (), (override)); - // NOLINT MOCK_METHOD(void, OnBootstrapTokenUpdated, (const std::string&, BootstrapTokenType type), (override)); - // NOLINT MOCK_METHOD(void, OnEncryptedTypesChanged, (ModelTypeSet, bool), (override)); - // NOLINT MOCK_METHOD(void, OnCryptographerStateChanged, (Cryptographer*, bool), (override)); - // NOLINT MOCK_METHOD(void, OnPassphraseTypeChanged, (PassphraseType, base::Time), (override)); - // NOLINT }; -} // namespace +class MockSyncScheduler : public FakeSyncScheduler { + public: + MockSyncScheduler() = default; + ~MockSyncScheduler() override = default; + MOCK_METHOD(void, Start, (SyncScheduler::Mode, base::Time), (override)); + MOCK_METHOD(void, ScheduleConfiguration, (ConfigurationParams), (override)); +}; -class SyncManagerTest : public testing::Test { +class ComponentsFactory : public TestEngineComponentsFactory { + public: + explicit ComponentsFactory(std::unique_ptr<SyncScheduler> scheduler_to_use) + : scheduler_to_use_(std::move(scheduler_to_use)) {} + ~ComponentsFactory() override = default; + + std::unique_ptr<SyncScheduler> BuildScheduler( + const std::string& name, + SyncCycleContext* context, + CancelationSignal* stop_handle, + bool local_sync_backend_enabled) override { + DCHECK(scheduler_to_use_); + return std::move(scheduler_to_use_); + } + + private: + std::unique_ptr<SyncScheduler> scheduler_to_use_; +}; + +class SyncManagerImplTest : public testing::Test { protected: - SyncManagerTest() + SyncManagerImplTest() : sync_manager_("Test sync manager", network::TestNetworkConnectionTracker::GetInstance()) {} - ~SyncManagerTest() override {} + ~SyncManagerImplTest() override = default; - virtual void DoSetUp(bool enable_local_sync_backend) { + void SetUp() { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); extensions_activity_ = new ExtensionsActivity(); sync_manager_.AddObserver(&manager_observer_); + // Save raw pointers to the objects that won't be owned by the fixture. auto encryption_observer = std::make_unique<StrictMock<SyncEncryptionHandlerObserverMock>>(); encryption_observer_ = encryption_observer.get(); + auto scheduler = std::make_unique<MockSyncScheduler>(); + scheduler_ = scheduler.get(); SyncManager::InitArgs args; args.service_url = GURL("https://example.com/"); @@ -173,9 +183,10 @@ args.extensions_activity = extensions_activity_.get(); args.cache_guid = "fake_cache_guid"; args.invalidator_client_id = "fake_invalidator_client_id"; - args.enable_local_sync_backend = enable_local_sync_backend; + args.enable_local_sync_backend = false; args.local_sync_backend_folder = temp_dir_.GetPath(); - args.engine_components_factory.reset(GetFactory()); + args.engine_components_factory = + std::make_unique<ComponentsFactory>(std::move(scheduler)); args.encryption_handler = &encryption_handler_; args.cancelation_signal = &cancelation_signal_; args.poll_interval = base::TimeDelta::FromMinutes(60); @@ -184,18 +195,14 @@ base::RunLoop().RunUntilIdle(); } - // Test implementation. - void SetUp() override { DoSetUp(false); } - void TearDown() override { sync_manager_.RemoveObserver(&manager_observer_); sync_manager_.ShutdownOnSyncThread(); base::RunLoop().RunUntilIdle(); } - virtual EngineComponentsFactory* GetFactory() { - return new TestEngineComponentsFactory(); - } + SyncManagerImpl* sync_manager() { return &sync_manager_; } + MockSyncScheduler* scheduler() { return scheduler_; } private: // Needed by |sync_manager_|. @@ -204,87 +211,35 @@ base::ScopedTempDir temp_dir_; scoped_refptr<ExtensionsActivity> extensions_activity_; - protected: FakeSyncEncryptionHandler encryption_handler_; SyncManagerImpl sync_manager_; CancelationSignal cancelation_signal_; StrictMock<SyncManagerObserverMock> manager_observer_; // Owned by |sync_manager_|. - StrictMock<SyncEncryptionHandlerObserverMock>* encryption_observer_; -}; - -class SyncManagerWithLocalBackendTest : public SyncManagerTest { - protected: - void SetUp() override { DoSetUp(true); } -}; - -class MockSyncScheduler : public FakeSyncScheduler { - public: - MockSyncScheduler() = default; - ~MockSyncScheduler() override = default; - MOCK_METHOD(void, Start, (SyncScheduler::Mode, base::Time), (override)); - void ScheduleConfiguration(ConfigurationParams params) override { - ScheduleConfiguration_(params); - } - MOCK_METHOD(void, ScheduleConfiguration_, (ConfigurationParams&), ()); -}; - -class ComponentsFactory : public TestEngineComponentsFactory { - public: - ComponentsFactory(SyncScheduler* scheduler_to_use, - SyncCycleContext** cycle_context) - : scheduler_to_use_(scheduler_to_use), cycle_context_(cycle_context) {} - ~ComponentsFactory() override {} - - std::unique_ptr<SyncScheduler> BuildScheduler( - const std::string& name, - SyncCycleContext* context, - CancelationSignal* stop_handle, - bool local_sync_backend_enabled) override { - *cycle_context_ = context; - return std::move(scheduler_to_use_); - } - - private: - std::unique_ptr<SyncScheduler> scheduler_to_use_; - SyncCycleContext** cycle_context_; -}; - -class SyncManagerTestWithMockScheduler : public SyncManagerTest { - public: - SyncManagerTestWithMockScheduler() : scheduler_(nullptr) {} - EngineComponentsFactory* GetFactory() override { - scheduler_ = new MockSyncScheduler(); - return new ComponentsFactory(scheduler_, &cycle_context_); - } - - MockSyncScheduler* scheduler() { return scheduler_; } - SyncCycleContext* cycle_context() { return cycle_context_; } - - private: - MockSyncScheduler* scheduler_; - SyncCycleContext* cycle_context_; + StrictMock<SyncEncryptionHandlerObserverMock>* encryption_observer_ = nullptr; + MockSyncScheduler* scheduler_ = nullptr; }; // Test that the configuration params are properly created and sent to // ScheduleConfigure. No callback should be invoked. -TEST_F(SyncManagerTestWithMockScheduler, BasicConfiguration) { - ConfigureReason reason = CONFIGURE_REASON_RECONFIGURATION; - ModelTypeSet types_to_download(BOOKMARKS, PREFERENCES); - +TEST_F(SyncManagerImplTest, BasicConfiguration) { ConfigurationParams params; EXPECT_CALL(*scheduler(), Start(SyncScheduler::CONFIGURATION_MODE, _)); - EXPECT_CALL(*scheduler(), ScheduleConfiguration_) + EXPECT_CALL(*scheduler(), ScheduleConfiguration) .WillOnce(MoveArg<0>(¶ms)); - CallbackCounter ready_task_counter; - sync_manager_.ConfigureSyncer( - reason, types_to_download, SyncManager::SyncFeatureState::ON, - base::BindOnce(&CallbackCounter::Callback, - base::Unretained(&ready_task_counter))); - EXPECT_EQ(0, ready_task_counter.times_called()); - EXPECT_EQ(sync_pb::SyncEnums::RECONFIGURATION, params.origin); + base::MockOnceClosure ready_task; + EXPECT_CALL(ready_task, Run).Times(0); + + ModelTypeSet types_to_download(BOOKMARKS, PREFERENCES); + sync_manager()->ConfigureSyncer( + CONFIGURE_REASON_RECONFIGURATION, types_to_download, + SyncManager::SyncFeatureState::ON, ready_task.Get()); + EXPECT_EQ(types_to_download, params.types_to_download); + EXPECT_EQ(sync_pb::SyncEnums::RECONFIGURATION, params.origin); } +} // namespace + } // namespace syncer
diff --git a/components/url_formatter/OWNERS b/components/url_formatter/OWNERS index 013962e..8ad1826 100644 --- a/components/url_formatter/OWNERS +++ b/components/url_formatter/OWNERS
@@ -1,6 +1,9 @@ pkasting@chromium.org tommycli@chromium.org meacer@chromium.org +cthomp@chromium.org +estark@chromium.org +felt@chromium.org # Changes to FormatUrlForSecurityDisplay and FormatOriginForSecurityDisplay # require a security review to avoid introducing security bugs.
diff --git a/components/viz/service/compositor_frame_fuzzer/fuzzer_browser_process.h b/components/viz/service/compositor_frame_fuzzer/fuzzer_browser_process.h index 160e169..ba69e7a 100644 --- a/components/viz/service/compositor_frame_fuzzer/fuzzer_browser_process.h +++ b/components/viz/service/compositor_frame_fuzzer/fuzzer_browser_process.h
@@ -16,6 +16,7 @@ #include "components/viz/test/fake_compositor_frame_sink_client.h" #include "components/viz/test/fake_display_client.h" #include "mojo/public/cpp/bindings/associated_remote.h" +#include "services/viz/privileged/mojom/compositing/external_begin_frame_controller.mojom.h" namespace viz {
diff --git a/components/viz/service/debugger/viz_debugger_unittest.cc b/components/viz/service/debugger/viz_debugger_unittest.cc index 72578d8..d7c2eb56 100644 --- a/components/viz/service/debugger/viz_debugger_unittest.cc +++ b/components/viz/service/debugger/viz_debugger_unittest.cc
@@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/json/json_reader.h" +#include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/time/time.h" #include "components/viz/service/debugger/viz_debugger.h"
diff --git a/components/viz/test/mock_display_client.h b/components/viz/test/mock_display_client.h index 6d477eb..5fb2297 100644 --- a/components/viz/test/mock_display_client.h +++ b/components/viz/test/mock_display_client.h
@@ -11,6 +11,7 @@ #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h" +#include "services/viz/privileged/mojom/compositing/display_private.mojom.h" #include "services/viz/privileged/mojom/compositing/frame_sink_manager.mojom.h" #include "testing/gmock/include/gmock/gmock.h"
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 264ee32..aa1a356f 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -1107,6 +1107,8 @@ "media/capture/desktop_capture_device_uma_types.h", "media/capture/desktop_streams_registry_impl.cc", "media/capture/desktop_streams_registry_impl.h", + "media/capture_handle_manager.cc", + "media/capture_handle_manager.h", "media/cdm_registry_impl.cc", "media/cdm_registry_impl.h", "media/desktop_media_window_registry.cc",
diff --git a/content/browser/accessibility/accessibility_action_browsertest.cc b/content/browser/accessibility/accessibility_action_browsertest.cc index 5922724..43af840 100644 --- a/content/browser/accessibility/accessibility_action_browsertest.cc +++ b/content/browser/accessibility/accessibility_action_browsertest.cc
@@ -156,7 +156,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityActionBrowserTest, DoDefaultAction) { LoadInitialAccessibilityTreeFromHtml(R"HTML( <div id="button" role="button" tabIndex=0>Click</div> - <p></p> + <p role="group"></p> <script> document.getElementById('button').addEventListener('click', () => { document.querySelector('p').setAttribute('aria-label', 'success'); @@ -252,14 +252,14 @@ IN_PROC_BROWSER_TEST_F(AccessibilityActionBrowserTest, Scroll) { LoadInitialAccessibilityTreeFromHtml(R"HTML( - <div style="width:100; height:50; overflow:scroll" + <div role="group" style="width:100; height:50; overflow:scroll" aria-label="shakespeare"> To be or not to be, that is the question. </div> )HTML"); BrowserAccessibility* target = - FindNode(ax::mojom::Role::kGenericContainer, "shakespeare"); + FindNode(ax::mojom::Role::kGroup, "shakespeare"); EXPECT_NE(target, nullptr); int y_before = target->GetIntAttribute(ax::mojom::IntAttribute::kScrollY); @@ -819,7 +819,7 @@ <html> <body> <div style='height: 5000px; width: 5000px;'></div> - <div aria-label='target' style='position: relative; + <div role='group' aria-label='target' style='position: relative; left: 2000px; width: 100px;'>One</div> <div style='height: 5000px;'></div> </body> @@ -843,7 +843,7 @@ doc_right_third.set_x(doc_bounds.right() - one_third_doc_width); BrowserAccessibility* target_node = - FindNode(ax::mojom::Role::kGenericContainer, "target"); + FindNode(ax::mojom::Role::kGroup, "target"); EXPECT_NE(target_node, nullptr); ScrollNodeIntoView(target_node,
diff --git a/content/browser/accessibility/accessibility_win_browsertest.cc b/content/browser/accessibility/accessibility_win_browsertest.cc index 68b1909..6902b28 100644 --- a/content/browser/accessibility/accessibility_win_browsertest.cc +++ b/content/browser/accessibility/accessibility_win_browsertest.cc
@@ -4585,13 +4585,13 @@ <!DOCTYPE html> <html> <body> - <div aria-label='not'> + <div aria-label='not' role='group'> not scrollable </div> - <div style='width:100px; overflow:auto' aria-label='x'> + <div style='width:100px; overflow:auto' aria-label='x' role='group'> <div style='width:200px; height:100px'></div> </div> - <div style='height:100px; overflow:auto' aria-label='y'> + <div style='height:100px; overflow:auto' aria-label='y' role='group'> <div style='width:100px; height:200px'></div> </div> </body> @@ -4611,7 +4611,7 @@ {"y", false, true, 0.0, 50.0}}; for (auto& expected : all_expected) { BrowserAccessibility* browser_accessibility = - FindNode(ax::mojom::Role::kGenericContainer, expected.node_name); + FindNode(ax::mojom::Role::kGroup, expected.node_name); EXPECT_NE(browser_accessibility, nullptr); BrowserAccessibilityComWin* browser_accessibility_com_win =
diff --git a/content/browser/accessibility/ax_platform_node_textrangeprovider_win_browsertest.cc b/content/browser/accessibility/ax_platform_node_textrangeprovider_win_browsertest.cc index 72a1f6e8a..0c5420fc 100644 --- a/content/browser/accessibility/ax_platform_node_textrangeprovider_win_browsertest.cc +++ b/content/browser/accessibility/ax_platform_node_textrangeprovider_win_browsertest.cc
@@ -2317,7 +2317,7 @@ R"HTML(<!DOCTYPE html> <html> <body> - <p aria-label="space"> </p> + <p tabindex="0" aria-label="space"> </p> <p>3.14</p> </body> </html>)HTML");
diff --git a/content/browser/accessibility/ax_platform_node_win_browsertest.cc b/content/browser/accessibility/ax_platform_node_win_browsertest.cc index b0f5836..4d9e90c 100644 --- a/content/browser/accessibility/ax_platform_node_win_browsertest.cc +++ b/content/browser/accessibility/ax_platform_node_win_browsertest.cc
@@ -558,7 +558,8 @@ <!DOCTYPE html> <html> <body> - <div aria-virtualcontent="block-end" aria-label="vc">Hello World</div> + <div role="group" aria-virtualcontent="block-end" + aria-label="vc">Hello World</div> </body> </html> )HTML")); @@ -567,8 +568,7 @@ BrowserAccessibility* body_node = root_node->PlatformGetFirstChild(); ASSERT_NE(nullptr, body_node); - BrowserAccessibility* node = - FindNode(ax::mojom::Role::kGenericContainer, "vc"); + BrowserAccessibility* node = FindNode(ax::mojom::Role::kGroup, "vc"); ASSERT_NE(nullptr, node); BrowserAccessibilityComWin* node_com_win = ToBrowserAccessibilityWin(node)->GetCOM();
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc index d34cc83..73a989cb 100644 --- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -2932,6 +2932,12 @@ // in the past. // +IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, + ContentVisibilityWithPseudoElement) { + RunRegressionTest( + FILE_PATH_LITERAL("content-visibility-with-pseudo-element.html")); +} + IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, DisplayContentsSelectCrash) { RunRegressionTest(FILE_PATH_LITERAL("display-contents-select-crash.html")); }
diff --git a/content/browser/back_forward_cache_browsertest.cc b/content/browser/back_forward_cache_browsertest.cc index 05c34b9..ddf0899 100644 --- a/content/browser/back_forward_cache_browsertest.cc +++ b/content/browser/back_forward_cache_browsertest.cc
@@ -1456,8 +1456,9 @@ ExpectCached(*delete_observers[3], /*cached=*/true, /*backgrounded=*/false); } -// Tests that RenderFrameHost::ForEachRenderFrameHost behaves correctly when -// bfcached. +// Tests that |RenderFrameHost::ForEachRenderFrameHost| and +// |WebContents::ForEachRenderFrameHost| behave correctly with bfcached +// RenderFrameHosts. IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest, ForEachRenderFrameHost) { ASSERT_TRUE(embedded_test_server()->Start()); GURL url_a(embedded_test_server()->GetURL( @@ -1481,6 +1482,8 @@ // entering bfcache. EXPECT_THAT(CollectAllRenderFrameHosts(rfh_a), testing::ElementsAre(rfh_a, rfh_b, rfh_d, rfh_c)); + EXPECT_THAT(CollectAllRenderFrameHosts(web_contents()), + testing::ElementsAre(rfh_a, rfh_b, rfh_d, rfh_c)); // 2) Navigate to e. EXPECT_TRUE(NavigateToURL(shell(), url_e)); @@ -1505,10 +1508,30 @@ // works. EXPECT_THAT(CollectAllRenderFrameHosts(rfh_b), testing::ElementsAre(rfh_b, rfh_c)); + + // When iterating over all RenderFrameHosts in a WebContents, we should see + // the RFHs of both the primary page and the bfcached page. + EXPECT_THAT(CollectAllRenderFrameHosts(web_contents()), + testing::UnorderedElementsAre(rfh_a, rfh_b, rfh_c, rfh_d, rfh_e)); + + { + // If we stop iteration in |WebContents::ForEachRenderFrameHost|, we stop + // the entire iteration, not just iteration in the page being iterated at + // that point. In this case, if we stop iteration in the primary page, we do + // not continue to iterate in the bfcached page. + bool stopped = false; + web_contents()->ForEachRenderFrameHost( + base::BindLambdaForTesting([&](RenderFrameHostImpl* rfh) { + EXPECT_FALSE(stopped); + stopped = true; + return RenderFrameHost::FrameIterationAction::kStop; + })); + } } -// Tests that RenderFrameHostImpl::ForEachRenderFrameHostIncludingSpeculative -// behaves correctly when a FrameTreeNode has both a speculative RFH and a +// Tests that |RenderFrameHostImpl::ForEachRenderFrameHostIncludingSpeculative| +// and |WebContentsImpl::ForEachRenderFrameHostIncludingSpeculative| +// behave correctly when a FrameTreeNode has both a speculative RFH and a // bfcached RFH. IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest, ForEachRenderFrameHostWithSpeculative) { @@ -1562,6 +1585,11 @@ // the speculative RFH. In particular, we should not see the bfcached RFH. EXPECT_THAT(CollectAllRenderFrameHostsIncludingSpeculative(rfh_c), testing::ElementsAre(rfh_c)); + + // When iterating over all RenderFrameHosts in a WebContents, we should see + // the RFHs of both the primary page and the bfcached page. + EXPECT_THAT(CollectAllRenderFrameHostsIncludingSpeculative(web_contents()), + testing::UnorderedElementsAre(rfh_a, rfh_b, rfh_c)); } // Similar to BackForwardCacheBrowserTest.SubframeSurviveCache*
diff --git a/content/browser/background_fetch/storage/create_metadata_task.cc b/content/browser/background_fetch/storage/create_metadata_task.cc index 52e0795..38535f6 100644 --- a/content/browser/background_fetch/storage/create_metadata_task.cc +++ b/content/browser/background_fetch/storage/create_metadata_task.cc
@@ -13,6 +13,7 @@ #include "base/callback_helpers.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" +#include "base/trace_event/trace_event.h" #include "content/browser/background_fetch/background_fetch_data_manager.h" #include "content/browser/background_fetch/background_fetch_data_manager_observer.h" #include "content/browser/background_fetch/storage/database_helpers.h"
diff --git a/content/browser/background_fetch/storage/delete_registration_task.cc b/content/browser/background_fetch/storage/delete_registration_task.cc index ff184bb..3e1a541 100644 --- a/content/browser/background_fetch/storage/delete_registration_task.cc +++ b/content/browser/background_fetch/storage/delete_registration_task.cc
@@ -8,6 +8,7 @@ #include "base/barrier_closure.h" #include "base/bind.h" +#include "base/trace_event/trace_event.h" #include "content/browser/background_fetch/background_fetch.pb.h" #include "content/browser/background_fetch/background_fetch_data_manager.h" #include "content/browser/background_fetch/storage/database_helpers.h"
diff --git a/content/browser/background_fetch/storage/mark_request_complete_task.cc b/content/browser/background_fetch/storage/mark_request_complete_task.cc index 4881159..7ab3d17 100644 --- a/content/browser/background_fetch/storage/mark_request_complete_task.cc +++ b/content/browser/background_fetch/storage/mark_request_complete_task.cc
@@ -7,6 +7,7 @@ #include "base/barrier_closure.h" #include "base/bind.h" #include "base/guid.h" +#include "base/trace_event/trace_event.h" #include "content/browser/background_fetch/background_fetch_cross_origin_filter.h" #include "content/browser/background_fetch/background_fetch_data_manager.h" #include "content/browser/background_fetch/storage/database_helpers.h"
diff --git a/content/browser/background_fetch/storage/match_requests_task.cc b/content/browser/background_fetch/storage/match_requests_task.cc index a13ede2..4fb060b 100644 --- a/content/browser/background_fetch/storage/match_requests_task.cc +++ b/content/browser/background_fetch/storage/match_requests_task.cc
@@ -8,6 +8,7 @@ #include "base/barrier_closure.h" #include "base/bind.h" +#include "base/trace_event/trace_event.h" #include "content/browser/background_fetch/background_fetch_data_manager.h" #include "content/browser/background_fetch/storage/database_helpers.h" #include "content/browser/service_worker/service_worker_context_wrapper.h"
diff --git a/content/browser/blob_storage/blob_url_unittest.cc b/content/browser/blob_storage/blob_url_unittest.cc index 0a7e8fb..a7edd4e 100644 --- a/content/browser/blob_storage/blob_url_unittest.cc +++ b/content/browser/blob_storage/blob_url_unittest.cc
@@ -28,6 +28,7 @@ #include "net/http/http_request_headers.h" #include "net/http/http_response_headers.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" +#include "services/network/public/mojom/url_loader_factory.mojom.h" #include "services/network/test/test_url_loader_client.h" #include "storage/browser/blob/blob_data_builder.h" #include "storage/browser/blob/blob_data_handle.h"
diff --git a/content/browser/browsing_data/browsing_data_browsertest_utils.cc b/content/browser/browsing_data/browsing_data_browsertest_utils.cc index 0ed4b23d..21383008 100644 --- a/content/browser/browsing_data/browsing_data_browsertest_utils.cc +++ b/content/browser/browsing_data/browsing_data_browsertest_utils.cc
@@ -29,6 +29,7 @@ #include "services/network/public/mojom/network_service.mojom.h" #include "services/network/public/mojom/network_service_test.mojom.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_registration_options.mojom.h" namespace content {
diff --git a/content/browser/cache_storage/cache_storage_dispatcher_host.cc b/content/browser/cache_storage/cache_storage_dispatcher_host.cc index 23680a8..7a87937 100644 --- a/content/browser/cache_storage/cache_storage_dispatcher_host.cc +++ b/content/browser/cache_storage/cache_storage_dispatcher_host.cc
@@ -29,6 +29,7 @@ #include "services/network/public/cpp/is_potentially_trustworthy.h" #include "services/network/public/mojom/cross_origin_embedder_policy.mojom.h" #include "third_party/blink/public/common/blob/blob_utils.h" +#include "third_party/blink/public/mojom/blob/blob.mojom.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h" #include "url/gurl.h" #include "url/origin.h"
diff --git a/content/browser/cookie_store/cookie_change_subscription.h b/content/browser/cookie_store/cookie_change_subscription.h index b9c84f4..f7c3ece 100644 --- a/content/browser/cookie_store/cookie_change_subscription.h +++ b/content/browser/cookie_store/cookie_change_subscription.h
@@ -14,6 +14,11 @@ #include "third_party/blink/public/mojom/cookie_store/cookie_store.mojom.h" #include "url/gurl.h" +namespace net { +class CanonicalCookie; +enum class CookieAccessSemantics; +} // namespace net + namespace content { namespace proto {
diff --git a/content/browser/devtools/protocol/network_handler.cc b/content/browser/devtools/protocol/network_handler.cc index 974b4e5..54b80ef 100644 --- a/content/browser/devtools/protocol/network_handler.cc +++ b/content/browser/devtools/protocol/network_handler.cc
@@ -2871,12 +2871,12 @@ switch (policy) { case network::mojom::PrivateNetworkRequestPolicy::kAllow: return protocol::Network::PrivateNetworkRequestPolicyEnum::Allow; - case network::mojom::PrivateNetworkRequestPolicy:: - kBlockFromInsecureToMorePrivate: + case network::mojom::PrivateNetworkRequestPolicy::kBlock: + // TODO(https://crbug.com/1141824): Fix this. return protocol::Network::PrivateNetworkRequestPolicyEnum:: BlockFromInsecureToMorePrivate; - case network::mojom::PrivateNetworkRequestPolicy:: - kWarnFromInsecureToMorePrivate: + case network::mojom::PrivateNetworkRequestPolicy::kWarn: + // TODO(https://crbug.com/1141824): Fix this. return protocol::Network::PrivateNetworkRequestPolicyEnum:: WarnFromInsecureToMorePrivate; }
diff --git a/content/browser/devtools/protocol/system_info_handler.cc b/content/browser/devtools/protocol/system_info_handler.cc index 0a7de38f..1f3b2f8 100644 --- a/content/browser/devtools/protocol/system_info_handler.cc +++ b/content/browser/devtools/protocol/system_info_handler.cc
@@ -26,6 +26,7 @@ #include "gpu/config/gpu_feature_type.h" #include "gpu/config/gpu_info.h" #include "gpu/config/gpu_switches.h" +#include "media/base/video_codecs.h" #if BUILDFLAG(IS_CHROMEOS_ASH) #include "gpu/config/gpu_util.h" #endif
diff --git a/content/browser/direct_sockets/direct_sockets_tcp_browsertest.cc b/content/browser/direct_sockets/direct_sockets_tcp_browsertest.cc index 745323f..b1c0d8e 100644 --- a/content/browser/direct_sockets/direct_sockets_tcp_browsertest.cc +++ b/content/browser/direct_sockets/direct_sockets_tcp_browsertest.cc
@@ -32,6 +32,7 @@ #include "net/traffic_annotation/network_traffic_annotation.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" #include "services/network/public/mojom/host_resolver.mojom.h" +#include "services/network/public/mojom/mdns_responder.mojom.h" #include "services/network/public/mojom/network_context.mojom.h" #include "services/network/public/mojom/tcp_socket.mojom.h" #include "testing/gmock/include/gmock/gmock-matchers.h"
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc index 804de20..049f1ef 100644 --- a/content/browser/download/download_manager_impl.cc +++ b/content/browser/download/download_manager_impl.cc
@@ -1154,7 +1154,9 @@ it.second->GetDangerType() != download::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED && it.second->GetDangerType() != - download::DOWNLOAD_DANGER_TYPE_DEEP_SCANNED_OPENED_DANGEROUS) { + download::DOWNLOAD_DANGER_TYPE_DEEP_SCANNED_OPENED_DANGEROUS && + it.second->GetDangerType() != + download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE) { ++count; } }
diff --git a/content/browser/indexed_db/indexed_db_browsertest.cc b/content/browser/indexed_db/indexed_db_browsertest.cc index 28c05241..e1d1a2e1 100644 --- a/content/browser/indexed_db/indexed_db_browsertest.cc +++ b/content/browser/indexed_db/indexed_db_browsertest.cc
@@ -27,6 +27,7 @@ #include "build/build_config.h" #include "components/services/storage/indexed_db/transactional_leveldb/transactional_leveldb_database.h" #include "components/services/storage/public/mojom/indexed_db_control.mojom-test-utils.h" +#include "components/services/storage/public/mojom/indexed_db_control_test.mojom.h" #include "components/services/storage/public/mojom/storage_usage_info.mojom.h" #include "content/browser/blob_storage/chrome_blob_storage_context.h" #include "content/browser/browser_main_loop.h"
diff --git a/content/browser/indexed_db/indexed_db_external_object.h b/content/browser/indexed_db/indexed_db_external_object.h index f0a1fe2..d49e462 100644 --- a/content/browser/indexed_db/indexed_db_external_object.h +++ b/content/browser/indexed_db/indexed_db_external_object.h
@@ -20,6 +20,7 @@ #include "storage/browser/blob/blob_data_handle.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/mojom/blob/blob.mojom.h" +#include "third_party/blink/public/mojom/file_system_access/file_system_access_transfer_token.mojom.h" #include "third_party/blink/public/mojom/indexeddb/indexeddb.mojom.h" namespace content {
diff --git a/content/browser/interest_group/auction_runner.h b/content/browser/interest_group/auction_runner.h index 569aca3..e2fc0db 100644 --- a/content/browser/interest_group/auction_runner.h +++ b/content/browser/interest_group/auction_runner.h
@@ -18,6 +18,7 @@ #include "content/services/auction_worklet/public/mojom/auction_worklet_service.mojom.h" #include "content/services/auction_worklet/public/mojom/bidder_worklet.mojom.h" #include "content/services/auction_worklet/public/mojom/seller_worklet.mojom.h" +#include "mojo/public/cpp/bindings/remote.h" #include "services/network/public/mojom/url_loader_factory.mojom-forward.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/mojom/interest_group/interest_group_types.mojom.h"
diff --git a/content/browser/interest_group/auction_runner_unittest.cc b/content/browser/interest_group/auction_runner_unittest.cc index 3d912ca9..fa519bb 100644 --- a/content/browser/interest_group/auction_runner_unittest.cc +++ b/content/browser/interest_group/auction_runner_unittest.cc
@@ -676,9 +676,11 @@ std::vector<auction_worklet::mojom::PreviousWinPtr> previous_wins; previous_wins.push_back(auction_worklet::mojom::PreviousWin::New( - base::Time::Now(), R"({"winner": 0})")); + base::Time::Now() - base::TimeDelta::FromSeconds(2), + R"({"winner": 0})")); previous_wins.push_back(auction_worklet::mojom::PreviousWin::New( - base::Time::Now(), R"({"winner": -1})")); + base::Time::Now() - base::TimeDelta::FromSeconds(1), + R"({"winner": -1})")); previous_wins.push_back(auction_worklet::mojom::PreviousWin::New( base::Time::Now(), R"({"winner": -2})"));
diff --git a/content/browser/media/capture_handle_manager.cc b/content/browser/media/capture_handle_manager.cc new file mode 100644 index 0000000..06d9c261 --- /dev/null +++ b/content/browser/media/capture_handle_manager.cc
@@ -0,0 +1,299 @@ +// Copyright (c) 2021 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 "content/browser/media/capture_handle_manager.h" + +#include "base/memory/ptr_util.h" +#include "content/browser/renderer_host/render_frame_host_delegate.h" +#include "content/browser/renderer_host/render_frame_host_impl.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/web_contents.h" +#include "content/public/browser/web_contents_observer.h" +#include "url/origin.h" + +namespace content { + +namespace { +media::mojom::CaptureHandlePtr CreateCaptureHandle( + const url::Origin& capturer_origin, + const blink::mojom::CaptureHandleConfig& capture_handle_config, + WebContents* captured) { + auto result = media::mojom::CaptureHandle::New(); + + if (!captured) { + return result; + } + + if (!capture_handle_config.all_origins_permitted && + std::none_of(capture_handle_config.permitted_origins.begin(), + capture_handle_config.permitted_origins.end(), + [capturer_origin](const url::Origin& permitted_origin) { + return capturer_origin.IsSameOriginWith(permitted_origin); + })) { + return result; + } + + if (capture_handle_config.expose_origin) { + result->origin = captured->GetMainFrame()->GetLastCommittedOrigin(); + } + result->capture_handle = capture_handle_config.capture_handle; + + return result; +} + +bool IsEqual(const media::mojom::CaptureHandlePtr& lhs, + const media::mojom::CaptureHandlePtr& rhs) { + if (!lhs || !rhs) { // If either is null, equal only if both are null. + return !lhs && !rhs; + } + + if (lhs->origin.opaque() != rhs->origin.opaque()) { + return false; // One is empty, the other is non-empty. + } + + // Either both are opaque or neither is. We only compare non-opaque origins. + if (!lhs->origin.opaque()) { + if (lhs->origin != rhs->origin) { + return false; + } + } + + return lhs->capture_handle == rhs->capture_handle; +} +} // namespace + +class CaptureHandleManager::Observer : public WebContentsObserver { + public: + static std::unique_ptr<Observer> Create( + const CaptureKey& capture_key, + GlobalFrameRoutingId captured, + GlobalFrameRoutingId capturer, + DeviceCaptureHandleChangeCallback handle_change_callback); + + ~Observer() final; + + // Implements WebContentsObserver. + void OnCaptureHandleConfigUpdate( + const blink::mojom::CaptureHandleConfig& config) final; + + // Forces an immediate polling of the captured tab for the current config. + // Reports it back via |handle_change_callback_|. + void UpdateCaptureHandleConfig(); + + private: + Observer(WebContents* web_contents, + const CaptureKey& capture_key, + GlobalFrameRoutingId capturer, + DeviceCaptureHandleChangeCallback handle_change_callback); + + const CaptureKey capture_key_; + const GlobalFrameRoutingId capturer_; + const DeviceCaptureHandleChangeCallback handle_change_callback_; +}; + +std::unique_ptr<CaptureHandleManager::Observer> +CaptureHandleManager::Observer::Create( + const CaptureKey& capture_key, + GlobalFrameRoutingId captured, + GlobalFrameRoutingId capturer, + DeviceCaptureHandleChangeCallback handle_change_callback) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + + auto* const capturer_rfhi = RenderFrameHostImpl::FromID(capturer); + if (!capturer_rfhi || !capturer_rfhi->IsCurrent()) { + return nullptr; + } + + auto* const captured_rfhi = RenderFrameHostImpl::FromID(captured); + if (!captured_rfhi || !captured_rfhi->IsCurrent()) { + return nullptr; + } + + auto* const captured_delegate = captured_rfhi->delegate(); + if (!captured_delegate) { + return nullptr; + } + + auto* const captured_web_contents = captured_delegate->GetAsWebContents(); + if (!captured_web_contents) { + return nullptr; + } + + return base::WrapUnique(new Observer(captured_web_contents, capture_key, + capturer, + std::move(handle_change_callback))); +} + +CaptureHandleManager::Observer::Observer( + WebContents* web_contents, + const CaptureKey& capture_key, + GlobalFrameRoutingId capturer, + DeviceCaptureHandleChangeCallback handle_change_callback) + : WebContentsObserver(web_contents), + capture_key_(capture_key), + capturer_(capturer), + handle_change_callback_(std::move(handle_change_callback)) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + DCHECK(handle_change_callback_); +} + +CaptureHandleManager::Observer::~Observer() = default; + +void CaptureHandleManager::Observer::OnCaptureHandleConfigUpdate( + const blink::mojom::CaptureHandleConfig& config) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + + auto* const capturer_rfhi = RenderFrameHostImpl::FromID(capturer_); + if (!capturer_rfhi || !capturer_rfhi->IsCurrent()) { + DVLOG(1) << "Invalid capturer: " << capturer_ << "."; + return; + } + + handle_change_callback_.Run( + capture_key_.label, capture_key_.type, + CreateCaptureHandle(capturer_rfhi->GetLastCommittedOrigin(), config, + web_contents())); +} + +void CaptureHandleManager::Observer::UpdateCaptureHandleConfig() { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + auto* wc = web_contents(); + if (wc) { + OnCaptureHandleConfigUpdate(wc->GetCaptureHandleConfig()); + } +} + +CaptureHandleManager::CaptureInfo::CaptureInfo( + std::unique_ptr<Observer> observer, + media::mojom::CaptureHandlePtr last_capture_handle, + DeviceCaptureHandleChangeCallback callback) + : observer(std::move(observer)), + last_capture_handle(std::move(last_capture_handle)), + callback(std::move(callback)) {} + +CaptureHandleManager::CaptureInfo::~CaptureInfo() = default; + +CaptureHandleManager::CaptureHandleManager() { + DCHECK_CURRENTLY_ON(BrowserThread::UI); +} + +CaptureHandleManager::~CaptureHandleManager() { + DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::IO)); +} + +void CaptureHandleManager::OnTabCaptureStarted( + const std::string& label, + const blink::MediaStreamDevice& captured_device, + GlobalFrameRoutingId capturer, + DeviceCaptureHandleChangeCallback handle_change_callback) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + + WebContentsMediaCaptureId captured_tab_id; + if (!WebContentsMediaCaptureId::Parse(captured_device.id, &captured_tab_id)) { + DVLOG(1) << "Not a tab-capture ID:" << captured_device.id << "."; + return; + } + const GlobalFrameRoutingId captured(captured_tab_id.render_process_id, + captured_tab_id.main_render_frame_id); + + const CaptureKey capture_key{label, captured_device.type}; + + // base::Unretained(this) is safe because the observer is owned by |this| + // and both live on the UI thread together. + std::unique_ptr<Observer> observer = Observer::Create( + capture_key, captured, capturer, + base::BindRepeating(&CaptureHandleManager::OnCaptureHandleConfigUpdate, + base::Unretained(this))); + if (!observer) { + DVLOG(1) << "Observer creation failed."; + return; + } + + auto iter = captures_.find(capture_key); + if (iter == captures_.end()) { + // Creating a new tracking session. + const absl::optional<media::mojom::DisplayMediaInformationPtr>& info = + captured_device.display_media_info; + auto capture_handle = + (info.has_value() && info.value() && info.value()->capture_handle) + ? info.value()->capture_handle.Clone() + : media::mojom::CaptureHandle::New(); + captures_[capture_key] = std::make_unique<CaptureInfo>( + std::move(observer), std::move(capture_handle), + std::move(handle_change_callback)); + } else { + // Updating an existing tracking session in response to a device change. + iter->second->observer = std::move(observer); + } + + // The currently executing task comes in response to a chain of tasks juggled + // between the IO and UI thread. During this time, the CaptureHandleConfig + // might have changed. Fetch the latest handle. + captures_[capture_key]->observer->UpdateCaptureHandleConfig(); +} + +void CaptureHandleManager::OnTabCaptureStopped( + const std::string& label, + const blink::MediaStreamDevice& captured_device) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + + captures_.erase({label, captured_device.type}); +} + +void CaptureHandleManager::OnTabCaptureDevicesUpdated( + const std::string& label, + const std::vector<blink::MediaStreamDevice>& new_devices, + GlobalFrameRoutingId capturer, + DeviceCaptureHandleChangeCallback handle_change_callback) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + + // Pause tracking of all old devices. + for (auto& capture : captures_) { + if (capture.first.label == label) { + capture.second->observer = nullptr; + } + } + + // Start tracking any new devices; resume tracking of changed devices. + for (const auto& device : new_devices) { + OnTabCaptureStarted(label, device, capturer, handle_change_callback); + } + + // Forget any old device which was not in |new_devices|. + for (auto iter = captures_.begin(); iter != captures_.end();) { + if (!iter->second->observer) { + iter = captures_.erase(iter); + } else { + ++iter; + } + } +} + +void CaptureHandleManager::OnCaptureHandleConfigUpdate( + const std::string& label, + blink::mojom::MediaStreamType type, + media::mojom::CaptureHandlePtr capture_handle) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + + auto iter = captures_.find({label, type}); + if (iter == captures_.end()) { + DVLOG(1) << "Unknown session."; + return; + } + + const CaptureKey& key = iter->first; + CaptureInfo& info = *iter->second; + + if (IsEqual(capture_handle, info.last_capture_handle)) { + // Nothing has changed -> do not report. This avoids exposing navigation + // between non-exposing sites to a potentially malicious render process. + return; + } + + iter->second->last_capture_handle = capture_handle.Clone(); + + info.callback.Run(key.label, key.type, std::move(capture_handle)); +} + +} // namespace content
diff --git a/content/browser/media/capture_handle_manager.h b/content/browser/media/capture_handle_manager.h new file mode 100644 index 0000000..e5f0258 --- /dev/null +++ b/content/browser/media/capture_handle_manager.h
@@ -0,0 +1,99 @@ +// Copyright (c) 2021 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 CONTENT_BROWSER_MEDIA_CAPTURE_HANDLE_MANAGER_H_ +#define CONTENT_BROWSER_MEDIA_CAPTURE_HANDLE_MANAGER_H_ + +#include <map> +#include <memory> +#include <vector> + +#include "base/callback.h" +#include "content/common/content_export.h" +#include "content/public/browser/global_routing_id.h" +#include "media/mojo/mojom/capture_handle.mojom.h" +#include "third_party/blink/public/common/mediastream/media_stream_request.h" +#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h" + +namespace content { + +// This class lives on the UI thread. +// TODO(crbug.com/1208868): Document this class. +class CONTENT_EXPORT CaptureHandleManager { + public: + using DeviceCaptureHandleChangeCallback = base::RepeatingCallback<void( + const std::string& label, + blink::mojom::MediaStreamType type, + media::mojom::CaptureHandlePtr capture_handle)>; + + CaptureHandleManager(); + CaptureHandleManager(const CaptureHandleManager&) = delete; + CaptureHandleManager& operator=(const CaptureHandleManager&) = delete; + virtual ~CaptureHandleManager(); + + // This method should be called after starting a video capture session of + // a MediaStreamDevice, to subscribe for its CaptureHandle changes. + // The permission to observe the CaptureHandle depends on |capturer|'s origin. + void OnTabCaptureStarted( + const std::string& label, + const blink::MediaStreamDevice& captured_device, + GlobalFrameRoutingId capturer, + DeviceCaptureHandleChangeCallback handle_change_callback); + + // Stops tracking a previously tracked capture session. + void OnTabCaptureStopped(const std::string& label, + const blink::MediaStreamDevice& captured_device); + + // Should be called when devices change. It is essentially equivalent to + // calling OnTabCaptureStopped() on all sessions with the right |label|, + // then calling OnTabCaptureStarted() on all |new_devices|. + void OnTabCaptureDevicesUpdated( + const std::string& label, + const std::vector<blink::MediaStreamDevice>& new_devices, + GlobalFrameRoutingId capturer, + DeviceCaptureHandleChangeCallback handle_change_callback); + + private: + // Tracks a single captured WebContents and informs its capturer of changes + // to the CaptureHandle. + class Observer; + + // Uniquely identifies a capture session. + struct CaptureKey { + bool operator<(const CaptureKey& other) const { + return std::tie(label, type) < std::tie(other.label, other.type); + } + + std::string label; + blink::mojom::MediaStreamType type; + }; + + // All the information this manager holds about a given capture. + struct CaptureInfo { + CaptureInfo(std::unique_ptr<Observer> observer, + media::mojom::CaptureHandlePtr last_capture_handle, + DeviceCaptureHandleChangeCallback callback); + ~CaptureInfo(); + + std::unique_ptr<Observer> observer; + media::mojom::CaptureHandlePtr last_capture_handle; + DeviceCaptureHandleChangeCallback callback; + }; + + // Called by Observer whenever a new CaptureHandle config is observed. + // Allows CaptureHandleManager to decide if a corresponding + // DeviceCaptureHandleChangeCallback should be called. + void OnCaptureHandleConfigUpdate( + const std::string& label, + blink::mojom::MediaStreamType type, + media::mojom::CaptureHandlePtr capture_handle); + + // Maps each capture session to everything we hold about it - the observer + // that tracks it, the last reported CaptureHandle, etc. + std::map<CaptureKey, std::unique_ptr<CaptureInfo>> captures_; +}; + +} // namespace content + +#endif // CONTENT_BROWSER_MEDIA_CAPTURE_HANDLE_MANAGER_H_
diff --git a/content/browser/network_service_client.h b/content/browser/network_service_client.h index 8954b088..77a855f7 100644 --- a/content/browser/network_service_client.h +++ b/content/browser/network_service_client.h
@@ -19,6 +19,7 @@ #include "mojo/public/cpp/bindings/receiver_set.h" #include "mojo/public/cpp/bindings/remote.h" #include "net/cert/cert_database.h" +#include "services/network/public/mojom/network_change_manager.mojom.h" #include "services/network/public/mojom/network_service.mojom.h" #include "url/gurl.h"
diff --git a/content/browser/prerender/prerender_browsertest.cc b/content/browser/prerender/prerender_browsertest.cc index bbfe0912..bdd7d7c 100644 --- a/content/browser/prerender/prerender_browsertest.cc +++ b/content/browser/prerender/prerender_browsertest.cc
@@ -834,8 +834,8 @@ EXPECT_EQ(GetRequestCount(kInnerContentsUrl), 1); } -// Tests that RenderFrameHost::ForEachRenderFrameHost behaves correctly when -// prerendering. +// Tests that |RenderFrameHost::ForEachRenderFrameHost| and +// |WebContents::ForEachRenderFrameHost| behave correctly when prerendering. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, ForEachRenderFrameHost) { const GURL kInitialUrl = GetUrl("/prerender/add_prerender.html"); // All frames are same-origin due to prerendering restrictions for @@ -844,6 +844,8 @@ GetUrl("/cross_site_iframe_factory.html?a.test(a.test(a.test),a.test)"); ASSERT_TRUE(NavigateToURL(shell(), kInitialUrl)); + RenderFrameHostImpl* initiator_render_frame_host = current_frame_host(); + const int host_id = AddPrerender(kPrerenderingUrl); RenderFrameHostImpl* prerendered_render_frame_host = GetPrerenderedMainFrameHost(host_id); @@ -857,6 +859,13 @@ EXPECT_THAT(CollectAllRenderFrameHosts(prerendered_render_frame_host), testing::ElementsAre(prerendered_render_frame_host, rfh_sub_1, rfh_sub_2, rfh_sub_1_1)); + + // When iterating over all RenderFrameHosts in a WebContents, we should see + // the RFHs of both the primary page and the prerendered page. + EXPECT_THAT(CollectAllRenderFrameHosts(web_contents_impl()), + testing::UnorderedElementsAre(initiator_render_frame_host, + prerendered_render_frame_host, + rfh_sub_1, rfh_sub_2, rfh_sub_1_1)); } class MojoCapabilityControlTestContentBrowserClient
diff --git a/content/browser/prerender/prerender_host.cc b/content/browser/prerender/prerender_host.cc index 49a819dc..a657d07 100644 --- a/content/browser/prerender/prerender_host.cc +++ b/content/browser/prerender/prerender_host.cc
@@ -144,10 +144,6 @@ return frame_tree_->controller(); } - RenderFrameHostImpl* GetMainFrame() { - return frame_tree_->root()->current_frame_host(); - } - ActivateResult Activate(NavigationRequest& navigation_request) { if (frame_tree_->root()->HasNavigation()) { // We do not yet support activation if there is an ongoing navigation in @@ -230,6 +226,8 @@ loop.Run(); } + FrameTree* frame_tree() { return frame_tree_.get(); } + private: // WebContents where this prerenderer is embedded. WebContentsImpl& web_contents_; @@ -325,7 +323,9 @@ } RenderFrameHostImpl* PrerenderHost::GetPrerenderedMainFrameHost() { - return page_holder_->GetMainFrame(); + DCHECK(page_holder_->frame_tree()); + DCHECK(page_holder_->frame_tree()->root()->current_frame_host()); + return page_holder_->frame_tree()->root()->current_frame_host(); } void PrerenderHost::RecordFinalStatus(base::PassKey<PrerenderHostRegistry>, @@ -335,18 +335,14 @@ void PrerenderHost::CreatePageHolder(WebContentsImpl& web_contents) { page_holder_ = std::make_unique<PageHolder>(web_contents); - frame_tree_node_id_ = page_holder_->GetMainFrame()->GetFrameTreeNodeId(); + frame_tree_node_id_ = + page_holder_->frame_tree()->root()->frame_tree_node_id(); } void PrerenderHost::WaitForLoadStopForTesting() { page_holder_->WaitForLoadCompletionForTesting(); // IN-TEST } -FrameTree* PrerenderHost::GetPrerenderedFrameTree() { - DCHECK(page_holder_); - return page_holder_->GetMainFrame()->frame_tree(); -} - void PrerenderHost::RecordFinalStatus(FinalStatus status) { DCHECK(!final_status_); final_status_ = status;
diff --git a/content/browser/prerender/prerender_host.h b/content/browser/prerender/prerender_host.h index 66dfdc7..c1a3b59 100644 --- a/content/browser/prerender/prerender_host.h +++ b/content/browser/prerender/prerender_host.h
@@ -119,9 +119,6 @@ void RecordFinalStatus(FinalStatus status); - // Returns the frame tree associated with |prerendered_contents_|; - FrameTree* GetPrerenderedFrameTree(); - void CreatePageHolder(WebContentsImpl& web_contents); const blink::mojom::PrerenderAttributesPtr attributes_;
diff --git a/content/browser/prerender/prerender_host_registry.cc b/content/browser/prerender/prerender_host_registry.cc index a181230d..e412512 100644 --- a/content/browser/prerender/prerender_host_registry.cc +++ b/content/browser/prerender/prerender_host_registry.cc
@@ -209,6 +209,18 @@ return iter->second.get(); } +std::vector<RenderFrameHostImpl*> +PrerenderHostRegistry::GetPrerenderedMainFrames() { + std::vector<RenderFrameHostImpl*> result; + for (auto& i : prerender_host_by_frame_tree_node_id_) { + result.push_back(i.second->GetPrerenderedMainFrameHost()); + } + for (auto& i : reserved_prerender_host_by_frame_tree_node_id_) { + result.push_back(i.second->GetPrerenderedMainFrameHost()); + } + return result; +} + PrerenderHost* PrerenderHostRegistry::FindHostByUrlForTesting( const GURL& prerendering_url) { auto id_iter = frame_tree_node_id_by_url_.find(prerendering_url);
diff --git a/content/browser/prerender/prerender_host_registry.h b/content/browser/prerender/prerender_host_registry.h index 10a262b..785e498 100644 --- a/content/browser/prerender/prerender_host_registry.h +++ b/content/browser/prerender/prerender_host_registry.h
@@ -123,6 +123,10 @@ // does not match any reserved host. PrerenderHost* FindReservedHostById(int frame_tree_node_id); + // Returns the main frames of FrameTrees owned by this registry's prerender + // hosts. + std::vector<RenderFrameHostImpl*> GetPrerenderedMainFrames(); + // Returns the non-reserved host for `prerendering_url`. Returns nullptr if // the URL doesn't match any non-reserved host. PrerenderHost* FindHostByUrlForTesting(const GURL& prerendering_url);
diff --git a/content/browser/prerender/prerender_processor.cc b/content/browser/prerender/prerender_processor.cc index cd15dd6..aa6488c 100644 --- a/content/browser/prerender/prerender_processor.cc +++ b/content/browser/prerender/prerender_processor.cc
@@ -8,6 +8,7 @@ #include "content/browser/prerender/prerender_host.h" #include "content/browser/renderer_host/render_frame_host_delegate.h" #include "content/browser/renderer_host/render_frame_host_impl.h" +#include "content/browser/webui/url_data_manager_backend.h" #include "third_party/blink/public/common/features.h" namespace content { @@ -72,6 +73,14 @@ return; } + // Report bad message if asked to prerender webUI. + std::string scheme = attributes->url.scheme(); + const auto& webui_schemes = URLDataManagerBackend::GetWebUISchemes(); + if (base::Contains(webui_schemes, scheme)) { + mojo::ReportBadMessage("PP_WEBUI"); + return; + } + if (!registry_) return; prerender_frame_tree_node_id_ = registry_->CreateAndStartHost(
diff --git a/content/browser/renderer_host/clipboard_host_impl.cc b/content/browser/renderer_host/clipboard_host_impl.cc index a65d7b5..3981ffd 100644 --- a/content/browser/renderer_host/clipboard_host_impl.cc +++ b/content/browser/renderer_host/clipboard_host_impl.cc
@@ -335,9 +335,8 @@ const std::vector<uint8_t>& data) { std::string string_data( reinterpret_cast<const char*>(data.data(), data.data() + data.size())); - // TODO(crbug.com/1201018): Create GetPngType() and use it here. PasteIfPolicyAllowed( - clipboard_buffer, ui::ClipboardFormatType::GetBitmapType(), + clipboard_buffer, ui::ClipboardFormatType::GetPngType(), std::move(string_data), base::BindOnce( [](std::vector<uint8_t> data, ReadPngCallback callback,
diff --git a/content/browser/renderer_host/cors_rfc1918_browsertest.cc b/content/browser/renderer_host/cors_rfc1918_browsertest.cc index af588c4..5cc235c6 100644 --- a/content/browser/renderer_host/cors_rfc1918_browsertest.cc +++ b/content/browser/renderer_host/cors_rfc1918_browsertest.cc
@@ -300,7 +300,8 @@ public: CorsRfc1918BrowserTest() : CorsRfc1918BrowserTestBase( - {features::kBlockInsecurePrivateNetworkRequests}) {} + {features::kBlockInsecurePrivateNetworkRequests, + features::kWarnAboutSecurePrivateNetworkRequests}) {} }; // Test with insecure private network requests blocked, including navigations. @@ -310,6 +311,7 @@ CorsRfc1918BrowserTestBlockNavigations() : CorsRfc1918BrowserTestBase({ features::kBlockInsecurePrivateNetworkRequests, + features::kWarnAboutSecurePrivateNetworkRequests, features::kBlockInsecurePrivateNetworkRequestsForNavigations, }) {} }; @@ -559,8 +561,7 @@ EXPECT_FALSE(security_state->is_web_secure_context); EXPECT_EQ(network::mojom::CrossOriginEmbedderPolicyValue::kNone, security_state->cross_origin_embedder_policy.value); - EXPECT_EQ(network::mojom::PrivateNetworkRequestPolicy:: - kBlockFromInsecureToMorePrivate, + EXPECT_EQ(network::mojom::PrivateNetworkRequestPolicy::kBlock, security_state->private_network_request_policy); // Browser-created empty main frames are trusted to access the local network, @@ -2215,8 +2216,8 @@ } // This test verifies that with the blocking feature disabled, the private -// network request policy used by RenderFrameHostImpl for requests is set -// to warn about insecure requests. +// network request policy used by RenderFrameHostImpl is to warn about requests +// from non-secure contexts. IN_PROC_BROWSER_TEST_F(CorsRfc1918BrowserTestNoBlocking, PrivateNetworkPolicyIsWarnByDefault) { EXPECT_TRUE(NavigateToURL(shell(), InsecurePublicURL(kDefaultPath))); @@ -2225,9 +2226,25 @@ root_frame_host()->BuildClientSecurityState(); ASSERT_FALSE(security_state.is_null()); + EXPECT_FALSE(security_state->is_web_secure_context); EXPECT_EQ(security_state->private_network_request_policy, - network::mojom::PrivateNetworkRequestPolicy:: - kWarnFromInsecureToMorePrivate); + network::mojom::PrivateNetworkRequestPolicy::kWarn); +} + +// This test verifies that with the blocking feature disabled, the private +// network request policy used by RenderFrameHostImpl is to allow requests from +// secure contexts. +IN_PROC_BROWSER_TEST_F(CorsRfc1918BrowserTestNoBlocking, + PrivateNetworkPolicyIsAllowByDefaultForSecureContexts) { + EXPECT_TRUE(NavigateToURL(shell(), SecurePublicURL(kDefaultPath))); + + const network::mojom::ClientSecurityStatePtr security_state = + root_frame_host()->BuildClientSecurityState(); + ASSERT_FALSE(security_state.is_null()); + + EXPECT_TRUE(security_state->is_web_secure_context); + EXPECT_EQ(security_state->private_network_request_policy, + network::mojom::PrivateNetworkRequestPolicy::kAllow); } // This test mimics the tests below, with the blocking feature disabled. It @@ -2246,7 +2263,8 @@ } // This test verifies that by default, the private network request policy used -// by RenderFrameHostImpl for requests is set to block insecure requests. +// by RenderFrameHostImpl for requests is set to block requests from non-secure +// contexts. IN_PROC_BROWSER_TEST_F(CorsRfc1918BrowserTest, PrivateNetworkPolicyIsBlockByDefault) { EXPECT_TRUE(NavigateToURL(shell(), InsecurePublicURL(kDefaultPath))); @@ -2255,9 +2273,25 @@ root_frame_host()->BuildClientSecurityState(); ASSERT_FALSE(security_state.is_null()); + EXPECT_FALSE(security_state->is_web_secure_context); EXPECT_EQ(security_state->private_network_request_policy, - network::mojom::PrivateNetworkRequestPolicy:: - kBlockFromInsecureToMorePrivate); + network::mojom::PrivateNetworkRequestPolicy::kBlock); +} + +// This test verifies that by default, the private network request policy used +// by RenderFrameHostImpl for requests is set to allow requests from secure +// contexts. +IN_PROC_BROWSER_TEST_F(CorsRfc1918BrowserTest, + PrivateNetworkPolicyIsAllowByDefaultForSecureContexts) { + EXPECT_TRUE(NavigateToURL(shell(), SecurePublicURL(kDefaultPath))); + + const network::mojom::ClientSecurityStatePtr security_state = + root_frame_host()->BuildClientSecurityState(); + ASSERT_FALSE(security_state.is_null()); + + EXPECT_TRUE(security_state->is_web_secure_context); + EXPECT_EQ(security_state->private_network_request_policy, + network::mojom::PrivateNetworkRequestPolicy::kWarn); } // This test verifies that when the right feature is enabled but the content @@ -2309,15 +2343,15 @@ EXPECT_TRUE(NavigateToURL(shell(), url)); RenderFrameHostImpl* child_frame = - AddChildFromURL(root_frame_host(), SecureLocalURL(kDefaultPath)); + AddChildFromURL(root_frame_host(), InsecureLocalURL(kDefaultPath)); network::mojom::ClientSecurityStatePtr security_state = child_frame->BuildClientSecurityState(); ASSERT_FALSE(security_state.is_null()); + EXPECT_FALSE(security_state->is_web_secure_context); EXPECT_EQ(security_state->private_network_request_policy, - network::mojom::PrivateNetworkRequestPolicy:: - kBlockFromInsecureToMorePrivate); + network::mojom::PrivateNetworkRequestPolicy::kBlock); } // This test verifies that the initial empty document, which inherits its origin @@ -2396,9 +2430,9 @@ child_frame->BuildClientSecurityState(); ASSERT_FALSE(security_state.is_null()); + EXPECT_FALSE(security_state->is_web_secure_context); EXPECT_EQ(security_state->private_network_request_policy, - network::mojom::PrivateNetworkRequestPolicy:: - kBlockFromInsecureToMorePrivate); + network::mojom::PrivateNetworkRequestPolicy::kBlock); } // This test verifies that when the right feature is enabled, requests:
diff --git a/content/browser/renderer_host/frame_tree_node.cc b/content/browser/renderer_host/frame_tree_node.cc index 292ee87..ee872a2 100644 --- a/content/browser/renderer_host/frame_tree_node.cc +++ b/content/browser/renderer_host/frame_tree_node.cc
@@ -260,8 +260,7 @@ return frame_tree_->root() == this; } -void FrameTreeNode::ResetForNavigation( - bool was_served_from_back_forward_cache) { +void FrameTreeNode::ResetForNavigation() { // This frame has had its user activation bits cleared in the renderer before // arriving here. We just need to clear them here and in the other renderer // processes that may have a reference to this frame.
diff --git a/content/browser/renderer_host/frame_tree_node.h b/content/browser/renderer_host/frame_tree_node.h index 2f3aa37..236ab137 100644 --- a/content/browser/renderer_host/frame_tree_node.h +++ b/content/browser/renderer_host/frame_tree_node.h
@@ -99,7 +99,7 @@ // a fresh set of CSP). // TODO(arthursonzogni): Remove this function. The frame/document must not be // left temporarily with lax state. - void ResetForNavigation(bool was_served_from_back_forward_cache); + void ResetForNavigation(); FrameTree* frame_tree() const { return frame_tree_; } Navigator& navigator() { return frame_tree()->navigator(); }
diff --git a/content/browser/renderer_host/media/capture_handle_manager_unittest.cc b/content/browser/renderer_host/media/capture_handle_manager_unittest.cc new file mode 100644 index 0000000..6a0ebff --- /dev/null +++ b/content/browser/renderer_host/media/capture_handle_manager_unittest.cc
@@ -0,0 +1,287 @@ +// Copyright (c) 2021 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 "content/browser/media/capture_handle_manager.h" + +#include "content/test/test_render_view_host.h" +#include "content/test/test_web_contents.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace content { + +namespace { + +using Callback = CaptureHandleManager::DeviceCaptureHandleChangeCallback; +using blink::MediaStreamDevice; +using testing::_; + +const std::string kLabel = "noladaleybeceipretsamrehtonatey"; + +GlobalFrameRoutingId GetGlobalFrameRoutingId(RenderFrameHost* frame) { + return GlobalFrameRoutingId(frame->GetProcess()->GetID(), + frame->GetRoutingID()); +} + +GlobalFrameRoutingId GetGlobalFrameRoutingId( + std::unique_ptr<TestWebContents>& web_contents) { + return GetGlobalFrameRoutingId(web_contents->GetMainFrame()); +} + +MATCHER_P2(IsCaptureHandle, expected_origin, expected_handle, "") { + if (!arg) { + return false; + } + + if (arg->origin.opaque() != expected_origin.opaque()) { + return false; // One is empty, the other is non-empty. + } + + // Either both are opaque or neither is. We only compare non-opaque origins. + if (!expected_origin.opaque()) { + if (arg->origin != expected_origin) { + return false; + } + } + + return arg->capture_handle == expected_handle; +} + +media::mojom::CaptureHandlePtr MakeCaptureHandle(url::Origin origin, + const std::u16string& handle) { + auto capture_handle = media::mojom::CaptureHandle::New(); + capture_handle->origin = origin; + capture_handle->capture_handle = handle; + return capture_handle; +} + +media::mojom::CaptureHandlePtr MakeCaptureHandle(const std::u16string& handle) { + return MakeCaptureHandle(url::Origin(), handle); +} + +blink::mojom::CaptureHandleConfigPtr MakePermissiveConfigWithHandle( + const std::u16string& handle = u"") { + auto ptr = blink::mojom::CaptureHandleConfig::New(); + ptr->expose_origin = true; + ptr->capture_handle = handle; + ptr->all_origins_permitted = true; + return ptr; +} + +blink::mojom::CaptureHandleConfigPtr MakeRestrictiveConfigWithHandle( + const std::vector<url::Origin> permitted_origins, + const std::u16string& handle = u"") { + auto ptr = blink::mojom::CaptureHandleConfig::New(); + ptr->expose_origin = true; + ptr->capture_handle = handle; + ptr->all_origins_permitted = false; + ptr->permitted_origins = permitted_origins; + return ptr; +} + +class CallbackHelper { + public: + MOCK_METHOD3(Method, + void(const std::string& label, + blink::mojom::MediaStreamType type, + media::mojom::CaptureHandlePtr capture_handle)); + + Callback AsCallback() { + return base::BindRepeating(&CallbackHelper::Method, base::Unretained(this)); + } +}; + +} // namespace + +class CaptureHandleManagerTest : public RenderViewHostImplTestHarness { + public: + std::unique_ptr<TestWebContents> MakeTestWebContents() { + scoped_refptr<SiteInstance> instance = + SiteInstance::Create(GetBrowserContext()); + instance->GetProcess()->Init(); + + return TestWebContents::Create(GetBrowserContext(), std::move(instance)); + } + + CallbackHelper& MakeCallbackHelper() { + CHECK_LT(callback_helper_count_, kMaxCallbackHelpers); + return callback_helpers_[++callback_helper_count_]; + } + + MediaStreamDevice& MakeDevice( + RenderFrameHost* frame, + media::mojom::CaptureHandlePtr capture_handle = nullptr) { + CHECK_LT(device_count_, kMaxDevices); + auto& device = devices_[++device_count_]; + + const WebContentsMediaCaptureId id(frame->GetProcess()->GetID(), + frame->GetRoutingID()); + device.id = id.ToString(); + device.display_media_info = media::mojom::DisplayMediaInformation::New(); + (*device.display_media_info)->capture_handle = std::move(capture_handle); + + return device; + } + + MediaStreamDevice& MakeDevice( + std::unique_ptr<TestWebContents>& web_contents, + media::mojom::CaptureHandlePtr capture_handle = nullptr) { + return MakeDevice(web_contents->GetMainFrame(), std::move(capture_handle)); + } + + protected: + CaptureHandleManager manager_; + + private: + static constexpr size_t kMaxCallbackHelpers = 10; + CallbackHelper callback_helpers_[kMaxCallbackHelpers]; + size_t callback_helper_count_ = 0; + + static constexpr size_t kMaxDevices = 10; + MediaStreamDevice devices_[kMaxDevices]; + size_t device_count_ = 0; +}; + +TEST_F(CaptureHandleManagerTest, + OnTabCaptureStartedProducesNoCallbackIfDeviceHasNoCaptureHandle) { + auto captured = MakeTestWebContents(); + auto capturer = MakeTestWebContents(); + + auto& callback_helper = MakeCallbackHelper(); + EXPECT_CALL(callback_helper, Method(_, _, _)).Times(0); + manager_.OnTabCaptureStarted(kLabel, MakeDevice(captured), + GetGlobalFrameRoutingId(capturer), + callback_helper.AsCallback()); +} + +TEST_F(CaptureHandleManagerTest, + OnTabCaptureStartedProducesCallbackIfDeviceHasOldCaptureHandle) { + auto captured = MakeTestWebContents(); + auto capturer = MakeTestWebContents(); + + auto& captured_device = MakeDevice(captured, MakeCaptureHandle(u"same")); + + captured->SetCaptureHandleConfig(MakePermissiveConfigWithHandle(u"same")); + + auto& callback_helper = MakeCallbackHelper(); + EXPECT_CALL(callback_helper, Method(_, _, _)).Times(0); + manager_.OnTabCaptureStarted(kLabel, captured_device, + GetGlobalFrameRoutingId(capturer), + callback_helper.AsCallback()); +} + +TEST_F(CaptureHandleManagerTest, + OnTabCaptureStartedProducesCallbackIfDeviceHasNewCaptureHandle) { + auto captured = MakeTestWebContents(); + auto capturer = MakeTestWebContents(); + + auto& captured_device = MakeDevice(captured, MakeCaptureHandle(u"old")); + + captured->SetCaptureHandleConfig(MakePermissiveConfigWithHandle(u"new")); + + auto& callback_helper = MakeCallbackHelper(); + EXPECT_CALL(callback_helper, Method(kLabel, captured_device.type, + IsCaptureHandle(url::Origin(), u"new"))) + .Times(1); + manager_.OnTabCaptureStarted(kLabel, captured_device, + GetGlobalFrameRoutingId(capturer), + callback_helper.AsCallback()); +} + +TEST_F(CaptureHandleManagerTest, CallbackInvokedWhenCaptureHandleChanges) { + auto captured = MakeTestWebContents(); + auto capturer = MakeTestWebContents(); + + auto& captured_device = MakeDevice(captured, MakeCaptureHandle(u"before")); + captured->SetCaptureHandleConfig(MakePermissiveConfigWithHandle(u"before")); + + auto& callback_helper = MakeCallbackHelper(); + manager_.OnTabCaptureStarted(kLabel, captured_device, + GetGlobalFrameRoutingId(capturer), + callback_helper.AsCallback()); + + EXPECT_CALL(callback_helper, Method(kLabel, captured_device.type, + IsCaptureHandle(url::Origin(), u"after"))) + .Times(1); + captured->SetCaptureHandleConfig(MakePermissiveConfigWithHandle(u"after")); +} + +TEST_F(CaptureHandleManagerTest, CaptureHandleResetByNavigation) { + auto captured = MakeTestWebContents(); + auto capturer = MakeTestWebContents(); + + const GURL kGurl1("https://origin1.com"); + const GURL kGurl2("https://origin2.com"); + const url::Origin kOrigin1 = url::Origin::Create(kGurl1); + + captured->NavigateAndCommit(kGurl1); + auto& captured_device = + MakeDevice(captured, MakeCaptureHandle(kOrigin1, u"handle")); + captured->SetCaptureHandleConfig(MakePermissiveConfigWithHandle(u"handle")); + + auto& callback_helper = MakeCallbackHelper(); + manager_.OnTabCaptureStarted(kLabel, captured_device, + GetGlobalFrameRoutingId(capturer), + callback_helper.AsCallback()); + + EXPECT_CALL(callback_helper, Method(kLabel, captured_device.type, + IsCaptureHandle(url::Origin(), u""))) + .Times(1); + captured->NavigateAndCommit(kGurl2); +} + +TEST_F(CaptureHandleManagerTest, + CallbackNotInvokedWhenConfigDisallowsCapturer) { + auto captured = MakeTestWebContents(); + auto capturer = MakeTestWebContents(); + + const GURL kCapturedUrl("https://captured.com"); + captured->NavigateAndCommit(kCapturedUrl); + + const GURL kDisallowedUrl("https://disallowed.com"); + capturer->NavigateAndCommit(kDisallowedUrl); + + const GURL kAllowedUrl("https://allowed.com"); + const url::Origin kAllowedOrigin = url::Origin::Create(kAllowedUrl); + + auto& captured_device = MakeDevice(captured); + + auto& callback_helper = MakeCallbackHelper(); + manager_.OnTabCaptureStarted(kLabel, captured_device, + GetGlobalFrameRoutingId(capturer), + callback_helper.AsCallback()); + + EXPECT_CALL(callback_helper, Method(_, _, _)).Times(0); + captured->SetCaptureHandleConfig( + MakeRestrictiveConfigWithHandle({kAllowedOrigin}, u"handle")); +} + +TEST_F(CaptureHandleManagerTest, CallbackInvokedWhenConfigAllowsCapturer) { + auto captured = MakeTestWebContents(); + auto capturer = MakeTestWebContents(); + + const GURL kCapturedUrl("https://captured.com"); + const url::Origin kCapturedOrigin = url::Origin::Create(kCapturedUrl); + captured->NavigateAndCommit(kCapturedUrl); + + const GURL kAllowedUrl("https://allowed.com"); + const url::Origin kAllowedOrigin = url::Origin::Create(kAllowedUrl); + capturer->NavigateAndCommit(kAllowedUrl); + + auto& captured_device = MakeDevice(captured); + + auto& callback_helper = MakeCallbackHelper(); + manager_.OnTabCaptureStarted(kLabel, captured_device, + GetGlobalFrameRoutingId(capturer), + callback_helper.AsCallback()); + + EXPECT_CALL(callback_helper, + Method(kLabel, captured_device.type, + IsCaptureHandle(kCapturedOrigin, u"handle"))) + .Times(1); + captured->SetCaptureHandleConfig( + MakeRestrictiveConfigWithHandle({kAllowedOrigin}, u"handle")); +} + +} // namespace content
diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host.cc index d27f3d0d..2091dbd 100644 --- a/content/browser/renderer_host/media/media_stream_dispatcher_host.cc +++ b/content/browser/renderer_host/media/media_stream_dispatcher_host.cc
@@ -100,6 +100,15 @@ new_state); } +void MediaStreamDispatcherHost::OnDeviceCaptureHandleChange( + const std::string& label, + const blink::MediaStreamDevice& device) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + DCHECK(device.display_media_info.has_value()); + + GetMediaStreamDeviceObserver()->OnDeviceCaptureHandleChange(label, device); +} + const mojo::Remote<blink::mojom::MediaStreamDeviceObserver>& MediaStreamDispatcherHost::GetMediaStreamDeviceObserver() { DCHECK_CURRENTLY_ON(BrowserThread::IO); @@ -184,6 +193,9 @@ weak_factory_.GetWeakPtr()), base::BindRepeating( &MediaStreamDispatcherHost::OnDeviceRequestStateChange, + weak_factory_.GetWeakPtr()), + base::BindRepeating( + &MediaStreamDispatcherHost::OnDeviceCaptureHandleChange, weak_factory_.GetWeakPtr())); }
diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host.h b/content/browser/renderer_host/media/media_stream_dispatcher_host.h index 5543dda..88fff65 100644 --- a/content/browser/renderer_host/media/media_stream_dispatcher_host.h +++ b/content/browser/renderer_host/media/media_stream_dispatcher_host.h
@@ -99,6 +99,8 @@ const std::string& label, const blink::MediaStreamDevice& device, const blink::mojom::MediaStreamStateChange new_state); + void OnDeviceCaptureHandleChange(const std::string& label, + const blink::MediaStreamDevice& device); static int next_requester_id_;
diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc index 3627d00..16b838a 100644 --- a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc
@@ -143,6 +143,9 @@ void OnDeviceChanged(const std::string& label, const blink::MediaStreamDevice& old_device, const blink::MediaStreamDevice& new_device) override {} + void OnDeviceCaptureHandleChange( + const std::string& label, + const blink::MediaStreamDevice& device) override {} void OnDeviceRequestStateChange( const std::string& label, const blink::MediaStreamDevice& device,
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc index 99f1b401e..bc85b94c 100644 --- a/content/browser/renderer_host/media/media_stream_manager.cc +++ b/content/browser/renderer_host/media/media_stream_manager.cc
@@ -14,6 +14,7 @@ #include <vector> #include "base/bind.h" +#include "base/bind_post_task.h" #include "base/command_line.h" #include "base/compiler_specific.h" #include "base/lazy_instance.h" @@ -673,6 +674,8 @@ DeviceRequestStateChangeCallback device_request_state_change_cb; + DeviceCaptureHandleChangeCallback device_capture_handle_change_cb; + std::unique_ptr<MediaStreamUIProxy> ui_proxy; std::string tab_capture_device_id; @@ -894,7 +897,8 @@ GenerateStreamCallback generate_stream_cb, DeviceStoppedCallback device_stopped_cb, DeviceChangedCallback device_changed_cb, - DeviceRequestStateChangeCallback device_request_state_change_cb) { + DeviceRequestStateChangeCallback device_request_state_change_cb, + DeviceCaptureHandleChangeCallback device_capture_handle_change_cb) { DCHECK_CURRENTLY_ON(BrowserThread::IO); SendLogMessage(GetGenerateStreamLogString(render_process_id, render_frame_id, requester_id, page_request_id)); @@ -907,6 +911,8 @@ request->device_changed_cb = std::move(device_changed_cb); request->device_request_state_change_cb = std::move(device_request_state_change_cb); + request->device_capture_handle_change_cb = + std::move(device_capture_handle_change_cb); const std::string& label = AddRequest(base::WrapUnique(request)); @@ -1105,6 +1111,7 @@ DeviceRequest* const request = labeled_request.second.get(); for (const MediaStreamDevice& device : request->devices) { if (device.session_id() == session_id && device.type == type) { + MaybeStopTrackingCaptureHandleConfig(labeled_request.first, device); // Notify observers that this device is being closed. // Note that only one device per type can be opened. request->SetState(type, MEDIA_REQUEST_STATE_CLOSING); @@ -1858,6 +1865,17 @@ std::move(request->generate_stream_cb) .Run(MediaStreamRequestResult::OK, label, audio_devices, video_devices, pan_tilt_zoom_allowed); + + // We only start tracking once stream generation is truly complete. + // If the CaptureHandle observable by this capturer has changed asynchronously + // while the current task was hopping between threads/queues, an event will + // be fired by the CaptureHandleManager. + for (const auto& device : video_devices) { + MaybeStartTrackingCaptureHandleConfig( + label, device, + GlobalFrameRoutingId(request->requesting_process_id, + request->requesting_frame_id)); + } } void MediaStreamManager::FinalizeRequestFailed( @@ -1958,6 +1976,11 @@ for (const auto& old_devices : old_devices_by_type) for (const auto& old_device : old_devices) request->device_changed_cb.Run(label, old_device, MediaStreamDevice()); + + MaybeUpdateTrackedCaptureHandleConfigs( + label, request->devices, + GlobalFrameRoutingId(request->requesting_process_id, + request->requesting_frame_id)); } void MediaStreamManager::FinalizeMediaAccessRequest( @@ -2852,4 +2875,110 @@ page_request_id); } +void MediaStreamManager::MaybeStartTrackingCaptureHandleConfig( + const std::string& label, + const MediaStreamDevice& captured_device, + GlobalFrameRoutingId capturer) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + if (!blink::IsVideoInputMediaType(captured_device.type) || + !WebContentsMediaCaptureId::Parse(captured_device.id, nullptr)) { + return; + } + + // It is safe to bind base::Unretained(this) because MediaStreamManager is + // owned by BrowserMainLoop. + // Since |capture_handle_manager_| is owned by |this|, it is also safe to + // bind base::Unretained(&capture_handle_manager_). + GetUIThreadTaskRunner({})->PostTask( + FROM_HERE, + base::BindOnce( + &CaptureHandleManager::OnTabCaptureStarted, + base::Unretained(&capture_handle_manager_), label, captured_device, + capturer, + base::BindPostTask( + GetIOThreadTaskRunner({}), + base::BindRepeating(&MediaStreamManager::OnCaptureHandleChange, + base::Unretained(this))))); +} + +void MediaStreamManager::MaybeStopTrackingCaptureHandleConfig( + const std::string& label, + const MediaStreamDevice& captured_device) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + if (!blink::IsVideoInputMediaType(captured_device.type) || + !WebContentsMediaCaptureId::Parse(captured_device.id, nullptr)) { + return; + } + + // It is safe to bind base::Unretained(&capture_handle_manager_) because + // it is owned by MediaStreamManager, which is in turn owned by + // BrowserMainLoop. + GetUIThreadTaskRunner({})->PostTask( + FROM_HERE, base::BindOnce(&CaptureHandleManager::OnTabCaptureStopped, + base::Unretained(&capture_handle_manager_), + label, captured_device)); +} + +void MediaStreamManager::MaybeUpdateTrackedCaptureHandleConfigs( + const std::string& label, + const MediaStreamDevices& new_devices, + GlobalFrameRoutingId capturer) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + MediaStreamDevices filtered_new_devices; + for (const MediaStreamDevice& device : new_devices) { + if (blink::IsVideoInputMediaType(device.type) && + WebContentsMediaCaptureId::Parse(device.id, nullptr)) { + filtered_new_devices.push_back(device); + } + } + + // It is safe to bind base::Unretained(&capture_handle_manager_) because + // it is owned by MediaStreamManager, which is in turn owned by + // BrowserMainLoop. + GetUIThreadTaskRunner({})->PostTask( + FROM_HERE, + base::BindOnce( + &CaptureHandleManager::OnTabCaptureDevicesUpdated, + base::Unretained(&capture_handle_manager_), label, + std::move(filtered_new_devices), capturer, + base::BindPostTask( + GetIOThreadTaskRunner({}), + base::BindRepeating(&MediaStreamManager::OnCaptureHandleChange, + base::Unretained(this))))); +} + +void MediaStreamManager::OnCaptureHandleChange( + const std::string& label, + blink::mojom::MediaStreamType type, + media::mojom::CaptureHandlePtr capture_handle) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + DeviceRequest* const request = FindRequest(label); + if (!request) { + DVLOG(1) << "The request with label = " << label << " does not exist."; + return; + } + + for (MediaStreamDevice& device : request->devices) { + if (type != device.type) { + continue; + } + + if (!device.display_media_info.has_value()) { + DVLOG(1) << "Tab capture without a DisplayMediaInformation (" << label + << ", " << type << ")."; + continue; + } + + device.display_media_info.value()->capture_handle = capture_handle.Clone(); + + if (request->device_capture_handle_change_cb) { + request->device_capture_handle_change_cb.Run(label, device); + } + } +} + } // namespace content
diff --git a/content/browser/renderer_host/media/media_stream_manager.h b/content/browser/renderer_host/media/media_stream_manager.h index 22816c4..52a615a 100644 --- a/content/browser/renderer_host/media/media_stream_manager.h +++ b/content/browser/renderer_host/media/media_stream_manager.h
@@ -42,11 +42,13 @@ #include "base/task/current_thread.h" #include "base/threading/thread.h" #include "build/build_config.h" +#include "content/browser/media/capture_handle_manager.h" #include "content/browser/media/media_devices_util.h" #include "content/browser/renderer_host/media/media_devices_manager.h" #include "content/browser/renderer_host/media/media_stream_provider.h" #include "content/common/content_export.h" #include "content/public/browser/desktop_media_id.h" +#include "content/public/browser/global_routing_id.h" #include "content/public/browser/media_request_state.h" #include "content/public/browser/media_stream_request.h" #include "content/public/browser/permission_controller.h" @@ -116,6 +118,10 @@ const blink::MediaStreamDevice& device, const blink::mojom::MediaStreamStateChange new_state)>; + using DeviceCaptureHandleChangeCallback = + base::RepeatingCallback<void(const std::string& label, + const blink::MediaStreamDevice& device)>; + // Callback for testing. using GenerateStreamTestCallback = base::OnceCallback<bool(const blink::StreamControls&)>; @@ -199,7 +205,8 @@ GenerateStreamCallback generate_stream_cb, DeviceStoppedCallback device_stopped_cb, DeviceChangedCallback device_changed_cb, - DeviceRequestStateChangeCallback device_request_state_change_cb); + DeviceRequestStateChangeCallback device_request_state_change_cb, + DeviceCaptureHandleChangeCallback device_capture_handle_change_cb); // Cancel an open request identified by |page_request_id| for the given frame. // Must be called on the IO thread. @@ -594,6 +601,28 @@ int page_request_id, blink::mojom::PermissionStatus status); + // Start tracking capture-handle changes for tab-capture. + void MaybeStartTrackingCaptureHandleConfig( + const std::string& label, + const blink::MediaStreamDevice& captured_device, + GlobalFrameRoutingId capturer); + + // Stop tracking capture-handle changes for tab-capture. + void MaybeStopTrackingCaptureHandleConfig( + const std::string& label, + const blink::MediaStreamDevice& captured_device); + + // When device changes, update which tabs' capture-handles are tracked. + void MaybeUpdateTrackedCaptureHandleConfigs( + const std::string& label, + const blink::MediaStreamDevices& new_devices, + GlobalFrameRoutingId capturer); + + // Receive a new capture-handle from the CaptureHandleManager. + void OnCaptureHandleChange(const std::string& label, + blink::mojom::MediaStreamType type, + media::mojom::CaptureHandlePtr capture_handle); + media::AudioSystem* const audio_system_; // not owned scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; scoped_refptr<VideoCaptureManager> video_capture_manager_; @@ -612,6 +641,11 @@ base::RepeatingCallback<std::unique_ptr<FakeMediaStreamUIProxy>(void)> fake_ui_factory_; + // Observes changes of captured tabs' CaptureHandleConfig and reports + // this changes back to their capturers. This object lives on the UI thread + // and must be accessed on it and torn down from it. + CaptureHandleManager capture_handle_manager_; + // Maps render process hosts to log callbacks. Used on the IO thread. std::map<int, base::RepeatingCallback<void(const std::string&)>> log_callbacks_;
diff --git a/content/browser/renderer_host/media/media_stream_manager_unittest.cc b/content/browser/renderer_host/media/media_stream_manager_unittest.cc index 805323c..80f5638 100644 --- a/content/browser/renderer_host/media/media_stream_manager_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_manager_unittest.cc
@@ -264,6 +264,8 @@ MediaStreamManager::DeviceChangedCallback changed_callback; MediaStreamManager::DeviceRequestStateChangeCallback request_state_change_callback; + MediaStreamManager::DeviceCaptureHandleChangeCallback + capture_handle_change_callback; std::vector<blink::mojom::MediaStreamType> expected_types; expected_types.push_back( @@ -289,7 +291,8 @@ blink::mojom::StreamSelectionStrategy::SEARCH_BY_DEVICE_ID, absl::nullopt), std::move(generate_stream_callback), stopped_callback.Get(), - std::move(changed_callback), std::move(request_state_change_callback)); + std::move(changed_callback), std::move(request_state_change_callback), + std::move(capture_handle_change_callback)); run_loop_.Run(); EXPECT_EQ(blink::mojom::MediaStreamType::DISPLAY_VIDEO_CAPTURE, @@ -371,6 +374,8 @@ MediaStreamManager::DeviceChangedCallback changed_callback; MediaStreamManager::DeviceRequestStateChangeCallback request_state_change_callback; + MediaStreamManager::DeviceCaptureHandleChangeCallback + capture_handle_change_callback; StreamSelectionInfoPtr info = StreamSelectionInfo::New(strategy, session_id); @@ -379,7 +384,8 @@ controls, MediaDeviceSaltAndOrigin(), false /* user_gesture */, std::move(info), std::move(generate_stream_callback), std::move(stopped_callback), std::move(changed_callback), - std::move(request_state_change_callback)); + std::move(request_state_change_callback), + std::move(capture_handle_change_callback)); run_loop.Run(); return audio_device; @@ -738,7 +744,8 @@ std::move(generate_stream_callback), MediaStreamManager::DeviceStoppedCallback(), MediaStreamManager::DeviceChangedCallback(), - MediaStreamManager::DeviceRequestStateChangeCallback()); + MediaStreamManager::DeviceRequestStateChangeCallback(), + MediaStreamManager::DeviceCaptureHandleChangeCallback()); run_loop_.Run(); EXPECT_CALL(*media_observer_, OnMediaRequestStateChanged(_, _, _, _, _, _)) @@ -779,6 +786,8 @@ .Times(testing::AtLeast(1)); MediaStreamManager::DeviceRequestStateChangeCallback request_state_change_callback; + MediaStreamManager::DeviceCaptureHandleChangeCallback + capture_handle_change_callback; media_stream_manager_->GenerateStream( render_process_id, render_frame_id, requester_id, page_request_id, @@ -787,7 +796,8 @@ blink::mojom::StreamSelectionStrategy::SEARCH_BY_DEVICE_ID, absl::nullopt), std::move(generate_stream_callback), std::move(stopped_callback), - std::move(changed_callback), std::move(request_state_change_callback)); + std::move(changed_callback), std::move(request_state_change_callback), + std::move(capture_handle_change_callback)); run_loop_.Run(); EXPECT_EQ(controls.video.stream_type, video_device.type); EXPECT_NE(DesktopMediaID::TYPE_NONE, @@ -843,6 +853,8 @@ .Times(testing::AtLeast(1)); MediaStreamManager::DeviceRequestStateChangeCallback request_state_change_callback; + MediaStreamManager::DeviceCaptureHandleChangeCallback + capture_handle_change_callback; media_stream_manager_->GenerateStream( render_process_id, render_frame_id, requester_id, page_request_id, @@ -851,7 +863,8 @@ blink::mojom::StreamSelectionStrategy::SEARCH_BY_DEVICE_ID, absl::nullopt), std::move(generate_stream_callback), std::move(stopped_callback), - std::move(changed_callback), std::move(request_state_change_callback)); + std::move(changed_callback), std::move(request_state_change_callback), + std::move(capture_handle_change_callback)); run_loop_.Run(); EXPECT_EQ(controls.video.stream_type, video_device.type); EXPECT_NE(DesktopMediaID::TYPE_NONE,
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index f900b91..1a036bb 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc
@@ -1599,8 +1599,9 @@ if (!NeedsUrlLoader()) { // The types of pages that don't need a URL Loader should never get served - // from the BackForwardCache. + // from the BackForwardCache or activated from a prerender. DCHECK(!IsServedFromBackForwardCache()); + DCHECK(!IsPrerenderedPageActivation()); // There is no need to make a network request for this navigation, so commit // it immediately. @@ -3331,7 +3332,7 @@ // This is incorrect: frames can cause others in the same browsing context // group to navigate to pages, without being the parent. Additionally // there is no client security state for top-level navigations, which mainly - // means that CORS-RFC1918 checks are skipped for such requests. + // means that Private Network Access checks are skipped for such requests. // // TODO(https://crbug.com/1170335): Pass the client security state of the // navigation initiator to this navigation request somehow and use that @@ -3344,12 +3345,15 @@ if (parent) { client_security_state = parent->BuildClientSecurityState(); - // Selectively disable blocking of insecure private network requests if the - // right feature is not enabled. + // If the right feature is not enabled, disable blocking of private network + // requests for navigation fetches. if (!base::FeatureList::IsEnabled( features::kBlockInsecurePrivateNetworkRequestsForNavigations)) { - client_security_state->private_network_request_policy = network::mojom:: - PrivateNetworkRequestPolicy::kWarnFromInsecureToMorePrivate; + // Only show warnings for requests initiated from non-secure contexts. + client_security_state->private_network_request_policy = + client_security_state->is_web_secure_context + ? network::mojom::PrivateNetworkRequestPolicy::kAllow + : network::mojom::PrivateNetworkRequestPolicy::kWarn; } } @@ -5124,13 +5128,34 @@ return; } + const PolicyContainerPolicies& policies = + policy_container_navigation_bundle_->FinalPolicies(); + + // Requests initiated from secure contexts are never blocked; depending + // on a feature flag, we show a warning in DevTools. + if (policies.is_web_secure_context) { + private_network_request_policy_ = + base::FeatureList::IsEnabled( + features::kWarnAboutSecurePrivateNetworkRequests) + ? network::mojom::PrivateNetworkRequestPolicy::kWarn + : network::mojom::PrivateNetworkRequestPolicy::kAllow; + return; + } + + // Requests from non-secure contexts in the unknown address space are allowed. + if (policies.ip_address_space == network::mojom::IPAddressSpace::kUnknown) { + private_network_request_policy_ = + network::mojom::PrivateNetworkRequestPolicy::kAllow; + return; + } + + // Requests from non-secure contexts are only blocked if the feature is + // enabled, otherwise we simply show a warning in DevTools. private_network_request_policy_ = base::FeatureList::IsEnabled( features::kBlockInsecurePrivateNetworkRequests) - ? network::mojom::PrivateNetworkRequestPolicy:: - kBlockFromInsecureToMorePrivate - : network::mojom::PrivateNetworkRequestPolicy:: - kWarnFromInsecureToMorePrivate; + ? network::mojom::PrivateNetworkRequestPolicy::kBlock + : network::mojom::PrivateNetworkRequestPolicy::kWarn; } void NavigationRequest::ReadyToCommitNavigation(bool is_error) {
diff --git a/content/browser/renderer_host/navigation_request.h b/content/browser/renderer_host/navigation_request.h index b0f599c..888621e 100644 --- a/content/browser/renderer_host/navigation_request.h +++ b/content/browser/renderer_host/navigation_request.h
@@ -1731,8 +1731,7 @@ // https://crbug.com/1154729 network::CrossOriginEmbedderPolicy cross_origin_embedder_policy_; network::mojom::PrivateNetworkRequestPolicy private_network_request_policy_ = - network::mojom::PrivateNetworkRequestPolicy:: - kWarnFromInsecureToMorePrivate; + network::mojom::PrivateNetworkRequestPolicy::kWarn; // Messages to be printed on the console in the target RenderFrameHost of this // NavigationRequest.
diff --git a/content/browser/renderer_host/navigator.cc b/content/browser/renderer_host/navigator.cc index 3654c2b..62eb048d 100644 --- a/content/browser/renderer_host/navigator.cc +++ b/content/browser/renderer_host/navigator.cc
@@ -419,8 +419,7 @@ if (!is_same_document_navigation) { // Navigating to a new location means a new, fresh set of http headers // and/or <meta> elements - we need to reset Permissions Policy. - frame_tree_node->ResetForNavigation( - navigation_request->IsServedFromBackForwardCache()); + frame_tree_node->ResetForNavigation(); } // Update the site of the SiteInstance if it doesn't have one yet, unless
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index da1a38b..04b53ab 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -1247,12 +1247,7 @@ } InitializePolicyContainerHost(renderer_initiated_creation_of_main_frame); - - if (!base::FeatureList::IsEnabled( - features::kBlockInsecurePrivateNetworkRequests)) { - private_network_request_policy_ = network::mojom:: - PrivateNetworkRequestPolicy::kWarnFromInsecureToMorePrivate; - } + InitializePrivateNetworkRequestPolicy(); unload_event_monitor_timeout_ = std::make_unique<TimeoutMonitor>(base::BindRepeating( @@ -1701,38 +1696,14 @@ return false; } -namespace { - -template <typename RfhType> -RenderFrameHostImpl::FrameIterationCallbackImpl ContinueIterationWrapper( - base::RepeatingCallback<void(RfhType*)> on_frame) { - return base::BindRepeating( - [](base::RepeatingCallback<void(RfhType*)> on_frame, - RenderFrameHostImpl* rfh) { - on_frame.Run(rfh); - return RenderFrameHost::FrameIterationAction::kContinue; - }, - on_frame); -} - -} // namespace - void RenderFrameHostImpl::ForEachRenderFrameHost( FrameIterationCallback on_frame) { - // There's no automatic conversion from FrameIterationCallback to - // FrameIterationCallbackImpl, so this wrapper just forwards the - // RenderFrameHost argument. - FrameIterationCallbackImpl on_frame_impl = base::BindRepeating( - [](FrameIterationCallback on_frame, RenderFrameHostImpl* rfh) { - return on_frame.Run(rfh); - }, - on_frame); - ForEachRenderFrameHost(on_frame_impl); + ForEachRenderFrameHost(FrameIterationWrapper(on_frame)); } void RenderFrameHostImpl::ForEachRenderFrameHost( FrameIterationAlwaysContinueCallback on_frame) { - ForEachRenderFrameHost(ContinueIterationWrapper(on_frame)); + ForEachRenderFrameHost(FrameIterationWrapper(on_frame)); } void RenderFrameHostImpl::ForEachRenderFrameHost( @@ -1742,7 +1713,7 @@ void RenderFrameHostImpl::ForEachRenderFrameHost( FrameIterationAlwaysContinueCallbackImpl on_frame) { - ForEachRenderFrameHost(ContinueIterationWrapper(on_frame)); + ForEachRenderFrameHost(FrameIterationWrapper(on_frame)); } void RenderFrameHostImpl::ForEachRenderFrameHostIncludingSpeculative( @@ -1752,8 +1723,7 @@ void RenderFrameHostImpl::ForEachRenderFrameHostIncludingSpeculative( FrameIterationAlwaysContinueCallbackImpl on_frame) { - ForEachRenderFrameHostIncludingSpeculative( - ContinueIterationWrapper(on_frame)); + ForEachRenderFrameHostIncludingSpeculative(FrameIterationWrapper(on_frame)); } void RenderFrameHostImpl::ForEachRenderFrameHostImpl( @@ -2525,6 +2495,42 @@ policy_container_host_->AssociateWithFrameToken(GetFrameToken()); } +void RenderFrameHostImpl::InitializePrivateNetworkRequestPolicy() { + if (!policy_container_host_) { + // Only speculative RFHs may lack a policy container. + DCHECK_EQ(lifecycle_state_, LifecycleStateImpl::kSpeculative); + return; + } + + const PolicyContainerPolicies& policies = policy_container_host_->policies(); + + // For now, we always allow private network requests from secure contexts; + // depending on a feature flag, we show a warning in DevTools. + if (policies.is_web_secure_context) { + private_network_request_policy_ = + base::FeatureList::IsEnabled( + features::kWarnAboutSecurePrivateNetworkRequests) + ? network::mojom::PrivateNetworkRequestPolicy::kWarn + : network::mojom::PrivateNetworkRequestPolicy::kAllow; + return; + } + + // Requests from non-secure contexts in the unknown address space are allowed. + if (policies.ip_address_space == network::mojom::IPAddressSpace::kUnknown) { + private_network_request_policy_ = + network::mojom::PrivateNetworkRequestPolicy::kAllow; + return; + } + + // Insecure private network request handling depends on a feature flag. Even + // if blocking is disabled, we warn developers when we notice such requests. + private_network_request_policy_ = + base::FeatureList::IsEnabled( + features::kBlockInsecurePrivateNetworkRequests) + ? network::mojom::PrivateNetworkRequestPolicy::kBlock + : network::mojom::PrivateNetworkRequestPolicy::kWarn; +} + void RenderFrameHostImpl::RenderProcessExited( RenderProcessHost* host, const ChildProcessTerminationInfo& info) { @@ -9075,8 +9081,7 @@ std::move(coep), /*is_web_secure_context=*/false, network::mojom::IPAddressSpace::kUnknown, - network::mojom::PrivateNetworkRequestPolicy:: - kBlockFromInsecureToMorePrivate); + network::mojom::PrivateNetworkRequestPolicy::kBlock); } auto client_security_state = network::mojom::ClientSecurityState::New();
diff --git a/content/browser/renderer_host/render_frame_host_impl.h b/content/browser/renderer_host/render_frame_host_impl.h index 1e1cab4..602041271 100644 --- a/content/browser/renderer_host/render_frame_host_impl.h +++ b/content/browser/renderer_host/render_frame_host_impl.h
@@ -1760,6 +1760,30 @@ void ForEachRenderFrameHostIncludingSpeculative( FrameIterationAlwaysContinueCallbackImpl on_frame); + // |ForEachRenderFrameHost| has multiple overloads for convenience of the + // caller that only differ by the provided callback's signature. + // |FrameIterationWrapper| converts to a common callback signature for the + // implementation to use. + template <typename RfhType> + static FrameIterationCallbackImpl FrameIterationWrapper( + base::RepeatingCallback<FrameIterationAction(RfhType*)> on_frame) { + return base::BindRepeating( + [](base::RepeatingCallback<FrameIterationAction(RfhType*)> on_frame, + RenderFrameHostImpl* rfh) { return on_frame.Run(rfh); }, + on_frame); + } + template <typename RfhType> + static FrameIterationCallbackImpl FrameIterationWrapper( + base::RepeatingCallback<void(RfhType*)> on_frame) { + return base::BindRepeating( + [](base::RepeatingCallback<void(RfhType*)> on_frame, + RenderFrameHostImpl* rfh) { + on_frame.Run(rfh); + return FrameIterationAction::kContinue; + }, + on_frame); + } + bool DocumentUsedWebOTP() override; scoped_refptr<WebAuthRequestSecurityChecker> @@ -2897,6 +2921,9 @@ void SetPolicyContainerHost( scoped_refptr<PolicyContainerHost> policy_container_host); + // Initializes |private_network_request_policy_|. Constructor helper. + void InitializePrivateNetworkRequestPolicy(); + // Returns true if this frame requires a proxy to talk to its parent. // Note: Using a proxy to talk to a parent does not imply that the parent // is in a different process. @@ -2987,8 +3014,7 @@ // TODO(https://crbug.com/888079): Simplify the above comment when the // behavior it explains is fixed. network::mojom::PrivateNetworkRequestPolicy private_network_request_policy_ = - network::mojom::PrivateNetworkRequestPolicy:: - kBlockFromInsecureToMorePrivate; + network::mojom::PrivateNetworkRequestPolicy::kBlock; network::CrossOriginEmbedderPolicy cross_origin_embedder_policy_;
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index f51e9bd..617e5d59 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -195,6 +195,7 @@ #include "services/metrics/public/mojom/ukm_interface.mojom.h" #include "services/metrics/ukm_recorder_interface.h" #include "services/network/public/cpp/network_switches.h" +#include "services/network/public/mojom/mdns_responder.mojom.h" #include "services/network/public/mojom/network_service.mojom.h" #include "services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom.h" #include "services/service_manager/public/cpp/binder_registry.h"
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index 1490224..ce8aa5b 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -45,6 +45,7 @@ #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_widget_host_delegate.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" +#include "content/common/frame.mojom-forward.h" #include "content/public/browser/render_process_host_observer.h" #include "content/public/browser/render_widget_host.h" #include "content/public/common/page_zoom.h"
diff --git a/content/browser/service_worker/fake_embedded_worker_instance_client.cc b/content/browser/service_worker/fake_embedded_worker_instance_client.cc index 0c4c332..e2eee87 100644 --- a/content/browser/service_worker/fake_embedded_worker_instance_client.cc +++ b/content/browser/service_worker/fake_embedded_worker_instance_client.cc
@@ -14,6 +14,7 @@ #include "content/browser/service_worker/service_worker_context_core.h" #include "content/public/common/content_features.h" #include "services/network/test/test_url_loader_client.h" +#include "third_party/blink/public/mojom/devtools/devtools_agent.mojom.h" namespace content {
diff --git a/content/browser/service_worker/fake_service_worker.cc b/content/browser/service_worker/fake_service_worker.cc index 7bba20a..47b5a349 100644 --- a/content/browser/service_worker/fake_service_worker.cc +++ b/content/browser/service_worker/fake_service_worker.cc
@@ -12,6 +12,7 @@ #include "mojo/public/cpp/bindings/remote.h" #include "services/network/public/mojom/fetch_api.mojom.h" #include "third_party/blink/public/mojom/fetch/fetch_api_response.mojom.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_fetch_response_callback.mojom.h" namespace content {
diff --git a/content/browser/service_worker/service_worker_job_coordinator.cc b/content/browser/service_worker/service_worker_job_coordinator.cc index 76181ed7..dd3b3b40 100644 --- a/content/browser/service_worker/service_worker_job_coordinator.cc +++ b/content/browser/service_worker/service_worker_job_coordinator.cc
@@ -12,6 +12,7 @@ #include "base/memory/ptr_util.h" #include "content/browser/service_worker/service_worker_register_job_base.h" #include "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_registration_options.mojom.h" namespace content {
diff --git a/content/browser/service_worker/service_worker_process_manager.h b/content/browser/service_worker/service_worker_process_manager.h index 49bab08..bce5ca6 100644 --- a/content/browser/service_worker/service_worker_process_manager.h +++ b/content/browser/service_worker/service_worker_process_manager.h
@@ -18,6 +18,10 @@ class GURL; +namespace network { +struct CrossOriginEmbedderPolicy; +} + namespace content { class BrowserContext;
diff --git a/content/browser/service_worker/service_worker_registry.cc b/content/browser/service_worker/service_worker_registry.cc index 8db1998..764297d 100644 --- a/content/browser/service_worker/service_worker_registry.cc +++ b/content/browser/service_worker/service_worker_registry.cc
@@ -26,6 +26,7 @@ #include "storage/browser/quota/special_storage_policy.h" #include "third_party/blink/public/common/service_worker/service_worker_scope_match.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_options.mojom.h" namespace content {
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc index 39fc6c7..98cdf32 100644 --- a/content/browser/service_worker/service_worker_version.cc +++ b/content/browser/service_worker/service_worker_version.cc
@@ -27,6 +27,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/time/default_clock.h" #include "base/time/default_tick_clock.h" +#include "base/trace_event/trace_event.h" #include "components/services/storage/public/cpp/storage_key.h" #include "content/browser/bad_message.h" #include "content/browser/child_process_security_policy_impl.h"
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index f7c82c8..4fa1323 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1311,6 +1311,99 @@ return SendToAllFramesImpl(frame_tree_, /*include_pending=*/true, message); } +void WebContentsImpl::ForEachRenderFrameHost( + RenderFrameHost::FrameIterationCallback on_frame) { + ForEachRenderFrameHost(RenderFrameHostImpl::FrameIterationWrapper(on_frame)); +} + +void WebContentsImpl::ForEachRenderFrameHost( + RenderFrameHost::FrameIterationAlwaysContinueCallback on_frame) { + ForEachRenderFrameHost(RenderFrameHostImpl::FrameIterationWrapper(on_frame)); +} + +void WebContentsImpl::ForEachRenderFrameHost( + RenderFrameHostImpl::FrameIterationCallbackImpl on_frame) { + ForEachRenderFrameHostImpl(on_frame, /* include_speculative */ false); +} + +void WebContentsImpl::ForEachRenderFrameHost( + RenderFrameHostImpl::FrameIterationAlwaysContinueCallbackImpl on_frame) { + ForEachRenderFrameHost(RenderFrameHostImpl::FrameIterationWrapper(on_frame)); +} + +void WebContentsImpl::ForEachRenderFrameHostIncludingSpeculative( + RenderFrameHostImpl::FrameIterationCallbackImpl on_frame) { + ForEachRenderFrameHostImpl(on_frame, /* include_speculative */ true); +} + +void WebContentsImpl::ForEachRenderFrameHostIncludingSpeculative( + RenderFrameHostImpl::FrameIterationAlwaysContinueCallbackImpl on_frame) { + ForEachRenderFrameHostIncludingSpeculative( + RenderFrameHostImpl::FrameIterationWrapper(on_frame)); +} + +void WebContentsImpl::ForEachRenderFrameHostImpl( + RenderFrameHostImpl::FrameIterationCallbackImpl on_frame, + bool include_speculative) { + // Since |RenderFrameHostImpl::ForEachRenderFrameHost| will reach the + // RenderFrameHosts descending from a specified root, it is enough to start + // iteration from each of the outermost main frames to reach everything in + // this WebContents. However, if iteration stops early in + // |RenderFrameHostImpl::ForEachRenderFrameHost|, we also need to stop early + // by not iterating over additional outermost main frames. + bool iteration_stopped = false; + RenderFrameHostImpl::FrameIterationCallbackImpl on_frame_with_termination = + base::BindRepeating( + [](bool& iteration_stopped, + RenderFrameHostImpl::FrameIterationCallbackImpl on_frame, + RenderFrameHostImpl* rfh) { + const auto action = on_frame.Run(rfh); + if (action == RenderFrameHost::FrameIterationAction::kStop) { + iteration_stopped = true; + } + return action; + }, + std::ref(iteration_stopped), on_frame); + + for (auto* rfh : GetOutermostMainFrames()) { + if (include_speculative) { + rfh->ForEachRenderFrameHostIncludingSpeculative( + on_frame_with_termination); + } else { + rfh->ForEachRenderFrameHost(on_frame_with_termination); + } + + if (iteration_stopped) { + return; + } + } +} + +std::vector<RenderFrameHostImpl*> WebContentsImpl::GetOutermostMainFrames() { + std::vector<RenderFrameHostImpl*> result; + result.push_back(GetMainFrame()); + + for (const auto& entry : GetController().GetBackForwardCache().GetEntries()) { + result.push_back(entry->render_frame_host.get()); + } + + if (blink::features::IsPrerender2Enabled()) { + const std::vector<RenderFrameHostImpl*> prerendered_main_frames = + GetPrerenderHostRegistry()->GetPrerenderedMainFrames(); + result.insert(result.end(), prerendered_main_frames.begin(), + prerendered_main_frames.end()); + } + + // In the case of inner WebContents, we still allow this method to be called, + // but the semantics of the values being returned are "outermost + // within this WebContents" as opposed to truly outermost. We would not expect + // any other outermost pages besides the primary page in the case of inner + // WebContents. + DCHECK(!GetOuterWebContents() || (result.size() == 1)); + + return result; +} + void WebContentsImpl::ExecutePageBroadcastMethod( PageBroadcastMethodCallback callback) { OPTIONAL_TRACE_EVENT0("content",
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index fccd17ed..f981b43 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h
@@ -354,6 +354,10 @@ const base::RepeatingCallback<void(RenderFrameHost*)>& on_frame) override; std::vector<RenderFrameHost*> GetAllFrames() override; int SendToAllFrames(IPC::Message* message) override; + void ForEachRenderFrameHost( + RenderFrameHost::FrameIterationCallback on_frame) override; + void ForEachRenderFrameHost( + RenderFrameHost::FrameIterationAlwaysContinueCallback on_frame) override; RenderViewHostImpl* GetRenderViewHost() override; RenderWidgetHostView* GetRenderWidgetHostView() override; RenderWidgetHostView* GetTopLevelRenderWidgetHostView() override; @@ -1248,6 +1252,20 @@ std::vector<RenderFrameHost*> GetAllFramesIncludingPending(); int SendToAllFramesIncludingPending(IPC::Message* message); + // These are the content internal equivalents of + // |WebContents::ForEachRenderFrameHost| whose comment can be referred to + // for details. Content internals can also access speculative + // RenderFrameHostImpls if necessary by using the + // |ForEachRenderFrameHostIncludingSpeculative| variations. + void ForEachRenderFrameHost( + RenderFrameHostImpl::FrameIterationCallbackImpl on_frame); + void ForEachRenderFrameHost( + RenderFrameHostImpl::FrameIterationAlwaysContinueCallbackImpl on_frame); + void ForEachRenderFrameHostIncludingSpeculative( + RenderFrameHostImpl::FrameIterationCallbackImpl on_frame); + void ForEachRenderFrameHostIncludingSpeculative( + RenderFrameHostImpl::FrameIterationAlwaysContinueCallbackImpl on_frame); + // Computes and returns the content specific preferences for this WebContents. // Recomputes only the "fast" preferences (those not requiring slow // platform/device polling); the remaining "slow" ones are recomputed only if @@ -1741,6 +1759,16 @@ // shown in the address bar), as opposed to one in for example a Prerender. bool IsPrimaryFrameTree(const FrameTree& frame_tree) const; + // This is the actual implementation of the various overloads of + // |ForEachRenderFrameHost|. + void ForEachRenderFrameHostImpl( + RenderFrameHostImpl::FrameIterationCallbackImpl on_frame, + bool include_speculative); + + // Returns the primary main frame, followed by the main frames of any other + // outermost frame trees in this WebContents. + std::vector<RenderFrameHostImpl*> GetOutermostMainFrames(); + // Called when the base::ScopedClosureRunner returned by // IncrementCapturerCount() is destructed. void DecrementCapturerCount(bool stay_hidden, bool stay_awake);
diff --git a/content/browser/web_contents/web_contents_impl_browsertest.cc b/content/browser/web_contents/web_contents_impl_browsertest.cc index 817edfa..5cc687f 100644 --- a/content/browser/web_contents/web_contents_impl_browsertest.cc +++ b/content/browser/web_contents/web_contents_impl_browsertest.cc
@@ -3848,6 +3848,44 @@ /* count */ 1); } +IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ForEachRenderFrameHost) { + ASSERT_TRUE(embedded_test_server()->Start()); + const GURL url = + embedded_test_server()->GetURL("a.com", "/page_with_iframe.html"); + ASSERT_TRUE(NavigateToURL(shell(), url)); + auto* web_contents = static_cast<WebContentsImpl*>(shell()->web_contents()); + + // In the absence of any pages besides the primary page (e.g. nothing in + // bfcache, no prerendered pages), iterating over the RenderFrameHosts of the + // WebContents would just produce the RenderFrameHosts of the primary page. + EXPECT_THAT(CollectAllRenderFrameHosts(web_contents), + testing::ContainerEq( + CollectAllRenderFrameHosts(web_contents->GetMainFrame()))); +} + +IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, + ForEachRenderFrameHostInnerContents) { + ASSERT_TRUE(embedded_test_server()->Start()); + const GURL url_a( + embedded_test_server()->GetURL("a.com", "/page_with_iframe.html")); + const GURL url_b(embedded_test_server()->GetURL("b.com", "/title1.html")); + ASSERT_TRUE(NavigateToURL(shell(), url_a)); + auto* web_contents = static_cast<WebContentsImpl*>(shell()->web_contents()); + + auto* inner_contents = CreateAndAttachInnerContents( + web_contents->GetMainFrame()->child_at(0)->current_frame_host()); + ASSERT_TRUE(NavigateToURLFromRenderer(inner_contents, url_b)); + + // Calling |WebContents::ForEachRenderFrameHost| on an inner contents does not + // add much value over |RenderFrameHost::ForEachRenderFrameHost|, since we + // don't have any pages besides the primary page, however for completeness, we + // allow it to be called and confirm that it just returns the RenderFrameHosts + // of the primary page. + EXPECT_THAT(CollectAllRenderFrameHosts(inner_contents), + testing::ContainerEq( + CollectAllRenderFrameHosts(inner_contents->GetMainFrame()))); +} + namespace { class LoadingObserver : public WebContentsObserver {
diff --git a/content/browser/webauth/virtual_authenticator.cc b/content/browser/webauth/virtual_authenticator.cc index a0b9662..0fa5ead 100644 --- a/content/browser/webauth/virtual_authenticator.cc +++ b/content/browser/webauth/virtual_authenticator.cc
@@ -14,6 +14,7 @@ #include "device/fido/public_key_credential_user_entity.h" #include "device/fido/virtual_ctap2_device.h" #include "device/fido/virtual_u2f_device.h" +#include "mojo/public/cpp/base/big_buffer.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace content {
diff --git a/content/browser/webui/web_ui_impl.cc b/content/browser/webui/web_ui_impl.cc index 64b34f4..7cc7f68b4 100644 --- a/content/browser/webui/web_ui_impl.cc +++ b/content/browser/webui/web_ui_impl.cc
@@ -69,6 +69,12 @@ web_contents_(contents), web_contents_observer_(new WebUIMainFrameObserver(this, contents)) { DCHECK(contents); + + // Assert that we can only open webui for the active or speculative pages. + DCHECK(frame_host->lifecycle_state() == + RenderFrameHostImpl::LifecycleStateImpl::kActive || + frame_host->lifecycle_state() == + RenderFrameHostImpl::LifecycleStateImpl::kSpeculative); } WebUIImpl::~WebUIImpl() {
diff --git a/content/browser/webui/web_ui_main_frame_observer.cc b/content/browser/webui/web_ui_main_frame_observer.cc index 3d8464b3..2b72cd2 100644 --- a/content/browser/webui/web_ui_main_frame_observer.cc +++ b/content/browser/webui/web_ui_main_frame_observer.cc
@@ -58,7 +58,7 @@ void WebUIMainFrameObserver::DidFinishNavigation( NavigationHandle* navigation_handle) { // Only disallow JavaScript on cross-document navigations in the main frame. - if (!navigation_handle->IsInMainFrame() || + if (!navigation_handle->IsInPrimaryMainFrame() || !navigation_handle->HasCommitted() || navigation_handle->IsSameDocument()) { return;
diff --git a/content/browser/xr/service/xr_runtime_manager_impl.cc b/content/browser/xr/service/xr_runtime_manager_impl.cc index 1f6b1bef..d732f36 100644 --- a/content/browser/xr/service/xr_runtime_manager_impl.cc +++ b/content/browser/xr/service/xr_runtime_manager_impl.cc
@@ -14,7 +14,7 @@ #include "base/lazy_instance.h" #include "base/memory/singleton.h" #include "base/strings/string_number_conversions.h" -#include "base/trace_event/common/trace_event_common.h" +#include "base/trace_event/trace_event.h" #include "content/browser/xr/service/xr_frame_sink_client_impl.h" #include "content/browser/xr/xr_utils.h" #include "content/public/browser/browser_task_traits.h"
diff --git a/content/child/BUILD.gn b/content/child/BUILD.gn index c8a036d..4b49a07 100644 --- a/content/child/BUILD.gn +++ b/content/child/BUILD.gn
@@ -53,8 +53,6 @@ "runtime_features.h", "scoped_child_process_reference.cc", "scoped_child_process_reference.h", - "webthemeengine_impl_conversions.cc", - "webthemeengine_impl_conversions.h", ] configs += [ "//build/config:precompiled_headers" ] @@ -116,19 +114,6 @@ "//v8", ] - if (is_android) { - deps += [ "//third_party/android_ndk:cpu_features" ] - sources += [ - "webthemeengine_impl_android.cc", - "webthemeengine_impl_android.h", - ] - } else { - sources += [ - "webthemeengine_impl_default.cc", - "webthemeengine_impl_default.h", - ] - } - if (is_linux || is_chromeos) { sources += [ "child_process_sandbox_support_impl_linux.cc", @@ -160,8 +145,6 @@ sources += [ "child_process_sandbox_support_impl_mac.cc", "child_process_sandbox_support_impl_mac.h", - "webthemeengine_impl_mac.cc", - "webthemeengine_impl_mac.h", ] }
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc index a1e434b..29cb1ce6 100644 --- a/content/child/blink_platform_impl.cc +++ b/content/child/blink_platform_impl.cc
@@ -57,19 +57,8 @@ #include "ui/base/ui_base_features.h" #include "ui/events/gestures/blink/web_gesture_curve_impl.h" -#if defined(OS_ANDROID) -#include "content/child/webthemeengine_impl_android.h" -#else -#include "content/child/webthemeengine_impl_default.h" -#endif - -#if defined(OS_MAC) -#include "content/child/webthemeengine_impl_mac.h" -#endif - using blink::WebData; using blink::WebString; -using blink::WebThemeEngine; using blink::WebURL; using blink::WebURLError; @@ -77,16 +66,6 @@ namespace { -std::unique_ptr<blink::WebThemeEngine> GetWebThemeEngine() { -#if defined(OS_ANDROID) - return std::make_unique<WebThemeEngineAndroid>(); -#elif defined(OS_MAC) - return std::make_unique<WebThemeEngineMac>(); -#else - return std::make_unique<WebThemeEngineDefault>(); -#endif -} - // This must match third_party/WebKit/public/blink_resources.grd. struct DataResource { const char* name; @@ -163,8 +142,7 @@ scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner) : io_thread_task_runner_(std::move(io_thread_task_runner)), browser_interface_broker_proxy_( - base::MakeRefCounted<ThreadSafeBrowserInterfaceBrokerProxyImpl>()), - native_theme_engine_(GetWebThemeEngine()) {} + base::MakeRefCounted<ThreadSafeBrowserInterfaceBrokerProxyImpl>()) {} BlinkPlatformImpl::~BlinkPlatformImpl() = default; @@ -241,10 +219,6 @@ return browser_interface_broker_proxy_.get(); } -WebThemeEngine* BlinkPlatformImpl::ThemeEngine() { - return native_theme_engine_.get(); -} - bool BlinkPlatformImpl::IsURLSupportedForAppCache(const blink::WebURL& url) { return IsSchemeSupportedForAppCache(url); }
diff --git a/content/child/blink_platform_impl.h b/content/child/blink_platform_impl.h index 0809fec..2f5cddc 100644 --- a/content/child/blink_platform_impl.h +++ b/content/child/blink_platform_impl.h
@@ -32,7 +32,6 @@ ~BlinkPlatformImpl() override; // blink::Platform implementation. - blink::WebThemeEngine* ThemeEngine() override; bool IsURLSupportedForAppCache(const blink::WebURL& url) override; bool IsURLSavableForSavableResource(const blink::WebURL& url) override; size_t MaxDecodedImageBytes() override; @@ -60,7 +59,6 @@ scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; const scoped_refptr<blink::ThreadSafeBrowserInterfaceBrokerProxy> browser_interface_broker_proxy_; - std::unique_ptr<blink::WebThemeEngine> native_theme_engine_; webcrypto::WebCryptoImpl web_crypto_; };
diff --git a/content/child/webthemeengine_impl_conversions.cc b/content/child/webthemeengine_impl_conversions.cc deleted file mode 100644 index fa3747b5..0000000 --- a/content/child/webthemeengine_impl_conversions.cc +++ /dev/null
@@ -1,121 +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 "content/child/webthemeengine_impl_conversions.h" - -namespace content { - -// TODO(https://crbug.com/988434): The mapping functions below are duplicated -// inside Blink and in the Android implementation of WebThemeEngine. They should -// be implemented in one place where dependencies between Blink and -// ui::NativeTheme make sense. -ui::NativeTheme::Part NativeThemePart(blink::WebThemeEngine::Part part) { - switch (part) { - case blink::WebThemeEngine::kPartScrollbarDownArrow: - return ui::NativeTheme::kScrollbarDownArrow; - case blink::WebThemeEngine::kPartScrollbarLeftArrow: - return ui::NativeTheme::kScrollbarLeftArrow; - case blink::WebThemeEngine::kPartScrollbarRightArrow: - return ui::NativeTheme::kScrollbarRightArrow; - case blink::WebThemeEngine::kPartScrollbarUpArrow: - return ui::NativeTheme::kScrollbarUpArrow; - case blink::WebThemeEngine::kPartScrollbarHorizontalThumb: - return ui::NativeTheme::kScrollbarHorizontalThumb; - case blink::WebThemeEngine::kPartScrollbarVerticalThumb: - return ui::NativeTheme::kScrollbarVerticalThumb; - case blink::WebThemeEngine::kPartScrollbarHorizontalTrack: - return ui::NativeTheme::kScrollbarHorizontalTrack; - case blink::WebThemeEngine::kPartScrollbarVerticalTrack: - return ui::NativeTheme::kScrollbarVerticalTrack; - case blink::WebThemeEngine::kPartScrollbarCorner: - return ui::NativeTheme::kScrollbarCorner; - case blink::WebThemeEngine::kPartCheckbox: - return ui::NativeTheme::kCheckbox; - case blink::WebThemeEngine::kPartRadio: - return ui::NativeTheme::kRadio; - case blink::WebThemeEngine::kPartButton: - return ui::NativeTheme::kPushButton; - case blink::WebThemeEngine::kPartTextField: - return ui::NativeTheme::kTextField; - case blink::WebThemeEngine::kPartMenuList: - return ui::NativeTheme::kMenuList; - case blink::WebThemeEngine::kPartSliderTrack: - return ui::NativeTheme::kSliderTrack; - case blink::WebThemeEngine::kPartSliderThumb: - return ui::NativeTheme::kSliderThumb; - case blink::WebThemeEngine::kPartInnerSpinButton: - return ui::NativeTheme::kInnerSpinButton; - case blink::WebThemeEngine::kPartProgressBar: - return ui::NativeTheme::kProgressBar; - default: - return ui::NativeTheme::kScrollbarDownArrow; - } -} - -ui::NativeTheme::ScrollbarOverlayColorTheme -NativeThemeScrollbarOverlayColorTheme( - blink::WebScrollbarOverlayColorTheme theme) { - switch (theme) { - case blink::WebScrollbarOverlayColorTheme:: - kWebScrollbarOverlayColorThemeLight: - return ui::NativeTheme::ScrollbarOverlayColorThemeLight; - case blink::WebScrollbarOverlayColorTheme:: - kWebScrollbarOverlayColorThemeDark: - return ui::NativeTheme::ScrollbarOverlayColorThemeDark; - default: - return ui::NativeTheme::ScrollbarOverlayColorThemeDark; - } -} - -ui::NativeTheme::State NativeThemeState(blink::WebThemeEngine::State state) { - switch (state) { - case blink::WebThemeEngine::kStateDisabled: - return ui::NativeTheme::kDisabled; - case blink::WebThemeEngine::kStateHover: - return ui::NativeTheme::kHovered; - case blink::WebThemeEngine::kStateNormal: - return ui::NativeTheme::kNormal; - case blink::WebThemeEngine::kStatePressed: - return ui::NativeTheme::kPressed; - default: - return ui::NativeTheme::kDisabled; - } -} - -ui::NativeTheme::ColorScheme NativeColorScheme( - blink::mojom::ColorScheme color_scheme) { - switch (color_scheme) { - case blink::mojom::ColorScheme::kLight: - return ui::NativeTheme::ColorScheme::kLight; - case blink::mojom::ColorScheme::kDark: - return ui::NativeTheme::ColorScheme::kDark; - } -} - -ui::NativeTheme::SystemThemeColor NativeSystemThemeColor( - blink::WebThemeEngine::SystemThemeColor theme_color) { - switch (theme_color) { - case blink::WebThemeEngine::SystemThemeColor::kButtonFace: - return ui::NativeTheme::SystemThemeColor::kButtonFace; - case blink::WebThemeEngine::SystemThemeColor::kButtonText: - return ui::NativeTheme::SystemThemeColor::kButtonText; - case blink::WebThemeEngine::SystemThemeColor::kGrayText: - return ui::NativeTheme::SystemThemeColor::kGrayText; - case blink::WebThemeEngine::SystemThemeColor::kHighlight: - return ui::NativeTheme::SystemThemeColor::kHighlight; - case blink::WebThemeEngine::SystemThemeColor::kHighlightText: - return ui::NativeTheme::SystemThemeColor::kHighlightText; - case blink::WebThemeEngine::SystemThemeColor::kHotlight: - return ui::NativeTheme::SystemThemeColor::kHotlight; - case blink::WebThemeEngine::SystemThemeColor::kWindow: - return ui::NativeTheme::SystemThemeColor::kWindow; - case blink::WebThemeEngine::SystemThemeColor::kWindowText: - return ui::NativeTheme::SystemThemeColor::kWindowText; - default: - return ui::NativeTheme::SystemThemeColor::kNotSupported; - } -} - - -} // namespace content
diff --git a/content/child/webthemeengine_impl_conversions.h b/content/child/webthemeengine_impl_conversions.h deleted file mode 100644 index 92f7826f..0000000 --- a/content/child/webthemeengine_impl_conversions.h +++ /dev/null
@@ -1,32 +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 CONTENT_CHILD_WEBTHEMEENGINE_IMPL_CONVERSIONS_H_ -#define CONTENT_CHILD_WEBTHEMEENGINE_IMPL_CONVERSIONS_H_ - -#include "content/child/webthemeengine_impl_default.h" -#include "content/common/content_export.h" -#include "ui/native_theme/native_theme.h" - -namespace content { - -CONTENT_EXPORT ui::NativeTheme::Part NativeThemePart( - blink::WebThemeEngine::Part part); - -CONTENT_EXPORT ui::NativeTheme::ScrollbarOverlayColorTheme -NativeThemeScrollbarOverlayColorTheme( - blink::WebScrollbarOverlayColorTheme theme); - -CONTENT_EXPORT ui::NativeTheme::State NativeThemeState( - blink::WebThemeEngine::State state); - -CONTENT_EXPORT ui::NativeTheme::ColorScheme NativeColorScheme( - blink::mojom::ColorScheme color_scheme); - -CONTENT_EXPORT ui::NativeTheme::SystemThemeColor NativeSystemThemeColor( - blink::WebThemeEngine::SystemThemeColor theme_color); - -} // namespace content - -#endif // CONTENT_CHILD_WEBTHEMEENGINE_IMPL_CONVERSIONS_H_
diff --git a/content/child/webthemeengine_impl_default.h b/content/child/webthemeengine_impl_default.h deleted file mode 100644 index b6e8e4c..0000000 --- a/content/child/webthemeengine_impl_default.h +++ /dev/null
@@ -1,49 +0,0 @@ -// Copyright 2014 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 CONTENT_CHILD_WEBTHEMEENGINE_IMPL_DEFAULT_H_ -#define CONTENT_CHILD_WEBTHEMEENGINE_IMPL_DEFAULT_H_ - -#include <stdint.h> - -#include "build/build_config.h" -#include "third_party/blink/public/platform/web_theme_engine.h" - -namespace content { - -class WebThemeEngineDefault : public blink::WebThemeEngine { - public: - // WebThemeEngine methods: - ~WebThemeEngineDefault() override; - gfx::Size GetSize(blink::WebThemeEngine::Part) override; - void Paint(cc::PaintCanvas* canvas, - blink::WebThemeEngine::Part part, - blink::WebThemeEngine::State state, - const gfx::Rect& rect, - const blink::WebThemeEngine::ExtraParams* extra_params, - blink::mojom::ColorScheme color_scheme, - const absl::optional<SkColor>& accent_color) override; - void GetOverlayScrollbarStyle( - blink::WebThemeEngine::ScrollbarStyle*) override; - bool SupportsNinePatch(Part part) const override; - gfx::Size NinePatchCanvasSize(Part part) const override; - gfx::Rect NinePatchAperture(Part part) const override; - absl::optional<SkColor> GetSystemColor(blink::WebThemeEngine::SystemThemeColor - system_theme_color) const override; -#if defined(OS_WIN) - // Caches the scrollbar metrics. These are retrieved in the browser and passed - // to the renderer in blink::RendererPreferences because the required Windows - // system calls cannot be made in sandboxed renderers. - static void cacheScrollBarMetrics(int32_t vertical_scroll_bar_width, - int32_t horizontal_scroll_bar_height, - int32_t vertical_arrow_bitmap_height, - int32_t horizontal_arrow_bitmap_width); -#endif - blink::ForcedColors GetForcedColors() const override; - void SetForcedColors(const blink::ForcedColors forced_colors) override; -}; - -} // namespace content - -#endif // CONTENT_CHILD_WEBTHEMEENGINE_IMPL_DEFAULT_H_
diff --git a/content/child/webthemeengine_impl_mac.h b/content/child/webthemeengine_impl_mac.h deleted file mode 100644 index eaf1c66..0000000 --- a/content/child/webthemeengine_impl_mac.h +++ /dev/null
@@ -1,36 +0,0 @@ -// Copyright 2014 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 CONTENT_CHILD_WEBTHEMEENGINE_IMPL_MAC_H_ -#define CONTENT_CHILD_WEBTHEMEENGINE_IMPL_MAC_H_ - -#include "content/child/webthemeengine_impl_default.h" - -namespace content { - -class WebThemeEngineMac : public WebThemeEngineDefault { - public: - ~WebThemeEngineMac() override {} - - void Paint(cc::PaintCanvas* canvas, - blink::WebThemeEngine::Part part, - blink::WebThemeEngine::State state, - const gfx::Rect& rect, - const blink::WebThemeEngine::ExtraParams* extra_params, - blink::mojom::ColorScheme color_scheme, - const absl::optional<SkColor>& accent_color) override; - - static bool IsScrollbarPart(WebThemeEngine::Part part); - static void PaintMacScrollBarParts( - cc::PaintCanvas* canvas, - WebThemeEngine::Part part, - WebThemeEngine::State state, - const gfx::Rect& rect, - const WebThemeEngine::ExtraParams* extra_params, - blink::mojom::ColorScheme color_scheme); -}; - -} // namespace content - -#endif // CONTENT_CHILD_WEBTHEMEENGINE_IMPL_MAC_H_
diff --git a/content/common/background_fetch/background_fetch_types.cc b/content/common/background_fetch/background_fetch_types.cc index de139df..499e4ee 100644 --- a/content/common/background_fetch/background_fetch_types.cc +++ b/content/common/background_fetch/background_fetch_types.cc
@@ -5,6 +5,7 @@ #include "content/common/background_fetch/background_fetch_types.h" #include "mojo/public/cpp/bindings/remote.h" +#include "third_party/blink/public/mojom/blob/blob.mojom.h" namespace {
diff --git a/content/common/content_param_traits.cc b/content/common/content_param_traits.cc index 2051103..e029c8a 100644 --- a/content/common/content_param_traits.cc +++ b/content/common/content_param_traits.cc
@@ -21,6 +21,7 @@ #include "third_party/blink/public/common/messaging/message_port_descriptor.h" #include "third_party/blink/public/common/messaging/transferable_message.h" #include "third_party/blink/public/common/permissions_policy/permissions_policy.h" +#include "third_party/blink/public/mojom/blob/blob.mojom.h" #include "third_party/blink/public/mojom/permissions_policy/policy_value.mojom.h" #include "ui/accessibility/ax_mode.h"
diff --git a/content/public/browser/gpu_utils.cc b/content/public/browser/gpu_utils.cc index 3d18c96..43d90de 100644 --- a/content/public/browser/gpu_utils.cc +++ b/content/public/browser/gpu_utils.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/single_thread_task_runner.h" +#include "base/strings/string_number_conversions.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "cc/base/switches.h"
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h index 1fd0d64..67006dfc 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h
@@ -318,6 +318,8 @@ virtual const GURL& GetLastCommittedURL() = 0; // Returns the main frame for the currently active view. + // With MPArch, this returns the primary main frame. This WebContents may have + // additional main frames for prerendered pages, bfcached pages, etc. virtual RenderFrameHost* GetMainFrame() = 0; // Returns the focused frame for the currently active view. @@ -342,6 +344,7 @@ virtual RenderFrameHost* UnsafeFindFrameByFrameTreeNodeId( int frame_tree_node_id) = 0; + // TODO(1208438): Migrate to |ForEachRenderFrameHost|. // Calls |on_frame| for each frame in the currently active view. // Note: The RenderFrameHost parameter is not guaranteed to have a live // RenderFrame counterpart in the renderer process. Callbacks should check @@ -350,14 +353,30 @@ virtual void ForEachFrame( const base::RepeatingCallback<void(RenderFrameHost*)>& on_frame) = 0; + // TODO(1208438): Migrate to |ForEachRenderFrameHost|. // Returns a vector of all RenderFrameHosts in the currently active view in // breadth-first traversal order. virtual std::vector<RenderFrameHost*> GetAllFrames() = 0; + // TODO(1208438): Migrate to |ForEachRenderFrameHost|. // Sends the given IPC to all live frames in this WebContents and returns the // number of sent messages (i.e. the number of processed frames). virtual int SendToAllFrames(IPC::Message* message) = 0; + // Calls |on_frame| for every RenderFrameHost in this WebContents. Note that + // this includes RenderFrameHosts that are not descended from the primary main + // frame (e.g. bfcached pages and prerendered pages). The order of traversal + // for RenderFrameHosts within a page is consistent with + // |RenderFrameHost::ForEachRenderFrameHost|'s order, however no order is + // guaranteed between pages. + // For callers only interested in the primary page, + // |GetMainFrame()->ForEachRenderFrameHost()| can be used. + // See |RenderFrameHost::ForEachRenderFrameHost| for details. + virtual void ForEachRenderFrameHost( + RenderFrameHost::FrameIterationCallback on_frame) = 0; + virtual void ForEachRenderFrameHost( + RenderFrameHost::FrameIterationAlwaysContinueCallback on_frame) = 0; + // Gets the current RenderViewHost for this tab. virtual RenderViewHost* GetRenderViewHost() = 0;
diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h index 16ff713..6c2b6e4 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h
@@ -91,7 +91,7 @@ // listen for when RenderFrame objects are created. virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) {} - // This method is invoked whenever one of the current frames of a WebContents + // This method is invoked whenever one of the frames of a WebContents // swaps its RenderFrameHost with another one; for example because that frame // navigated and the new content is in a different process. The // RenderFrameHost that has been replaced is in |old_host|, which can be @@ -99,8 +99,10 @@ // created and no old RenderFrameHost exists. // // This method, in combination with |FrameDeleted|, is appropriate for - // observers wishing to track the set of current RenderFrameHosts -- i.e., - // those hosts that would be visited by calling WebContents::ForEachFrame(). + // observers wishing to track the set of RenderFrameHosts that are current in + // their frame tree. Note that being current in a frame tree is separate from + // the lifecycle state of the RenderFrameHosts. Consider using + // |RenderFrameHostStateChanged|. virtual void RenderFrameHostChanged(RenderFrameHost* old_host, RenderFrameHost* new_host) {}
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index 6df11ea..21f09d8 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -828,6 +828,11 @@ const base::Feature kV8VmFuture{"V8VmFuture", base::FEATURE_DISABLED_BY_DEFAULT}; +// Enables DevTools warnings about accesses to private network resources from +// secure contexts. See also feature `kBlockInsecurePrivateNetworkRequests`. +const base::Feature kWarnAboutSecurePrivateNetworkRequests{ + "WarnAboutSecurePrivateNetworkRequests", base::FEATURE_DISABLED_BY_DEFAULT}; + // Enable window controls overlays for desktop PWAs const base::Feature kWebAppWindowControlsOverlay{ "WebAppWindowControlsOverlay", base::FEATURE_DISABLED_BY_DEFAULT}; @@ -1041,6 +1046,16 @@ kSendWebUIJavaScriptErrorReportsSendToProductionVariation, true}; #endif +#if BUILDFLAG(IS_CHROMEOS_ASH) +// Controls whether the new subtree capture path is used for window capturing on +// ChromeOS Ash, instead of the legacy SlowWindowCapturerChromeOS +// implementation. +// TODO(crbug.com/1210549): remove once we have determined the new path is +// stable. +const base::Feature kAuraWindowSubtreeCapture{"AuraWindowSubtreeCapture", + base::FEATURE_ENABLED_BY_DEFAULT}; +#endif + #if defined(WEBRTC_USE_PIPEWIRE) // Controls whether the PipeWire support for screen capturing is enabled on the // Wayland display server.
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index 3e88614..9b24661 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -212,6 +212,8 @@ CONTENT_EXPORT extern const base::Feature kVerifyDidCommitParams; CONTENT_EXPORT extern const base::Feature kVideoPlaybackQuality; CONTENT_EXPORT extern const base::Feature kV8VmFuture; +CONTENT_EXPORT extern const base::Feature + kWarnAboutSecurePrivateNetworkRequests; CONTENT_EXPORT extern const base::Feature kWebAppWindowControlsOverlay; CONTENT_EXPORT extern const base::Feature kWebAssemblyBaseline; CONTENT_EXPORT extern const base::Feature kWebAssemblyCodeProtection; @@ -267,7 +269,11 @@ kSendWebUIJavaScriptErrorReportsSendToProductionVariation[]; CONTENT_EXPORT extern const base::FeatureParam<bool> kWebUIJavaScriptErrorReportsSendToProductionParam; -#endif +#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) + +#if BUILDFLAG(IS_CHROMEOS_ASH) +CONTENT_EXPORT extern const base::Feature kAuraWindowSubtreeCapture; +#endif // BUILDFLAG(IS_CHROMEOS_ASH) #if defined(WEBRTC_USE_PIPEWIRE) CONTENT_EXPORT extern const base::Feature kWebRtcPipeWireCapturer;
diff --git a/content/public/common/content_switch_dependent_feature_overrides.cc b/content/public/common/content_switch_dependent_feature_overrides.cc index 1e8c5bd4..c1f21a4 100644 --- a/content/public/common/content_switch_dependent_feature_overrides.cc +++ b/content/public/common/content_switch_dependent_feature_overrides.cc
@@ -76,6 +76,9 @@ std::cref(features::kBlockInsecurePrivateNetworkRequests), base::FeatureList::OVERRIDE_ENABLE_FEATURE}, {switches::kEnableExperimentalWebPlatformFeatures, + std::cref(features::kWarnAboutSecurePrivateNetworkRequests), + base::FeatureList::OVERRIDE_ENABLE_FEATURE}, + {switches::kEnableExperimentalWebPlatformFeatures, std::cref(network::features::kAcceptCHFrame), base::FeatureList::OVERRIDE_ENABLE_FEATURE}, {switches::kEnableExperimentalWebPlatformFeatures,
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index e2efd6e..9df9c76 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc
@@ -1823,6 +1823,14 @@ return visited_frames; } +std::vector<RenderFrameHost*> CollectAllRenderFrameHosts( + WebContents* web_contents) { + std::vector<RenderFrameHost*> visited_frames; + web_contents->ForEachRenderFrameHost(base::BindLambdaForTesting( + [&](RenderFrameHost* rfh) { visited_frames.push_back(rfh); })); + return visited_frames; +} + bool ExecuteWebUIResourceTest(WebContents* web_contents, const std::vector<int>& js_resource_ids) { // Inject WebUI test runner script first prior to other scripts required to
diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h index 306b4b8..3c95cb7 100644 --- a/content/public/test/browser_test_utils.h +++ b/content/public/test/browser_test_utils.h
@@ -876,6 +876,10 @@ // the same order. std::vector<RenderFrameHost*> CollectAllRenderFrameHosts( RenderFrameHost* starting_rfh); +// Returns the frames visited by |WebContents::ForEachRenderFrameHost| in +// the same order. +std::vector<RenderFrameHost*> CollectAllRenderFrameHosts( + WebContents* web_contents); // Executes the WebUI resource test runner injecting each resource ID in // |js_resource_ids| prior to executing the tests.
diff --git a/content/public/test/fake_render_widget_host.h b/content/public/test/fake_render_widget_host.h index 5f27180..6d62b5b 100644 --- a/content/public/test/fake_render_widget_host.h +++ b/content/public/test/fake_render_widget_host.h
@@ -12,6 +12,7 @@ #include "mojo/public/cpp/bindings/associated_remote.h" #include "mojo/public/cpp/bindings/remote.h" #include "third_party/blink/public/mojom/frame/intrinsic_sizing_info.mojom-forward.h" +#include "third_party/blink/public/mojom/input/input_handler.mojom.h" #include "third_party/blink/public/mojom/input/touch_event.mojom-forward.h" #include "third_party/blink/public/mojom/page/widget.mojom.h" #include "ui/base/ime/mojom/text_input_state.mojom.h"
diff --git a/content/public/test/mock_render_thread.cc b/content/public/test/mock_render_thread.cc index 63186b8..c6e63d7 100644 --- a/content/public/test/mock_render_thread.cc +++ b/content/public/test/mock_render_thread.cc
@@ -25,6 +25,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/dom_storage/session_storage_namespace_id.h" #include "third_party/blink/public/common/user_agent/user_agent_metadata.h" +#include "third_party/blink/public/mojom/page/widget.mojom.h" #include "third_party/blink/public/web/web_script_controller.h" namespace content {
diff --git a/content/public/test/render_view_test.cc b/content/public/test/render_view_test.cc index f962ef6..7657712 100644 --- a/content/public/test/render_view_test.cc +++ b/content/public/test/render_view_test.cc
@@ -133,7 +133,6 @@ void LoadSynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<blink::WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool pass_response_pipe_to_client, bool no_mime_sniffing, base::TimeDelta timeout_interval, @@ -152,7 +151,6 @@ void LoadAsynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<blink::WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool no_mime_sniffing, std::unique_ptr<blink::ResourceLoadInfoNotifierWrapper>, blink::WebURLLoaderClient* client) override {
diff --git a/content/renderer/accessibility/render_accessibility_impl_browsertest.cc b/content/renderer/accessibility/render_accessibility_impl_browsertest.cc index 833755e..7414414 100644 --- a/content/renderer/accessibility/render_accessibility_impl_browsertest.cc +++ b/content/renderer/accessibility/render_accessibility_impl_browsertest.cc
@@ -734,7 +734,7 @@ TEST_F(RenderAccessibilityImplTest, TestBoundsForFixedNodeAfterScroll) { constexpr char html[] = R"HTML( <div id="positioned" style="position:fixed; top:10px; font-size:40px;" - aria-label="first">title</div> + role="group" aria-label="first">title</div> <div style="padding-top: 50px; font-size:40px;"> <h2>Heading #1</h2> <h2>Heading #2</h2> @@ -803,9 +803,9 @@ TEST_F(RenderAccessibilityImplTest, TestBoundsForMultipleFixedNodeAfterScroll) { constexpr char html[] = R"HTML( <div id="positioned" style="position:fixed; top:10px; font-size:40px;" - aria-label="first">title1</div> + role="group" aria-label="first">title1</div> <div id="positioned" style="position:fixed; top:50px; font-size:40px;" - aria-label="second">title2</div> + role="group" aria-label="second">title2</div> <div style="padding-top: 50px; font-size:40px;"> <h2>Heading #1</h2> <h2>Heading #2</h2>
diff --git a/content/renderer/loader/web_worker_fetch_context_impl.cc b/content/renderer/loader/web_worker_fetch_context_impl.cc index bd384a2..c50e6d9 100644 --- a/content/renderer/loader/web_worker_fetch_context_impl.cc +++ b/content/renderer/loader/web_worker_fetch_context_impl.cc
@@ -22,6 +22,7 @@ #include "third_party/blink/public/common/loader/loader_constants.h" #include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_provider.mojom.h" +#include "third_party/blink/public/mojom/timing/worker_timing_container.mojom.h" #include "third_party/blink/public/platform/child_url_loader_factory_bundle.h" #include "third_party/blink/public/platform/modules/service_worker/web_service_worker_provider_context.h" #include "third_party/blink/public/platform/resource_load_info_notifier_wrapper.h"
diff --git a/content/renderer/loader/web_worker_fetch_context_impl.h b/content/renderer/loader/web_worker_fetch_context_impl.h index 4d5c450..e4b6144 100644 --- a/content/renderer/loader/web_worker_fetch_context_impl.h +++ b/content/renderer/loader/web_worker_fetch_context_impl.h
@@ -24,6 +24,7 @@ #include "third_party/blink/public/mojom/service_worker/service_worker_container.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom-forward.h" #include "third_party/blink/public/mojom/service_worker/service_worker_provider.mojom.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_worker_client.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_worker_client_registry.mojom.h" #include "third_party/blink/public/mojom/timing/worker_timing_container.mojom-forward.h" #include "third_party/blink/public/mojom/worker/subresource_loader_updater.mojom.h"
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 4e7bdc5..ffde530 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -149,6 +149,7 @@ #include "third_party/blink/public/common/page_state/page_state.h" #include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h" #include "third_party/blink/public/mojom/blob/blob.mojom.h" +#include "third_party/blink/public/mojom/blob/blob_url_store.mojom.h" #include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h" #include "third_party/blink/public/mojom/frame/frame_owner_properties.mojom.h" @@ -159,6 +160,7 @@ #include "third_party/blink/public/mojom/loader/referrer.mojom.h" #include "third_party/blink/public/mojom/loader/request_context_frame_type.mojom.h" #include "third_party/blink/public/mojom/loader/resource_load_info.mojom.h" +#include "third_party/blink/public/mojom/page/widget.mojom.h" #include "third_party/blink/public/mojom/permissions/permission.mojom.h" #include "third_party/blink/public/platform/file_path_conversion.h" #include "third_party/blink/public/platform/impression_conversions.h" @@ -4008,11 +4010,6 @@ routing_id_, request)); } - // This is an instance where we embed a copy of the routing id - // into the data portion of the message. This can cause problems if we - // don't register this id on the browser side, since the download manager - // expects to find a RenderViewHost based off the id. - request.SetRequestorID(render_view_->GetRoutingID()); request.SetHasUserGesture(frame_->HasTransientUserActivation()); if (!render_view_->GetRendererPreferences().enable_referrers) {
diff --git a/content/renderer/render_frame_impl_browsertest.cc b/content/renderer/render_frame_impl_browsertest.cc index 34a2452..9c9acc74 100644 --- a/content/renderer/render_frame_impl_browsertest.cc +++ b/content/renderer/render_frame_impl_browsertest.cc
@@ -53,6 +53,7 @@ #include "third_party/blink/public/mojom/frame/frame_replication_state.mojom.h" #include "third_party/blink/public/mojom/frame/viewport_intersection_state.mojom-blink.h" #include "third_party/blink/public/mojom/page/record_content_to_visible_time_request.mojom.h" +#include "third_party/blink/public/mojom/page/widget.mojom.h" #include "third_party/blink/public/platform/web_runtime_features.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_url.h"
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index e373e98..37efa41 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc
@@ -12,7 +12,6 @@ #include "base/single_thread_task_runner.h" #include "base/strings/string_piece.h" #include "cc/trees/ukm_manager.h" -#include "content/child/webthemeengine_impl_default.h" #include "content/common/agent_scheduling_group.mojom.h" #include "content/public/common/content_client.h" #include "content/public/common/content_constants.h" @@ -485,16 +484,4 @@ return webview_; } -void RenderViewImpl::DidUpdateRendererPreferences() { -#if defined(OS_WIN) - // Update Theme preferences on Windows. - const blink::RendererPreferences& renderer_prefs = GetRendererPreferences(); - WebThemeEngineDefault::cacheScrollBarMetrics( - renderer_prefs.vertical_scroll_bar_width_in_dips, - renderer_prefs.horizontal_scroll_bar_height_in_dips, - renderer_prefs.arrow_bitmap_height_vertical_scroll_bar_in_dips, - renderer_prefs.arrow_bitmap_width_horizontal_scroll_bar_in_dips); -#endif -} - } // namespace content
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index 51268da..96fb064 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h
@@ -140,7 +140,6 @@ const absl::optional<blink::WebImpression>& impression) override; void PrintPage(blink::WebLocalFrame* frame) override; void OnPageFrozenChanged(bool frozen) override; - void DidUpdateRendererPreferences() override; // RenderView implementation -------------------------------------------------
diff --git a/content/renderer/service_worker/navigation_preload_request.h b/content/renderer/service_worker/navigation_preload_request.h index 639cc6f..08cfc4a 100644 --- a/content/renderer/service_worker/navigation_preload_request.h +++ b/content/renderer/service_worker/navigation_preload_request.h
@@ -13,6 +13,7 @@ #include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/system/data_pipe.h" #include "services/network/public/mojom/url_loader.mojom-forward.h" +#include "services/network/public/mojom/url_loader.mojom.h" #include "third_party/blink/public/mojom/service_worker/dispatch_fetch_event_params.mojom.h" #include "third_party/blink/public/platform/modules/service_worker/web_service_worker_error.h" #include "third_party/blink/public/platform/web_url_response.h"
diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc index 79334c2..d569c53 100644 --- a/content/renderer/service_worker/service_worker_context_client.cc +++ b/content/renderer/service_worker/service_worker_context_client.cc
@@ -44,6 +44,7 @@ #include "third_party/blink/public/mojom/blob/blob.mojom.h" #include "third_party/blink/public/mojom/browser_interface_broker.mojom.h" #include "third_party/blink/public/mojom/loader/request_context_frame_type.mojom.h" +#include "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_client.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom.h"
diff --git a/content/renderer/service_worker/service_worker_network_provider_for_frame.cc b/content/renderer/service_worker/service_worker_network_provider_for_frame.cc index 095684d0..f4df59d 100644 --- a/content/renderer/service_worker/service_worker_network_provider_for_frame.cc +++ b/content/renderer/service_worker/service_worker_network_provider_for_frame.cc
@@ -16,6 +16,7 @@ #include "content/renderer/render_thread_impl.h" #include "content/renderer/service_worker/service_worker_provider_context.h" #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" +#include "third_party/blink/public/mojom/timing/worker_timing_container.mojom.h" #include "third_party/blink/public/platform/web_back_forward_cache_loader_helper.h" #include "third_party/blink/public/platform/web_url_loader.h" #include "third_party/blink/public/web/web_local_frame.h"
diff --git a/content/renderer/service_worker/service_worker_provider_context.cc b/content/renderer/service_worker/service_worker_provider_context.cc index aee1c06b..2d279c6 100644 --- a/content/renderer/service_worker/service_worker_provider_context.cc +++ b/content/renderer/service_worker/service_worker_provider_context.cc
@@ -25,6 +25,7 @@ #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" #include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_worker_client.mojom.h" namespace content {
diff --git a/content/renderer/service_worker/service_worker_subresource_loader.h b/content/renderer/service_worker/service_worker_subresource_loader.h index f88fe7b..8c6eec62 100644 --- a/content/renderer/service_worker/service_worker_subresource_loader.h +++ b/content/renderer/service_worker/service_worker_subresource_loader.h
@@ -17,11 +17,14 @@ #include "mojo/public/cpp/bindings/remote.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "net/url_request/redirect_info.h" +#include "services/network/public/mojom/url_loader.mojom.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/common/service_worker/service_worker_status_code.h" #include "third_party/blink/public/mojom/blob/blob.mojom-forward.h" +#include "third_party/blink/public/mojom/blob/blob.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_event_status.mojom-forward.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_fetch_response_callback.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_stream_handle.mojom-forward.h" #include "third_party/blink/public/mojom/timing/worker_timing_container.mojom-forward.h"
diff --git a/content/services/auction_worklet/BUILD.gn b/content/services/auction_worklet/BUILD.gn index 0f89dae..c1f3c24 100644 --- a/content/services/auction_worklet/BUILD.gn +++ b/content/services/auction_worklet/BUILD.gn
@@ -14,6 +14,8 @@ "auction_worklet_service_impl.h", "bidder_worklet.cc", "bidder_worklet.h", + "console.cc", + "console.h", "report_bindings.cc", "report_bindings.h", "seller_worklet.cc",
diff --git a/content/services/auction_worklet/auction_v8_helper.cc b/content/services/auction_worklet/auction_v8_helper.cc index 14ece7d..45c4cf6 100644 --- a/content/services/auction_worklet/auction_v8_helper.cc +++ b/content/services/auction_worklet/auction_v8_helper.cc
@@ -182,7 +182,18 @@ v8::Context::New(isolate(), nullptr /* extensions */, global_template); auto result = context->Global()->Delete(context, CreateStringFromLiteral("Date")); - DCHECK(!result.IsNothing()); + + v8::Local<v8::ObjectTemplate> console_emulation = + console_.GetConsoleTemplate(); + v8::Local<v8::Object> console_obj; + if (console_emulation->NewInstance(context).ToLocal(&console_obj)) { + result = context->Global()->Set(context, CreateStringFromLiteral("console"), + console_obj); + DCHECK(!result.IsNothing()); + } else { + DCHECK(false); + } + return context; } @@ -305,9 +316,12 @@ v8::Local<v8::UnboundScript> script, base::StringPiece script_name, base::span<v8::Local<v8::Value>> args, - absl::optional<std::string>& error_out) { + std::vector<std::string>& error_out) { DCHECK_EQ(isolate(), context->GetIsolate()); + ScopedConsoleTarget direct_console( + this, FormatValue(isolate(), script->GetScriptName()), &error_out); + v8::Local<v8::String> v8_script_name; if (!CreateUtf8String(script_name).ToLocal(&v8_script_name)) return v8::MaybeLocal<v8::Value>(); @@ -320,13 +334,14 @@ auto result = local_script->Run(context); if (try_catch.HasTerminated()) { - error_out = base::StrCat({FormatValue(isolate(), script->GetScriptName()), - " top-level execution timed out."}); + error_out.push_back( + base::StrCat({FormatValue(isolate(), script->GetScriptName()), + " top-level execution timed out."})); return v8::MaybeLocal<v8::Value>(); } if (try_catch.HasCaught()) { - error_out = FormatExceptionMessage(context, try_catch.Message()); + error_out.push_back(FormatExceptionMessage(context, try_catch.Message())); return v8::MaybeLocal<v8::Value>(); } @@ -335,31 +350,50 @@ v8::Local<v8::Value> function; if (!context->Global()->Get(context, v8_script_name).ToLocal(&function)) { - error_out = base::StrCat({FormatValue(isolate(), script->GetScriptName()), - " function `", script_name, "` not found."}); + error_out.push_back( + base::StrCat({FormatValue(isolate(), script->GetScriptName()), + " function `", script_name, "` not found."})); return v8::MaybeLocal<v8::Value>(); } if (!function->IsFunction()) { - error_out = base::StrCat({FormatValue(isolate(), script->GetScriptName()), - " `", script_name, "` is not a function."}); + error_out.push_back( + base::StrCat({FormatValue(isolate(), script->GetScriptName()), " `", + script_name, "` is not a function."})); return v8::MaybeLocal<v8::Value>(); } v8::MaybeLocal<v8::Value> func_result = v8::Function::Cast(*function)->Call( context, context->Global(), args.size(), args.data()); if (try_catch.HasTerminated()) { - error_out = base::StrCat({FormatValue(isolate(), script->GetScriptName()), - " execution of `", script_name, "` timed out."}); + error_out.push_back( + base::StrCat({FormatValue(isolate(), script->GetScriptName()), + " execution of `", script_name, "` timed out."})); return v8::MaybeLocal<v8::Value>(); } if (try_catch.HasCaught()) { - error_out = FormatExceptionMessage(context, try_catch.Message()); + error_out.push_back(FormatExceptionMessage(context, try_catch.Message())); return v8::MaybeLocal<v8::Value>(); } return func_result; } +AuctionV8Helper::ScopedConsoleTarget::ScopedConsoleTarget( + AuctionV8Helper* owner, + const std::string& console_script_name, + std::vector<std::string>* out) + : owner_(owner) { + DCHECK(!owner_->console_buffer_); + DCHECK(owner_->console_script_name_.empty()); + owner_->console_buffer_ = out; + owner_->console_script_name_ = console_script_name; +} + +AuctionV8Helper::ScopedConsoleTarget::~ScopedConsoleTarget() { + owner_->console_buffer_ = nullptr; + owner_->console_script_name_ = std::string(); +} + // static std::string AuctionV8Helper::FormatExceptionMessage( v8::Local<v8::Context> context,
diff --git a/content/services/auction_worklet/auction_v8_helper.h b/content/services/auction_worklet/auction_v8_helper.h index 1659c66..f6d94324 100644 --- a/content/services/auction_worklet/auction_v8_helper.h +++ b/content/services/auction_worklet/auction_v8_helper.h
@@ -7,11 +7,13 @@ #include <memory> #include <string> +#include <vector> #include "base/compiler_specific.h" #include "base/containers/span.h" #include "base/strings/string_piece.h" #include "base/time/time.h" +#include "content/services/auction_worklet/console.h" #include "gin/public/isolate_holder.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "url/gurl.h" @@ -63,7 +65,8 @@ } // Create a v8::Context. The one thing this does that v8::Context::New() does - // not is remove access the Date object. + // not is remove access the Date object. It also (for now) installs some + // rudimentary console emulation. v8::Local<v8::Context> CreateContext( v8::Handle<v8::ObjectTemplate> global_template = v8::Handle<v8::ObjectTemplate>()); @@ -111,7 +114,7 @@ // Compiles the provided script. Despite not being bound to a context, there // still must be an active context for this method to be invoked. In case of - // an error, sets `error_out`. + // an error sets `error_out`. v8::MaybeLocal<v8::UnboundScript> Compile( const std::string& src, const GURL& src_url, @@ -128,27 +131,56 @@ // Running this multiple times in the same context will re-load the entire // script file in the context, and then run the script again. // - // In case of an error, sets `error_out`. + // In case of an error or console output sets `error_out`. v8::MaybeLocal<v8::Value> RunScript(v8::Local<v8::Context> context, v8::Local<v8::UnboundScript> script, base::StringPiece script_name, base::span<v8::Local<v8::Value>> args, - absl::optional<std::string>& error_out); + std::vector<std::string>& error_out); void set_script_timeout_for_testing(base::TimeDelta script_timeout) { script_timeout_ = script_timeout; } + // If non-nullptr, this returns a pointer to the of vector representing the + // debug output lines of the currently running script. It's nullptr when + // nothing is running. + std::vector<std::string>* console_buffer() { return console_buffer_; } + + // Returns a string identifying the currently running script for purpose of + // attributing its debug output in a human-understandable way. Empty if + // nothing is running. + const std::string& console_script_name() { return console_script_name_; } + private: + // Sets values of console_buffer() and console_script_name() to those + // passed-in to its constructor for duration of its existence, and clears + // them afterward. + class ScopedConsoleTarget { + public: + ScopedConsoleTarget(AuctionV8Helper* owner, + const std::string& console_script_name, + std::vector<std::string>* out); + ~ScopedConsoleTarget(); + + private: + AuctionV8Helper* owner_; + }; + static std::string FormatExceptionMessage(v8::Local<v8::Context> context, v8::Local<v8::Message> message); static std::string FormatValue(v8::Isolate* isolate, v8::Local<v8::Value> val); std::unique_ptr<gin::IsolateHolder> isolate_holder_; + Console console_{this}; v8::Global<v8::Context> scratch_context_; // Script timeout. Can be changed for testing. base::TimeDelta script_timeout_ = kScriptTimeout; + + // See corresponding getters for description. + std::vector<std::string>* console_buffer_ = nullptr; + std::string console_script_name_; }; } // namespace auction_worklet
diff --git a/content/services/auction_worklet/auction_v8_helper_unittest.cc b/content/services/auction_worklet/auction_v8_helper_unittest.cc index ad3d90e..fdef057 100644 --- a/content/services/auction_worklet/auction_v8_helper_unittest.cc +++ b/content/services/auction_worklet/auction_v8_helper_unittest.cc
@@ -5,6 +5,7 @@ #include "content/services/auction_worklet/auction_v8_helper.h" #include <string> +#include <vector> #include "base/test/task_environment.h" #include "base/time/time.h" @@ -15,6 +16,7 @@ #include "url/gurl.h" #include "v8/include/v8.h" +using testing::ElementsAre; using testing::HasSubstr; using testing::StartsWith; @@ -47,17 +49,17 @@ for (v8::Local<v8::Context> context : {helper_.scratch_context(), helper_.CreateContext()}) { - absl::optional<std::string> error_msg; + std::vector<std::string> error_msgs; v8::Context::Scope ctx(context); v8::Local<v8::Value> result; ASSERT_TRUE(helper_ .RunScript(context, script, "foo", - base::span<v8::Local<v8::Value>>(), error_msg) + base::span<v8::Local<v8::Value>>(), error_msgs) .ToLocal(&result)); int int_result = 0; ASSERT_TRUE(gin::ConvertFromV8(helper_.isolate(), result, &int_result)); EXPECT_EQ(1, int_result); - EXPECT_FALSE(error_msg.has_value()); + EXPECT_TRUE(error_msgs.empty()); } } @@ -93,21 +95,22 @@ v8::Context::Scope context_scope(context); v8::Local<v8::UnboundScript> script; - absl::optional<std::string> error_msg; + absl::optional<std::string> compile_error; ASSERT_TRUE(helper_ .Compile(hanging_script.script, GURL("https://foo.test/"), - error_msg) + compile_error) .ToLocal(&script)); - EXPECT_FALSE(error_msg.has_value()); + EXPECT_FALSE(compile_error.has_value()); + std::vector<std::string> error_msgs; v8::MaybeLocal<v8::Value> result = helper_.RunScript( - context, script, "foo", base::span<v8::Local<v8::Value>>(), error_msg); + context, script, "foo", base::span<v8::Local<v8::Value>>(), error_msgs); EXPECT_TRUE(result.IsEmpty()); - ASSERT_TRUE(error_msg.has_value()); - EXPECT_EQ(hanging_script.top_level_hangs - ? "https://foo.test/ top-level execution timed out." - : "https://foo.test/ execution of `foo` timed out.", - error_msg.value()); + EXPECT_THAT( + error_msgs, + ElementsAre(hanging_script.top_level_hangs + ? "https://foo.test/ top-level execution timed out." + : "https://foo.test/ execution of `foo` timed out.")); // Make sure at least `kScriptTimeout` has passed, allowing for some time // skew between change in base::TimeTicks::Now() and the timeout. This @@ -122,18 +125,20 @@ v8::Local<v8::Context> context = helper_.CreateContext(); v8::Context::Scope context_scope(context); v8::Local<v8::UnboundScript> script; - absl::optional<std::string> error_msg; + absl::optional<std::string> compile_error; ASSERT_TRUE(helper_ .Compile("function foo() { return 1;}", - GURL("https://foo.test/"), error_msg) + GURL("https://foo.test/"), compile_error) .ToLocal(&script)); - EXPECT_FALSE(error_msg.has_value()); + EXPECT_FALSE(compile_error.has_value()); + + std::vector<std::string> error_msgs; v8::Local<v8::Value> result; ASSERT_TRUE(helper_ .RunScript(context, script, "foo", - base::span<v8::Local<v8::Value>>(), error_msg) + base::span<v8::Local<v8::Value>>(), error_msgs) .ToLocal(&result)); - EXPECT_FALSE(error_msg.has_value()); + EXPECT_TRUE(error_msgs.empty()); int int_result = 0; ASSERT_TRUE(gin::ConvertFromV8(helper_.isolate(), result, &int_result)); EXPECT_EQ(1, int_result); @@ -147,20 +152,21 @@ // Make sure Date() is not accessible. v8::Local<v8::UnboundScript> script; - absl::optional<std::string> error_msg; + absl::optional<std::string> compile_error; ASSERT_TRUE(helper_ .Compile("function foo() { return Date();}", - GURL("https://foo.test/"), error_msg) + GURL("https://foo.test/"), compile_error) .ToLocal(&script)); - EXPECT_FALSE(error_msg.has_value()); + EXPECT_FALSE(compile_error.has_value()); + std::vector<std::string> error_msgs; EXPECT_TRUE(helper_ .RunScript(context, script, "foo", - base::span<v8::Local<v8::Value>>(), error_msg) + base::span<v8::Local<v8::Value>>(), error_msgs) .IsEmpty()); - ASSERT_TRUE(error_msg.has_value()); - EXPECT_THAT(error_msg.value(), StartsWith("https://foo.test/:1")); - EXPECT_THAT(error_msg.value(), HasSubstr("ReferenceError")); - EXPECT_THAT(error_msg.value(), HasSubstr("Date")); + ASSERT_EQ(1u, error_msgs.size()); + EXPECT_THAT(error_msgs[0], StartsWith("https://foo.test/:1")); + EXPECT_THAT(error_msgs[0], HasSubstr("ReferenceError")); + EXPECT_THAT(error_msgs[0], HasSubstr("Date")); } // A script that doesn't compile. @@ -190,16 +196,16 @@ } v8::Local<v8::Context> context = helper_.CreateContext(); - absl::optional<std::string> error_msg; + std::vector<std::string> error_msgs; v8::Context::Scope ctx(context); v8::Local<v8::Value> result; ASSERT_FALSE(helper_ .RunScript(context, script, "foo", - base::span<v8::Local<v8::Value>>(), error_msg) + base::span<v8::Local<v8::Value>>(), error_msgs) .ToLocal(&result)); - ASSERT_TRUE(error_msg.has_value()); - EXPECT_EQ("https://foo.test/:3 Uncaught Error: I am an error.", - error_msg.value()); + EXPECT_THAT( + error_msgs, + ElementsAre("https://foo.test/:3 Uncaught Error: I am an error.")); } // Test for when desired function isn't found @@ -217,18 +223,18 @@ v8::Local<v8::Context> context = helper_.CreateContext(); - absl::optional<std::string> error_msg; + std::vector<std::string> error_msgs; v8::Context::Scope ctx(context); v8::Local<v8::Value> result; ASSERT_FALSE(helper_ .RunScript(context, script, "bar", - base::span<v8::Local<v8::Value>>(), error_msg) + base::span<v8::Local<v8::Value>>(), error_msgs) .ToLocal(&result)); - ASSERT_TRUE(error_msg.has_value()); // This "not a function" and not "not found" since the lookup successfully // returns `undefined`. - EXPECT_EQ("https://foo.test/ `bar` is not a function.", error_msg.value()); + EXPECT_THAT(error_msgs, + ElementsAre("https://foo.test/ `bar` is not a function.")); } TEST_F(AuctionV8HelperTest, TargetFunctionError) { @@ -245,18 +251,60 @@ v8::Local<v8::Context> context = helper_.CreateContext(); - absl::optional<std::string> error_msg; + std::vector<std::string> error_msgs; v8::Context::Scope ctx(context); v8::Local<v8::Value> result; ASSERT_FALSE(helper_ .RunScript(context, script, "foo", - base::span<v8::Local<v8::Value>>(), error_msg) + base::span<v8::Local<v8::Value>>(), error_msgs) .ToLocal(&result)); - ASSERT_TRUE(error_msg.has_value()); + ASSERT_EQ(1u, error_msgs.size()); - EXPECT_THAT(error_msg.value(), StartsWith("https://foo.test/:1 ")); - EXPECT_THAT(error_msg.value(), HasSubstr("ReferenceError")); - EXPECT_THAT(error_msg.value(), HasSubstr("notfound")); + EXPECT_THAT(error_msgs[0], StartsWith("https://foo.test/:1 ")); + EXPECT_THAT(error_msgs[0], HasSubstr("ReferenceError")); + EXPECT_THAT(error_msgs[0], HasSubstr("notfound")); +} + +TEST_F(AuctionV8HelperTest, LogThenError) { + const char kScript[] = R"( + console.debug('debug is there'); + console.error('error is also there'); + + function foo() { + console.info('info too'); + console.log('can', 'log', 'multiple', 'things'); + console.warn('conversions?', true); + console.table('not the fancier stuff, though'); + } + )"; + + v8::Local<v8::UnboundScript> script; + { + v8::Context::Scope ctx(helper_.scratch_context()); + absl::optional<std::string> error_msg; + ASSERT_TRUE(helper_.Compile(kScript, GURL("https://foo.test/"), error_msg) + .ToLocal(&script)); + EXPECT_FALSE(error_msg.has_value()); + } + + v8::Local<v8::Context> context = helper_.CreateContext(); + + std::vector<std::string> error_msgs; + v8::Context::Scope ctx(context); + v8::Local<v8::Value> result; + ASSERT_FALSE(helper_ + .RunScript(context, script, "foo", + base::span<v8::Local<v8::Value>>(), error_msgs) + .ToLocal(&result)); + ASSERT_EQ(error_msgs.size(), 6u); + EXPECT_EQ("https://foo.test/ [Debug]: debug is there", error_msgs[0]); + EXPECT_EQ("https://foo.test/ [Error]: error is also there", error_msgs[1]); + EXPECT_EQ("https://foo.test/ [Info]: info too", error_msgs[2]); + EXPECT_EQ("https://foo.test/ [Log]: can log multiple things", error_msgs[3]); + EXPECT_EQ("https://foo.test/ [Warn]: conversions? true", error_msgs[4]); + EXPECT_THAT(error_msgs[5], StartsWith("https://foo.test/:9")); + EXPECT_THAT(error_msgs[5], HasSubstr("TypeError")); + EXPECT_THAT(error_msgs[5], HasSubstr("table")); } } // namespace auction_worklet
diff --git a/content/services/auction_worklet/bidder_worklet.cc b/content/services/auction_worklet/bidder_worklet.cc index 67a07e1..0b0c5ca 100644 --- a/content/services/auction_worklet/bidder_worklet.cc +++ b/content/services/auction_worklet/bidder_worklet.cc
@@ -4,6 +4,7 @@ #include "content/services/auction_worklet/bidder_worklet.h" +#include <algorithm> #include <cmath> #include <memory> #include <string> @@ -26,6 +27,7 @@ #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/struct_ptr.h" +#include "services/network/public/mojom/url_loader_factory.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/mojom/interest_group/interest_group_types.mojom.h" #include "url/gurl.h" @@ -50,6 +52,40 @@ return true; } +// Creates a V8 array containing information about the passed in previous wins. +// Array is sorted by time, earliest wins first. Modifies order of `prev_wins` +// input vector. This should should be harmless, since each list of previous +// wins is only used for a single bid in a single auction, and its order is +// unspecified, anyways. +v8::MaybeLocal<v8::Value> CreatePrevWinsArray( + AuctionV8Helper* v8_helper, + v8::Local<v8::Context> context, + base::Time auction_start_time, + std::vector<mojom::PreviousWinPtr>& prev_wins) { + std::sort(prev_wins.begin(), prev_wins.end(), + [](const mojom::PreviousWinPtr& prev_win1, + const mojom::PreviousWinPtr& prev_win2) { + return prev_win1->time < prev_win2->time; + }); + std::vector<v8::Local<v8::Value>> prev_wins_v8; + v8::Isolate* isolate = v8_helper->isolate(); + for (const auto& prev_win : prev_wins) { + int64_t time_delta = (auction_start_time - prev_win->time).InSeconds(); + // Don't give negative times if clock has changed since last auction win. + if (time_delta < 0) + time_delta = 0; + v8::Local<v8::Value> win_values[2]; + win_values[0] = v8::Number::New(isolate, time_delta); + if (!v8_helper->CreateValueFromJson(context, prev_win->ad_json) + .ToLocal(&win_values[1])) { + return v8::MaybeLocal<v8::Value>(); + } + prev_wins_v8.push_back( + v8::Array::New(isolate, win_values, base::size(win_values))); + } + return v8::Array::New(isolate, prev_wins_v8.data(), prev_wins_v8.size()); +} + } // namespace BidderWorklet::BidderWorklet( @@ -163,22 +199,18 @@ // An empty return value indicates an exception was thrown. Any other return // value indicates no exception. - absl::optional<std::string> error_msg_out; + std::vector<std::string> errors_out; if (v8_helper_ ->RunScript(context, worklet_script_->Get(isolate), "reportWin", args, - error_msg_out) + errors_out) .IsEmpty()) { - std::vector<std::string> errors; - if (error_msg_out) - errors.push_back(std::move(error_msg_out).value()); - std::move(callback).Run(absl::nullopt /* report_url */, errors); + std::move(callback).Run(absl::nullopt /* report_url */, errors_out); return; } // This covers both the case where a report URL was provided, and the case one // was not. - std::move(callback).Run(report_bindings.report_url(), - std::vector<std::string>() /* errors */); + std::move(callback).Run(report_bindings.report_url(), errors_out); } void BidderWorklet::OnScriptDownloaded( @@ -189,7 +221,10 @@ if (worklet_script == nullptr) { // Abort loading trusted bidding signals, if it hasn't completed already. trusted_bidding_signals_.reset(); - InvokeBidCallbackOnError(std::move(error_msg)); + std::vector<std::string> errors; + if (error_msg.has_value()) + errors.emplace_back(std::move(error_msg).value()); + InvokeBidCallbackOnError(std::move(errors)); return; } @@ -299,27 +334,16 @@ return; } - std::vector<v8::Local<v8::Value>> prev_wins_v8; - for (const auto& prev_win : bidding_interest_group_->signals->prev_wins) { - int64_t time_delta = (auction_start_time_ - prev_win->time).InSeconds(); - // Don't give negative times if clock has changed since last auction win. - // Clock changes do mean times can be out of numerical order, despite being - // in chronological order. - if (time_delta < 0) - time_delta = 0; - v8::Local<v8::Value> win_values[2]; - win_values[0] = v8::Number::New(isolate, time_delta); - if (!v8_helper_->CreateValueFromJson(context, prev_win->ad_json) - .ToLocal(&win_values[1])) { - InvokeBidCallbackOnError(); - return; - } - prev_wins_v8.push_back( - v8::Array::New(isolate, win_values, base::size(win_values))); + v8::Local<v8::Value> prev_wins; + if (!CreatePrevWinsArray(v8_helper_, context, auction_start_time_, + bidding_interest_group_->signals->prev_wins) + .ToLocal(&prev_wins)) { + InvokeBidCallbackOnError(); + return; } + v8::Maybe<bool> result = browser_signals->Set( - context, gin::StringToV8(isolate, "prevWins"), - v8::Array::New(isolate, prev_wins_v8.data(), prev_wins_v8.size())); + context, gin::StringToV8(isolate, "prevWins"), prev_wins); if (result.IsNothing() || !result.FromJust()) { InvokeBidCallbackOnError(); return; @@ -328,19 +352,20 @@ args.push_back(browser_signals); v8::Local<v8::Value> generate_bid_result; - absl::optional<std::string> error_msg_out; + std::vector<std::string> errors_out; if (!v8_helper_ ->RunScript(context, worklet_script_->Get(isolate), "generateBid", - args, error_msg_out) + args, errors_out) .ToLocal(&generate_bid_result)) { - InvokeBidCallbackOnError(std::move(error_msg_out)); + InvokeBidCallbackOnError(std::move(errors_out)); return; } if (!generate_bid_result->IsObject()) { - InvokeBidCallbackOnError( + errors_out.push_back( base::StrCat({script_source_url_.spec(), " generateBid() return value not an object."})); + InvokeBidCallbackOnError(std::move(errors_out)); return; } @@ -355,56 +380,57 @@ !v8_helper_->ExtractJson(context, ad_object, &ad_json) || !result_dict.Get("bid", &bid) || !result_dict.Get("render", &render_url_string)) { - InvokeBidCallbackOnError( + errors_out.push_back( base::StrCat({script_source_url_.spec(), " generateBid() return value has incorrect structure."})); + InvokeBidCallbackOnError(std::move(errors_out)); return; } if (bid <= 0 || std::isnan(bid) || !std::isfinite(bid)) { - InvokeBidCallbackOnError(); + InvokeBidCallbackOnError(std::move(errors_out)); return; } GURL render_url(render_url_string); if (!render_url.is_valid() || !render_url.SchemeIs(url::kHttpsScheme)) { - return InvokeBidCallbackOnError(base::StrCat( + errors_out.push_back(base::StrCat( {script_source_url_.spec(), " generateBid() returned render_url isn't a valid https:// URL."})); + InvokeBidCallbackOnError(std::move(errors_out)); return; } // `render_url` must be in `ad_render_urls`. for (const auto& ad : *interest_group.ads) { if (render_url == ad->render_url) { - std::vector<std::string> errors; if (trusted_bidding_signals_error_msg_) { - errors.emplace_back( + errors_out.emplace_back( std::move(trusted_bidding_signals_error_msg_).value()); } std::move(load_bidder_worklet_and_generate_bid_callback_) .Run(mojom::BidderWorkletBid::New( std::move(ad_json), bid, std::move(render_url), base::TimeTicks::Now() - start /* bid_duration */), - errors); + errors_out); return; } } - InvokeBidCallbackOnError( + errors_out.push_back( base::StrCat({script_source_url_.spec(), " generateBid() returned render_url isn't one " "of the registered creative URLs."})); + InvokeBidCallbackOnError(std::move(errors_out)); } void BidderWorklet::InvokeBidCallbackOnError( - absl::optional<std::string> error_msg) { - std::vector<std::string> errors; - if (error_msg) - errors.emplace_back(std::move(error_msg).value()); - if (trusted_bidding_signals_error_msg_) - errors.emplace_back(std::move(trusted_bidding_signals_error_msg_).value()); + std::vector<std::string> error_msgs) { + if (trusted_bidding_signals_error_msg_) { + error_msgs.emplace_back( + std::move(trusted_bidding_signals_error_msg_).value()); + } std::move(load_bidder_worklet_and_generate_bid_callback_) - .Run(mojom::BidderWorkletBidPtr(), errors); + .Run(mojom::BidderWorkletBidPtr(), error_msgs); } } // namespace auction_worklet
diff --git a/content/services/auction_worklet/bidder_worklet.h b/content/services/auction_worklet/bidder_worklet.h index b455c7d..2148d55 100644 --- a/content/services/auction_worklet/bidder_worklet.h +++ b/content/services/auction_worklet/bidder_worklet.h
@@ -89,9 +89,9 @@ void GenerateBidIfReady(); // Utility function to invoke `load_script_and_generate_bid_callback_` with - // `error_msg` and `trusted_bidding_signals_error_msg_`. + // `error_msgs` and `trusted_bidding_signals_error_msg_`. void InvokeBidCallbackOnError( - absl::optional<std::string> error_msg = absl::nullopt); + std::vector<std::string> error_msgs = std::vector<std::string>()); AuctionV8Helper* const v8_helper_;
diff --git a/content/services/auction_worklet/bidder_worklet_unittest.cc b/content/services/auction_worklet/bidder_worklet_unittest.cc index c4fe050..8c50369 100644 --- a/content/services/auction_worklet/bidder_worklet_unittest.cc +++ b/content/services/auction_worklet/bidder_worklet_unittest.cc
@@ -610,6 +610,20 @@ {"https://url.test/:4 Uncaught ReferenceError: Date is not defined."}); } +TEST_F(BidderWorkletTest, GenerateBidLogAndError) { + const char kScript[] = R"( + function generateBid() { + console.log("Logging"); + return "hello"; + } + )"; + + RunGenerateBidWithJavascriptExpectingResult( + kScript, mojom::BidderWorkletBidPtr() /* expected_bid */, + {"https://url.test/ [Log]: Logging", + "https://url.test/ generateBid() return value not an object."}); +} + // Checks that most input parameters are correctly passed in, and each is parsed // as JSON or not, depending on the parameter. Does not test `previousWins` or // `trustedBiddingSignals`. @@ -837,22 +851,18 @@ "[true,true]", 1, GURL("https://response.test/"), base::TimeDelta())); } -// Utility methods to create vectors of PreviousWin. Needed because StructPtr's +// Utility method to create a vector of PreviousWin. Needed because StructPtrs // don't allow copying. - -std::vector<mojo::StructPtr<mojom::PreviousWin>> CreateWinList( - const mojo::StructPtr<mojom::PreviousWin>& win1) { +std::vector<mojom::PreviousWinPtr> CreateWinList( + const mojom::PreviousWinPtr& win1, + const mojom::PreviousWinPtr& win2 = mojom::PreviousWinPtr(), + const mojom::PreviousWinPtr& win3 = mojom::PreviousWinPtr()) { std::vector<mojo::StructPtr<mojom::PreviousWin>> out; out.emplace_back(win1.Clone()); - return out; -} - -std::vector<mojo::StructPtr<mojom::PreviousWin>> CreateWinList( - const mojo::StructPtr<mojom::PreviousWin>& win1, - const mojo::StructPtr<mojom::PreviousWin>& win2) { - std::vector<mojo::StructPtr<mojom::PreviousWin>> out; - out.emplace_back(win1.Clone()); - out.emplace_back(win2.Clone()); + if (win2) + out.emplace_back(win2.Clone()); + if (win3) + out.emplace_back(win3.Clone()); return out; } @@ -908,11 +918,11 @@ "browserSignals.prevWins", R"([[0,"future_ad"]])", }, - // Out of order times. + // Out of order wins should be sorted. { - CreateWinList(future_win, win1), + CreateWinList(win2, future_win, win1), "browserSignals.prevWins", - R"([[0,"future_ad"],[200,"ad1"]])", + R"([[200,"ad1"],[100,["ad2"]],[0,"future_ad"]])", }, };
diff --git a/content/services/auction_worklet/console.cc b/content/services/auction_worklet/console.cc new file mode 100644 index 0000000..fa95102 --- /dev/null +++ b/content/services/auction_worklet/console.cc
@@ -0,0 +1,111 @@ +// Copyright 2021 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 "content/services/auction_worklet/report_bindings.h" + +#include <memory> +#include <string> +#include <utility> + +#include "base/bind.h" +#include "base/callback.h" +#include "base/logging.h" +#include "base/strings/strcat.h" +#include "content/services/auction_worklet/auction_v8_helper.h" +#include "gin/converter.h" +#include "v8/include/v8.h" + +#include <iostream> + +namespace auction_worklet { + +Console::Console(AuctionV8Helper* v8_helper) : v8_helper_(v8_helper) {} +Console::~Console() = default; + +v8::Local<v8::ObjectTemplate> Console::GetConsoleTemplate() { + v8::Local<v8::ObjectTemplate> console_template = + v8::ObjectTemplate::New(v8_helper_->isolate()); + + v8::Local<v8::External> v8_this = + v8::External::New(v8_helper_->isolate(), this); + + RegisterConsoleMethod(v8_this, "debug", &Console::ConsoleDebug, + console_template); + RegisterConsoleMethod(v8_this, "error", &Console::ConsoleError, + console_template); + RegisterConsoleMethod(v8_this, "info", &Console::ConsoleInfo, + console_template); + RegisterConsoleMethod(v8_this, "log", &Console::ConsoleLog, console_template); + RegisterConsoleMethod(v8_this, "warn", &Console::ConsoleWarn, + console_template); + + return console_template; +} + +void Console::RegisterConsoleMethod( + v8::Local<v8::External> v8_this, + const char* name, + ConsoleFn function, + v8::Local<v8::ObjectTemplate> console_template) { + v8::Local<v8::FunctionTemplate> function_obj = + v8::FunctionTemplate::New(v8_helper_->isolate(), function, v8_this); + function_obj->RemovePrototype(); + console_template->Set(v8_helper_->CreateStringFromLiteral(name), + function_obj); +} + +// static +void Console::ConsoleDebug(const v8::FunctionCallbackInfo<v8::Value>& args) { + Console* console = + static_cast<Console*>(v8::External::Cast(*args.Data())->Value()); + console->DoConsoleOut("[Debug]", args); +} + +// static +void Console::ConsoleError(const v8::FunctionCallbackInfo<v8::Value>& args) { + Console* console = + static_cast<Console*>(v8::External::Cast(*args.Data())->Value()); + console->DoConsoleOut("[Error]", args); +} + +// static +void Console::ConsoleInfo(const v8::FunctionCallbackInfo<v8::Value>& args) { + Console* console = + static_cast<Console*>(v8::External::Cast(*args.Data())->Value()); + console->DoConsoleOut("[Info]", args); +} + +// static +void Console::ConsoleLog(const v8::FunctionCallbackInfo<v8::Value>& args) { + Console* console = + static_cast<Console*>(v8::External::Cast(*args.Data())->Value()); + console->DoConsoleOut("[Log]", args); +} + +// static +void Console::ConsoleWarn(const v8::FunctionCallbackInfo<v8::Value>& args) { + Console* console = + static_cast<Console*>(v8::External::Cast(*args.Data())->Value()); + console->DoConsoleOut("[Warn]", args); +} + +void Console::DoConsoleOut(const std::string& prefix, + const v8::FunctionCallbackInfo<v8::Value>& args) { + if (!v8_helper_->console_buffer()) + return; + + std::string result = + base::StrCat({v8_helper_->console_script_name(), " ", prefix, ": "}); + for (int i = 0; i < args.Length(); ++i) { + v8::String::Utf8Value val_utf8(v8_helper_->isolate(), args[i]); + if (i != 0) + result += ' '; + if (*val_utf8) + result += std::string(*val_utf8, val_utf8.length()); + } + + v8_helper_->console_buffer()->push_back(std::move(result)); +} + +} // namespace auction_worklet
diff --git a/content/services/auction_worklet/console.h b/content/services/auction_worklet/console.h new file mode 100644 index 0000000..75403ab9 --- /dev/null +++ b/content/services/auction_worklet/console.h
@@ -0,0 +1,57 @@ +// Copyright 2021 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 CONTENT_SERVICES_AUCTION_WORKLET_CONSOLE_H_ +#define CONTENT_SERVICES_AUCTION_WORKLET_CONSOLE_H_ + +#include <string> + +#include "v8/include/v8.h" + +namespace auction_worklet { + +class AuctionV8Helper; + +// A basic interim implementation of console output. This doesn't support +// format specifiers. Is owned by an AuctionV8Helper (keeping a back pointer), +// and writes to AuctionV8Helper::console_buffer() active at time of any JS call +// it handles. +class Console { + public: + Console(const Console&) = delete; + Console& operator=(const Console&) = delete; + ~Console(); + + // Returns an object template that provides a minimal replacement for the + // standard console object. Refers to `this`, so should not outlast it. + v8::Local<v8::ObjectTemplate> GetConsoleTemplate(); + + private: + friend class AuctionV8Helper; + typedef void(ConsoleFn)(const v8::FunctionCallbackInfo<v8::Value>&); + + // Should not outlast `v8_helper` (which is the only thing that should create + // this in the first place). + explicit Console(AuctionV8Helper* v8_helper); + + void RegisterConsoleMethod(v8::Local<v8::External> v8_this, + const char* name, + ConsoleFn function, + v8::Local<v8::ObjectTemplate> console_template); + + static void ConsoleDebug(const v8::FunctionCallbackInfo<v8::Value>& args); + static void ConsoleError(const v8::FunctionCallbackInfo<v8::Value>& args); + static void ConsoleInfo(const v8::FunctionCallbackInfo<v8::Value>& args); + static void ConsoleLog(const v8::FunctionCallbackInfo<v8::Value>& args); + static void ConsoleWarn(const v8::FunctionCallbackInfo<v8::Value>& args); + + void DoConsoleOut(const std::string& prefix, + const v8::FunctionCallbackInfo<v8::Value>& args); + + AuctionV8Helper* const v8_helper_; +}; + +} // namespace auction_worklet + +#endif // CONTENT_SERVICES_AUCTION_WORKLET_CONSOLE_H_
diff --git a/content/services/auction_worklet/seller_worklet.cc b/content/services/auction_worklet/seller_worklet.cc index cb20351..8d858dc 100644 --- a/content/services/auction_worklet/seller_worklet.cc +++ b/content/services/auction_worklet/seller_worklet.cc
@@ -24,6 +24,7 @@ #include "gin/dictionary.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/remote.h" +#include "services/network/public/mojom/url_loader_factory.mojom.h" #include "url/gurl.h" #include "url/origin.h" #include "v8/include/v8.h" @@ -219,34 +220,30 @@ v8::Local<v8::Value> score_ad_result; double score; - absl::optional<std::string> error_msg_out; + std::vector<std::string> errors_out; if (!v8_helper_ ->RunScript(context, worklet_script_->Get(isolate), "scoreAd", args, - error_msg_out) + errors_out) .ToLocal(&score_ad_result)) { - std::vector<std::string> errors; - if (error_msg_out) - errors.emplace_back(std::move(error_msg_out).value()); - std::move(callback).Run(0 /* score */, errors); + std::move(callback).Run(0 /* score */, errors_out); return; } if (!gin::ConvertFromV8(isolate, score_ad_result, &score) || std::isnan(score) || !std::isfinite(score)) { - std::move(callback).Run( - 0 /* score */, std::vector<std::string>{base::StrCat( - {script_source_url_.spec(), - " scoreAd() did not return a valid number."})}); + errors_out.push_back( + base::StrCat({script_source_url_.spec(), + " scoreAd() did not return a valid number."})); + std::move(callback).Run(0 /* score */, errors_out); return; } if (score <= 0) { - std::move(callback).Run(0 /* score */, - std::vector<std::string>() /* errors */); + std::move(callback).Run(0 /* score */, errors_out); return; } - std::move(callback).Run(score, std::vector<std::string>() /* errors */); + std::move(callback).Run(score, errors_out); } void SellerWorklet::ReportResult( @@ -302,16 +299,13 @@ args.push_back(browser_signals); v8::Local<v8::Value> signals_for_winner_value; - absl::optional<std::string> error_msg_out; + std::vector<std::string> errors_out; if (!v8_helper_ ->RunScript(context, worklet_script_->Get(isolate), "reportResult", - args, error_msg_out) + args, errors_out) .ToLocal(&signals_for_winner_value)) { - std::vector<std::string> errors; - if (error_msg_out) - errors.emplace_back(std::move(error_msg_out).value()); std::move(callback).Run(absl::nullopt /* signals_for_winner */, - absl::nullopt /* report_url */, errors); + absl::nullopt /* report_url */, errors_out); return; } @@ -324,7 +318,7 @@ } std::move(callback).Run(signals_for_winner, report_bindings.report_url(), - std::vector<std::string>() /* errors */); + errors_out); } void SellerWorklet::OnDownloadComplete(
diff --git a/content/services/auction_worklet/seller_worklet_unittest.cc b/content/services/auction_worklet/seller_worklet_unittest.cc index 97886b3..d13c771 100644 --- a/content/services/auction_worklet/seller_worklet_unittest.cc +++ b/content/services/auction_worklet/seller_worklet_unittest.cc
@@ -343,6 +343,20 @@ {"https://url.test/:4 Uncaught ReferenceError: Date is not defined."}); } +TEST_F(SellerWorkletTest, ScoreAdLogAndError) { + const char kScript[] = R"( + function scoreAd() { + console.log("Logging"); + return "hello"; + } + )"; + + RunScoreAdWithJavascriptExpectingResult( + kScript, 0, + {"https://url.test/ [Log]: Logging", + "https://url.test/ scoreAd() did not return a valid number."}); +} + // Checks that input parameters are correctly passed in. TEST_F(SellerWorkletTest, ScoreAdParameters) { // Parameters that are C++ strings, including JSON strings.
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index a68b7f49..34f198a 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -2049,6 +2049,7 @@ "../browser/renderer_host/media/audio_input_stream_handle_unittest.cc", "../browser/renderer_host/media/audio_output_authorization_handler_unittest.cc", "../browser/renderer_host/media/audio_service_listener_unittest.cc", + "../browser/renderer_host/media/capture_handle_manager_unittest.cc", "../browser/renderer_host/media/fake_video_capture_device_launcher.cc", "../browser/renderer_host/media/fake_video_capture_device_launcher.h", "../browser/renderer_host/media/fake_video_capture_provider.cc", @@ -2184,7 +2185,6 @@ "../browser/worker_host/worker_script_loader_factory_unittest.cc", "../browser/xr/metrics/session_tracker_unittest.cc", "../child/blink_platform_impl_unittest.cc", - "../child/webthemeengine_impl_unittest.cc", "../common/background_fetch/background_fetch_mojom_traits_unittest.cc", "../common/common_param_traits_unittest.cc", "../common/content_switches_internal_unittest.cc",
diff --git a/content/test/content_browser_test_utils_internal.cc b/content/test/content_browser_test_utils_internal.cc index ff933312..174cc48 100644 --- a/content/test/content_browser_test_utils_internal.cc +++ b/content/test/content_browser_test_utils_internal.cc
@@ -177,6 +177,23 @@ return visited_frames; } +std::vector<RenderFrameHostImpl*> CollectAllRenderFrameHosts( + WebContentsImpl* web_contents) { + std::vector<RenderFrameHostImpl*> visited_frames; + web_contents->ForEachRenderFrameHost(base::BindLambdaForTesting( + [&](RenderFrameHostImpl* rfh) { visited_frames.push_back(rfh); })); + return visited_frames; +} + +std::vector<RenderFrameHostImpl*> +CollectAllRenderFrameHostsIncludingSpeculative(WebContentsImpl* web_contents) { + std::vector<RenderFrameHostImpl*> visited_frames; + web_contents->ForEachRenderFrameHostIncludingSpeculative( + base::BindLambdaForTesting( + [&](RenderFrameHostImpl* rfh) { visited_frames.push_back(rfh); })); + return visited_frames; +} + Shell* OpenBlankWindow(WebContentsImpl* web_contents) { FrameTreeNode* root = web_contents->GetFrameTree()->root(); ShellAddedObserver new_shell_observer;
diff --git a/content/test/content_browser_test_utils_internal.h b/content/test/content_browser_test_utils_internal.h index 50a093c..101ffaa 100644 --- a/content/test/content_browser_test_utils_internal.h +++ b/content/test/content_browser_test_utils_internal.h
@@ -90,6 +90,12 @@ std::vector<RenderFrameHostImpl*> CollectAllRenderFrameHostsIncludingSpeculative( RenderFrameHostImpl* starting_rfh); +// Returns the frames visited by |WebContentsImpl::ForEachRenderFrameHost| +// in the same order. +std::vector<RenderFrameHostImpl*> CollectAllRenderFrameHosts( + WebContentsImpl* web_contents); +std::vector<RenderFrameHostImpl*> +CollectAllRenderFrameHostsIncludingSpeculative(WebContentsImpl* web_contents); // Open a new popup passing no URL to window.open, which results in a blank page // and no last committed entry. Returns the newly created shell. Also saves the
diff --git a/content/test/data/accessibility/aria/aria-busy-expected-android.txt b/content/test/data/accessibility/aria/aria-busy-expected-android.txt index b597578..c5e2b31 100644 --- a/content/test/data/accessibility/aria/aria-busy-expected-android.txt +++ b/content/test/data/accessibility/aria/aria-busy-expected-android.txt
@@ -1,4 +1,4 @@ android.webkit.WebView focusable focused scrollable ++android.view.View role_description='log' focusable name='Busy log' live_region_type=1 ++android.view.View role_description='log' focusable name='Not-busy log' live_region_type=1 -++android.view.View name='plain div' \ No newline at end of file +++android.view.View hint='plain div'
diff --git a/content/test/data/accessibility/aria/aria-busy-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-busy-expected-auralinux.txt index 92d00ae..9dd0d45 100644 --- a/content/test/data/accessibility/aria/aria-busy-expected-auralinux.txt +++ b/content/test/data/accessibility/aria/aria-busy-expected-auralinux.txt
@@ -1,4 +1,4 @@ [document web] ++[log] name='Busy log' busy container-live:polite live:polite ++[log] name='Not-busy log' container-live:polite live:polite -++[section] name='plain div' busy +++[section] description='plain div' busy
diff --git a/content/test/data/accessibility/aria/aria-busy-expected-blink.txt b/content/test/data/accessibility/aria/aria-busy-expected-blink.txt index f6643da..8577499 100644 --- a/content/test/data/accessibility/aria/aria-busy-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-busy-expected-blink.txt
@@ -3,4 +3,4 @@ ++++genericContainer ignored ++++++log name='Busy log' busy=true containerLiveBusy=true ++++++log name='Not-busy log' containerLiveBusy=false -++++++genericContainer name='plain div' busy=true +++++++genericContainer description='plain div' busy=true
diff --git a/content/test/data/accessibility/aria/aria-busy-expected-mac.txt b/content/test/data/accessibility/aria/aria-busy-expected-mac.txt index 99a3ef0..3cf623e 100644 --- a/content/test/data/accessibility/aria/aria-busy-expected-mac.txt +++ b/content/test/data/accessibility/aria/aria-busy-expected-mac.txt
@@ -1,4 +1,4 @@ AXWebArea AXRoleDescription='HTML content' ++AXGroup AXSubrole=AXApplicationLog AXARIABusy=1 AXDescription='Busy log' AXRoleDescription='log' ++AXGroup AXSubrole=AXApplicationLog AXDescription='Not-busy log' AXRoleDescription='log' -++AXGroup AXARIABusy=1 AXDescription='plain div' AXRoleDescription='group' +++AXGroup AXARIABusy=1 AXHelp='plain div' AXRoleDescription='group'
diff --git a/content/test/data/accessibility/aria/aria-busy-expected-win.txt b/content/test/data/accessibility/aria/aria-busy-expected-win.txt index 1dd6457..cf0eb98 100644 --- a/content/test/data/accessibility/aria/aria-busy-expected-win.txt +++ b/content/test/data/accessibility/aria/aria-busy-expected-win.txt
@@ -1,4 +1,4 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ++ROLE_SYSTEM_GROUPING name='Busy log' BUSY FOCUSABLE ++ROLE_SYSTEM_GROUPING name='Not-busy log' FOCUSABLE -++IA2_ROLE_SECTION name='plain div' BUSY \ No newline at end of file +++IA2_ROLE_SECTION BUSY description='plain div'
diff --git a/content/test/data/accessibility/aria/aria-busy.html b/content/test/data/accessibility/aria/aria-busy.html index 846eae7..9076f017 100644 --- a/content/test/data/accessibility/aria/aria-busy.html +++ b/content/test/data/accessibility/aria/aria-busy.html
@@ -3,8 +3,13 @@ @MAC-ALLOW:AXRoleDescription @MAC-ALLOW:AXSubrole @WIN-ALLOW:BUSY* +@WIN-DENY:description:* +@WIN-DENY:description-from* @BLINK-ALLOW:liveBusy* @BLINK-ALLOW:containerLiveBusy* +@BLINK-DENY:descriptionFrom* +@AURALINUX-DENY:description:* +@AURALINUX-DENY:description-from* @AURALINUX-ALLOW:busy @AURALINUX-ALLOW:*live* --> @@ -13,6 +18,6 @@ <body> <div tabindex=0 role="log" aria-busy="true" aria-label="Busy log"></div> <div tabindex=1 role="log" aria-busy="false" aria-label="Not-busy log"></div> -<div aria-busy="true" name='plain div' aria-label="plain div"></div> +<div aria-busy="true" name='plain div' aria-description="plain div"></div> </body> </html>
diff --git a/content/test/data/accessibility/aria/aria-details-roles-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-details-roles-expected-auralinux.txt index 284fe74..9fc9deb 100644 --- a/content/test/data/accessibility/aria/aria-details-roles-expected-auralinux.txt +++ b/content/test/data/accessibility/aria/aria-details-roles-expected-auralinux.txt
@@ -1,12 +1,12 @@ [document web] -++[section] name='comment' details-roles:comment -++[section] name='comment-group' details-roles:comment -++[section] name='comment-region' details-roles:* -++[section] name='comment-section' details-roles:* -++[section] name='definition' details-roles:definition -++[section] name='doc-endnote' details-roles:doc-endnote -++[section] name='doc-footnote' details-roles:doc-footnote -++[section] name='many' details-roles:comment definition doc-footnote +++[section] description='comment' details-roles:comment +++[section] description='comment-group' details-roles:comment +++[section] description='comment-region' details-roles:* +++[section] description='comment-section' details-roles:* +++[section] description='definition' details-roles:definition +++[section] description='doc-endnote' details-roles:doc-endnote +++[section] description='doc-footnote' details-roles:doc-footnote +++[section] description='many' details-roles:comment definition doc-footnote ++[section] ++++[static] name='x' ++[panel]
diff --git a/content/test/data/accessibility/aria/aria-details-roles-expected-win.txt b/content/test/data/accessibility/aria/aria-details-roles-expected-win.txt index 4f86e84d..51d6289d 100644 --- a/content/test/data/accessibility/aria/aria-details-roles-expected-win.txt +++ b/content/test/data/accessibility/aria/aria-details-roles-expected-win.txt
@@ -1,12 +1,12 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE -++IA2_ROLE_SECTION name='comment' details-roles:comment -++IA2_ROLE_SECTION name='comment-group' details-roles:comment -++IA2_ROLE_SECTION name='comment-region' details-roles:* -++IA2_ROLE_SECTION name='comment-section' details-roles:* -++IA2_ROLE_SECTION name='definition' details-roles:definition -++IA2_ROLE_SECTION name='doc-endnote' details-roles:doc-endnote -++IA2_ROLE_SECTION name='doc-footnote' details-roles:doc-footnote -++IA2_ROLE_SECTION name='many' details-roles:comment definition doc-footnote +++IA2_ROLE_SECTION details-roles:comment description='comment' +++IA2_ROLE_SECTION details-roles:comment description='comment-group' +++IA2_ROLE_SECTION details-roles:* description='comment-region' +++IA2_ROLE_SECTION details-roles:* description='comment-section' +++IA2_ROLE_SECTION details-roles:definition description='definition' +++IA2_ROLE_SECTION details-roles:doc-endnote description='doc-endnote' +++IA2_ROLE_SECTION details-roles:doc-footnote description='doc-footnote' +++IA2_ROLE_SECTION details-roles:comment definition doc-footnote description='many' ++IA2_ROLE_COMMENT ++++ROLE_SYSTEM_STATICTEXT name='x' ++ROLE_SYSTEM_GROUPING
diff --git a/content/test/data/accessibility/aria/aria-details-roles.html b/content/test/data/accessibility/aria/aria-details-roles.html index 53b51bde..b72d01e 100644 --- a/content/test/data/accessibility/aria/aria-details-roles.html +++ b/content/test/data/accessibility/aria/aria-details-roles.html
@@ -1,19 +1,23 @@ <!-- @WIN-ALLOW:details-roles:* +@WIN-DENY:description* +@WIN-ALLOW:description=* +@AURALINUX-DENY:description* +@AURALINUX-ALLOW:description=* @AURALINUX-ALLOW:details-roles:* @AURALINUX-DENY:details @AURALINUX-DENY:details-for @AURALINUX-DENY:last-defined --> <!-- details-roles=comment when pointing to a group or region with comments --> -<div aria-details="comment" aria-label="comment"></div> -<div aria-details="comment-group" aria-label="comment-group"></div> -<div aria-details="comment-region" aria-label="comment-region"></div> -<div aria-details="comment-section" aria-label="comment-section"></div> -<div aria-details="definition" aria-label="definition"></div> -<div aria-details="doc-endnote" aria-label="doc-endnote"></div> -<div aria-details="doc-footnote" aria-label="doc-footnote"></div> -<div aria-details="comment-group comment definition doc-footnote" aria-label="many"></div> +<div aria-details="comment" aria-description="comment"></div> +<div aria-details="comment-group" aria-description="comment-group"></div> +<div aria-details="comment-region" aria-description="comment-region"></div> +<div aria-details="comment-section" aria-description="comment-section"></div> +<div aria-details="definition" aria-description="definition"></div> +<div aria-details="doc-endnote" aria-description="doc-endnote"></div> +<div aria-details="doc-footnote" aria-description="doc-footnote"></div> +<div aria-details="comment-group comment definition doc-footnote" aria-description="many"></div> <div id="comment" role="comment">x</div> <div id="comment-group" role="group"> <h1>heading</h1>
diff --git a/content/test/data/accessibility/aria/aria-empty-string-expected-blink.txt b/content/test/data/accessibility/aria/aria-empty-string-expected-blink.txt index c4d45a4..602ae58 100644 --- a/content/test/data/accessibility/aria/aria-empty-string-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-empty-string-expected-blink.txt
@@ -1,28 +1,28 @@ rootWebArea ++genericContainer ignored ++++genericContainer ignored -++++++genericContainer name='Atomic undefined' +++++++group name='Atomic undefined' ++++++textField name='Autocomplete undefined' -++++++genericContainer name='Busy undefined' +++++++group name='Busy undefined' ++++++treeItem name='Checked undefined' -++++++genericContainer name='Current undefined' -++++++genericContainer name='Disabled undefined' -++++++genericContainer name='Dropeffect undefined' dropeffect=none +++++++group name='Current undefined' +++++++group name='Disabled undefined' +++++++group name='Dropeffect undefined' dropeffect=none ++++++treeItem name='Expanded undefined' -++++++genericContainer name='Grabbed undefined' +++++++group name='Grabbed undefined' ++++++button name='Haspopup undefined' -++++++genericContainer name='Invalid undefined' -++++++genericContainer name='Live undefined' +++++++textField name='Invalid undefined' +++++++group name='Live undefined' ++++++dialog name='Modal undefined' modal=false ++++++textField name='Multiline undefined' ++++++grid name='Multiselectable undefined' ++++++scrollBar vertical name='Orientation undefined' ++++++button name='Pressed undefined' ++++++textField name='Readonly undefined' -++++++genericContainer name='Relevant undefined' +++++++group name='Relevant undefined' ++++++textField name='Required undefined' ++++++tree multiselectable vertical ++++++++treeItem name='Selected undefined' ++++++grid ++++++++columnHeader name='Sort undefined' -++++++genericContainer name='Hidden undefined, display block' +++++++group name='Hidden undefined, display block'
diff --git a/content/test/data/accessibility/aria/aria-empty-string.html b/content/test/data/accessibility/aria/aria-empty-string.html index 03a974b..28a0cfd 100644 --- a/content/test/data/accessibility/aria/aria-empty-string.html +++ b/content/test/data/accessibility/aria/aria-empty-string.html
@@ -30,25 +30,25 @@ --> <html> <body> -<div aria-atomic="" aria-label="Atomic undefined"></div> +<div aria-atomic="" role="group" aria-label="Atomic undefined"></div> <div aria-autocomplete="" role="textbox" aria-label="Autocomplete undefined"></div> -<div aria-busy="" aria-label="Busy undefined"></div> +<div aria-busy="" role="group" aria-label="Busy undefined"></div> <div aria-checked="" role="treeitem" aria-label="Checked undefined"></div> -<div aria-current="" aria-label="Current undefined"></div> -<div aria-disabled="" aria-label="Disabled undefined"></div> -<div aria-dropeffect="" aria-label="Dropeffect undefined"></div> +<div aria-current="" role="group" aria-label="Current undefined"></div> +<div aria-disabled="" role="group" aria-label="Disabled undefined"></div> +<div aria-dropeffect="" role="group" aria-label="Dropeffect undefined"></div> <div aria-expanded="" role="treeitem" aria-label="Expanded undefined"></div> -<div aria-grabbed="" aria-label="Grabbed undefined"></div> +<div aria-grabbed="" role="group" aria-label="Grabbed undefined"></div> <div aria-haspopup="" role="button" aria-label="Haspopup undefined"></div> -<div aria-invalid="" aria-label="Invalid undefined"></div> -<div aria-live="" aria-label="Live undefined"></div> +<div aria-invalid="" role="textbox" aria-label="Invalid undefined"></div> +<div aria-live="" role="group" aria-label="Live undefined"></div> <div aria-modal="" role="dialog" aria-label="Modal undefined"></div> <div aria-multiline="" role="textbox" aria-label="Multiline undefined"></div> <div aria-multiselectable="" role="grid" aria-label="Multiselectable undefined"></div> <div aria-orientation="" role="scrollbar" aria-label="Orientation undefined"></div> <div aria-pressed="" role="button" aria-label="Pressed undefined"></div> <div aria-readonly="" role="textbox" aria-label="Readonly undefined"></div> -<div aria-relevant="" aria-label="Relevant undefined"></div> +<div aria-relevant="" role="group" aria-label="Relevant undefined"></div> <div aria-required="" role="textbox" aria-label="Required undefined"></div> <!-- Test selected inside multiselectable. --> <div role="tree" aria-multiselectable="true"> @@ -59,7 +59,7 @@ </div> <!-- Test aria-hidden at end because a broken test can have extra object, and ruin the rest of the test. --> -<div aria-hidden="" style="display: block" aria-label="Hidden undefined, display block"></div> +<div aria-hidden="" role="group" style="display: block" aria-label="Hidden undefined, display block"></div> <div aria-hidden="" style="display: none" aria-label="Hidden undefined, display none"></div> </body> </html>
diff --git a/content/test/data/accessibility/aria/aria-flowto-multiple.html b/content/test/data/accessibility/aria/aria-flowto-multiple.html index 9211ba81..9df799cb 100644 --- a/content/test/data/accessibility/aria/aria-flowto-multiple.html +++ b/content/test/data/accessibility/aria/aria-flowto-multiple.html
@@ -1,7 +1,7 @@ <html> <body> - <div id='a3' aria-label='a3' aria-flowto="b3">a3</div> - <div id='b3' aria-label='b3'>b3</div> - <div id='c3' aria-label='c3' aria-flowto="b3">c3</div> + <div tabindex='0' id='a3' aria-label='a3' aria-flowto="b3">a3</div> + <div tabindex='0' id='b3' aria-label='b3'>b3</div> + <div tabindex='0' id='c3' aria-label='c3' aria-flowto="b3">c3</div> </body> </html>
diff --git a/content/test/data/accessibility/aria/aria-grid-extra-wrap-elems-expected-blink.txt b/content/test/data/accessibility/aria/aria-grid-extra-wrap-elems-expected-blink.txt index 973a3e8..a78ca59b 100644 --- a/content/test/data/accessibility/aria/aria-grid-extra-wrap-elems-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-grid-extra-wrap-elems-expected-blink.txt
@@ -2,7 +2,7 @@ ++genericContainer ignored ++++genericContainer ignored ++++++grid name='1: Individual rows get their own wrappers' tableRowCount=2 tableColumnCount=2 -++++++++genericContainer name='r1-wrap' +++++++++genericContainer description='r1-wrap' ++++++++++row name='r1-real' tableRowIndex=0 ++++++++++++cell name='A1' tableCellColumnIndex=0 tableCellRowIndex=0 ++++++++++++++staticText name='A1' @@ -10,8 +10,8 @@ ++++++++++++cell name='A2' tableCellColumnIndex=1 tableCellRowIndex=0 ++++++++++++++staticText name='A2' ++++++++++++++++inlineTextBox name='A2' -++++++++genericContainer name='r2-wrap' -++++++++++genericContainer name='r2-vanilla' +++++++++genericContainer description='r2-wrap' +++++++++++genericContainer description='r2-vanilla' ++++++++++++row name='r2-real' tableRowIndex=1 ++++++++++++++cell name='B1' tableCellColumnIndex=0 tableCellRowIndex=1 ++++++++++++++++staticText name='B1'
diff --git a/content/test/data/accessibility/aria/aria-grid-extra-wrap-elems.html b/content/test/data/accessibility/aria/aria-grid-extra-wrap-elems.html index af07c07..3a2ef2f6 100644 --- a/content/test/data/accessibility/aria/aria-grid-extra-wrap-elems.html +++ b/content/test/data/accessibility/aria/aria-grid-extra-wrap-elems.html
@@ -2,23 +2,25 @@ @MAC-ALLOW:AXRoleDescription @WIN-ALLOW:*SELECTABLE @WIN-ALLOW:xml-roles* +@BLINK-DENY:descriptionFrom* @BLINK-ALLOW:tableColumnCount* @BLINK-ALLOW:tableRowCount* @BLINK-ALLOW:id* @BLINK-ALLOW:table*Index* +@AURALINUX-DENY:description-from* --> <!DOCTYPE html> <html> <body> <div role="grid" aria-label="1: Individual rows get their own wrappers"> - <div id="r1" aria-label="r1-wrap"> + <div id="r1" aria-description="r1-wrap"> <div role="row" aria-label="r1-real"> <div role="gridcell">A1</div> <div role="gridcell">A2</div> </div> </div> - <div id="r2" aria-label="r2-wrap"> - <div aria-label="r2-vanilla"> + <div id="r2" aria-description="r2-wrap"> + <div aria-description="r2-vanilla"> <div role="row" aria-label="r2-real"> <div role="gridcell">B1</div> <div role="gridcell">B2</div>
diff --git a/content/test/data/accessibility/aria/aria-hidden-descendants-expected-blink.txt b/content/test/data/accessibility/aria/aria-hidden-descendants-expected-blink.txt index 1764292..89835892 100644 --- a/content/test/data/accessibility/aria/aria-hidden-descendants-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-hidden-descendants-expected-blink.txt
@@ -5,7 +5,7 @@ ++++++++group ignored invisible ++++++++++group ignored invisible ++++++++++++slider horizontal invisible name='Slider#1 now inside hidden subtree' -++++++genericContainer name='Subtree starts hidden ends visible' +++++++group name='Subtree starts hidden ends visible' ++++++++group ++++++++++group ++++++++++++slider horizontal name='Slider #2 now inside visible subtree'
diff --git a/content/test/data/accessibility/aria/aria-hidden-descendants.html b/content/test/data/accessibility/aria/aria-hidden-descendants.html index 7d0a5862..43a94f5 100644 --- a/content/test/data/accessibility/aria/aria-hidden-descendants.html +++ b/content/test/data/accessibility/aria/aria-hidden-descendants.html
@@ -12,7 +12,7 @@ </div> </div> </div> - <div id="starts-hidden-ends-visible" aria-label="Subtree starts hidden ends visible"> + <div id="starts-hidden-ends-visible" role="group" aria-label="Subtree starts hidden ends visible"> <div role="group"> <div role="group"> <div role="slider" tabindex="0" aria-label="Slider #2 now inside visible subtree"></div>
diff --git a/content/test/data/accessibility/aria/aria-hidden-labelled-by-expected-blink.txt b/content/test/data/accessibility/aria/aria-hidden-labelled-by-expected-blink.txt index 62a98a7..b295c81 100644 --- a/content/test/data/accessibility/aria/aria-hidden-labelled-by-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-hidden-labelled-by-expected-blink.txt
@@ -6,7 +6,7 @@ ++++++++genericContainer name='span-2' ++++++++genericContainer name='span-4' labelledbyIds=genericContainer ++++++++++genericContainer ignored invisible -++++++++genericContainer name='span-1' labelledbyIds=genericContainer -++++++++genericContainer name='span-2' labelledbyIds=genericContainer -++++++++genericContainer name='span-3' labelledbyIds=genericContainer -++++++++genericContainer name='span-4' labelledbyIds=genericContainer \ No newline at end of file +++++++++group name='span-1' labelledbyIds=genericContainer +++++++++group name='span-2' labelledbyIds=genericContainer +++++++++group name='span-3' labelledbyIds=genericContainer +++++++++group name='span-4' labelledbyIds=genericContainer
diff --git a/content/test/data/accessibility/aria/aria-hidden-labelled-by-expected-win.txt b/content/test/data/accessibility/aria/aria-hidden-labelled-by-expected-win.txt index 19a37ad..092c715 100644 --- a/content/test/data/accessibility/aria/aria-hidden-labelled-by-expected-win.txt +++ b/content/test/data/accessibility/aria/aria-hidden-labelled-by-expected-win.txt
@@ -1,7 +1,7 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ++IA2_ROLE_SECTION name='span-2' ++IA2_ROLE_SECTION name='span-4' -++IA2_ROLE_SECTION name='span-1' -++IA2_ROLE_SECTION name='span-2' -++IA2_ROLE_SECTION name='span-3' -++IA2_ROLE_SECTION name='span-4' +++ROLE_SYSTEM_GROUPING name='span-1' +++ROLE_SYSTEM_GROUPING name='span-2' +++ROLE_SYSTEM_GROUPING name='span-3' +++ROLE_SYSTEM_GROUPING name='span-4'
diff --git a/content/test/data/accessibility/aria/aria-hidden-labelled-by.html b/content/test/data/accessibility/aria/aria-hidden-labelled-by.html index 9aad637..3f90378 100644 --- a/content/test/data/accessibility/aria/aria-hidden-labelled-by.html +++ b/content/test/data/accessibility/aria/aria-hidden-labelled-by.html
@@ -14,10 +14,10 @@ </span> </span> - <span aria-label="span-A" aria-labelledby="s1"></span> - <span aria-label="span-B" aria-labelledby="s2"></span> - <span aria-label="span-C" aria-labelledby="s3"></span> - <span aria-label="span-D" aria-labelledby="s4"></span> + <span role="group" aria-label="span-A" aria-labelledby="s1"></span> + <span role="group" aria-label="span-B" aria-labelledby="s2"></span> + <span role="group" aria-label="span-C" aria-labelledby="s3"></span> + <span role="group" aria-label="span-D" aria-labelledby="s4"></span> </div> </body> </html>
diff --git a/content/test/data/accessibility/aria/aria-illegal-val-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-illegal-val-expected-auralinux.txt index 26812238..7831345 100644 --- a/content/test/data/accessibility/aria/aria-illegal-val-expected-auralinux.txt +++ b/content/test/data/accessibility/aria/aria-illegal-val-expected-auralinux.txt
@@ -3,13 +3,13 @@ ++[entry] name='Autocomplete illegal' selectable-text autocomplete:x-illegal ++[log] name='Busy illegal' busy atomic:false busy:true live:polite relevant:additions text ++[tree item] name='Checked illegal' checked checkable:true -++[section] name='Current illegal' current:true -++[section] name='Disabled illegal' -++[section] name='Dropeffect illegal' dropeffect:none +++[panel] name='Current illegal' current:true +++[panel] name='Disabled illegal' +++[panel] name='Dropeffect illegal' dropeffect:none ++[tree item] name='Expanded illegal' expanded -++[section] name='Grabbed illegal' +++[panel] name='Grabbed illegal' ++[push button] name='Haspopup illegal' -++[section] name='Invalid illegal' invalid-entry +++[panel] name='Invalid illegal' invalid-entry ++[log] name='Live illegal' atomic:false live:X-ILLEGAL relevant:additions text ++[dialog] name='Modal illegal' modal ++[entry] name='Multiline illegal' selectable-text
diff --git a/content/test/data/accessibility/aria/aria-illegal-val-expected-blink.txt b/content/test/data/accessibility/aria/aria-illegal-val-expected-blink.txt index ddb445b9..3276d5f 100644 --- a/content/test/data/accessibility/aria/aria-illegal-val-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-illegal-val-expected-blink.txt
@@ -5,13 +5,13 @@ ++++++textField autoComplete='x-illegal' name='Autocomplete illegal' ++++++log containerLiveRelevant='additions text' containerLiveStatus='polite' name='Busy illegal' liveRelevant='additions text' liveStatus='polite' busy=true containerLiveAtomic=false containerLiveBusy=true liveAtomic=false ++++++treeItem name='Checked illegal' checkedState=true -++++++genericContainer name='Current illegal' ariaCurrentState=true -++++++genericContainer name='Disabled illegal' restriction=disabled -++++++genericContainer name='Dropeffect illegal' dropeffect=none +++++++group name='Current illegal' ariaCurrentState=true +++++++group name='Disabled illegal' restriction=disabled +++++++group name='Dropeffect illegal' dropeffect=none ++++++treeItem expanded name='Expanded illegal' -++++++genericContainer name='Grabbed illegal' +++++++group name='Grabbed illegal' ++++++button name='Haspopup illegal' -++++++genericContainer ariaInvalidValue='X-ILLEGAL' name='Invalid illegal' invalidState=other +++++++group ariaInvalidValue='X-ILLEGAL' name='Invalid illegal' invalidState=other ++++++log containerLiveRelevant='additions text' containerLiveStatus='X-ILLEGAL' name='Live illegal' liveRelevant='additions text' liveStatus='X-ILLEGAL' containerLiveAtomic=false containerLiveBusy=false liveAtomic=false ++++++dialog name='Modal illegal' modal=true ++++++textField multiline name='Multiline illegal'
diff --git a/content/test/data/accessibility/aria/aria-illegal-val-expected-win.txt b/content/test/data/accessibility/aria/aria-illegal-val-expected-win.txt index 95f3d735..e561eb0 100644 --- a/content/test/data/accessibility/aria/aria-illegal-val-expected-win.txt +++ b/content/test/data/accessibility/aria/aria-illegal-val-expected-win.txt
@@ -3,13 +3,13 @@ ++ROLE_SYSTEM_TEXT name='Autocomplete illegal' autocomplete:x-illegal ++ROLE_SYSTEM_GROUPING name='Busy illegal' BUSY live:polite relevant:additions text atomic:false ++ROLE_SYSTEM_OUTLINEITEM name='Checked illegal' CHECKED IA2_STATE_CHECKABLE checkable:true -++IA2_ROLE_SECTION name='Current illegal' current:true -++IA2_ROLE_SECTION name='Disabled illegal' UNAVAILABLE -++IA2_ROLE_SECTION name='Dropeffect illegal' dropeffect:none +++ROLE_SYSTEM_GROUPING name='Current illegal' current:true +++ROLE_SYSTEM_GROUPING name='Disabled illegal' UNAVAILABLE +++ROLE_SYSTEM_GROUPING name='Dropeffect illegal' dropeffect:none ++ROLE_SYSTEM_OUTLINEITEM name='Expanded illegal' EXPANDED -++IA2_ROLE_SECTION name='Grabbed illegal' +++ROLE_SYSTEM_GROUPING name='Grabbed illegal' ++ROLE_SYSTEM_PUSHBUTTON name='Haspopup illegal' -++IA2_ROLE_SECTION name='Invalid illegal' IA2_STATE_INVALID_ENTRY +++ROLE_SYSTEM_GROUPING name='Invalid illegal' IA2_STATE_INVALID_ENTRY ++ROLE_SYSTEM_GROUPING name='Live illegal' live:X-ILLEGAL relevant:additions text atomic:false ++ROLE_SYSTEM_DIALOG name='Modal illegal' IA2_STATE_MODAL ++ROLE_SYSTEM_TEXT name='Multiline illegal' IA2_STATE_MULTI_LINE
diff --git a/content/test/data/accessibility/aria/aria-illegal-val.html b/content/test/data/accessibility/aria/aria-illegal-val.html index c9e8b51..d7902fee5 100644 --- a/content/test/data/accessibility/aria/aria-illegal-val.html +++ b/content/test/data/accessibility/aria/aria-illegal-val.html
@@ -73,13 +73,13 @@ <!-- aria-current rules from https://www.w3.org/TR/wai-aria-1.1/#aria-current: "Any value not included in the list of allowed values should be treated by assistive technologies as if the value true had been provided." --> -<div aria-current="X-ILLEGAL" aria-label="Current illegal"></div> -<div aria-disabled="X-ILLEGAL" aria-label="Disabled illegal"></div> -<div aria-dropeffect="X-ILLEGAL" aria-label="Dropeffect illegal"></div> +<div aria-current="X-ILLEGAL" role="group" aria-label="Current illegal"></div> +<div aria-disabled="X-ILLEGAL" role="group" aria-label="Disabled illegal"></div> +<div aria-dropeffect="X-ILLEGAL" role="group" aria-label="Dropeffect illegal"></div> <div aria-expanded="X-ILLEGAL" role="treeitem" aria-label="Expanded illegal"></div> -<div aria-grabbed="X-ILLEGAL" aria-label="Grabbed illegal"></div> +<div aria-grabbed="X-ILLEGAL" role="group" aria-label="Grabbed illegal"></div> <div aria-haspopup="X-ILLEGAL" role="button" aria-label="Haspopup illegal"></div> -<div aria-invalid="X-ILLEGAL" aria-label="Invalid illegal"></div> +<div aria-invalid="X-ILLEGAL" role="group" aria-label="Invalid illegal"></div> <div aria-live="X-ILLEGAL" role="log" aria-label="Live illegal"></div> <div aria-modal="X-ILLEGAL" role="dialog" aria-label="Modal illegal"></div> <div aria-multiline="X-ILLEGAL" role="textbox" aria-label="Multiline illegal"></div>
diff --git a/content/test/data/accessibility/aria/aria-undefined-expected-blink.txt b/content/test/data/accessibility/aria/aria-undefined-expected-blink.txt index 4319a525..5bef58b 100644 --- a/content/test/data/accessibility/aria/aria-undefined-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-undefined-expected-blink.txt
@@ -1,28 +1,28 @@ rootWebArea ++genericContainer ignored ++++genericContainer ignored -++++++genericContainer name='Atomic undefined' +++++++group name='Atomic undefined' ++++++textField name='Autocomplete undefined' -++++++genericContainer name='Busy undefined' +++++++group name='Busy undefined' ++++++treeItem name='Checked undefined' -++++++genericContainer name='Current undefined' -++++++genericContainer name='Disabled undefined' -++++++genericContainer name='Dropeffect undefined' +++++++group name='Current undefined' +++++++group name='Disabled undefined' +++++++group name='Dropeffect undefined' ++++++treeItem name='Expanded undefined' -++++++genericContainer name='Grabbed undefined' +++++++group name='Grabbed undefined' ++++++button name='Haspopup undefined' -++++++genericContainer name='Invalid undefined' -++++++genericContainer name='Live undefined' +++++++group name='Invalid undefined' +++++++group name='Live undefined' ++++++dialog name='Modal undefined' modal=false ++++++textField name='Multiline undefined' ++++++grid name='Multiselectable undefined' ++++++scrollBar vertical name='Orientation undefined' ++++++button name='Pressed undefined' ++++++textField name='Readonly undefined' -++++++genericContainer name='Relevant undefined' +++++++group name='Relevant undefined' ++++++textField name='Required undefined' ++++++tree multiselectable vertical ++++++++treeItem name='Selected undefined' ++++++grid ++++++++columnHeader name='Sort undefined' -++++++genericContainer name='Hidden undefined, display block' +++++++group name='Hidden undefined, display block'
diff --git a/content/test/data/accessibility/aria/aria-undefined-literal-expected-blink.txt b/content/test/data/accessibility/aria/aria-undefined-literal-expected-blink.txt index c4d45a4..fb4c3724 100644 --- a/content/test/data/accessibility/aria/aria-undefined-literal-expected-blink.txt +++ b/content/test/data/accessibility/aria/aria-undefined-literal-expected-blink.txt
@@ -1,28 +1,28 @@ rootWebArea ++genericContainer ignored ++++genericContainer ignored -++++++genericContainer name='Atomic undefined' +++++++group name='Atomic undefined' ++++++textField name='Autocomplete undefined' -++++++genericContainer name='Busy undefined' +++++++group name='Busy undefined' ++++++treeItem name='Checked undefined' -++++++genericContainer name='Current undefined' -++++++genericContainer name='Disabled undefined' -++++++genericContainer name='Dropeffect undefined' dropeffect=none +++++++group name='Current undefined' +++++++group name='Disabled undefined' +++++++group name='Dropeffect undefined' dropeffect=none ++++++treeItem name='Expanded undefined' -++++++genericContainer name='Grabbed undefined' +++++++group name='Grabbed undefined' ++++++button name='Haspopup undefined' -++++++genericContainer name='Invalid undefined' -++++++genericContainer name='Live undefined' +++++++group name='Invalid undefined' +++++++group name='Live undefined' ++++++dialog name='Modal undefined' modal=false ++++++textField name='Multiline undefined' ++++++grid name='Multiselectable undefined' ++++++scrollBar vertical name='Orientation undefined' ++++++button name='Pressed undefined' ++++++textField name='Readonly undefined' -++++++genericContainer name='Relevant undefined' +++++++group name='Relevant undefined' ++++++textField name='Required undefined' ++++++tree multiselectable vertical ++++++++treeItem name='Selected undefined' ++++++grid ++++++++columnHeader name='Sort undefined' -++++++genericContainer name='Hidden undefined, display block' +++++++group name='Hidden undefined, display block'
diff --git a/content/test/data/accessibility/aria/aria-undefined-literal.html b/content/test/data/accessibility/aria/aria-undefined-literal.html index 8ade407..18ca010 100644 --- a/content/test/data/accessibility/aria/aria-undefined-literal.html +++ b/content/test/data/accessibility/aria/aria-undefined-literal.html
@@ -30,25 +30,25 @@ --> <html> <body> -<div aria-atomic="undefined" aria-label="Atomic undefined"></div> +<div aria-atomic="undefined" role="group" aria-label="Atomic undefined"></div> <div aria-autocomplete="undefined" role="textbox" aria-label="Autocomplete undefined"></div> -<div aria-busy="undefined" aria-label="Busy undefined"></div> +<div aria-busy="undefined" role="group" aria-label="Busy undefined"></div> <div aria-checked="undefined" role="treeitem" aria-label="Checked undefined"></div> -<div aria-current="undefined" aria-label="Current undefined"></div> -<div aria-disabled="undefined" aria-label="Disabled undefined"></div> -<div aria-dropeffect="undefined" aria-label="Dropeffect undefined"></div> +<div aria-current="undefined" role="group" aria-label="Current undefined"></div> +<div aria-disabled="undefined" role="group" aria-label="Disabled undefined"></div> +<div aria-dropeffect="undefined" role="group" aria-label="Dropeffect undefined"></div> <div aria-expanded="undefined" role="treeitem" aria-label="Expanded undefined"></div> -<div aria-grabbed="undefined" aria-label="Grabbed undefined"></div> +<div aria-grabbed="undefined" role="group" aria-label="Grabbed undefined"></div> <div aria-haspopup="undefined" role="button" aria-label="Haspopup undefined"></div> -<div aria-invalid="undefined" aria-label="Invalid undefined"></div> -<div aria-live="undefined" aria-label="Live undefined"></div> +<div aria-invalid="undefined" role="group" aria-label="Invalid undefined"></div> +<div aria-live="undefined" role="group" aria-label="Live undefined"></div> <div aria-modal="undefined" role="dialog" aria-label="Modal undefined"></div> <div aria-multiline="undefined" role="textbox" aria-label="Multiline undefined"></div> <div aria-multiselectable="undefined" role="grid" aria-label="Multiselectable undefined"></div> <div aria-orientation="undefined" role="scrollbar" aria-label="Orientation undefined"></div> <div aria-pressed="undefined" role="button" aria-label="Pressed undefined"></div> <div aria-readonly="undefined" role="textbox" aria-label="Readonly undefined"></div> -<div aria-relevant="undefined" aria-label="Relevant undefined"></div> +<div aria-relevant="undefined" role="group" aria-label="Relevant undefined"></div> <div aria-required="undefined" role="textbox" aria-label="Required undefined"></div> <!-- Test selected inside multiselectable. --> <div role="tree" aria-multiselectable="true"> @@ -59,7 +59,7 @@ </div> <!-- Test aria-hidden at end because a broken test can have extra object, and ruin the rest of the test. --> -<div aria-hidden="undefined" style="display: block" aria-label="Hidden undefined, display block"></div> +<div aria-hidden="undefined" role="group" style="display: block" aria-label="Hidden undefined, display block"></div> <div aria-hidden="undefined" style="display: none" aria-label="Hidden undefined, display none"></div> </body> </html>
diff --git a/content/test/data/accessibility/aria/aria-undefined.html b/content/test/data/accessibility/aria/aria-undefined.html index a93e20ef..72780dbc 100644 --- a/content/test/data/accessibility/aria/aria-undefined.html +++ b/content/test/data/accessibility/aria/aria-undefined.html
@@ -30,25 +30,25 @@ --> <html> <body> -<div aria-label="Atomic undefined"></div> +<div role="group" aria-label="Atomic undefined"></div> <div role="textbox" aria-label="Autocomplete undefined"></div> -<div aria-label="Busy undefined"></div> +<div role="group" aria-label="Busy undefined"></div> <div role="treeitem" aria-label="Checked undefined"></div> -<div aria-label="Current undefined"></div> -<div aria-label="Disabled undefined"></div> -<div aria-label="Dropeffect undefined"></div> +<div role="group" aria-label="Current undefined"></div> +<div role="group" aria-label="Disabled undefined"></div> +<div role="group" aria-label="Dropeffect undefined"></div> <div role="treeitem" aria-label="Expanded undefined"></div> -<div aria-label="Grabbed undefined"></div> +<div role="group" aria-label="Grabbed undefined"></div> <div role="button" aria-label="Haspopup undefined"></div> -<div aria-label="Invalid undefined"></div> -<div aria-label="Live undefined"></div> +<div role="group" aria-label="Invalid undefined"></div> +<div role="group" aria-label="Live undefined"></div> <div role="dialog" aria-label="Modal undefined"></div> <div role="textbox" aria-label="Multiline undefined"></div> <div role="grid" aria-label="Multiselectable undefined"></div> <div role="scrollbar" aria-label="Orientation undefined"></div> <div role="button" aria-label="Pressed undefined"></div> <div role="textbox" aria-label="Readonly undefined"></div> -<div aria-label="Relevant undefined"></div> +<div role="group" aria-label="Relevant undefined"></div> <div role="textbox" aria-label="Required undefined"></div> <!-- Test selected inside multiselectable. --> <div role="tree" aria-multiselectable="true"> @@ -59,7 +59,7 @@ </div> <!-- Test aria-hidden at end because a broken test can have extra object, and ruin the rest of the test. --> -<div style="display: block" aria-label="Hidden undefined, display block"></div> +<div role="group" style="display: block" aria-label="Hidden undefined, display block"></div> <div style="display: none" aria-label="Hidden undefined, display none"></div> </body> </html>
diff --git a/content/test/data/accessibility/aria/hidden-expected-blink.txt b/content/test/data/accessibility/aria/hidden-expected-blink.txt index 890fbdd6..66c13fbc 100644 --- a/content/test/data/accessibility/aria/hidden-expected-blink.txt +++ b/content/test/data/accessibility/aria/hidden-expected-blink.txt
@@ -2,5 +2,5 @@ ++genericContainer ignored ++++genericContainer ignored ++++++genericContainer ignored -++++++++genericContainer name='b' -++++++++genericContainer name='c' +++++++++genericContainer description='b' +++++++++genericContainer description='c'
diff --git a/content/test/data/accessibility/aria/hidden-expected-uia-win.txt b/content/test/data/accessibility/aria/hidden-expected-uia-win.txt index 7b3188f..09d8698c 100644 --- a/content/test/data/accessibility/aria/hidden-expected-uia-win.txt +++ b/content/test/data/accessibility/aria/hidden-expected-uia-win.txt
@@ -1,3 +1,3 @@ Document -++Group Name='b' -++Group Name='c' +++Group +++Group
diff --git a/content/test/data/accessibility/aria/hidden-expected-win.txt b/content/test/data/accessibility/aria/hidden-expected-win.txt index 1d262c97..bf7d5fa6 100644 --- a/content/test/data/accessibility/aria/hidden-expected-win.txt +++ b/content/test/data/accessibility/aria/hidden-expected-win.txt
@@ -1,3 +1,3 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE -++IA2_ROLE_SECTION name='b' -++IA2_ROLE_SECTION name='c' +++IA2_ROLE_SECTION description='b' +++IA2_ROLE_SECTION description='c'
diff --git a/content/test/data/accessibility/aria/hidden-labelled-by-expected-blink.txt b/content/test/data/accessibility/aria/hidden-labelled-by-expected-blink.txt index 25381fc8..d249801 100644 --- a/content/test/data/accessibility/aria/hidden-labelled-by-expected-blink.txt +++ b/content/test/data/accessibility/aria/hidden-labelled-by-expected-blink.txt
@@ -3,7 +3,7 @@ ++++genericContainer ignored ++++++genericContainer ignored ++++++++genericContainer ignored invisible -++++++++genericContainer name='span-A4' labelledbyIds=genericContainer +++++++++group name='span-A4' labelledbyIds=genericContainer ++++++++++genericContainer ignored invisible -++++++++genericContainer name='span-A2' labelledbyIds=genericContainer -++++++++genericContainer name='span-C' \ No newline at end of file +++++++++group name='span-A2' labelledbyIds=genericContainer +++++++++genericContainer name='span-C'
diff --git a/content/test/data/accessibility/aria/hidden-labelled-by-expected-win.txt b/content/test/data/accessibility/aria/hidden-labelled-by-expected-win.txt index 8f7e17e..fb8686c 100644 --- a/content/test/data/accessibility/aria/hidden-labelled-by-expected-win.txt +++ b/content/test/data/accessibility/aria/hidden-labelled-by-expected-win.txt
@@ -1,4 +1,4 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE -++IA2_ROLE_SECTION name='span-A4' -++IA2_ROLE_SECTION name='span-A2' -++IA2_ROLE_SECTION name='span-C' \ No newline at end of file +++ROLE_SYSTEM_GROUPING name='span-A4' +++ROLE_SYSTEM_GROUPING name='span-A2' +++IA2_ROLE_SECTION name='span-C'
diff --git a/content/test/data/accessibility/aria/hidden-labelled-by.html b/content/test/data/accessibility/aria/hidden-labelled-by.html index 33392f66..76cb37b7f 100644 --- a/content/test/data/accessibility/aria/hidden-labelled-by.html +++ b/content/test/data/accessibility/aria/hidden-labelled-by.html
@@ -17,12 +17,12 @@ <div> <span class="hide" aria-label="span-A1"> <span aria-label="span-A2" id="a2"></span> - <span class="visible" aria-label="span-A3" aria-labelledby="a4"> + <span role="group" class="visible" aria-label="span-A3" aria-labelledby="a4"> <span class="hide" aria-label="span-A4" id="a4"></span> </span> </span> - <span aria-label="span-B" aria-labelledby="a2"></span> + <span role="group" aria-label="span-B" aria-labelledby="a2"></span> <span aria-label="span-C"></span> </div> </body>
diff --git a/content/test/data/accessibility/aria/hidden.html b/content/test/data/accessibility/aria/hidden.html index 4d8f972..083b076 100644 --- a/content/test/data/accessibility/aria/hidden.html +++ b/content/test/data/accessibility/aria/hidden.html
@@ -1,3 +1,9 @@ +<!-- +@BLINK-DENY:descriptionFrom* +@WIN-DENY:description* +@WIN-ALLOW:description=* +--> + <!DOCTYPE html> <html> <style> @@ -7,12 +13,12 @@ </style> <body> <div> - <span class="hide" aria-label="a1"> - <span aria-label="a2"></span> + <span class="hide" aria-description="a1"> + <span aria-description="a2"></span> </span> - <span aria-label="b"></span> - <span aria-label="c"></span> + <span aria-description="b"></span> + <span aria-description="c"></span> </div> </body> </html>
diff --git a/content/test/data/accessibility/css/content-visibility-to-hidden-expected-blink.txt b/content/test/data/accessibility/css/content-visibility-to-hidden-expected-blink.txt index 75c56af..39204e04 100644 --- a/content/test/data/accessibility/css/content-visibility-to-hidden-expected-blink.txt +++ b/content/test/data/accessibility/css/content-visibility-to-hidden-expected-blink.txt
@@ -2,6 +2,6 @@ ++genericContainer ignored ++++genericContainer ignored ++++++genericContainer -++++++++genericContainer className='hidden' name='Label' +++++++++group className='hidden' name='Label' ++++++++++genericContainer ignored invisible -++++++++++genericContainer ignored invisible \ No newline at end of file +++++++++++genericContainer ignored invisible
diff --git a/content/test/data/accessibility/css/content-visibility-to-hidden.html b/content/test/data/accessibility/css/content-visibility-to-hidden.html index 0344c815..35df913 100644 --- a/content/test/data/accessibility/css/content-visibility-to-hidden.html +++ b/content/test/data/accessibility/css/content-visibility-to-hidden.html
@@ -8,7 +8,7 @@ } </style> <div id="container"> - <div id="target" aria-labelledby="target_label"> + <div role="group" id="target" aria-labelledby="target_label"> target <div id="child"> child
diff --git a/content/test/data/accessibility/event/aria-atomic-changed.html b/content/test/data/accessibility/event/aria-atomic-changed.html index 1b230b77..b5bca8a 100644 --- a/content/test/data/accessibility/event/aria-atomic-changed.html +++ b/content/test/data/accessibility/event/aria-atomic-changed.html
@@ -5,10 +5,10 @@ <!DOCTYPE html> <html> <body> - <div id="d1" aria-label="Item1" aria-live="polite">Item1</div> - <div id="d2" aria-label="Item2" aria-live="polite" aria-atomic="true">Item2</div> - <div id="d3" aria-label="Item3" aria-live="polite" aria-atomic="true">Item3</div> - <div id="d4" aria-label="Item4" aria-live="polite">Item4</div> + <div id="d1" tabindex='0' aria-label="Item1" aria-live="polite">Item1</div> + <div id="d2" tabindex='0' aria-label="Item2" aria-live="polite" aria-atomic="true">Item2</div> + <div id="d3" tabindex='0' aria-label="Item3" aria-live="polite" aria-atomic="true">Item3</div> + <div id="d4" tabindex='0' aria-label="Item4" aria-live="polite">Item4</div> <div id="d5">Item5</div> <button onclick="go()">go</button> <script>
diff --git a/content/test/data/accessibility/event/aria-flow-to.html b/content/test/data/accessibility/event/aria-flow-to.html index dce68c53..4d94bc8e 100644 --- a/content/test/data/accessibility/event/aria-flow-to.html +++ b/content/test/data/accessibility/event/aria-flow-to.html
@@ -8,34 +8,34 @@ <body> <!-- No flow-to(b1), will add one in script --> - <div id='a1' aria-label='a1'>a1</div> - <div id='b1' aria-label='b1'>b1</div> + <div id='a1' tabindex='0' aria-label='a1'>a1</div> + <div id='b1' tabindex='0' aria-label='b1'>b1</div> <!-- Existing flow-to(b2), will add a second one in script --> - <div id='a2' aria-label='a2' aria-flowto="b2">a2</div> - <div id='b2' aria-label='b2'>b2</div> - <div id='c2' aria-label='c2'>c2</div> + <div id='a2' tabindex='0' aria-label='a2' aria-flowto="b2">a2</div> + <div id='b2' tabindex='0' aria-label='b2'>b2</div> + <div id='c2' tabindex='0' aria-label='c2'>c2</div> <!-- Multiple existing flow-to(b3), will remove one in script --> - <div id='a3' aria-label='a3' aria-flowto="b3">a3</div> - <div id='b3' aria-label='b3'>b3</div> - <div id='c3' aria-label='c3' aria-flowto="b3">c3</div> + <div id='a3' tabindex='0' aria-label='a3' aria-flowto="b3">a3</div> + <div id='b3' tabindex='0' aria-label='b3'>b3</div> + <div id='c3' tabindex='0' aria-label='c3' aria-flowto="b3">c3</div> <!-- Flow-to multiple(b4,c4), will remove one in script --> - <div id='a4' aria-label='a4' aria-flowto="b4 c4">a4</div> - <div id='b4' aria-label='b4'>b4</div> - <div id='c4' aria-label='c4'>c4</div> + <div id='a4' tabindex='0' aria-label='a4' aria-flowto="b4 c4">a4</div> + <div id='b4' tabindex='0' aria-label='b4'>b4</div> + <div id='c4' tabindex='0' aria-label='c4'>c4</div> <!-- Flow-to multiple(b5,c5), will remove both in script --> - <div id='a5' aria-label='a5' aria-flowto="b5 c5">a5</div> - <div id='b5' aria-label='b5'>b5</div> - <div id='c5' aria-label='c5'>c5</div> + <div id='a5' tabindex='0' aria-label='a5' aria-flowto="b5 c5">a5</div> + <div id='b5' tabindex='0' aria-label='b5'>b5</div> + <div id='c5' tabindex='0' aria-label='c5'>c5</div> <!-- Flow-to multiple(b6,c6), will change one in script --> - <div id='a6' aria-label='a6' aria-flowto="b6 c6">a6</div> - <div id='b6' aria-label='b6'>b6</div> - <div id='c6' aria-label='c6'>c6</div> - <div id='d6' aria-label='d6'>d6</div> + <div id='a6' tabindex='0' aria-label='a6' aria-flowto="b6 c6">a6</div> + <div id='b6' tabindex='0' aria-label='b6'>b6</div> + <div id='c6' tabindex='0' aria-label='c6'>c6</div> + <div id='d6' tabindex='0' aria-label='d6'>d6</div> <script> var go_passes = [
diff --git a/content/test/data/accessibility/event/aria-relevant-changed.html b/content/test/data/accessibility/event/aria-relevant-changed.html index b1de155..5a0a016 100644 --- a/content/test/data/accessibility/event/aria-relevant-changed.html +++ b/content/test/data/accessibility/event/aria-relevant-changed.html
@@ -5,14 +5,14 @@ <!DOCTYPE html> <html> <body> - <div id="d1" aria-label="Div1">Div1</div> - <div id="d2" aria-label="Div2" aria-live="polite">Div2</div> - <div id="d3" aria-label="Div3" aria-live="polite">Div3</div> - <div id="d4" aria-label="Div4" aria-live="polite">Div4</div> - <div id="d5" aria-label="Div5" aria-live="polite">Div5</div> - <div id="d6" aria-label="Div6" aria-live="polite">Div6</div> - <div id="d7" aria-label="Div7" aria-live="polite" aria-relevant="true">Div7</div> - <div id="d8" aria-label="Div8" aria-live="polite" aria-relevant="true">Div8</div> + <div id="d1" tabindex='0' aria-label="Div1">Div1</div> + <div id="d2" tabindex='0' aria-label="Div2" aria-live="polite">Div2</div> + <div id="d3" tabindex='0' aria-label="Div3" aria-live="polite">Div3</div> + <div id="d4" tabindex='0' aria-label="Div4" aria-live="polite">Div4</div> + <div id="d5" tabindex='0' aria-label="Div5" aria-live="polite">Div5</div> + <div id="d6" tabindex='0' aria-label="Div6" aria-live="polite">Div6</div> + <div id="d7" tabindex='0' aria-label="Div7" aria-live="polite" aria-relevant="true">Div7</div> + <div id="d8" tabindex='0' aria-label="Div8" aria-live="polite" aria-relevant="true">Div8</div> <script> function go() { // Set aria-relevant from default 'additions text'->'all' on a non-live region;
diff --git a/content/test/data/accessibility/event/style-changed-expected-auralinux.txt b/content/test/data/accessibility/event/style-changed-expected-auralinux.txt index 819e354..f6022f6 100644 --- a/content/test/data/accessibility/event/style-changed-expected-auralinux.txt +++ b/content/test/data/accessibility/event/style-changed-expected-auralinux.txt
@@ -1,10 +1,10 @@ -TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p1' ENABLED,SENSITIVE,SHOWING,VISIBLE -TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p2' ENABLED,SENSITIVE,SHOWING,VISIBLE -TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p3' ENABLED,SENSITIVE,SHOWING,VISIBLE -TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p4' ENABLED,SENSITIVE,SHOWING,VISIBLE -TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p5' ENABLED,SENSITIVE,SHOWING,VISIBLE -TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p6' ENABLED,SENSITIVE,SHOWING,VISIBLE -TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p7' ENABLED,SENSITIVE,SHOWING,VISIBLE -TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p8' ENABLED,SENSITIVE,SHOWING,VISIBLE -TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p9' ENABLED,SENSITIVE,SHOWING,VISIBLE -TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='span10' ENABLED,SENSITIVE,SHOWING,VISIBLE +TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p1' ENABLED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE +TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p2' ENABLED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE +TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p3' ENABLED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE +TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p4' ENABLED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE +TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p5' ENABLED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE +TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p6' ENABLED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE +TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p7' ENABLED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE +TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p8' ENABLED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE +TEXT-ATTRIBUTES-CHANGED role=ROLE_PARAGRAPH name='p9' ENABLED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE +TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='span10' ENABLED,FOCUSABLE,SENSITIVE,SHOWING,VISIBLE
diff --git a/content/test/data/accessibility/event/style-changed-expected-win.txt b/content/test/data/accessibility/event/style-changed-expected-win.txt index 3899dc92..e6069a2 100644 --- a/content/test/data/accessibility/event/style-changed-expected-win.txt +++ b/content/test/data/accessibility/event/style-changed-expected-win.txt
@@ -1,11 +1,11 @@ EVENT_OBJECT_LOCATIONCHANGE on <p#p10> role=ROLE_SYSTEM_GROUPING -IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p1> role=ROLE_SYSTEM_GROUPING name="p1" -IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p2> role=ROLE_SYSTEM_GROUPING name="p2" -IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p3> role=ROLE_SYSTEM_GROUPING name="p3" -IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p4> role=ROLE_SYSTEM_GROUPING name="p4" -IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p5> role=ROLE_SYSTEM_GROUPING name="p5" -IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p6> role=ROLE_SYSTEM_GROUPING name="p6" -IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p7> role=ROLE_SYSTEM_GROUPING name="p7" -IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p8> role=ROLE_SYSTEM_GROUPING name="p8" -IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p9> role=ROLE_SYSTEM_GROUPING name="p9" -IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <span#span10> role=ROLE_SYSTEM_GROUPING name="span10" +IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p1> role=ROLE_SYSTEM_GROUPING name="p1" FOCUSABLE +IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p2> role=ROLE_SYSTEM_GROUPING name="p2" FOCUSABLE +IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p3> role=ROLE_SYSTEM_GROUPING name="p3" FOCUSABLE +IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p4> role=ROLE_SYSTEM_GROUPING name="p4" FOCUSABLE +IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p5> role=ROLE_SYSTEM_GROUPING name="p5" FOCUSABLE +IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p6> role=ROLE_SYSTEM_GROUPING name="p6" FOCUSABLE +IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p7> role=ROLE_SYSTEM_GROUPING name="p7" FOCUSABLE +IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p8> role=ROLE_SYSTEM_GROUPING name="p8" FOCUSABLE +IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <p#p9> role=ROLE_SYSTEM_GROUPING name="p9" FOCUSABLE +IA2_EVENT_TEXT_ATTRIBUTE_CHANGED on <span#span10> role=ROLE_SYSTEM_GROUPING name="span10" FOCUSABLE
diff --git a/content/test/data/accessibility/event/style-changed.html b/content/test/data/accessibility/event/style-changed.html index 8bce52c..8907f8b2 100644 --- a/content/test/data/accessibility/event/style-changed.html +++ b/content/test/data/accessibility/event/style-changed.html
@@ -2,16 +2,16 @@ @AURALINUX-DENY:STATE-CHANGE:DEFUNCT* --> <!DOCTYPE html> -<p id="p1" aria-label="p1">One</p> -<p id="p2" aria-label="p2">Two</p> -<p id="p3" aria-label="p3">Three</p> -<p id="p4" aria-label="p4">Four</p> -<p id="p5" aria-label="p5">Five</p> -<p id="p6" aria-label="p6">Six</p> -<p id="p7" aria-label="p7">Seven</p> -<p id="p8" aria-label="p8">Eight</p> -<p id="p9" aria-label="p9">Nine</p> -<p id="p10">Ten<span aria-label="span10" id="span10">10</span></p> +<p id="p1" tabindex="0" aria-label="p1">One</p> +<p id="p2" tabindex="0" aria-label="p2">Two</p> +<p id="p3" tabindex="0" aria-label="p3">Three</p> +<p id="p4" tabindex="0" aria-label="p4">Four</p> +<p id="p5" tabindex="0" aria-label="p5">Five</p> +<p id="p6" tabindex="0" aria-label="p6">Six</p> +<p id="p7" tabindex="0" aria-label="p7">Seven</p> +<p id="p8" tabindex="0" aria-label="p8">Eight</p> +<p id="p9" tabindex="0" aria-label="p9">Nine</p> +<p id="p10">Ten<span tabindex="0" aria-label="span10" id="span10">10</span></p> <script> function go() { document.getElementById("p1").style.backgroundColor = "red";
diff --git a/content/test/data/accessibility/hit_testing/simple_rectangles.html b/content/test/data/accessibility/hit_testing/simple_rectangles.html index 2eebaabb..c6384316 100644 --- a/content/test/data/accessibility/hit_testing/simple_rectangles.html +++ b/content/test/data/accessibility/hit_testing/simple_rectangles.html
@@ -1,9 +1,9 @@ <!DOCTYPE html> <div> - <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rect1"></div> - <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rect2"></div> - <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rect3"></div> - <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rect4"></div> - <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rect5"></div> + <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rect1"></div> + <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rect2"></div> + <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rect3"></div> + <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rect4"></div> + <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rect5"></div> </div> <iframe src="simple_rectangles_iframe.html" style="width: 200px; height: 50px; margin: 20px"></iframe>
diff --git a/content/test/data/accessibility/hit_testing/simple_rectangles_iframe.html b/content/test/data/accessibility/hit_testing/simple_rectangles_iframe.html index 210959f..ed3ac78 100644 --- a/content/test/data/accessibility/hit_testing/simple_rectangles_iframe.html +++ b/content/test/data/accessibility/hit_testing/simple_rectangles_iframe.html
@@ -1,6 +1,6 @@ <!DOCTYPE html> -<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectA"></div> -<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectB"></div> -<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectC"></div> -<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectD"></div> -<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectE"></div> +<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectA"></div> +<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectB"></div> +<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectC"></div> +<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectD"></div> +<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectE"></div>
diff --git a/content/test/data/accessibility/hit_testing/simple_rectangles_scrolling_iframe.html b/content/test/data/accessibility/hit_testing/simple_rectangles_scrolling_iframe.html index c1a493b6..7aadba0 100644 --- a/content/test/data/accessibility/hit_testing/simple_rectangles_scrolling_iframe.html +++ b/content/test/data/accessibility/hit_testing/simple_rectangles_scrolling_iframe.html
@@ -1,12 +1,12 @@ <!DOCTYPE html> -<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectA"></div> -<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectB"></div> -<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectC"></div> -<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectD"></div> -<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectE"></div> +<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectA"></div> +<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectB"></div> +<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectC"></div> +<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectD"></div> +<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectE"></div> <div style="height: 80px"></div> -<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectF"></div> -<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectG"></div> -<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectH"></div> -<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectI"></div> -<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectJ"></div> +<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectF"></div> +<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectG"></div> +<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectH"></div> +<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectI"></div> +<div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectJ"></div>
diff --git a/content/test/data/accessibility/hit_testing/simple_rectangles_with_curtain.html b/content/test/data/accessibility/hit_testing/simple_rectangles_with_curtain.html index e315d9e7..6cd8137 100644 --- a/content/test/data/accessibility/hit_testing/simple_rectangles_with_curtain.html +++ b/content/test/data/accessibility/hit_testing/simple_rectangles_with_curtain.html
@@ -19,11 +19,11 @@ </div> </div> <div> - <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rect1"></div> - <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rect2"></div> - <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rect3"></div> - <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rect4"></div> - <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" aria-label="rect5"></div> + <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rect1"></div> + <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rect2"></div> + <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rect3"></div> + <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rect4"></div> + <div style="width: 5px; height: 5px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rect5"></div> </div> <iframe src="simple_rectangles_iframe.html" style="width: 200px; height: 50px; margin: 20px"></iframe> <!-- Confound naive hit testing by appearing to cover the whole screen -->
diff --git a/content/test/data/accessibility/hit_testing/text_ranges.html b/content/test/data/accessibility/hit_testing/text_ranges.html index 3c2d3436..4b5ea26b 100644 --- a/content/test/data/accessibility/hit_testing/text_ranges.html +++ b/content/test/data/accessibility/hit_testing/text_ranges.html
@@ -1,9 +1,9 @@ <!DOCTYPE html> <div> - <div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" aria-label="rect1">1</div> - <div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" aria-label="rect2">2</div> - <div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" aria-label="rect3">3</div> - <div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" aria-label="rect4">4</div> - <div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" aria-label="rect5">5</div> + <div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rect1">1</div> + <div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rect2">2</div> + <div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rect3">3</div> + <div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rect4">4</div> + <div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rect5">5</div> </div> <iframe src="text_ranges_iframe.html" style="width: 300px; height: 60px; margin: 20px"></iframe>
diff --git a/content/test/data/accessibility/hit_testing/text_ranges_iframe.html b/content/test/data/accessibility/hit_testing/text_ranges_iframe.html index d3356e1..f819ec2 100644 --- a/content/test/data/accessibility/hit_testing/text_ranges_iframe.html +++ b/content/test/data/accessibility/hit_testing/text_ranges_iframe.html
@@ -1,6 +1,6 @@ <!DOCTYPE html> -<div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectA">A</div> -<div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectB">B</div> -<div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectC">C</div> -<div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectD">D</div> -<div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" aria-label="rectE">E</div> +<div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectA">A</div> +<div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectB">B</div> +<div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectC">C</div> +<div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectD">D</div> +<div style="width: 20px; height: 20px; background: lightgray; display: inline-block; margin: 10px" tabindex="0" aria-label="rectE">E</div>
diff --git a/content/test/data/accessibility/html/a-name-calc.html b/content/test/data/accessibility/html/a-name-calc.html index b953748..8b24427c 100644 --- a/content/test/data/accessibility/html/a-name-calc.html +++ b/content/test/data/accessibility/html/a-name-calc.html
@@ -2,6 +2,7 @@ @WIN-ALLOW:description* @WIN-ALLOW:explicit-name* @UIA-WIN-ALLOW:FullDescription* +@UIA-WIN-ALLOW:ClassName* @MAC-ALLOW:AXDescription @MAC-ALLOW:AXHelp @MAC-DENY:AXValue @@ -20,7 +21,7 @@ <a href="#" aria-label="Label5"></a> <a href="#" aria-labelledby="label6"></a> - <p aria-label="@NO_DUMP"> + <p class="@NO_DUMP"> <span id="label3">LabelledBy3</span> <span id="label6">LabelledBy6</span> </p>
diff --git a/content/test/data/accessibility/html/accordion-expected-android.txt b/content/test/data/accessibility/html/accordion-expected-android.txt index 849ff781..6f85fda3 100644 --- a/content/test/data/accessibility/html/accordion-expected-android.txt +++ b/content/test/data/accessibility/html/accordion-expected-android.txt
@@ -1,7 +1,7 @@ android.webkit.WebView focusable focused scrollable ++android.view.View role_description='heading 3' heading name='Accordion Section #1' ++++android.widget.Button role_description='button' clickable expanded focusable heading name='Accordion Section #1' action_collapse -++android.view.View name='Accordion Section #1' +++android.view.View role_description='region' name='Accordion Section #1' ++++android.view.View name='Content for first section of accordion element.' ++android.view.View role_description='heading 3' heading name='Accordion Section #2' ++++android.widget.Button role_description='button' clickable collapsed focusable heading name='Accordion Section #2' action_expand @@ -9,5 +9,5 @@ ++++android.widget.Button role_description='button' clickable collapsed focusable heading name='Accordion Section #3' action_expand ++android.view.View role_description='heading 3' heading name='Accordion Section #4' ++++android.widget.Button role_description='button' clickable disabled expanded focusable heading name='Accordion Section #4' action_collapse -++android.view.View name='Accordion Section #4' -++++android.view.View name='Content for forth section of accordion element. This section will always be visible but disabled.' \ No newline at end of file +++android.view.View role_description='region' name='Accordion Section #4' +++++android.view.View name='Content for forth section of accordion element. This section will always be visible but disabled.'
diff --git a/content/test/data/accessibility/html/accordion-expected-auralinux.txt b/content/test/data/accessibility/html/accordion-expected-auralinux.txt index a5f4d25..9e077f7 100644 --- a/content/test/data/accessibility/html/accordion-expected-auralinux.txt +++ b/content/test/data/accessibility/html/accordion-expected-auralinux.txt
@@ -3,7 +3,7 @@ ++++[push button] name='Accordion Section #1' expanded controller-for label-for ++++++[paragraph] ++++++++[static] name='Accordion Section #1' -++[section] name='Accordion Section #1' controlled-by labelled-by +++[landmark] name='Accordion Section #1' controlled-by labelled-by ++++[paragraph] ++++++[static] name='Content for first section of accordion element.' ++[heading] name='Accordion Section #2' @@ -18,6 +18,6 @@ ++++[push button] name='Accordion Section #4' expanded label-for ++++++[paragraph] ++++++++[static] name='Accordion Section #4' -++[section] name='Accordion Section #4' labelled-by +++[landmark] name='Accordion Section #4' labelled-by ++++[paragraph] ++++++[static] name='Content for forth section of accordion element. This section will always be visible but disabled.' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/accordion-expected-blink.txt b/content/test/data/accessibility/html/accordion-expected-blink.txt index 0f838c1..ef4bc51b 100644 --- a/content/test/data/accessibility/html/accordion-expected-blink.txt +++ b/content/test/data/accessibility/html/accordion-expected-blink.txt
@@ -2,11 +2,11 @@ ++genericContainer ignored ++++genericContainer ignored ++++++heading name='Accordion Section #1' -++++++++button expanded name='Accordion Section #1' controlsIds=genericContainer +++++++++button expanded name='Accordion Section #1' controlsIds=region ++++++++++paragraph ++++++++++++staticText name='Accordion Section #1' ++++++++++++++inlineTextBox name='Accordion Section #1' -++++++genericContainer name='Accordion Section #1' +++++++region name='Accordion Section #1' ++++++++paragraph ++++++++++staticText name='Content for first section of accordion element.' ++++++++++++inlineTextBox name='Content for first section of accordion element.' @@ -15,19 +15,19 @@ ++++++++++paragraph ++++++++++++staticText name='Accordion Section #2' ++++++++++++++inlineTextBox name='Accordion Section #2' -++++++genericContainer ignored invisible +++++++region ignored invisible ++++++heading name='Accordion Section #3' ++++++++button collapsed name='Accordion Section #3' controlsIds= ++++++++++paragraph ++++++++++++staticText name='Accordion Section #3' ++++++++++++++inlineTextBox name='Accordion Section #3' -++++++genericContainer ignored invisible +++++++region ignored invisible ++++++heading name='Accordion Section #4' ++++++++button expanded name='Accordion Section #4' restriction=disabled ++++++++++paragraph ++++++++++++staticText name='Accordion Section #4' ++++++++++++++inlineTextBox name='Accordion Section #4' -++++++genericContainer name='Accordion Section #4' +++++++region name='Accordion Section #4' ++++++++paragraph ++++++++++staticText name='Content for forth section of accordion element. This section will always be visible but disabled.' ++++++++++++inlineTextBox name='Content for forth section of accordion element. This section will always be visible but disabled.' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/accordion-expected-mac.txt b/content/test/data/accessibility/html/accordion-expected-mac.txt index ecada9c..9366c14 100644 --- a/content/test/data/accessibility/html/accordion-expected-mac.txt +++ b/content/test/data/accessibility/html/accordion-expected-mac.txt
@@ -3,7 +3,7 @@ ++++AXButton AXExpanded=1 AXTitle='Accordion Section #1' ++++++AXGroup ++++++++AXStaticText AXValue='Accordion Section #1' -++AXGroup AXDescription='Accordion Section #1' +++AXGroup AXTitle='Accordion Section #1' ++++AXGroup ++++++AXStaticText AXValue='Content for first section of accordion element.' ++AXHeading AXTitle='Accordion Section #2' AXValue=3 @@ -18,6 +18,6 @@ ++++AXButton AXExpanded=1 AXTitle='Accordion Section #4' ++++++AXGroup ++++++++AXStaticText AXValue='Accordion Section #4' -++AXGroup AXDescription='Accordion Section #4' +++AXGroup AXTitle='Accordion Section #4' ++++AXGroup ++++++AXStaticText AXValue='Content for forth section of accordion element. This section will always be visible but disabled.' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/accordion-expected-win.txt b/content/test/data/accessibility/html/accordion-expected-win.txt index 6ed6328b..6282040 100644 --- a/content/test/data/accessibility/html/accordion-expected-win.txt +++ b/content/test/data/accessibility/html/accordion-expected-win.txt
@@ -3,7 +3,7 @@ ++++ROLE_SYSTEM_PUSHBUTTON name='Accordion Section #1' EXPANDED FOCUSABLE ++++++IA2_ROLE_PARAGRAPH ++++++++ROLE_SYSTEM_STATICTEXT name='Accordion Section #1' -++IA2_ROLE_SECTION name='Accordion Section #1' +++IA2_ROLE_LANDMARK name='Accordion Section #1' ++++IA2_ROLE_PARAGRAPH ++++++ROLE_SYSTEM_STATICTEXT name='Content for first section of accordion element.' ++IA2_ROLE_HEADING name='Accordion Section #2' @@ -18,6 +18,6 @@ ++++ROLE_SYSTEM_PUSHBUTTON name='Accordion Section #4' UNAVAILABLE EXPANDED FOCUSABLE ++++++IA2_ROLE_PARAGRAPH ++++++++ROLE_SYSTEM_STATICTEXT name='Accordion Section #4' -++IA2_ROLE_SECTION name='Accordion Section #4' +++IA2_ROLE_LANDMARK name='Accordion Section #4' ++++IA2_ROLE_PARAGRAPH ++++++ROLE_SYSTEM_STATICTEXT name='Content for forth section of accordion element. This section will always be visible but disabled.' \ No newline at end of file
diff --git a/content/test/data/accessibility/html/accordion.html b/content/test/data/accessibility/html/accordion.html index 45b9e54..b6398c76 100644 --- a/content/test/data/accessibility/html/accordion.html +++ b/content/test/data/accessibility/html/accordion.html
@@ -18,7 +18,7 @@ <p>Accordion Section #1</p> </button> </h3> - <div id="section1" aria-labelledby="header1control"> + <div role="region" id="section1" aria-labelledby="header1control"> <p>Content for first section of accordion element.</p> </div> @@ -28,7 +28,7 @@ <p>Accordion Section #2</p> </button> </h3> - <div id="section2" aria-labelledby="header2control" hidden> + <div role="region" id="section2" aria-labelledby="header2control" hidden> <p>Content for second section of accordion element.</p> </div> @@ -38,7 +38,7 @@ <p>Accordion Section #3</p> </button> </h3> - <div id="section3" aria-labelledby="header3control" hidden> + <div role="region" id="section3" aria-labelledby="header3control" hidden> <p>Content for third section of accordion element.</p> </div> @@ -48,7 +48,7 @@ <p>Accordion Section #4</p> </button> </h3> - <div id="section3" aria-labelledby="header4control"> + <div role="region" id="section3" aria-labelledby="header4control"> <p>Content for forth section of accordion element. This section will always be visible but disabled.</p> </div> </body>
diff --git a/content/test/data/accessibility/html/button-alt-changed.html b/content/test/data/accessibility/html/button-alt-changed.html index af79908..6bc70cbf 100644 --- a/content/test/data/accessibility/html/button-alt-changed.html +++ b/content/test/data/accessibility/html/button-alt-changed.html
@@ -5,7 +5,7 @@ <!DOCTYPE html> <html> <body> - <div id="status" aria-label="Working"></div> + <div tabindex="0" id="status" aria-label="Working"></div> <button> <img alt="Before"></img> </button>
diff --git a/content/test/data/accessibility/html/button-content-changed.html b/content/test/data/accessibility/html/button-content-changed.html index 7301d1f9..bb3c84e6 100644 --- a/content/test/data/accessibility/html/button-content-changed.html +++ b/content/test/data/accessibility/html/button-content-changed.html
@@ -5,7 +5,7 @@ <!DOCTYPE html> <html> <body> - <div id="status" aria-label="Working"></div> + <div tabindex="0" id="status" aria-label="Working"></div> <button> <p> <div id="txt1">Before</div>
diff --git a/content/test/data/accessibility/html/canvas-fallback-expected-android.txt b/content/test/data/accessibility/html/canvas-fallback-expected-android.txt index c88cc80..9bbf29d5 100644 --- a/content/test/data/accessibility/html/canvas-fallback-expected-android.txt +++ b/content/test/data/accessibility/html/canvas-fallback-expected-android.txt
@@ -3,9 +3,9 @@ ++++android.widget.Image name='Static fallback' ++++android.widget.Image ++++++android.widget.TextView name='<newline> ' -++++++android.view.View name='Aria hidden paragraph in fallback content' +++++++android.view.View name='Line breaking content in a fallback' hint='Aria hidden paragraph in fallback content' ++++++android.widget.TextView name='<newline> ' -++++++android.view.View name='Visibility hidden paragraph in fallback content' +++++++android.view.View name='This is another paragraph in fallback' hint='Visibility hidden paragraph in fallback content' ++++++android.widget.TextView name='<newline> ' ++++++android.view.View role_description='heading 1' heading invisible name='Aria hidden paragraph in fallback content' ++++++android.widget.TextView name='<newline> '
diff --git a/content/test/data/accessibility/html/canvas-fallback-expected-auralinux.txt b/content/test/data/accessibility/html/canvas-fallback-expected-auralinux.txt index 4e5c47d..96bb6ba 100644 --- a/content/test/data/accessibility/html/canvas-fallback-expected-auralinux.txt +++ b/content/test/data/accessibility/html/canvas-fallback-expected-auralinux.txt
@@ -4,18 +4,18 @@ ++++++[static] name='Static fallback' ++++[canvas] ++++++[static] name='<newline> ' -++++++[paragraph] name='Aria hidden paragraph in fallback content' labelled-by +++++++[paragraph] description='Aria hidden paragraph in fallback content' described-by ++++++++[static] name='Line breaking content in a fallback' ++++++[static] name='<newline> ' -++++++[paragraph] name='Visibility hidden paragraph in fallback content' labelled-by +++++++[paragraph] description='Visibility hidden paragraph in fallback content' described-by ++++++++[static] name='This is another paragraph in fallback' ++++++[static] name='<newline> ' -++++++[heading] name='Aria hidden paragraph in fallback content' label-for +++++++[heading] name='Aria hidden paragraph in fallback content' description-for ++++++++[static] name='Aria hidden paragraph in fallback content' ++++++[static] name='<newline> ' ++++++[heading] ++++++++[static] name='Display none text in fallback content ' ++++++[static] name='<newline> ' -++++++[heading] label-for +++++++[heading] description-for ++++++++[static] name='Visibility hidden paragraph in fallback content' ++++++[static] name='<newline> '
diff --git a/content/test/data/accessibility/html/canvas-fallback-expected-blink.txt b/content/test/data/accessibility/html/canvas-fallback-expected-blink.txt index 6a64a04..1275efc 100644 --- a/content/test/data/accessibility/html/canvas-fallback-expected-blink.txt +++ b/content/test/data/accessibility/html/canvas-fallback-expected-blink.txt
@@ -5,10 +5,10 @@ ++++++++staticText name='Static fallback' ++++++canvas ++++++++staticText name='<newline> ' -++++++++paragraph name='Aria hidden paragraph in fallback content' +++++++++paragraph description='Aria hidden paragraph in fallback content' ++++++++++staticText name='Line breaking content in a fallback' ++++++++staticText name='<newline> ' -++++++++paragraph name='Visibility hidden paragraph in fallback content' +++++++++paragraph description='Visibility hidden paragraph in fallback content' ++++++++++staticText name='This is another paragraph in fallback' ++++++++staticText name='<newline> ' ++++++++heading invisible name='Aria hidden paragraph in fallback content' hierarchicalLevel=1
diff --git a/content/test/data/accessibility/html/canvas-fallback-expected-mac.txt b/content/test/data/accessibility/html/canvas-fallback-expected-mac.txt index ce1b8418..e5f46e4 100644 --- a/content/test/data/accessibility/html/canvas-fallback-expected-mac.txt +++ b/content/test/data/accessibility/html/canvas-fallback-expected-mac.txt
@@ -4,10 +4,10 @@ ++++++AXStaticText AXValue='Static fallback' ++++AXGroup ++++++AXStaticText AXValue='<newline> ' -++++++AXGroup AXTitle='Aria hidden paragraph in fallback content' +++++++AXGroup AXHelp='Aria hidden paragraph in fallback content' ++++++++AXStaticText AXValue='Line breaking content in a fallback' ++++++AXStaticText AXValue='<newline> ' -++++++AXGroup AXTitle='Visibility hidden paragraph in fallback content' +++++++AXGroup AXHelp='Visibility hidden paragraph in fallback content' ++++++++AXStaticText AXValue='This is another paragraph in fallback' ++++++AXStaticText AXValue='<newline> ' ++++++AXStaticText AXValue='<newline> '
diff --git a/content/test/data/accessibility/html/canvas-fallback-expected-uia-win.txt b/content/test/data/accessibility/html/canvas-fallback-expected-uia-win.txt index 5b2328f..9f4630ab 100644 --- a/content/test/data/accessibility/html/canvas-fallback-expected-uia-win.txt +++ b/content/test/data/accessibility/html/canvas-fallback-expected-uia-win.txt
@@ -4,10 +4,10 @@ ++++++Text Name='Static fallback' ++++Image ++++++Text Name='<newline> ' -++++++Group Name='Aria hidden paragraph in fallback content' +++++++Group ++++++++Text Name='Line breaking content in a fallback' ++++++Text Name='<newline> ' -++++++Group Name='Visibility hidden paragraph in fallback content' +++++++Group ++++++++Text Name='This is another paragraph in fallback' ++++++Text Name='<newline> ' ++++++Text Name='Aria hidden paragraph in fallback content' IsControlElement=false
diff --git a/content/test/data/accessibility/html/canvas-fallback-expected-win.txt b/content/test/data/accessibility/html/canvas-fallback-expected-win.txt index 995396c..a71af66 100644 --- a/content/test/data/accessibility/html/canvas-fallback-expected-win.txt +++ b/content/test/data/accessibility/html/canvas-fallback-expected-win.txt
@@ -4,10 +4,10 @@ ++++++ROLE_SYSTEM_STATICTEXT ++++IA2_ROLE_CANVAS ++++++ROLE_SYSTEM_STATICTEXT -++++++IA2_ROLE_PARAGRAPH +++++++IA2_ROLE_PARAGRAPH description='Aria hidden paragraph in fallback content' ++++++++ROLE_SYSTEM_STATICTEXT ++++++ROLE_SYSTEM_STATICTEXT -++++++IA2_ROLE_PARAGRAPH +++++++IA2_ROLE_PARAGRAPH description='Visibility hidden paragraph in fallback content' ++++++++ROLE_SYSTEM_STATICTEXT ++++++ROLE_SYSTEM_STATICTEXT ++++++IA2_ROLE_HEADING INVISIBLE
diff --git a/content/test/data/accessibility/html/canvas-fallback.html b/content/test/data/accessibility/html/canvas-fallback.html index fc571eb..e16fff9 100644 --- a/content/test/data/accessibility/html/canvas-fallback.html +++ b/content/test/data/accessibility/html/canvas-fallback.html
@@ -1,5 +1,9 @@ <!-- +@AURALINUX-DENY:description-from* +@BLINK-DENY:descriptionFrom* @BLINK-ALLOW:hierarchicalLevel* +@WIN-DENY:description* +@WIN-ALLOW:description=* @WIN-DENY:name* --> <html> @@ -7,8 +11,8 @@ <body> <canvas width=100 height=100>Static fallback</canvas> <canvas width=100 height=100> - <p id="p1" aria-labelledby="h1">Line breaking content in a fallback</p> - <p id="p2" aria-labelledby="h2">This is another paragraph in fallback</p> + <p id="p1" aria-describedby="h1">Line breaking content in a fallback</p> + <p id="p2" aria-describedby="h2">This is another paragraph in fallback</p> <h1 id="h1" aria-hidden="true">Aria hidden paragraph in fallback content</h1> <h1 style="display:none">Display none text in fallback content </h1> <h2 id="h2" style="visibility: hidden">Visibility hidden paragraph in fallback content</h2>
diff --git a/content/test/data/accessibility/html/checkbox-name-calc.html b/content/test/data/accessibility/html/checkbox-name-calc.html index dd9c427..8e5c1b38 100644 --- a/content/test/data/accessibility/html/checkbox-name-calc.html +++ b/content/test/data/accessibility/html/checkbox-name-calc.html
@@ -1,6 +1,7 @@ <!-- @WIN-ALLOW:description* @WIN-ALLOW:explicit-name* +@UIA-WIN-ALLOW:ClassName* @AURALINUX-ALLOW:description* @AURALINUX-ALLOW:explicit-name* @AURALINUX-DENY:checkable @@ -20,7 +21,7 @@ aria-labelledby="lb4" aria-describedby="db4"> <input id="c5" type="checkbox" aria-describedby="db5"> - <p title="@NO_DUMP please"> + <p class="@NO_DUMP please"> <label for="c1">Label1</label> <label for="c2">Label2</label> <label for="c3">Label3</label>
diff --git a/content/test/data/accessibility/html/input-text-name-calc.html b/content/test/data/accessibility/html/input-text-name-calc.html index c467209..a332cb69e 100644 --- a/content/test/data/accessibility/html/input-text-name-calc.html +++ b/content/test/data/accessibility/html/input-text-name-calc.html
@@ -1,6 +1,7 @@ <!-- @BLINK-ALLOW:inputType=* @UIA-WIN-ALLOW:HelpText* +@UIA-WIN-ALLOW:ClassName* @WIN-ALLOW:description* @WIN-ALLOW:explicit-name* @AURALINUX-ALLOW:description* @@ -27,7 +28,7 @@ <input id="c7" type="text" aria-label="AriaLabel7" placeholder="Placeholder7" aria-describedby="db7"> - <p aria-label="@NO_DUMP"> + <p class="@NO_DUMP"> <label for="c1">Label1</label> <label for="c2">Label2</label> <label for="c3">Label3</label>
diff --git a/content/test/data/accessibility/html/offscreen-iframe-content.html b/content/test/data/accessibility/html/offscreen-iframe-content.html index cc082f47..f53fd674 100644 --- a/content/test/data/accessibility/html/offscreen-iframe-content.html +++ b/content/test/data/accessibility/html/offscreen-iframe-content.html
@@ -1,7 +1,7 @@ <!doctype html> <html> <body> - <div aria-label="iframe_onscreen" style="height:300px; background-color: red;"></div> - <div aria-label="iframe_offscreen" style="height:200px; background-color: green"></div> + <div role="group" aria-label="iframe_onscreen" style="height:300px; background-color: red;"></div> + <div role="group" aria-label="iframe_offscreen" style="height:200px; background-color: green"></div> </body> </html>
diff --git a/content/test/data/accessibility/html/offscreen-iframe-expected-blink.txt b/content/test/data/accessibility/html/offscreen-iframe-expected-blink.txt index 8bacf77..59a59f6e 100644 --- a/content/test/data/accessibility/html/offscreen-iframe-expected-blink.txt +++ b/content/test/data/accessibility/html/offscreen-iframe-expected-blink.txt
@@ -5,5 +5,5 @@ ++++++++rootWebArea ++++++++++genericContainer ignored ++++++++++++genericContainer ignored -++++++++++++++genericContainer name='iframe_onscreen' -++++++++++++++genericContainer offscreen name='iframe_offscreen' +++++++++++++++group name='iframe_onscreen' +++++++++++++++group offscreen name='iframe_offscreen'
diff --git a/content/test/data/accessibility/html/offscreen-iframe-expected-win.txt b/content/test/data/accessibility/html/offscreen-iframe-expected-win.txt index 7e4daa5..6f49987 100644 --- a/content/test/data/accessibility/html/offscreen-iframe-expected-win.txt +++ b/content/test/data/accessibility/html/offscreen-iframe-expected-win.txt
@@ -2,5 +2,5 @@ ++IA2_ROLE_SECTION ++++IA2_ROLE_INTERNAL_FRAME ++++++ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE -++++++++IA2_ROLE_SECTION name='iframe_onscreen' -++++++++IA2_ROLE_SECTION name='iframe_offscreen' OFFSCREEN +++++++++ROLE_SYSTEM_GROUPING name='iframe_onscreen' +++++++++ROLE_SYSTEM_GROUPING name='iframe_offscreen' OFFSCREEN
diff --git a/content/test/data/accessibility/html/scrollable-expected-uia-win.txt b/content/test/data/accessibility/html/scrollable-expected-uia-win.txt index ffebe6e..ed377a1 100644 --- a/content/test/data/accessibility/html/scrollable-expected-uia-win.txt +++ b/content/test/data/accessibility/html/scrollable-expected-uia-win.txt
@@ -1,5 +1,5 @@ Document Scroll.HorizontalScrollPercent=-1.00 Scroll.HorizontalViewSize=100.00 Scroll.HorizontallyScrollable=false Scroll.VerticalScrollPercent=-1.00 Scroll.VerticalViewSize=100.00 Scroll.VerticallyScrollable=false -++Group Name='not' +++Group ClassName='not' IsControlElement=false ++++Text Name='not scrollable' -++Group Name='x' Scroll.HorizontalScrollPercent=0.00 Scroll.HorizontalViewSize=50.00 Scroll.HorizontallyScrollable=true Scroll.VerticalScrollPercent=-1.00 Scroll.VerticalViewSize=100.00 Scroll.VerticallyScrollable=false -++Group Name='y' Scroll.HorizontalScrollPercent=-1.00 Scroll.HorizontalViewSize=100.00 Scroll.HorizontallyScrollable=false Scroll.VerticalScrollPercent=0.00 Scroll.VerticalViewSize=50.00 Scroll.VerticallyScrollable=true +++Group ClassName='x' IsControlElement=false Scroll.HorizontalScrollPercent=0.00 Scroll.HorizontalViewSize=50.00 Scroll.HorizontallyScrollable=true Scroll.VerticalScrollPercent=-1.00 Scroll.VerticalViewSize=100.00 Scroll.VerticallyScrollable=false +++Group ClassName='y' IsControlElement=false Scroll.HorizontalScrollPercent=-1.00 Scroll.HorizontalViewSize=100.00 Scroll.HorizontallyScrollable=false Scroll.VerticalScrollPercent=0.00 Scroll.VerticalViewSize=50.00 Scroll.VerticallyScrollable=true
diff --git a/content/test/data/accessibility/html/scrollable.html b/content/test/data/accessibility/html/scrollable.html index e3821038..ae64e6a 100644 --- a/content/test/data/accessibility/html/scrollable.html +++ b/content/test/data/accessibility/html/scrollable.html
@@ -5,18 +5,19 @@ @UIA-WIN-ALLOW:Scroll.VerticalScrollPercent=* @UIA-WIN-ALLOW:Scroll.VerticalViewSize=* @UIA-WIN-ALLOW:Scroll.VerticallyScrollable=* + @UIA-WIN-ALLOW:ClassName* --> <!DOCTYPE html> <html> <body> - <div aria-label='not'> + <div class='not'> not scrollable </div> - <div style='width:100px; overflow:auto' aria-label='x'> + <div style='width:100px; overflow:auto' class='x'> <div style='width:200px; height:100px'></div> </div> - <div style='height:100px; overflow:auto' aria-label='y'> + <div style='height:100px; overflow:auto' class='y'> <div style='width:100px; height:200px'></div> </div> </body> -</html> \ No newline at end of file +</html>
diff --git a/content/test/data/accessibility/html/truncate-label-expected-blink.txt b/content/test/data/accessibility/html/truncate-label-expected-blink.txt index da733772..eda06be 100644 --- a/content/test/data/accessibility/html/truncate-label-expected-blink.txt +++ b/content/test/data/accessibility/html/truncate-label-expected-blink.txt
@@ -1,4 +1,4 @@ rootWebArea ++genericContainer ignored ++++genericContainer ignored -++++++genericContainer name='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' +++++++group name='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
diff --git a/content/test/data/accessibility/html/truncate-label.html b/content/test/data/accessibility/html/truncate-label.html index e4effe3..6967088d 100644 --- a/content/test/data/accessibility/html/truncate-label.html +++ b/content/test/data/accessibility/html/truncate-label.html
@@ -4,7 +4,7 @@ <!DOCTYPE html> <html> <body> -<div id="big"></div> +<div role="group" id="big"></div> <script> var huge = document.getElementById('big'); var count = 1000000;
diff --git a/content/test/data/accessibility/regression/content-visibility-with-pseudo-element-expected-blink.txt b/content/test/data/accessibility/regression/content-visibility-with-pseudo-element-expected-blink.txt new file mode 100644 index 0000000..c0232ef --- /dev/null +++ b/content/test/data/accessibility/regression/content-visibility-with-pseudo-element-expected-blink.txt
@@ -0,0 +1,3 @@ +rootWebArea name='done' +++genericContainer ignored +++++genericContainer
diff --git a/content/test/data/accessibility/regression/content-visibility-with-pseudo-element.html b/content/test/data/accessibility/regression/content-visibility-with-pseudo-element.html new file mode 100644 index 0000000..d4aec67 --- /dev/null +++ b/content/test/data/accessibility/regression/content-visibility-with-pseudo-element.html
@@ -0,0 +1,35 @@ +<!-- +@WAIT-FOR:done +--> +<html> +<style> +.auto { + content-visibility: auto; + height: 20000px; +} +#target { + position: absolute; + bottom: 0; +} +</style> +<body class="@NO_CHILDREN_DUMP"> +<script> +function fuzz() { + document.designMode = 'on'; + document.execCommand("selectAll"); + document.execCommand("insertunorderedlist"); + document.title = 'done'; +} + +document.addEventListener('DOMContentLoaded', () => { + setTimeout(fuzz, 200); +}); +</script> +<div class="auto"></div> +<div class="auto"> + <div id="target">target</div> +</div> +<script> + target.scrollIntoView(); +</script> +</body> \ No newline at end of file
diff --git a/content/test/mock_widget.h b/content/test/mock_widget.h index a0c42fb..8f29123 100644 --- a/content/test/mock_widget.h +++ b/content/test/mock_widget.h
@@ -13,6 +13,7 @@ #include "mojo/public/cpp/bindings/associated_receiver.h" #include "mojo/public/cpp/bindings/remote.h" #include "third_party/blink/public/common/widget/visual_properties.h" +#include "third_party/blink/public/mojom/input/input_handler.mojom.h" #include "third_party/blink/public/mojom/page/record_content_to_visible_time_request.mojom.h" #include "third_party/blink/public/mojom/page/widget.mojom.h"
diff --git a/content/web_test/browser/web_test_background_fetch_delegate.cc b/content/web_test/browser/web_test_background_fetch_delegate.cc index 22b57e2..94bbba3 100644 --- a/content/web_test/browser/web_test_background_fetch_delegate.cc +++ b/content/web_test/browser/web_test_background_fetch_delegate.cc
@@ -33,6 +33,7 @@ #include "mojo/public/cpp/bindings/remote.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "services/network/public/cpp/resource_request_body.h" +#include "third_party/blink/public/mojom/blob/blob.mojom.h" #include "ui/gfx/geometry/size.h" namespace content {
diff --git a/crypto/DIR_METADATA b/crypto/DIR_METADATA index 250c6d5..54e5bb81 100644 --- a/crypto/DIR_METADATA +++ b/crypto/DIR_METADATA
@@ -1,10 +1,10 @@ # Metadata information for this directory. # # For more information on DIR_METADATA files, see: -# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/README.md +# https://source.chromium.org/chromium/infra/infra/+/main:go/src/infra/tools/dirmd/README.md # # For the schema of this file, see Metadata message: -# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/proto/dir_metadata.proto +# https://source.chromium.org/chromium/infra/infra/+/main:go/src/infra/tools/dirmd/proto/dir_metadata.proto monorail { component: "Internals>Network>SSL"
diff --git a/device/vr/android/arcore/ar_compositor_frame_sink.h b/device/vr/android/arcore/ar_compositor_frame_sink.h index eca8c55..32b1d6e 100644 --- a/device/vr/android/arcore/ar_compositor_frame_sink.h +++ b/device/vr/android/arcore/ar_compositor_frame_sink.h
@@ -19,6 +19,7 @@ #include "device/vr/public/cpp/xr_frame_sink_client.h" #include "mojo/public/cpp/bindings/associated_remote.h" #include "services/viz/privileged/mojom/compositing/display_private.mojom.h" +#include "services/viz/privileged/mojom/compositing/external_begin_frame_controller.mojom.h" #include "services/viz/privileged/mojom/compositing/frame_sink_manager.mojom.h" #include "services/viz/public/mojom/compositing/compositor_frame_sink.mojom.h" #include "ui/gfx/geometry/size.h"
diff --git a/extensions/browser/DEPS b/extensions/browser/DEPS index b1403fad..2612a5f9 100644 --- a/extensions/browser/DEPS +++ b/extensions/browser/DEPS
@@ -73,4 +73,8 @@ "+components/services/unzip", "+services/data_decoder", ], + "extension_prefs.cc": [ + # For CONTENT_SETTING_ALLOW / BLOCK. + "+components/content_settings/core/common", + ], }
diff --git a/extensions/browser/extension_prefs.cc b/extensions/browser/extension_prefs.cc index d0558c9..eadd781 100644 --- a/extensions/browser/extension_prefs.cc +++ b/extensions/browser/extension_prefs.cc
@@ -23,6 +23,7 @@ #include "base/trace_event/trace_event.h" #include "base/util/values/values_util.h" #include "build/build_config.h" +#include "components/content_settings/core/common/content_settings.h" #include "components/crx_file/id_util.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_service.h"
diff --git a/extensions/browser/service_worker_task_queue.cc b/extensions/browser/service_worker_task_queue.cc index d4eef96..f81b450 100644 --- a/extensions/browser/service_worker_task_queue.cc +++ b/extensions/browser/service_worker_task_queue.cc
@@ -29,6 +29,7 @@ #include "extensions/common/constants.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/background_info.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_registration_options.mojom.h" using content::BrowserContext;
diff --git a/extensions/common/api/automation.idl b/extensions/common/api/automation.idl index 528f66a..ce529c0 100644 --- a/extensions/common/api/automation.idl +++ b/extensions/common/api/automation.idl
@@ -1049,9 +1049,6 @@ // text element; -1 if no selection. long? textSelEnd; - // The input type, like email or number. - DOMString? textInputType; - // An array of Marker objects for this node. Marker[]? markers;
diff --git a/extensions/renderer/api/automation/automation_internal_custom_bindings.cc b/extensions/renderer/api/automation/automation_internal_custom_bindings.cc index 1559afc..6019937 100644 --- a/extensions/renderer/api/automation/automation_internal_custom_bindings.cc +++ b/extensions/renderer/api/automation/automation_internal_custom_bindings.cc
@@ -1445,9 +1445,7 @@ // Increment and decrement are available when the role is a slider or // spin button. - const std::string& role_string = - node->GetStringAttribute(ax::mojom::StringAttribute::kRole); - auto role = ui::ParseAXEnum<ax::mojom::Role>(role_string.c_str()); + auto role = node->data().role; if (role == ax::mojom::Role::kSlider || role == ax::mojom::Role::kSpinButton) { standard_actions.push_back( @@ -1576,13 +1574,17 @@ RouteNodeIDFunction( "GetTableColumnCount", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, - AutomationAXTreeWrapper* tree_wrapper, - ui::AXNode* node) { result.Set(*node->GetTableColCount()); }); + AutomationAXTreeWrapper* tree_wrapper, ui::AXNode* node) { + if (node->GetTableColCount()) + result.Set(*node->GetTableColCount()); + }); RouteNodeIDFunction( "GetTableRowCount", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, - AutomationAXTreeWrapper* tree_wrapper, - ui::AXNode* node) { result.Set(*node->GetTableRowCount()); }); + AutomationAXTreeWrapper* tree_wrapper, ui::AXNode* node) { + if (node->GetTableRowCount()) + result.Set(*node->GetTableRowCount()); + }); RouteNodeIDFunction( "GetTableCellColumnHeaders", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result,
diff --git a/extensions/renderer/resources/automation/automation_node.js b/extensions/renderer/resources/automation/automation_node.js index fb33a39e..9fb7de0 100644 --- a/extensions/renderer/resources/automation/automation_node.js +++ b/extensions/renderer/resources/automation/automation_node.js
@@ -1370,7 +1370,6 @@ 'liveStatus', 'placeholder', 'roleDescription', - 'textInputType', 'tooltip', 'url' ]; @@ -1415,7 +1414,6 @@ ['tableRowHeaderId', 'tableRowHeader', null]]; var intListAttributes = [ - 'lineBreaks', 'wordEnds', 'wordStarts'];
diff --git a/fuchsia/engine/BUILD.gn b/fuchsia/engine/BUILD.gn index 40b546d..fb45173 100644 --- a/fuchsia/engine/BUILD.gn +++ b/fuchsia/engine/BUILD.gn
@@ -125,6 +125,7 @@ "//fuchsia/base:legacymetrics", "//fuchsia/base:message_port", "//fuchsia/base:modular", + "//fuchsia/engine/web_instance_host", "//google_apis", "//gpu/command_buffer/service", "//media", @@ -507,6 +508,7 @@ "//components/cast_streaming/mojo:mojom", "//content/test:test_support", "//fuchsia/base/test:test_support", + "//fuchsia/engine/web_instance_host", "//mojo/core/embedder", "//services/media_session/public/mojom", "//services/network:network_service",
diff --git a/fuchsia/engine/browser/accessibility_bridge.cc b/fuchsia/engine/browser/accessibility_bridge.cc index 4c7fb5e..4e4fe1c1 100644 --- a/fuchsia/engine/browser/accessibility_bridge.cc +++ b/fuchsia/engine/browser/accessibility_bridge.cc
@@ -4,12 +4,14 @@ #include "fuchsia/engine/browser/accessibility_bridge.h" -#include <algorithm> - #include <lib/sys/cpp/component_context.h> +#include <lib/sys/inspect/cpp/component.h> #include <lib/ui/scenic/cpp/view_ref_pair.h> +#include <algorithm> + #include "base/fuchsia/fuchsia_logging.h" +#include "base/fuchsia/process_context.h" #include "base/logging.h" #include "content/public/browser/global_routing_id.h" #include "content/public/browser/render_widget_host_view.h" @@ -25,6 +27,12 @@ // Error allowed for each edge when converting from gfx::RectF to gfx::Rect. constexpr float kRectConversionError = 0.5; +// Inspect node/property names. +constexpr char kSemanticTreesInspectNodeName[] = "trees"; +constexpr char kSemanticTreeContentsInspectPropertyName[] = "contents"; +constexpr char kParentTreeInspectPropertyName[] = "parent_tree"; +constexpr char kParentNodeInspectPropertyName[] = "parent_node"; + // Returns the id of the offset container for |node|, or the root node id if // |node| does not specify an offset container. int32_t GetOffsetContainerId(const ui::AXTree* tree, @@ -41,10 +49,12 @@ fuchsia::accessibility::semantics::SemanticsManager* semantics_manager, fuchsia::ui::views::ViewRef view_ref, content::WebContents* web_contents, - base::OnceCallback<void(zx_status_t)> on_error_callback) + base::OnceCallback<void(zx_status_t)> on_error_callback, + inspect::Node inspect_node) : binding_(this), web_contents_(web_contents), - on_error_callback_(std::move(on_error_callback)) { + on_error_callback_(std::move(on_error_callback)), + inspect_node_(std::move(inspect_node)) { DCHECK(web_contents_); Observe(web_contents_); @@ -56,6 +66,44 @@ }); } +inspect::Inspector AccessibilityBridge::FillInspectData() { + DCHECK(enable_semantic_updates_); + + inspect::Inspector inspector; + + // Add a node for each AXTree of which the accessibility bridge is aware. + // The output for each tree has the following form: + // + // <tree id>: + // contents: <string representation of tree contents> + // parent_tree: <tree id of this tree's parent, if it has one> + // parent_node: <node id of this tree's parent, if it has one> + for (const auto& ax_tree : ax_trees_) { + const ui::AXTree* ax_tree_ptr = ax_tree.second.get(); + + inspect::Node inspect_node = + inspector.GetRoot().CreateChild(ax_tree_ptr->GetAXTreeID().ToString()); + + inspect_node.CreateString(kSemanticTreeContentsInspectPropertyName, + ax_tree_ptr->ToString(), &inspector); + + auto tree_id_and_connection = + tree_connections_.find(ax_tree_ptr->GetAXTreeID()); + if (tree_id_and_connection != tree_connections_.end()) { + const TreeConnection& connection = tree_id_and_connection->second; + inspect_node.CreateString(kParentTreeInspectPropertyName, + connection.parent_tree_id.ToString(), + &inspector); + inspect_node.CreateUint(kParentNodeInspectPropertyName, + connection.parent_node_id, &inspector); + } + + inspector.emplace(std::move(inspect_node)); + } + + return inspector; +} + AccessibilityBridge::~AccessibilityBridge() { InterruptPendingActions(); ax_trees_.clear(); @@ -246,6 +294,10 @@ // The first call to AccessibilityEventReceived after this call will be // the entire semantic tree. web_contents_->EnableWebContentsOnlyAccessibilityMode(); + // Set up inspect node for semantic trees. + inspect_node_tree_dump_ = inspect_node_.CreateLazyNode( + kSemanticTreesInspectNodeName, + [this]() { return fit::make_ok_promise(FillInspectData()); }); } else { // The SemanticsManager will clear all state in this case, which is // mirrored here. @@ -259,6 +311,7 @@ tree_connections_.clear(); frame_id_to_tree_id_.clear(); InterruptPendingActions(); + inspect_node_tree_dump_ = inspect::LazyNode(); } // Notify the SemanticsManager that this request was handled. @@ -359,6 +412,7 @@ } } UpdateTreeConnections(); + UpdateFocus(); // TODO(https://crbug.com/1134737): Separate updates of atomic updates and // don't allow all of them to be in the same commit. TryCommit(); @@ -432,22 +486,14 @@ if (kv.second.is_connected) continue; // No work to do, trees connected and present. - int32_t offset_container_id = - GetOffsetContainerId(parent_tree, ax_node->data()); - const auto* container = parent_tree->GetFromId(offset_container_id); - DCHECK(container); - - auto fuchsia_node = - AXNodeDataToSemanticNode(ax_node->data(), container->data(), - parent_ax_tree_id, false, id_mapper_.get()); - + auto* fuchsia_node = GetUpdatedNode(parent_ax_tree_id, ax_node->id()); + DCHECK(fuchsia_node); // Now, the connection really happens: // This node, from the parent tree, will have a child that points to the // root of the child tree. auto child_tree_root_id = id_mapper_->ToFuchsiaNodeID( child_tree->GetAXTreeID(), child_tree->root()->id(), false); - fuchsia_node.mutable_child_ids()->push_back(child_tree_root_id); - to_update_.push_back(std::move(fuchsia_node)); + fuchsia_node->mutable_child_ids()->push_back(child_tree_root_id); kv.second.is_connected = true; // Trees are connected! } @@ -456,6 +502,39 @@ } } +void AccessibilityBridge::UpdateFocus() { + auto new_focused_node = GetFocusedNodeId(); + if (!new_focused_node && !last_focused_node_id_) + return; // no node in focus, no new node in focus. + + const bool focus_changed = last_focused_node_id_ != new_focused_node; + + if (new_focused_node) { + // If the new focus is the same as the old focus, we only want to set the + // value in the node if it is part of the current update, meaning that its + // data changed. This makes sure that it contains the focus information. If + // it is not part of the current update, no need to send this information, + // as it is redundant. + auto* node = + focus_changed + ? GetUpdatedNode(new_focused_node->first, new_focused_node->second) + : GetNodeIfChangingInUpdate(new_focused_node->first, + new_focused_node->second); + if (node) + node->mutable_states()->set_has_input_focus(true); + } + + if (last_focused_node_id_) { + auto* node = focus_changed ? GetUpdatedNode(last_focused_node_id_->first, + last_focused_node_id_->second) + : nullptr /*already updated above*/; + if (node) + node->mutable_states()->set_has_input_focus(false); + } + + last_focused_node_id_ = std::move(new_focused_node); +} + bool AccessibilityBridge::ShouldHoldCommit() { const auto& main_frame_tree_id = web_contents_->GetMainFrame()->GetAXTreeID(); auto main_tree_it = ax_trees_.find(main_frame_tree_id); @@ -544,3 +623,94 @@ if (it != tree_connections_.end()) it->second.is_connected = false; } + +absl::optional<AccessibilityBridge::AXNodeID> +AccessibilityBridge::GetFocusedNodeId() const { + const auto& main_frame_tree_id = web_contents_->GetMainFrame()->GetAXTreeID(); + const auto main_tree_it = ax_trees_.find(main_frame_tree_id); + if (main_tree_it == ax_trees_.end()) + return absl::nullopt; + + const ui::AXSerializableTree* main_tree = main_tree_it->second.get(); + DCHECK(main_tree); + const ui::AXTreeID& focused_tree_id = main_tree->data().focused_tree_id; + if (focused_tree_id == ui::AXTreeIDUnknown()) + return absl::nullopt; + + const auto focused_tree_it = ax_trees_.find(focused_tree_id); + if (focused_tree_it == ax_trees_.end()) + return absl::nullopt; + + const ui::AXSerializableTree* focused_tree = focused_tree_it->second.get(); + DCHECK(focused_tree); + + return GetFocusFromThisOrDescendantFrame(focused_tree); +} + +absl::optional<AccessibilityBridge::AXNodeID> +AccessibilityBridge::GetFocusFromThisOrDescendantFrame( + const ui::AXSerializableTree* tree) const { + DCHECK(tree); + const auto focused_node_id = tree->data().focus_id; + const auto* node = tree->GetFromId(focused_node_id); + const auto root_id = tree->root() ? tree->root()->id() : ui::kInvalidAXNodeID; + if (!node) { + if (root_id != ui::kInvalidAXNodeID) + return std::make_pair(tree->GetAXTreeID(), root_id); + + return absl::nullopt; + } + + if (node->data().HasStringAttribute( + ax::mojom::StringAttribute::kChildTreeId)) { + const auto child_tree_id = + ui::AXTreeID::FromString(node->data().GetStringAttribute( + ax::mojom::StringAttribute::kChildTreeId)); + const auto child_tree_it = ax_trees_.find(child_tree_id); + if (child_tree_it != ax_trees_.end()) + return GetFocusFromThisOrDescendantFrame(child_tree_it->second.get()); + } + + return std::make_pair(tree->GetAXTreeID(), node->id()); +} + +fuchsia::accessibility::semantics::Node* +AccessibilityBridge::GetNodeIfChangingInUpdate(const ui::AXTreeID& tree_id, + ui::AXNodeID node_id) { + auto fuchsia_node_id = id_mapper_->ToFuchsiaNodeID(tree_id, node_id, false); + auto result = std::find_if( + to_update_.rbegin(), to_update_.rend(), + [&fuchsia_node_id](const fuchsia::accessibility::semantics::Node& node) { + return node.node_id() == fuchsia_node_id; + }); + if (result == to_update_.rend()) + return nullptr; + + return &(*result); +} + +fuchsia::accessibility::semantics::Node* AccessibilityBridge::GetUpdatedNode( + const ui::AXTreeID& tree_id, + ui::AXNodeID node_id) { + auto* fuchsia_node = GetNodeIfChangingInUpdate(tree_id, node_id); + if (fuchsia_node) + return fuchsia_node; + + auto ax_tree_it = ax_trees_.find(tree_id); + if (ax_tree_it == ax_trees_.end()) + return nullptr; + + auto* tree = ax_tree_it->second.get(); + auto* ax_node = tree->GetFromId(node_id); + if (!ax_node) + return nullptr; + + int32_t offset_container_id = GetOffsetContainerId(tree, ax_node->data()); + const auto* container = tree->GetFromId(offset_container_id); + DCHECK(container); + + auto new_fuchsia_node = AXNodeDataToSemanticNode( + ax_node->data(), container->data(), tree_id, false, id_mapper_.get()); + to_update_.push_back(std::move(new_fuchsia_node)); + return &to_update_.back(); +}
diff --git a/fuchsia/engine/browser/accessibility_bridge.h b/fuchsia/engine/browser/accessibility_bridge.h index cb0fb9cee..eaf07fae 100644 --- a/fuchsia/engine/browser/accessibility_bridge.h +++ b/fuchsia/engine/browser/accessibility_bridge.h
@@ -9,6 +9,7 @@ #include <fuchsia/math/cpp/fidl.h> #include <fuchsia/ui/views/cpp/fidl.h> #include <lib/fidl/cpp/binding.h> +#include <lib/inspect/cpp/vmo/types.h> #include "base/callback.h" #include "base/containers/flat_map.h" @@ -42,13 +43,16 @@ public fuchsia::accessibility::semantics::SemanticListener, public ui::AXTreeObserver { public: + using AXNodeID = std::pair<ui::AXTreeID, int32_t>; + // |semantics_manager| is used during construction to register the instance. // |web_contents| is required to exist for the duration of |this|. AccessibilityBridge( fuchsia::accessibility::semantics::SemanticsManager* semantics_manager, fuchsia::ui::views::ViewRef view_ref, content::WebContents* web_contents, - base::OnceCallback<void(zx_status_t)> on_error_callback); + base::OnceCallback<void(zx_status_t)> on_error_callback, + inspect::Node inspect_node); ~AccessibilityBridge() final; AccessibilityBridge(const AccessibilityBridge&) = delete; @@ -64,6 +68,8 @@ device_scale_factor_override_for_test_ = device_scale_factor; } + NodeIDMapper* node_id_mapper_for_test() { return id_mapper_.get(); } + private: FRIEND_TEST_ALL_PREFIXES(AccessibilityBridgeTest, OnSemanticsModeChanged); FRIEND_TEST_ALL_PREFIXES(AccessibilityBridgeTest, @@ -75,8 +81,6 @@ FRIEND_TEST_ALL_PREFIXES(AccessibilityBridgeTest, OffsetContainerBookkeepingIsUpdated); - using AXNodeID = std::pair<ui::AXTreeID, int32_t>; - // Represents a connection between two AXTrees that are in different frames. struct TreeConnection { // ID of the node in the parent tree that points to this tree. @@ -87,6 +91,9 @@ bool is_connected = false; }; + // Populates inspect data with the AXTrees. Updates must be enabled. + inspect::Inspector FillInspectData(); + // Processes pending data and commits it to the Semantic Tree. void TryCommit(); @@ -94,6 +101,11 @@ // gone. void UpdateTreeConnections(); + // Updates the node in focus and clears the focus from the old node. The nodes + // are added to |to_update_|, and will be sent to Fuchsia the next time the + // update is committed. + void UpdateFocus(); + // Returns true if the main frame AXTree is not present or if trees are not // connected. bool ShouldHoldCommit(); @@ -124,6 +136,31 @@ void RemoveNodeFromOffsetMapping(ui::AXTree* tree, const ui::AXNodeData& node_data); + // Helper method to return the node in focus. Returns nullptr if the main + // frame is not ready yet. If no focus information is present, returns the + // root node of the frame in focus. + absl::optional<AXNodeID> GetFocusedNodeId() const; + + // Helper method to return the fuchsia representation of the node if it is + // being changed in this update. Returns nullptr if the node is not part of + // the current update. + fuchsia::accessibility::semantics::Node* GetNodeIfChangingInUpdate( + const ui::AXTreeID& tree_id, + ui::AXNodeID node_id); + + // Helper method to get the most recently updated fuchsia representation of + // the node. Note that it differs from |GetNodeIfChangingInUpdate| because + // here a node will be created to be part of the update if it is not. Returns + // nullptr if the node does not exist. + fuchsia::accessibility::semantics::Node* GetUpdatedNode( + const ui::AXTreeID& tree_id, + ui::AXNodeID node_id); + + // Returns the node in focus in this frame or in one of its descendants if the + // node in focus points to a child frame. + absl::optional<AXNodeID> GetFocusFromThisOrDescendantFrame( + const ui::AXSerializableTree* tree) const; + // content::WebContentsObserver implementation. void AccessibilityEventReceived( const content::AXEventNotificationDetails& details) override; @@ -167,6 +204,9 @@ // tree. base::flat_map<ui::AXTreeID, TreeConnection> tree_connections_; + // Last focused node. If nullptr, no node is in focus. + absl::optional<AXNodeID> last_focused_node_id_; + // Maintain a map of callbacks as multiple hit test events can happen at // once. These are keyed by the request_id field of ui::AXActionData. base::flat_map<int, HitTestCallback> pending_hit_test_callbacks_; @@ -197,6 +237,12 @@ // If set, the scale factor for this device for use in tests. absl::optional<float> device_scale_factor_override_for_test_; + + // Inspect node for the accessibility bridge. + inspect::Node inspect_node_; + + // Inspect node to store a dump of the semantic tree. + inspect::LazyNode inspect_node_tree_dump_; }; #endif // FUCHSIA_ENGINE_BROWSER_ACCESSIBILITY_BRIDGE_H_
diff --git a/fuchsia/engine/browser/accessibility_bridge_browsertest.cc b/fuchsia/engine/browser/accessibility_bridge_browsertest.cc index 48f93479..5062b6b 100644 --- a/fuchsia/engine/browser/accessibility_bridge_browsertest.cc +++ b/fuchsia/engine/browser/accessibility_bridge_browsertest.cc
@@ -19,6 +19,7 @@ #include "fuchsia/engine/test/web_engine_browser_test.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/accessibility/ax_action_data.h" #include "ui/accessibility/ax_tree_observer.h" #include "ui/gfx/switches.h" #include "ui/ozone/public/ozone_switches.h" @@ -1018,3 +1019,61 @@ num_frames = frame_impl_->web_contents_for_test()->GetAllFrames().size(); EXPECT_EQ(num_frames, 1); } + +IN_PROC_BROWSER_TEST_F(AccessibilityBridgeTest, UpdatesFocusInformation) { + LoadPage(kPage1Path, kPage1Title); + + semantics_manager_.semantic_tree()->RunUntilNodeCountAtLeast(kPage1NodeCount); + + ASSERT_FALSE(semantics_manager_.semantic_tree() + ->GetNodeWithId(0u) + ->states() + .has_has_input_focus()); + + // Focus the root node. + ui::AXActionData action_data; + action_data.action = ax::mojom::Action::kFocus; + AccessibilityBridge* bridge = frame_impl_->accessibility_bridge_for_test(); + action_data.target_tree_id = bridge->ax_tree_for_test()->GetAXTreeID(); + action_data.target_node_id = bridge->ax_tree_for_test()->root()->id(); + + frame_impl_->web_contents_for_test() + ->GetMainFrame() + ->AccessibilityPerformAction(action_data); + + base::RunLoop run_loop; + semantics_manager_.semantic_tree()->SetNodeUpdatedCallback( + 0u, run_loop.QuitClosure()); + run_loop.Run(); + + ASSERT_TRUE(semantics_manager_.semantic_tree() + ->GetNodeWithId(0u) + ->states() + .has_input_focus()); + + // Changes the focus to a different node and checks that the old value is + // cleared. + auto new_focus_id = semantics_manager_.semantic_tree() + ->GetNodeFromLabel(kButtonName1) + ->node_id(); + action_data.target_node_id = + bridge->node_id_mapper_for_test()->ToAXNodeID(new_focus_id)->second; + + frame_impl_->web_contents_for_test() + ->GetMainFrame() + ->AccessibilityPerformAction(action_data); + + base::RunLoop run_loop2; + semantics_manager_.semantic_tree()->SetNodeUpdatedCallback( + new_focus_id, run_loop2.QuitClosure()); + run_loop2.Run(); + + ASSERT_FALSE(semantics_manager_.semantic_tree() + ->GetNodeWithId(0u) + ->states() + .has_input_focus()); + ASSERT_TRUE(semantics_manager_.semantic_tree() + ->GetNodeWithId(new_focus_id) + ->states() + .has_input_focus()); +}
diff --git a/fuchsia/engine/browser/frame_impl.cc b/fuchsia/engine/browser/frame_impl.cc index ba54048..ca562b9b 100644 --- a/fuchsia/engine/browser/frame_impl.cc +++ b/fuchsia/engine/browser/frame_impl.cc
@@ -69,6 +69,9 @@ // Simulated screen bounds to use when testing the SemanticsManager. constexpr gfx::Size kSemanticsTestingWindowSize = {720, 640}; +// Name of the Inspect node that holds accessibility information. +constexpr char kAccessibilityInspectNodeName[] = "accessibility"; + // A special value which matches all origins when specified in an origin list. constexpr char kWildcardOrigin[] = "*"; @@ -617,7 +620,8 @@ semantics_manager_for_test_ ? semantics_manager_for_test_ : semantics_manager.get(), window_tree_host_->CreateViewRef(), web_contents_.get(), - base::BindOnce(&FrameImpl::OnAccessibilityError, base::Unretained(this))); + base::BindOnce(&FrameImpl::OnAccessibilityError, base::Unretained(this)), + inspect_node_.CreateChild(kAccessibilityInspectNodeName)); } void FrameImpl::GetMediaPlayer( @@ -830,7 +834,8 @@ semantics_manager_for_test_, window_tree_host_->CreateViewRef(), web_contents_.get(), base::BindOnce(&FrameImpl::OnAccessibilityError, - base::Unretained(this))); + base::Unretained(this)), + inspect_node_.CreateChild(kAccessibilityInspectNodeName)); // Set bounds for testing hit testing. bounds.set_size(kSemanticsTestingWindowSize);
diff --git a/fuchsia/engine/context_provider_impl.cc b/fuchsia/engine/context_provider_impl.cc index d8bfdcd..681df3e5 100644 --- a/fuchsia/engine/context_provider_impl.cc +++ b/fuchsia/engine/context_provider_impl.cc
@@ -5,269 +5,10 @@ #include "fuchsia/engine/context_provider_impl.h" #include <chromium/internal/cpp/fidl.h> -#include <fuchsia/sys/cpp/fidl.h> -#include <lib/async/default.h> -#include <lib/fdio/directory.h> -#include <lib/fdio/fd.h> -#include <lib/fdio/io.h> -#include <lib/sys/cpp/component_context.h> #include <lib/sys/cpp/service_directory.h> -#include <lib/zx/job.h> -#include <stdio.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <unistd.h> -#include <zircon/processargs.h> - -#include <string> #include <utility> -#include <vector> -#include "base/base_paths_fuchsia.h" -#include "base/base_switches.h" -#include "base/bind.h" -#include "base/command_line.h" -#include "base/containers/contains.h" -#include "base/files/file_path.h" -#include "base/files/file_util.h" -#include "base/files/scoped_file.h" -#include "base/fuchsia/fuchsia_logging.h" -#include "base/fuchsia/process_context.h" -#include "base/json/json_reader.h" #include "base/logging.h" -#include "base/path_service.h" -#include "base/process/launch.h" -#include "base/process/process.h" -#include "base/strings/strcat.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/string_piece.h" -#include "base/strings/string_util.h" -#include "base/strings/stringprintf.h" -#include "base/values.h" -#include "build/build_config.h" -#include "cc/base/switches.h" -#include "components/viz/common/features.h" -#include "components/viz/common/switches.h" -#include "content/public/common/content_switches.h" -#include "fuchsia/base/config_reader.h" -#include "fuchsia/base/string_util.h" -#include "fuchsia/engine/common/web_engine_content_client.h" -#include "fuchsia/engine/switches.h" -#include "gpu/command_buffer/service/gpu_switches.h" -#include "gpu/config/gpu_finch_features.h" -#include "gpu/config/gpu_switches.h" -#include "media/base/key_system_names.h" -#include "media/base/media_switches.h" -#include "net/http/http_util.h" -#include "sandbox/policy/fuchsia/sandbox_policy_fuchsia.h" -#include "services/network/public/cpp/features.h" -#include "services/network/public/cpp/network_switches.h" -#include "third_party/blink/public/common/switches.h" -#include "third_party/widevine/cdm/widevine_cdm_common.h" -#include "ui/gfx/switches.h" -#include "ui/gl/gl_switches.h" -#include "ui/ozone/public/ozone_switches.h" - -namespace { - -// Path to the definition file for web Component instances. -constexpr char kWebInstanceComponentPath[] = "/pkg/meta/web_instance.cmx"; - -// Test-only URL for web hosting Component instances with WebUI resources. -const char kWebInstanceWithWebUiComponentUrl[] = - "fuchsia-pkg://fuchsia.com/web_engine_with_webui#meta/web_instance.cmx"; - -// Use a constexpr instead of the existing base::Feature, because of the -// additional dependencies required. -constexpr char kMixedContentAutoupgradeFeatureName[] = - "AutoupgradeMixedContent"; -constexpr char kDisableMixedContentAutoupgradeOrigin[] = - "disable-mixed-content-autoupgrade"; - -// Returns the underlying channel if |directory| is a client endpoint for a -// |fuchsia::io::Directory| protocol. Otherwise, returns an empty channel. -zx::channel ValidateDirectoryAndTakeChannel( - fidl::InterfaceHandle<fuchsia::io::Directory> directory_handle) { - fidl::SynchronousInterfacePtr<fuchsia::io::Directory> directory = - directory_handle.BindSync(); - - fuchsia::io::NodeInfo info; - zx_status_t status = directory->Describe(&info); - if (status != ZX_OK) { - ZX_DLOG(ERROR, status) << "Describe()"; - return {}; - } - - if (!info.is_directory()) { - DLOG(ERROR) << "Not a directory."; - return {}; - } - - return directory.Unbind().TakeChannel(); -} - -// File names must not contain directory separators, nor match the special -// current- nor parent-directory filenames. -bool IsValidContentDirectoryName(base::StringPiece file_name) { - if (file_name.find_first_of(base::FilePath::kSeparators, 0, - base::FilePath::kSeparatorsLength - 1) != - base::StringPiece::npos) { - return false; - } - if (file_name == base::FilePath::kCurrentDirectory || - file_name == base::FilePath::kParentDirectory) { - return false; - } - return true; -} - -// Maps content directories into the LaunchInfo and adds the enable flag to the -// CommandLine. -bool SetContentDirectoriesArgsAndLaunchInfo( - std::vector<fuchsia::web::ContentDirectoryProvider> directories, - base::CommandLine* launch_args, - fuchsia::sys::LaunchInfo* launch_info) { - DCHECK(launch_args); - DCHECK(launch_info); - DCHECK(launch_info->flat_namespace); - DCHECK(!directories.empty()); - - for (auto& directory : directories) { - if (!IsValidContentDirectoryName(directory.name())) { - DLOG(ERROR) << "Invalid directory name: " << directory.name(); - return false; - } - - zx::channel validated_channel = ValidateDirectoryAndTakeChannel( - std::move(*directory.mutable_directory())); - if (!validated_channel) { - DLOG(ERROR) << "Service directory handle not valid for directory: " - << directory.name(); - return false; - } - - const base::FilePath kContentDirectories("/content-directories"); - launch_info->flat_namespace->paths.push_back( - kContentDirectories.Append(directory.name()).value()); - launch_info->flat_namespace->directories.push_back( - std::move(validated_channel)); - } - - launch_args->AppendSwitch(switches::kEnableContentDirectories); - - return true; -} - -void AppendFeature(base::StringPiece features_flag, - base::StringPiece feature_string, - base::CommandLine* command_line) { - if (!command_line->HasSwitch(features_flag)) { - command_line->AppendSwitchNative(std::string(features_flag), - feature_string); - return; - } - - std::string new_feature_string = base::StrCat( - {command_line->GetSwitchValueASCII(features_flag), ",", feature_string}); - command_line->RemoveSwitch(features_flag); - command_line->AppendSwitchNative(std::string(features_flag), - new_feature_string); -} - -// Returns false if the config is present but has invalid contents. -bool MaybeAddCommandLineArgsFromConfig(const base::Value& config, - base::CommandLine* command_line) { - const base::Value* args = config.FindDictKey("command-line-args"); - if (!args) - return true; - - static const base::StringPiece kAllowedArgs[] = { - blink::switches::kGpuRasterizationMSAASampleCount, - blink::switches::kMinHeightForGpuRasterTile, - cc::switches::kEnableClippedImageScaling, - cc::switches::kEnableGpuBenchmarking, - switches::kDisableFeatures, - switches::kDisableGpuWatchdog, - switches::kDisableMipmapGeneration, - // TODO(crbug.com/1082821): Remove this switch from the allow-list. - switches::kEnableCastStreamingReceiver, - switches::kEnableFeatures, - switches::kEnableLowEndDeviceMode, - switches::kForceGpuMemAvailableMb, - switches::kForceGpuMemDiscardableLimitMb, - switches::kForceMaxTextureSize, - switches::kGoogleApiKey, - switches::kMaxDecodedImageSizeMb, - switches::kRendererProcessLimit, - switches::kUseCmdDecoder, - switches::kV, - switches::kVModule, - switches::kVulkanHeapMemoryLimitMb, - switches::kVulkanSyncCpuMemoryLimitMb, - switches::kWebglAntialiasingMode, - switches::kWebglMSAASampleCount, - }; - - for (const auto& arg : args->DictItems()) { - if (!base::Contains(kAllowedArgs, arg.first)) { - // TODO(https://crbug.com/1032439): Increase severity and return false - // once we have a mechanism for soft transitions of supported arguments. - LOG(WARNING) << "Unknown command-line arg: '" << arg.first - << "'. Config file and WebEngine version may not match."; - continue; - } - - DCHECK(!command_line->HasSwitch(arg.first)); - if (arg.second.is_none()) { - command_line->AppendSwitch(arg.first); - } else if (arg.second.is_string()) { - command_line->AppendSwitchNative(arg.first, arg.second.GetString()); - } else { - LOG(ERROR) << "Config command-line arg must be a string: " << arg.first; - return false; - } - - // TODO(https://crbug.com/1023012): enable-low-end-device-mode currently - // fakes 512MB total physical memory, which triggers RGB4444 textures, - // which - // we don't yet support. - if (arg.first == switches::kEnableLowEndDeviceMode) - command_line->AppendSwitch(blink::switches::kDisableRGBA4444Textures); - } - - return true; -} - -// Returns true if DRM is supported in current configuration. Currently we -// assume that it is supported on ARM64, but not on x64. -// -// TODO(crbug.com/1013412): Detect support for all features required for -// FuchsiaCdm. Specifically we need to verify that protected memory is supported -// and that mediacodec API provides hardware video decoders. -bool IsFuchsiaCdmSupported() { -#if defined(ARCH_CPU_ARM64) - return true; -#else - return false; -#endif -} - -std::vector<std::string> LoadWebInstanceSandboxServices() { - std::string cmx; - CHECK(ReadFileToString(base::FilePath(kWebInstanceComponentPath), &cmx)); - absl::optional<base::Value> json = base::JSONReader::Read(cmx); - const base::Value* services = json->FindListPath("sandbox.services"); - std::vector<std::string> result; - for (auto& entry : services->GetList()) - result.push_back(std::move(entry.GetString())); - return result; -} - -} // namespace - -// Production URL for web hosting Component instances. -const char ContextProviderImpl::kWebInstanceComponentUrl[] = - "fuchsia-pkg://fuchsia.com/web_engine#meta/web_instance.cmx"; ContextProviderImpl::ContextProviderImpl() = default; @@ -280,359 +21,19 @@ DLOG(ERROR) << "Invalid |context_request|."; return; } - if (!params.has_service_directory()) { - DLOG(ERROR) - << "Missing argument |service_directory| in CreateContextParams."; - context_request.Close(ZX_ERR_INVALID_ARGS); - return; - } - - fidl::InterfaceHandle<::fuchsia::io::Directory> service_directory = - std::move(*params.mutable_service_directory()); - if (!service_directory) { - DLOG(ERROR) << "Invalid |service_directory| in CreateContextParams."; - context_request.Close(ZX_ERR_INVALID_ARGS); - return; - } - - // Base the new Component's command-line on this process' command-line. - base::CommandLine launch_args(*base::CommandLine::ForCurrentProcess()); - launch_args.RemoveSwitch(switches::kContextProvider); - - fuchsia::sys::LaunchInfo launch_info; - // TODO(1010222): Make kWebInstanceComponentUrl a relative component URL, and - // remove this workaround. - if (base::CommandLine::ForCurrentProcess()->HasSwitch("with-webui")) - launch_info.url = kWebInstanceWithWebUiComponentUrl; - else - launch_info.url = kWebInstanceComponentUrl; - launch_info.flat_namespace = fuchsia::sys::FlatNamespace::New(); - - // Bind |data_directory| to /data directory, if provided. - if (params.has_data_directory()) { - zx::channel data_directory_channel = ValidateDirectoryAndTakeChannel( - std::move(*params.mutable_data_directory())); - if (!data_directory_channel) { - DLOG(ERROR) - << "Invalid argument |data_directory| in CreateContextParams."; - context_request.Close(ZX_ERR_INVALID_ARGS); - return; - } - - base::FilePath data_path; - if (!base::PathService::Get(base::DIR_APP_DATA, &data_path)) { - DLOG(ERROR) << "Failed to get data directory service path."; - context_request.Close(ZX_ERR_INTERNAL); - return; - } - launch_info.flat_namespace->paths.push_back(data_path.value()); - launch_info.flat_namespace->directories.push_back( - std::move(data_directory_channel)); - - if (params.has_data_quota_bytes()) { - launch_args.AppendSwitchNative( - switches::kDataQuotaBytes, - base::NumberToString(params.data_quota_bytes())); - } - } - - // Process command-line settings specified in our package config-data. - base::Value web_engine_config; - if (config_for_test_.is_none()) { - const absl::optional<base::Value>& config = cr_fuchsia::LoadPackageConfig(); - web_engine_config = - config ? config->Clone() : base::Value(base::Value::Type::DICTIONARY); - } else { - web_engine_config = std::move(config_for_test_); - } - if (!MaybeAddCommandLineArgsFromConfig(web_engine_config, &launch_args)) { - context_request.Close(ZX_ERR_INTERNAL); - return; - } - - if (params.has_remote_debugging_port()) { - launch_args.AppendSwitchNative( - switches::kRemoteDebuggingPort, - base::NumberToString(params.remote_debugging_port())); - } - - fuchsia::web::ContextFeatureFlags features = {}; - if (params.has_features()) - features = params.features(); - - const bool is_headless = - (features & fuchsia::web::ContextFeatureFlags::HEADLESS) == - fuchsia::web::ContextFeatureFlags::HEADLESS; - if (is_headless) { - launch_args.AppendSwitchNative(switches::kOzonePlatform, - switches::kHeadless); - launch_args.AppendSwitch(switches::kHeadless); - } - - if ((features & fuchsia::web::ContextFeatureFlags::LEGACYMETRICS) == - fuchsia::web::ContextFeatureFlags::LEGACYMETRICS) { - launch_args.AppendSwitch(switches::kUseLegacyMetricsService); - } - - const bool enable_vulkan = - (features & fuchsia::web::ContextFeatureFlags::VULKAN) == - fuchsia::web::ContextFeatureFlags::VULKAN; - bool enable_widevine = - (features & fuchsia::web::ContextFeatureFlags::WIDEVINE_CDM) == - fuchsia::web::ContextFeatureFlags::WIDEVINE_CDM; - bool enable_playready = params.has_playready_key_system(); - - // VULKAN is required for DRM-protected video playback. Allow DRM to also be - // enabled for HEADLESS Contexts, since Vulkan is never required for audio. - if ((enable_widevine || enable_playready) && !enable_vulkan && !is_headless) { - DLOG(ERROR) << "WIDEVINE_CDM and PLAYREADY_CDM features require VULKAN or " - "HEADLESS."; - context_request.Close(ZX_ERR_NOT_SUPPORTED); - return; - } - if ((enable_widevine || enable_playready) && - !params.has_cdm_data_directory()) { - LOG(ERROR) << "WIDEVINE_CDM and PLAYREADY_CDM features require a " - "|cdm_data_directory|."; - context_request.Close(ZX_ERR_NOT_SUPPORTED); - return; - } - - // If the system doesn't actually support DRM then disable it. This may result - // in the Context being able to run without using protected buffers. - if (enable_playready && !IsFuchsiaCdmSupported()) { - LOG(WARNING) << "PlayReady is not supported on this device."; - enable_playready = false; - } - if (enable_widevine && !IsFuchsiaCdmSupported()) { - LOG(WARNING) << "Widevine is not supported on this device."; - enable_widevine = false; - } - - bool allow_protected_graphics = - web_engine_config.FindBoolPath("allow-protected-graphics") - .value_or(false); - bool force_protected_graphics = - web_engine_config.FindBoolPath("force-protected-graphics") - .value_or(false); - bool enable_protected_graphics = - ((enable_playready || enable_widevine) && allow_protected_graphics) || - force_protected_graphics; - bool use_overlays_for_video = - web_engine_config.FindBoolPath("use-overlays-for-video").value_or(false); - - if (enable_protected_graphics) { - launch_args.AppendSwitch(switches::kEnableVulkanProtectedMemory); - launch_args.AppendSwitch(switches::kEnableProtectedVideoBuffers); - bool force_protected_video_buffers = - web_engine_config.FindBoolPath("force-protected-video-buffers") - .value_or(false); - if (force_protected_video_buffers) { - launch_args.AppendSwitch(switches::kForceProtectedVideoOutputBuffers); - } - } - - if (use_overlays_for_video) { - // Overlays are only available if OutputPresenterFuchsia is in use. - AppendFeature(switches::kEnableFeatures, - features::kUseSkiaOutputDeviceBufferQueue.name, &launch_args); - AppendFeature(switches::kEnableFeatures, - features::kUseRealBuffersForPageFlipTest.name, &launch_args); - launch_args.AppendSwitchASCII(switches::kEnableHardwareOverlays, - "underlay"); - launch_args.AppendSwitch(switches::kUseOverlaysForVideo); - } - - if (enable_vulkan) { - if (is_headless) { - DLOG(ERROR) << "VULKAN and HEADLESS features cannot be used together."; - context_request.Close(ZX_ERR_NOT_SUPPORTED); - return; - } - - VLOG(1) << "Enabling Vulkan GPU acceleration."; - // Vulkan requires use of SkiaRenderer, configured to a use Vulkan context. - launch_args.AppendSwitch(switches::kUseVulkan); - const std::vector<base::StringPiece> enabled_features = { - features::kUseSkiaRenderer.name, features::kVulkan.name}; - AppendFeature(switches::kEnableFeatures, - base::JoinString(enabled_features, ","), &launch_args); - - // SkiaRenderer requires out-of-process rasterization be enabled. - launch_args.AppendSwitch(switches::kEnableOopRasterization); - - launch_args.AppendSwitchASCII(switches::kUseGL, - gl::kGLImplementationANGLEName); - } else { - VLOG(1) << "Disabling GPU acceleration."; - // Disable use of Vulkan GPU, and use of the software-GL rasterizer. The - // Context will still run a GPU process, but will not support WebGL. - launch_args.AppendSwitch(switches::kDisableGpu); - launch_args.AppendSwitch(switches::kDisableSoftwareRasterizer); - } - - if (enable_widevine) { - launch_args.AppendSwitch(switches::kEnableWidevine); - } - - if (enable_playready) { - const std::string& key_system = params.playready_key_system(); - if (key_system == kWidevineKeySystem || media::IsClearKey(key_system)) { - LOG(ERROR) - << "Invalid value for CreateContextParams/playready_key_system: " - << key_system; - context_request.Close(ZX_ERR_INVALID_ARGS); - return; - } - launch_args.AppendSwitchNative(switches::kPlayreadyKeySystem, key_system); - } - - bool enable_audio = (features & fuchsia::web::ContextFeatureFlags::AUDIO) == - fuchsia::web::ContextFeatureFlags::AUDIO; - if (!enable_audio) { - // TODO(fxbug.dev/58902): Split up audio input and output in - // ContextFeatureFlags. - launch_args.AppendSwitch(switches::kDisableAudioOutput); - launch_args.AppendSwitch(switches::kDisableAudioInput); - } - - if (enable_widevine || enable_playready) { - DCHECK(params.has_cdm_data_directory()); - const char kCdmDataPath[] = "/cdm_data"; - - zx::channel cdm_data_directory_channel = ValidateDirectoryAndTakeChannel( - std::move(*params.mutable_cdm_data_directory())); - if (!cdm_data_directory_channel) { - LOG(ERROR) - << "Invalid argument |cdm_data_directory| in CreateContextParams."; - context_request.Close(ZX_ERR_INVALID_ARGS); - return; - } - - launch_args.AppendSwitchNative(switches::kCdmDataDirectory, kCdmDataPath); - launch_info.flat_namespace->paths.push_back(kCdmDataPath); - launch_info.flat_namespace->directories.push_back( - std::move(cdm_data_directory_channel)); - - if (params.has_cdm_data_quota_bytes()) { - launch_args.AppendSwitchNative( - switches::kCdmDataQuotaBytes, - base::NumberToString(params.cdm_data_quota_bytes())); - } - } - - bool enable_hardware_video_decoder = - (features & fuchsia::web::ContextFeatureFlags::HARDWARE_VIDEO_DECODER) == - fuchsia::web::ContextFeatureFlags::HARDWARE_VIDEO_DECODER; - if (!enable_hardware_video_decoder) - launch_args.AppendSwitch(switches::kDisableAcceleratedVideoDecode); - - if (enable_hardware_video_decoder && !enable_vulkan) { - DLOG(ERROR) << "HARDWARE_VIDEO_DECODER requires VULKAN."; - context_request.Close(ZX_ERR_NOT_SUPPORTED); - return; - } - - bool disable_software_video_decoder = - (features & - fuchsia::web::ContextFeatureFlags::HARDWARE_VIDEO_DECODER_ONLY) == - fuchsia::web::ContextFeatureFlags::HARDWARE_VIDEO_DECODER_ONLY; - if (disable_software_video_decoder) { - if (!enable_hardware_video_decoder) { - LOG(ERROR) << "Software video decoding may only be disabled if hardware " - "video decoding is enabled."; - context_request.Close(ZX_ERR_INVALID_ARGS); - return; - } - - launch_args.AppendSwitch(switches::kDisableSoftwareVideoDecoders); - } - - // Validate embedder-supplied product, and optional version, and pass it to - // the Context to include in the UserAgent. - if (params.has_user_agent_product()) { - if (!net::HttpUtil::IsToken(params.user_agent_product())) { - LOG(ERROR) << "Invalid embedder product."; - context_request.Close(ZX_ERR_INVALID_ARGS); - return; - } - std::string product_tag(params.user_agent_product()); - if (params.has_user_agent_version()) { - if (!net::HttpUtil::IsToken(params.user_agent_version())) { - LOG(ERROR) << "Invalid embedder version."; - context_request.Close(ZX_ERR_INVALID_ARGS); - return; - } - product_tag += "/" + params.user_agent_version(); - } - launch_args.AppendSwitchNative(switches::kUserAgentProductAndVersion, - std::move(product_tag)); - } else if (params.has_user_agent_version()) { - LOG(ERROR) << "Embedder version without product."; - context_request.Close(ZX_ERR_INVALID_ARGS); - return; - } - - if (params.has_content_directories() && - !SetContentDirectoriesArgsAndLaunchInfo( - std::move(*params.mutable_content_directories()), &launch_args, - &launch_info)) { - LOG(ERROR) << "Invalid content directories specified."; - context_request.Close(ZX_ERR_INVALID_ARGS); - return; - } - - if (params.has_unsafely_treat_insecure_origins_as_secure()) { - const std::vector<std::string>& insecure_origins = - params.unsafely_treat_insecure_origins_as_secure(); - for (auto origin : insecure_origins) { - if (origin == switches::kAllowRunningInsecureContent) { - launch_args.AppendSwitch(switches::kAllowRunningInsecureContent); - } else if (origin == kDisableMixedContentAutoupgradeOrigin) { - AppendFeature(switches::kDisableFeatures, - kMixedContentAutoupgradeFeatureName, &launch_args); - } else { - // Pass the rest of the list to the Context process. - AppendFeature(network::switches::kUnsafelyTreatInsecureOriginAsSecure, - origin, &launch_args); - } - } - } - - if (params.has_cors_exempt_headers()) { - std::vector<base::StringPiece> cors_exempt_headers; - for (const auto& header : params.cors_exempt_headers()) { - cors_exempt_headers.push_back(cr_fuchsia::BytesAsString(header)); - } - - launch_args.AppendSwitchNative(switches::kCorsExemptHeaders, - base::JoinString(cors_exempt_headers, ",")); - } - - // In tests the ContextProvider is configured to log to stderr, so clone the - // handle to allow web instances to also log there. - if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - "enable-logging") == "stderr") { - launch_info.err = fuchsia::sys::FileDescriptor::New(); - launch_info.err->type0 = PA_FD; - zx_status_t status = fdio_fd_clone( - STDERR_FILENO, launch_info.err->handle0.reset_and_get_address()); - ZX_CHECK(status == ZX_OK, status); - } // Request access to the component's outgoing service directory. - fidl::InterfaceRequest<fuchsia::io::Directory> component_services_request; - auto component_services = - sys::ServiceDirectory::CreateWithRequest(&component_services_request); - launch_info.directory_request = component_services_request.TakeChannel(); + fidl::InterfaceRequest<fuchsia::io::Directory> services_request; + auto services = sys::ServiceDirectory::CreateWithRequest(&services_request); // If there are DevToolsListeners active then set the remote-debugging option // and create DevToolsPerContextListener channels to connect asynchronously // to the instance. - if (devtools_listeners_.size() > 0) { - launch_args.AppendSwitch(switches::kEnableRemoteDebugMode); + const bool have_devtools_listeners = devtools_listeners_.size() > 0; + web_instance_host_.set_enable_remote_debug_mode(have_devtools_listeners); + if (have_devtools_listeners) { chromium::internal::DevToolsConnectorPtr devtools_connector; - component_services->Connect(devtools_connector.NewRequest()); + services->Connect(devtools_connector.NewRequest()); for (auto& devtools_listener : devtools_listeners_.ptrs()) { fidl::InterfaceHandle<fuchsia::web::DevToolsPerContextListener> listener; devtools_listener.get()->get()->OnContextDevToolsAvailable( @@ -641,27 +42,19 @@ } } - // Set |additional_services| to redirect requests for all services specified - // in the web instance component manifest to be satisfied by the caller- - // supplied service directory. This ensures that the instance cannot access - // any services outside those provided by the caller. - launch_info.additional_services = fuchsia::sys::ServiceList::New(); - launch_info.additional_services->names = LoadWebInstanceSandboxServices(); - launch_info.additional_services->host_directory = - service_directory.TakeChannel(); + zx_status_t result = web_instance_host_.CreateInstanceForContext( + std::move(params), std::move(services_request)); - // Take the accumulated command line arguments, omitting the program name in - // argv[0], and set them in |launch_info|. - launch_info.arguments = std::vector<std::string>( - launch_args.argv().begin() + 1, launch_args.argv().end()); + if (result == ZX_OK) { + // Route the fuchsia.web.Context request to the new Component. + services->Connect(std::move(context_request)); + } else { + context_request.Close(result); + } +} - // Launch the component with the accumulated settings. The Component will - // self-terminate when the fuchsia.web.Context client disconnects. - IsolatedEnvironmentLauncher()->CreateComponent(std::move(launch_info), - nullptr /* controller */); - - // Route the fuchsia.web.Context request to the new Component. - component_services->Connect(std::move(context_request)); +void ContextProviderImpl::set_config_for_test(base::Value config) { + web_instance_host_.set_config_for_test(std::move(config)); // IN-TEST } void ContextProviderImpl::EnableDevTools( @@ -670,49 +63,3 @@ devtools_listeners_.AddInterfacePtr(listener.Bind()); callback(); } - -fuchsia::sys::Launcher* ContextProviderImpl::IsolatedEnvironmentLauncher() { - if (isolated_environment_launcher_) - return isolated_environment_launcher_.get(); - - // Create the nested isolated Environment. This environment provides only the - // fuchsia.sys.Loader service, which is required to allow the Launcher to - // resolve the web instance package. All other services are provided - // explicitly to each web instance, from those passed to |CreateContext()|. - auto environment = base::ComponentContextForProcess() - ->svc() - ->Connect<fuchsia::sys::Environment>(); - - // Populate a ServiceList providing only the Loader service. - auto services = fuchsia::sys::ServiceList::New(); - services->names.push_back(fuchsia::sys::Loader::Name_); - fidl::InterfaceHandle<::fuchsia::io::Directory> services_channel; - environment->GetDirectory(services_channel.NewRequest().TakeChannel()); - services->host_directory = services_channel.TakeChannel(); - - // Instantiate the isolated environment. This ContextProvider instance's PID - // is included in the label to ensure that concurrent service instances - // launched in the same Environment (e.g. during tests) do not clash. - fuchsia::sys::EnvironmentPtr isolated_environment; - environment->CreateNestedEnvironment( - isolated_environment.NewRequest(), - isolated_environment_controller_.NewRequest(), - base::StringPrintf("web_instances:%lu", base::Process::Current().Pid()), - std::move(services), - {.inherit_parent_services = false, - .use_parent_runners = false, - .delete_storage_on_death = true}); - - // The ContextProvider only needs to retain the EnvironmentController and - // a connection to the Launcher service for the isolated environment. - isolated_environment->GetLauncher( - isolated_environment_launcher_.NewRequest()); - isolated_environment_launcher_.set_error_handler([](zx_status_t status) { - ZX_LOG(ERROR, status) << "Launcher disconnected."; - }); - isolated_environment_controller_.set_error_handler([](zx_status_t status) { - ZX_LOG(ERROR, status) << "EnvironmentController disconnected."; - }); - - return isolated_environment_launcher_.get(); -}
diff --git a/fuchsia/engine/context_provider_impl.h b/fuchsia/engine/context_provider_impl.h index a9836f72..788d62b 100644 --- a/fuchsia/engine/context_provider_impl.h +++ b/fuchsia/engine/context_provider_impl.h
@@ -5,23 +5,18 @@ #ifndef FUCHSIA_ENGINE_CONTEXT_PROVIDER_IMPL_H_ #define FUCHSIA_ENGINE_CONTEXT_PROVIDER_IMPL_H_ -#include <fuchsia/sys/cpp/fidl.h> #include <fuchsia/web/cpp/fidl.h> -#include <lib/fidl/cpp/binding_set.h> #include <lib/fidl/cpp/interface_ptr_set.h> -#include <memory> #include "base/callback.h" #include "base/values.h" #include "fuchsia/engine/web_engine_export.h" +#include "fuchsia/engine/web_instance_host/web_instance_host.h" class WEB_ENGINE_EXPORT ContextProviderImpl : public fuchsia::web::ContextProvider, public fuchsia::web::Debug { public: - // Component URL used to launch WebEngine instances to host Contexts. - static const char kWebInstanceComponentUrl[]; - ContextProviderImpl(); ~ContextProviderImpl() override; @@ -34,9 +29,7 @@ fidl::InterfaceRequest<fuchsia::web::Context> context_request) override; // Sets a config to use for the test, instead of looking for the config file. - void set_config_for_test(base::Value config) { - config_for_test_ = std::move(config); - } + void set_config_for_test(base::Value config); private: // fuchsia::web::Debug implementation. @@ -44,20 +37,11 @@ fidl::InterfaceHandle<fuchsia::web::DevToolsListener> listener, EnableDevToolsCallback callback) override; - // Returns the Launcher for the isolated Environment in which web instances - // should run. If the Environment does not presently exist then it will be - // created. - fuchsia::sys::Launcher* IsolatedEnvironmentLauncher(); - - // Set by configuration tests. - base::Value config_for_test_; - // The DevToolsListeners registered via the Debug interface. fidl::InterfacePtrSet<fuchsia::web::DevToolsListener> devtools_listeners_; - // Used to manage the isolated Environment that web instances run in. - fuchsia::sys::LauncherPtr isolated_environment_launcher_; - fuchsia::sys::EnvironmentControllerPtr isolated_environment_controller_; + // Manages an isolated Environment, and the web instances hosted within it. + cr_fuchsia::WebInstanceHost web_instance_host_; }; #endif // FUCHSIA_ENGINE_CONTEXT_PROVIDER_IMPL_H_
diff --git a/fuchsia/engine/context_provider_impl_unittest.cc b/fuchsia/engine/context_provider_impl_unittest.cc index e237a6b4..1a8cffd 100644 --- a/fuchsia/engine/context_provider_impl_unittest.cc +++ b/fuchsia/engine/context_provider_impl_unittest.cc
@@ -42,6 +42,7 @@ #include "build/build_config.h" #include "fuchsia/engine/fake_context.h" #include "fuchsia/engine/switches.h" +#include "fuchsia/engine/web_instance_host/web_instance_host.h" #include "services/network/public/cpp/network_switches.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -157,7 +158,7 @@ // CreateContextParams from being mapped. // Launch the component via a fake manifest identical to the one used for // web instances, but which runs this test executable. - EXPECT_EQ(launch_info.url, ContextProviderImpl::kWebInstanceComponentUrl); + EXPECT_EQ(launch_info.url, cr_fuchsia::WebInstanceHost::kComponentUrl); launch_info.url = "fuchsia-pkg://fuchsia.com/web_engine_unittests#meta/" "web_engine_unittests_fake_instance.cmx"; @@ -329,18 +330,20 @@ fidl::InterfacePtr<fuchsia::web::Context>* context) { // Call a Context method and wait for it to invoke a listener call. base::RunLoop run_loop; - context->set_error_handler([&run_loop](zx_status_t status) { - run_loop.Quit(); - ZX_LOG(ERROR, status) << " Context lost."; - ADD_FAILURE(); - }); + context->set_error_handler( + [quit_loop = run_loop.QuitClosure()](zx_status_t status) { + quit_loop.Run(); + ZX_LOG(ERROR, status) << " Context lost."; + ADD_FAILURE(); + }); fuchsia::web::FramePtr frame_ptr; - frame_ptr.set_error_handler([&run_loop](zx_status_t status) { - run_loop.Quit(); - ZX_LOG(ERROR, status) << " Frame lost."; - ADD_FAILURE(); - }); + frame_ptr.set_error_handler( + [quit_loop = run_loop.QuitClosure()](zx_status_t status) { + quit_loop.Run(); + ZX_LOG(ERROR, status) << " Frame lost."; + ADD_FAILURE(); + }); (*context)->CreateFrame(frame_ptr.NewRequest()); // Create a Frame and expect to see a navigation event. @@ -360,10 +363,11 @@ void CheckContextUnresponsive( fidl::InterfacePtr<fuchsia::web::Context>* context) { base::RunLoop run_loop; - context->set_error_handler([&run_loop](zx_status_t status) { - run_loop.Quit(); - EXPECT_EQ(status, ZX_ERR_PEER_CLOSED); - }); + context->set_error_handler( + [quit_loop = run_loop.QuitClosure()](zx_status_t status) { + quit_loop.Run(); + EXPECT_EQ(status, ZX_ERR_PEER_CLOSED); + }); fuchsia::web::FramePtr frame; (*context)->CreateFrame(frame.NewRequest()); @@ -429,10 +433,11 @@ fuchsia::web::CreateContextParams create_params; provider_ptr_->Create(std::move(create_params), context.NewRequest()); base::RunLoop run_loop; - context.set_error_handler([&run_loop](zx_status_t status) { - run_loop.Quit(); - EXPECT_EQ(status, ZX_ERR_INVALID_ARGS); - }); + context.set_error_handler( + [quit_loop = run_loop.QuitClosure()](zx_status_t status) { + quit_loop.Run(); + EXPECT_EQ(status, ZX_ERR_INVALID_ARGS); + }); run_loop.Run(); } @@ -447,10 +452,11 @@ zx::channel(socket1.release()))); provider_ptr_->Create(std::move(create_params), context.NewRequest()); base::RunLoop run_loop; - context.set_error_handler([&run_loop](zx_status_t status) { - run_loop.Quit(); - EXPECT_TRUE(status == ZX_ERR_PEER_CLOSED); - }); + context.set_error_handler( + [quit_loop = run_loop.QuitClosure()](zx_status_t status) { + quit_loop.Run(); + EXPECT_TRUE(status == ZX_ERR_PEER_CLOSED); + }); run_loop.Run(); } @@ -465,10 +471,11 @@ *create_params.mutable_cdm_data_directory() = OpenCacheDirectory(); provider_ptr_->Create(std::move(create_params), context.NewRequest()); base::RunLoop run_loop; - context.set_error_handler([&run_loop](zx_status_t status) { - run_loop.Quit(); - EXPECT_EQ(status, ZX_ERR_NOT_SUPPORTED); - }); + context.set_error_handler( + [quit_loop = run_loop.QuitClosure()](zx_status_t status) { + quit_loop.Run(); + EXPECT_EQ(status, ZX_ERR_NOT_SUPPORTED); + }); run_loop.Run(); } @@ -481,10 +488,11 @@ *create_params.mutable_cdm_data_directory() = OpenCacheDirectory(); provider_ptr_->Create(std::move(create_params), context.NewRequest()); base::RunLoop run_loop; - context.set_error_handler([&run_loop](zx_status_t status) { - run_loop.Quit(); - EXPECT_EQ(status, ZX_ERR_NOT_SUPPORTED); - }); + context.set_error_handler( + [quit_loop = run_loop.QuitClosure()](zx_status_t status) { + quit_loop.Run(); + EXPECT_EQ(status, ZX_ERR_NOT_SUPPORTED); + }); run_loop.Run(); } @@ -499,11 +507,12 @@ *create_params.mutable_cdm_data_directory() = OpenCacheDirectory(); provider_ptr_->Create(std::move(create_params), context.NewRequest()); base::RunLoop run_loop; - context.set_error_handler([&run_loop](zx_status_t status) { - run_loop.Quit(); - ZX_LOG(ERROR, status); - ADD_FAILURE(); - }); + context.set_error_handler( + [quit_loop = run_loop.QuitClosure()](zx_status_t status) { + quit_loop.Run(); + ZX_LOG(ERROR, status); + ADD_FAILURE(); + }); // Spin the loop to allow CreateContext() to be handled, and the |context| // channel to be disconnected, in case of failure. run_loop.RunUntilIdle();
diff --git a/fuchsia/engine/web_instance_host/BUILD.gn b/fuchsia/engine/web_instance_host/BUILD.gn new file mode 100644 index 0000000..dea6e26 --- /dev/null +++ b/fuchsia/engine/web_instance_host/BUILD.gn
@@ -0,0 +1,33 @@ +# Copyright 2021 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. + +assert(is_fuchsia) + +source_set("web_instance_host") { + sources = [ "web_instance_host.cc" ] + public = [ "web_instance_host.h" ] + deps = [ + "//base", + "//content/public/common", + "//fuchsia/base", + "//fuchsia/engine:switches", + "//gpu/command_buffer/service", + "//media", + "//services/network/public/cpp", + "//third_party/blink/public/common", + "//third_party/fuchsia-sdk/sdk/pkg/async", + "//third_party/fuchsia-sdk/sdk/pkg/fdio", + "//third_party/fuchsia-sdk/sdk/pkg/sys_cpp", + "//third_party/fuchsia-sdk/sdk/pkg/zx", + "//third_party/widevine/cdm:headers", + "//ui/gfx", + "//ui/ozone", + ] + public_deps = [ + "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.io", + "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.sys", + "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.web", + "//third_party/fuchsia-sdk/sdk/pkg/fidl", + ] +}
diff --git a/fuchsia/engine/web_instance_host/OWNERS b/fuchsia/engine/web_instance_host/OWNERS new file mode 100644 index 0000000..a1d1cfec --- /dev/null +++ b/fuchsia/engine/web_instance_host/OWNERS
@@ -0,0 +1,3 @@ +# For sandbox security review. +per-file web_instance_host.*=set noparent +per-file web_instance_host.*=file://fuchsia/SECURITY_OWNERS
diff --git a/fuchsia/engine/web_instance_host/web_instance_host.cc b/fuchsia/engine/web_instance_host/web_instance_host.cc new file mode 100644 index 0000000..e77473da --- /dev/null +++ b/fuchsia/engine/web_instance_host/web_instance_host.cc
@@ -0,0 +1,710 @@ +// Copyright 2018 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 "fuchsia/engine/web_instance_host/web_instance_host.h" + +#include <fuchsia/sys/cpp/fidl.h> +#include <lib/async/default.h> +#include <lib/fdio/directory.h> +#include <lib/fdio/fd.h> +#include <lib/fdio/io.h> +#include <lib/sys/cpp/component_context.h> +#include <lib/sys/cpp/service_directory.h> +#include <stdio.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> +#include <zircon/processargs.h> + +#include <string> +#include <utility> +#include <vector> + +#include "base/base_paths_fuchsia.h" +#include "base/base_switches.h" +#include "base/bind.h" +#include "base/command_line.h" +#include "base/containers/contains.h" +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/files/scoped_file.h" +#include "base/fuchsia/fuchsia_logging.h" +#include "base/fuchsia/process_context.h" +#include "base/json/json_reader.h" +#include "base/logging.h" +#include "base/path_service.h" +#include "base/process/process.h" +#include "base/strings/strcat.h" +#include "base/strings/string_number_conversions.h" +#include "base/strings/string_piece.h" +#include "base/strings/string_util.h" +#include "base/strings/stringprintf.h" +#include "base/values.h" +#include "build/build_config.h" +#include "cc/base/switches.h" +#include "components/viz/common/features.h" +#include "components/viz/common/switches.h" +#include "content/public/common/content_switches.h" +#include "fuchsia/base/config_reader.h" +#include "fuchsia/base/string_util.h" +#include "fuchsia/engine/switches.h" +#include "gpu/command_buffer/service/gpu_switches.h" +#include "gpu/config/gpu_finch_features.h" +#include "gpu/config/gpu_switches.h" +#include "media/base/key_system_names.h" +#include "media/base/media_switches.h" +#include "net/http/http_util.h" +#include "services/network/public/cpp/features.h" +#include "services/network/public/cpp/network_switches.h" +#include "third_party/blink/public/common/switches.h" +#include "third_party/widevine/cdm/widevine_cdm_common.h" +#include "ui/gfx/switches.h" +#include "ui/gl/gl_switches.h" +#include "ui/ozone/public/ozone_switches.h" + +namespace cr_fuchsia { + +namespace { + +// Path to the definition file for web Component instances. +constexpr char kWebInstanceComponentPath[] = "/pkg/meta/web_instance.cmx"; + +// Test-only URL for web hosting Component instances with WebUI resources. +const char kWebInstanceWithWebUiComponentUrl[] = + "fuchsia-pkg://fuchsia.com/web_engine_with_webui#meta/web_instance.cmx"; + +// Use a constexpr instead of the existing base::Feature, because of the +// additional dependencies required. +constexpr char kMixedContentAutoupgradeFeatureName[] = + "AutoupgradeMixedContent"; +constexpr char kDisableMixedContentAutoupgradeOrigin[] = + "disable-mixed-content-autoupgrade"; + +// Returns the underlying channel if |directory| is a client endpoint for a +// |fuchsia::io::Directory| protocol. Otherwise, returns an empty channel. +zx::channel ValidateDirectoryAndTakeChannel( + fidl::InterfaceHandle<fuchsia::io::Directory> directory_handle) { + fidl::SynchronousInterfacePtr<fuchsia::io::Directory> directory = + directory_handle.BindSync(); + + fuchsia::io::NodeInfo info; + zx_status_t status = directory->Describe(&info); + if (status != ZX_OK) { + ZX_DLOG(ERROR, status) << "Describe()"; + return {}; + } + + if (!info.is_directory()) { + DLOG(ERROR) << "Not a directory."; + return {}; + } + + return directory.Unbind().TakeChannel(); +} + +void AppendFeature(base::StringPiece features_flag, + base::StringPiece feature_string, + base::CommandLine* command_line) { + if (!command_line->HasSwitch(features_flag)) { + command_line->AppendSwitchNative(std::string(features_flag), + feature_string); + return; + } + + std::string new_feature_string = base::StrCat( + {command_line->GetSwitchValueASCII(features_flag), ",", feature_string}); + command_line->RemoveSwitch(features_flag); + command_line->AppendSwitchNative(std::string(features_flag), + new_feature_string); +} + +// File names must not contain directory separators, nor match the special +// current- nor parent-directory filenames. +bool IsValidContentDirectoryName(base::StringPiece file_name) { + if (file_name.find_first_of(base::FilePath::kSeparators, 0, + base::FilePath::kSeparatorsLength - 1) != + base::StringPiece::npos) { + return false; + } + if (file_name == base::FilePath::kCurrentDirectory || + file_name == base::FilePath::kParentDirectory) { + return false; + } + return true; +} + +bool HandleDataDirectoryParam(fuchsia::web::CreateContextParams* params, + base::CommandLine* launch_args, + fuchsia::sys::LaunchInfo* launch_info) { + if (!params->has_data_directory()) + return true; + + zx::channel data_directory_channel = ValidateDirectoryAndTakeChannel( + std::move(*params->mutable_data_directory())); + if (!data_directory_channel) { + LOG(ERROR) << "Invalid argument |data_directory| in CreateContextParams."; + return false; + } + + base::FilePath data_path; + CHECK(base::PathService::Get(base::DIR_APP_DATA, &data_path)); + launch_info->flat_namespace->paths.push_back(data_path.value()); + launch_info->flat_namespace->directories.push_back( + std::move(data_directory_channel)); + if (params->has_data_quota_bytes()) { + launch_args->AppendSwitchNative( + switches::kDataQuotaBytes, + base::NumberToString(params->data_quota_bytes())); + } + + return true; +} + +bool HandleCdmDataDirectoryParam(fuchsia::web::CreateContextParams* params, + base::CommandLine* launch_args, + fuchsia::sys::LaunchInfo* launch_info) { + if (!params->has_cdm_data_directory()) + return true; + + const char kCdmDataPath[] = "/cdm_data"; + + zx::channel cdm_data_directory_channel = ValidateDirectoryAndTakeChannel( + std::move(*params->mutable_cdm_data_directory())); + if (!cdm_data_directory_channel) { + LOG(ERROR) + << "Invalid argument |cdm_data_directory| in CreateContextParams."; + return false; + } + + launch_args->AppendSwitchNative(switches::kCdmDataDirectory, kCdmDataPath); + launch_info->flat_namespace->paths.push_back(kCdmDataPath); + launch_info->flat_namespace->directories.push_back( + std::move(cdm_data_directory_channel)); + if (params->has_cdm_data_quota_bytes()) { + launch_args->AppendSwitchNative( + switches::kCdmDataQuotaBytes, + base::NumberToString(params->cdm_data_quota_bytes())); + } + + return true; +} + +bool HandleUserAgentParams(fuchsia::web::CreateContextParams* params, + base::CommandLine* launch_args) { + if (!params->has_user_agent_product()) { + if (params->has_user_agent_version()) { + LOG(ERROR) << "Embedder version without product."; + return false; + } + return true; + } + + if (!net::HttpUtil::IsToken(params->user_agent_product())) { + LOG(ERROR) << "Invalid embedder product."; + return false; + } + + std::string product_and_version(params->user_agent_product()); + if (params->has_user_agent_version()) { + if (!net::HttpUtil::IsToken(params->user_agent_version())) { + LOG(ERROR) << "Invalid embedder version."; + return false; + } + base::StrAppend(&product_and_version, {"/", params->user_agent_version()}); + } + launch_args->AppendSwitchNative(switches::kUserAgentProductAndVersion, + std::move(product_and_version)); + return true; +} + +void HandleUnsafelyTreatInsecureOriginsAsSecureParam( + fuchsia::web::CreateContextParams* params, + base::CommandLine* launch_args) { + if (!params->has_unsafely_treat_insecure_origins_as_secure()) + return; + + const std::vector<std::string>& insecure_origins = + params->unsafely_treat_insecure_origins_as_secure(); + for (auto origin : insecure_origins) { + if (origin == switches::kAllowRunningInsecureContent) { + launch_args->AppendSwitch(switches::kAllowRunningInsecureContent); + } else if (origin == kDisableMixedContentAutoupgradeOrigin) { + AppendFeature(switches::kDisableFeatures, + kMixedContentAutoupgradeFeatureName, launch_args); + } else { + // Pass the rest of the list to the Context process. + AppendFeature(network::switches::kUnsafelyTreatInsecureOriginAsSecure, + origin, launch_args); + } + } +} + +void HandleCorsExemptHeadersParam(fuchsia::web::CreateContextParams* params, + base::CommandLine* launch_args) { + if (!params->has_cors_exempt_headers()) + return; + + std::vector<base::StringPiece> cors_exempt_headers; + cors_exempt_headers.reserve(params->cors_exempt_headers().size()); + for (const auto& header : params->cors_exempt_headers()) { + cors_exempt_headers.push_back(cr_fuchsia::BytesAsString(header)); + } + + launch_args->AppendSwitchNative(switches::kCorsExemptHeaders, + base::JoinString(cors_exempt_headers, ",")); +} + +bool HandleContentDirectoriesParam(fuchsia::web::CreateContextParams* params, + base::CommandLine* launch_args, + fuchsia::sys::LaunchInfo* launch_info) { + DCHECK(launch_info); + DCHECK(launch_info->flat_namespace); + + if (!params->has_content_directories()) + return true; + + auto* directories = params->mutable_content_directories(); + for (size_t i = 0; i < directories->size(); ++i) { + fuchsia::web::ContentDirectoryProvider& directory = directories->at(i); + + if (!IsValidContentDirectoryName(directory.name())) { + DLOG(ERROR) << "Invalid directory name: " << directory.name(); + return false; + } + + zx::channel validated_channel = ValidateDirectoryAndTakeChannel( + std::move(*directory.mutable_directory())); + if (!validated_channel) { + DLOG(ERROR) << "Service directory handle not valid for directory: " + << directory.name(); + return false; + } + + const base::FilePath kContentDirectories("/content-directories"); + launch_info->flat_namespace->paths.push_back( + kContentDirectories.Append(directory.name()).value()); + launch_info->flat_namespace->directories.push_back( + std::move(validated_channel)); + } + + launch_args->AppendSwitch(switches::kEnableContentDirectories); + + return true; +} + +// Returns false if the config is present but has invalid contents. +bool MaybeAddCommandLineArgsFromConfig(const base::Value& config, + base::CommandLine* command_line) { + const base::Value* args = config.FindDictKey("command-line-args"); + if (!args) + return true; + + static const base::StringPiece kAllowedArgs[] = { + blink::switches::kGpuRasterizationMSAASampleCount, + blink::switches::kMinHeightForGpuRasterTile, + cc::switches::kEnableClippedImageScaling, + cc::switches::kEnableGpuBenchmarking, + switches::kDisableFeatures, + switches::kDisableGpuWatchdog, + switches::kDisableMipmapGeneration, + // TODO(crbug.com/1082821): Remove this switch from the allow-list. + switches::kEnableCastStreamingReceiver, + switches::kEnableFeatures, + switches::kEnableLowEndDeviceMode, + switches::kForceGpuMemAvailableMb, + switches::kForceGpuMemDiscardableLimitMb, + switches::kForceMaxTextureSize, + switches::kGoogleApiKey, + switches::kMaxDecodedImageSizeMb, + switches::kRendererProcessLimit, + switches::kUseCmdDecoder, + switches::kV, + switches::kVModule, + switches::kVulkanHeapMemoryLimitMb, + switches::kVulkanSyncCpuMemoryLimitMb, + switches::kWebglAntialiasingMode, + switches::kWebglMSAASampleCount, + }; + + for (const auto& arg : args->DictItems()) { + if (!base::Contains(kAllowedArgs, arg.first)) { + // TODO(https://crbug.com/1032439): Increase severity and return false + // once we have a mechanism for soft transitions of supported arguments. + LOG(WARNING) << "Unknown command-line arg: '" << arg.first + << "'. Config file and WebEngine version may not match."; + continue; + } + + DCHECK(!command_line->HasSwitch(arg.first)); + if (arg.second.is_none()) { + command_line->AppendSwitch(arg.first); + } else if (arg.second.is_string()) { + command_line->AppendSwitchNative(arg.first, arg.second.GetString()); + } else { + LOG(ERROR) << "Config command-line arg must be a string: " << arg.first; + return false; + } + + // TODO(https://crbug.com/1023012): enable-low-end-device-mode currently + // fakes 512MB total physical memory, which triggers RGB4444 textures, + // which + // we don't yet support. + if (arg.first == switches::kEnableLowEndDeviceMode) + command_line->AppendSwitch(blink::switches::kDisableRGBA4444Textures); + } + + return true; +} + +// Returns true if DRM is supported in current configuration. Currently we +// assume that it is supported on ARM64, but not on x64. +// +// TODO(crbug.com/1013412): Detect support for all features required for +// FuchsiaCdm. Specifically we need to verify that protected memory is supported +// and that mediacodec API provides hardware video decoders. +bool IsFuchsiaCdmSupported() { +#if defined(ARCH_CPU_ARM64) + return true; +#else + return false; +#endif +} + +std::vector<std::string> LoadWebInstanceSandboxServices() { + std::string cmx; + CHECK(ReadFileToString(base::FilePath(kWebInstanceComponentPath), &cmx)); + absl::optional<base::Value> json = base::JSONReader::Read(cmx); + const base::Value* services = json->FindListPath("sandbox.services"); + std::vector<std::string> result; + for (auto& entry : services->GetList()) + result.push_back(std::move(entry.GetString())); + return result; +} + +} // namespace + +// Production URL for web hosting Component instances. +const char WebInstanceHost::kComponentUrl[] = + "fuchsia-pkg://fuchsia.com/web_engine#meta/web_instance.cmx"; + +WebInstanceHost::WebInstanceHost() = default; + +WebInstanceHost::~WebInstanceHost() = default; + +zx_status_t WebInstanceHost::CreateInstanceForContext( + fuchsia::web::CreateContextParams params, + fidl::InterfaceRequest<fuchsia::io::Directory> services_request) { + DCHECK(services_request); + + if (!params.has_service_directory()) { + DLOG(ERROR) + << "Missing argument |service_directory| in CreateContextParams."; + return ZX_ERR_INVALID_ARGS; + } + + fidl::InterfaceHandle<::fuchsia::io::Directory> service_directory = + std::move(*params.mutable_service_directory()); + if (!service_directory) { + DLOG(ERROR) << "Invalid |service_directory| in CreateContextParams."; + return ZX_ERR_INVALID_ARGS; + } + + // Base the new Component's command-line on this process' command-line. + base::CommandLine launch_args(*base::CommandLine::ForCurrentProcess()); + launch_args.RemoveSwitch(switches::kContextProvider); + + fuchsia::sys::LaunchInfo launch_info; + // TODO(1010222): Make kComponentUrl a relative component URL, and + // remove this workaround. + if (base::CommandLine::ForCurrentProcess()->HasSwitch("with-webui")) + launch_info.url = kWebInstanceWithWebUiComponentUrl; + else + launch_info.url = kComponentUrl; + launch_info.flat_namespace = fuchsia::sys::FlatNamespace::New(); + + // Process command-line settings specified in our package config-data. + base::Value web_engine_config; + if (config_for_test_.is_none()) { + const absl::optional<base::Value>& config = cr_fuchsia::LoadPackageConfig(); + web_engine_config = + config ? config->Clone() : base::Value(base::Value::Type::DICTIONARY); + } else { + web_engine_config = std::move(config_for_test_); + } + if (!MaybeAddCommandLineArgsFromConfig(web_engine_config, &launch_args)) { + return ZX_ERR_INTERNAL; + } + + if (params.has_remote_debugging_port()) { + launch_args.AppendSwitchNative( + switches::kRemoteDebuggingPort, + base::NumberToString(params.remote_debugging_port())); + } + + fuchsia::web::ContextFeatureFlags features = {}; + if (params.has_features()) + features = params.features(); + + const bool is_headless = + (features & fuchsia::web::ContextFeatureFlags::HEADLESS) == + fuchsia::web::ContextFeatureFlags::HEADLESS; + if (is_headless) { + launch_args.AppendSwitchNative(switches::kOzonePlatform, + switches::kHeadless); + launch_args.AppendSwitch(switches::kHeadless); + } + + if ((features & fuchsia::web::ContextFeatureFlags::LEGACYMETRICS) == + fuchsia::web::ContextFeatureFlags::LEGACYMETRICS) { + launch_args.AppendSwitch(switches::kUseLegacyMetricsService); + } + + const bool enable_vulkan = + (features & fuchsia::web::ContextFeatureFlags::VULKAN) == + fuchsia::web::ContextFeatureFlags::VULKAN; + bool enable_widevine = + (features & fuchsia::web::ContextFeatureFlags::WIDEVINE_CDM) == + fuchsia::web::ContextFeatureFlags::WIDEVINE_CDM; + bool enable_playready = params.has_playready_key_system(); + + // Verify that the configuration is compatible with DRM, if requested. + if (enable_widevine || enable_playready) { + // VULKAN is required for DRM-protected video playback. Allow DRM to also be + // enabled for HEADLESS Contexts, since Vulkan is never required for audio. + if (!enable_vulkan && !is_headless) { + DLOG(ERROR) << "WIDEVINE_CDM and PLAYREADY_CDM features require VULKAN " + " or HEADLESS."; + return ZX_ERR_NOT_SUPPORTED; + } + if (!params.has_cdm_data_directory()) { + LOG(ERROR) << "WIDEVINE_CDM and PLAYREADY_CDM features require a " + "|cdm_data_directory|."; + return ZX_ERR_NOT_SUPPORTED; + } + // |cdm_data_directory| will be handled later. + } + + // If the system doesn't actually support DRM then disable it. This may result + // in the Context being able to run without using protected buffers. + if (enable_playready && !IsFuchsiaCdmSupported()) { + LOG(WARNING) << "PlayReady is not supported on this device."; + enable_playready = false; + } + if (enable_widevine && !IsFuchsiaCdmSupported()) { + LOG(WARNING) << "Widevine is not supported on this device."; + enable_widevine = false; + } + + bool allow_protected_graphics = + web_engine_config.FindBoolPath("allow-protected-graphics") + .value_or(false); + bool force_protected_graphics = + web_engine_config.FindBoolPath("force-protected-graphics") + .value_or(false); + bool enable_protected_graphics = + ((enable_playready || enable_widevine) && allow_protected_graphics) || + force_protected_graphics; + bool use_overlays_for_video = + web_engine_config.FindBoolPath("use-overlays-for-video").value_or(false); + + if (enable_protected_graphics) { + launch_args.AppendSwitch(switches::kEnableVulkanProtectedMemory); + launch_args.AppendSwitch(switches::kEnableProtectedVideoBuffers); + bool force_protected_video_buffers = + web_engine_config.FindBoolPath("force-protected-video-buffers") + .value_or(false); + if (force_protected_video_buffers) { + launch_args.AppendSwitch(switches::kForceProtectedVideoOutputBuffers); + } + } + + if (use_overlays_for_video) { + // Overlays are only available if OutputPresenterFuchsia is in use. + AppendFeature(switches::kEnableFeatures, + features::kUseSkiaOutputDeviceBufferQueue.name, &launch_args); + AppendFeature(switches::kEnableFeatures, + features::kUseRealBuffersForPageFlipTest.name, &launch_args); + launch_args.AppendSwitchASCII(switches::kEnableHardwareOverlays, + "underlay"); + launch_args.AppendSwitch(switches::kUseOverlaysForVideo); + } + + if (enable_vulkan) { + if (is_headless) { + DLOG(ERROR) << "VULKAN and HEADLESS features cannot be used together."; + return ZX_ERR_NOT_SUPPORTED; + } + + VLOG(1) << "Enabling Vulkan GPU acceleration."; + // Vulkan requires use of SkiaRenderer, configured to a use Vulkan context. + launch_args.AppendSwitch(switches::kUseVulkan); + const std::vector<base::StringPiece> enabled_features = { + features::kUseSkiaRenderer.name, features::kVulkan.name}; + AppendFeature(switches::kEnableFeatures, + base::JoinString(enabled_features, ","), &launch_args); + + // SkiaRenderer requires out-of-process rasterization be enabled. + launch_args.AppendSwitch(switches::kEnableOopRasterization); + + launch_args.AppendSwitchASCII(switches::kUseGL, + gl::kGLImplementationANGLEName); + } else { + VLOG(1) << "Disabling GPU acceleration."; + // Disable use of Vulkan GPU, and use of the software-GL rasterizer. The + // Context will still run a GPU process, but will not support WebGL. + launch_args.AppendSwitch(switches::kDisableGpu); + launch_args.AppendSwitch(switches::kDisableSoftwareRasterizer); + } + + if (enable_widevine) { + launch_args.AppendSwitch(switches::kEnableWidevine); + } + + if (enable_playready) { + const std::string& key_system = params.playready_key_system(); + if (key_system == kWidevineKeySystem || media::IsClearKey(key_system)) { + LOG(ERROR) + << "Invalid value for CreateContextParams/playready_key_system: " + << key_system; + return ZX_ERR_INVALID_ARGS; + } + launch_args.AppendSwitchNative(switches::kPlayreadyKeySystem, key_system); + } + + bool enable_audio = (features & fuchsia::web::ContextFeatureFlags::AUDIO) == + fuchsia::web::ContextFeatureFlags::AUDIO; + if (!enable_audio) { + // TODO(fxbug.dev/58902): Split up audio input and output in + // ContextFeatureFlags. + launch_args.AppendSwitch(switches::kDisableAudioOutput); + launch_args.AppendSwitch(switches::kDisableAudioInput); + } + + bool enable_hardware_video_decoder = + (features & fuchsia::web::ContextFeatureFlags::HARDWARE_VIDEO_DECODER) == + fuchsia::web::ContextFeatureFlags::HARDWARE_VIDEO_DECODER; + if (!enable_hardware_video_decoder) + launch_args.AppendSwitch(switches::kDisableAcceleratedVideoDecode); + + if (enable_hardware_video_decoder && !enable_vulkan) { + DLOG(ERROR) << "HARDWARE_VIDEO_DECODER requires VULKAN."; + return ZX_ERR_NOT_SUPPORTED; + } + + bool disable_software_video_decoder = + (features & + fuchsia::web::ContextFeatureFlags::HARDWARE_VIDEO_DECODER_ONLY) == + fuchsia::web::ContextFeatureFlags::HARDWARE_VIDEO_DECODER_ONLY; + if (disable_software_video_decoder) { + if (!enable_hardware_video_decoder) { + LOG(ERROR) << "Software video decoding may only be disabled if hardware " + "video decoding is enabled."; + return ZX_ERR_INVALID_ARGS; + } + + launch_args.AppendSwitch(switches::kDisableSoftwareVideoDecoders); + } + + if (!HandleCdmDataDirectoryParam(¶ms, &launch_args, &launch_info)) { + return ZX_ERR_INVALID_ARGS; + } + if (!HandleDataDirectoryParam(¶ms, &launch_args, &launch_info)) { + return ZX_ERR_INVALID_ARGS; + } + if (!HandleContentDirectoriesParam(¶ms, &launch_args, &launch_info)) { + return ZX_ERR_INVALID_ARGS; + } + if (!HandleUserAgentParams(¶ms, &launch_args)) { + return ZX_ERR_INVALID_ARGS; + } + HandleUnsafelyTreatInsecureOriginsAsSecureParam(¶ms, &launch_args); + HandleCorsExemptHeadersParam(¶ms, &launch_args); + + // Set the command-line flag to enable DevTools, if requested. + if (enable_remote_debug_mode_) + launch_args.AppendSwitch(switches::kEnableRemoteDebugMode); + + // In tests the ContextProvider is configured to log to stderr, so clone the + // handle to allow web instances to also log there. + if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + "enable-logging") == "stderr") { + launch_info.err = fuchsia::sys::FileDescriptor::New(); + launch_info.err->type0 = PA_FD; + zx_status_t status = fdio_fd_clone( + STDERR_FILENO, launch_info.err->handle0.reset_and_get_address()); + ZX_CHECK(status == ZX_OK, status); + } + + // Pass on the caller's service-directory request. + launch_info.directory_request = services_request.TakeChannel(); + + // Set |additional_services| to redirect requests for all services specified + // in the web instance component manifest to be satisfied by the caller- + // supplied service directory. This ensures that the instance cannot access + // any services outside those provided by the caller. + launch_info.additional_services = fuchsia::sys::ServiceList::New(); + launch_info.additional_services->names = LoadWebInstanceSandboxServices(); + launch_info.additional_services->host_directory = + service_directory.TakeChannel(); + + // Take the accumulated command line arguments, omitting the program name in + // argv[0], and set them in |launch_info|. + launch_info.arguments = std::vector<std::string>( + launch_args.argv().begin() + 1, launch_args.argv().end()); + + // Launch the component with the accumulated settings. The Component will + // self-terminate when the fuchsia.web.Context client disconnects. + IsolatedEnvironmentLauncher()->CreateComponent(std::move(launch_info), + nullptr /* controller */); + + return ZX_OK; +} + +fuchsia::sys::Launcher* WebInstanceHost::IsolatedEnvironmentLauncher() { + if (isolated_environment_launcher_) + return isolated_environment_launcher_.get(); + + // Create the nested isolated Environment. This environment provides only the + // fuchsia.sys.Loader service, which is required to allow the Launcher to + // resolve the web instance package. All other services are provided + // explicitly to each web instance, from those passed to |CreateContext()|. + auto environment = base::ComponentContextForProcess() + ->svc() + ->Connect<fuchsia::sys::Environment>(); + + // Populate a ServiceList providing only the Loader service. + auto services = fuchsia::sys::ServiceList::New(); + services->names.push_back(fuchsia::sys::Loader::Name_); + fidl::InterfaceHandle<::fuchsia::io::Directory> services_channel; + environment->GetDirectory(services_channel.NewRequest().TakeChannel()); + services->host_directory = services_channel.TakeChannel(); + + // Instantiate the isolated environment. This ContextProvider instance's PID + // is included in the label to ensure that concurrent service instances + // launched in the same Environment (e.g. during tests) do not clash. + fuchsia::sys::EnvironmentPtr isolated_environment; + environment->CreateNestedEnvironment( + isolated_environment.NewRequest(), + isolated_environment_controller_.NewRequest(), + base::StringPrintf("web_instances:%lu", base::Process::Current().Pid()), + std::move(services), + {.inherit_parent_services = false, + .use_parent_runners = false, + .delete_storage_on_death = true}); + + // The ContextProvider only needs to retain the EnvironmentController and + // a connection to the Launcher service for the isolated environment. + isolated_environment->GetLauncher( + isolated_environment_launcher_.NewRequest()); + isolated_environment_launcher_.set_error_handler([](zx_status_t status) { + ZX_LOG(ERROR, status) << "Launcher disconnected."; + }); + isolated_environment_controller_.set_error_handler([](zx_status_t status) { + ZX_LOG(ERROR, status) << "EnvironmentController disconnected."; + }); + + return isolated_environment_launcher_.get(); +} + +} // namespace cr_fuchsia
diff --git a/fuchsia/engine/web_instance_host/web_instance_host.h b/fuchsia/engine/web_instance_host/web_instance_host.h new file mode 100644 index 0000000..e839319 --- /dev/null +++ b/fuchsia/engine/web_instance_host/web_instance_host.h
@@ -0,0 +1,70 @@ +// Copyright 2018 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 FUCHSIA_ENGINE_WEB_INSTANCE_HOST_WEB_INSTANCE_HOST_H_ +#define FUCHSIA_ENGINE_WEB_INSTANCE_HOST_WEB_INSTANCE_HOST_H_ + +#include <fuchsia/io/cpp/fidl.h> +#include <fuchsia/sys/cpp/fidl.h> +#include <fuchsia/web/cpp/fidl.h> +#include <lib/fidl/cpp/interface_request.h> + +#include "base/values.h" + +namespace cr_fuchsia { + +// Helper class that allows web_instance Components to be launched based on +// caller-supplied |CreateContextParams|. +// Note that Components using this class must include the "web_instance.cmx" in +// their package, for the implementation to read the sandbox services from. +class WebInstanceHost { + public: + // Component URL used to launch WebEngine instances to host Contexts. + static const char kComponentUrl[]; + + WebInstanceHost(); + ~WebInstanceHost(); + + WebInstanceHost(const WebInstanceHost&) = delete; + WebInstanceHost& operator=(const WebInstanceHost&) = delete; + + // Creates a new web_instance Component and connects |services_request| to it. + // Returns ZX_OK if |params| were valid, and the Component was launched. + zx_status_t CreateInstanceForContext( + fuchsia::web::CreateContextParams params, + fidl::InterfaceRequest<fuchsia::io::Directory> services_request); + + // Enables/disables remote debugging mode in instances created by this host. + // This may be called at any time, and will not affect pre-existing instances. + void set_enable_remote_debug_mode(bool enable) { + enable_remote_debug_mode_ = enable; + } + + // Sets a set of config-data to use when launching instances, instead of any + // system-provided config-data. May be called at any time, and will not + // affect pre-existing instances. + void set_config_for_test(base::Value config) { + config_for_test_ = std::move(config); + } + + private: + // Returns the Launcher for the isolated Environment in which web instances + // should run. If the Environment does not presently exist then it will be + // created. + fuchsia::sys::Launcher* IsolatedEnvironmentLauncher(); + + // Used to manage the isolated Environment that web instances run in. + fuchsia::sys::LauncherPtr isolated_environment_launcher_; + fuchsia::sys::EnvironmentControllerPtr isolated_environment_controller_; + + // If true then new instances will have remote debug mode enabled. + bool enable_remote_debug_mode_ = false; + + // Set by configuration tests. + base::Value config_for_test_; +}; + +} // namespace cr_fuchsia + +#endif // FUCHSIA_ENGINE_WEB_INSTANCE_HOST_WEB_INSTANCE_HOST_H_
diff --git a/gin/DIR_METADATA b/gin/DIR_METADATA index a50f14cc..4afdacd8 100644 --- a/gin/DIR_METADATA +++ b/gin/DIR_METADATA
@@ -1,10 +1,10 @@ # Metadata information for this directory. # # For more information on DIR_METADATA files, see: -# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/README.md +# https://source.chromium.org/chromium/infra/infra/+/main:go/src/infra/tools/dirmd/README.md # # For the schema of this file, see Metadata message: -# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/proto/dir_metadata.proto +# https://source.chromium.org/chromium/infra/infra/+/main:go/src/infra/tools/dirmd/proto/dir_metadata.proto monorail { component: "Blink>Bindings"
diff --git a/gpu/command_buffer/service/shared_context_state.cc b/gpu/command_buffer/service/shared_context_state.cc index 0143d88..29a43c3 100644 --- a/gpu/command_buffer/service/shared_context_state.cc +++ b/gpu/command_buffer/service/shared_context_state.cc
@@ -279,6 +279,12 @@ if (gpu_preferences.force_max_texture_size) options.fMaxTextureSizeOverride = gpu_preferences.force_max_texture_size; + if (base::FeatureList::IsEnabled(features::kReduceOpsTaskSplitting)) { + options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kYes; + } else { + options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kNo; + } + if (gr_context_type_ == GrContextType::kGL) { DCHECK(context_->IsCurrent(nullptr)); bool use_version_es2 = false;
diff --git a/gpu/config/gpu_finch_features.cc b/gpu/config/gpu_finch_features.cc index df72207f..e45eff1c 100644 --- a/gpu/config/gpu_finch_features.cc +++ b/gpu/config/gpu_finch_features.cc
@@ -214,6 +214,10 @@ const base::Feature kEnableVkPipelineCache{"EnableVkPipelineCache", base::FEATURE_DISABLED_BY_DEFAULT}; +// Enable Skia reduceOpsTaskSplitting to reduce render passes. +const base::Feature kReduceOpsTaskSplitting{ + "ReduceOpsTaskSplitting", base::FEATURE_DISABLED_BY_DEFAULT}; + bool IsUsingVulkan() { #if defined(OS_ANDROID) // Force on if Vulkan feature is enabled from command line.
diff --git a/gpu/config/gpu_finch_features.h b/gpu/config/gpu_finch_features.h index c7486e0..4940e29c 100644 --- a/gpu/config/gpu_finch_features.h +++ b/gpu/config/gpu_finch_features.h
@@ -58,6 +58,8 @@ GPU_EXPORT extern const base::Feature kEnableVkPipelineCache; +GPU_EXPORT extern const base::Feature kReduceOpsTaskSplitting; + GPU_EXPORT bool IsUsingVulkan(); #if defined(OS_ANDROID) GPU_EXPORT bool IsAImageReaderEnabled();
diff --git a/ios/build/bots/scripts/shard_util.py b/ios/build/bots/scripts/shard_util.py index f7a326b..b4c76d6d 100644 --- a/ios/build/bots/scripts/shard_util.py +++ b/ios/build/bots/scripts/shard_util.py
@@ -129,9 +129,9 @@ Returns: (list) a list of (TestCase, testMethod), containing disabled tests. """ - test_names = TEST_NAMES_DEBUG_APP_PATTERN.findall(stdout) - return filter(lambda (test_case, _): test_case not in IGNORED_CLASSES, - test_names) + test_names = TEST_NAMES_DEBUG_APP_PATTERN.findall(stdout.decode("utf-8")) + return list( + filter(lambda test_name: test_name[0] not in IGNORED_CLASSES, test_names)) def fetch_test_names(app, host_app, release, enabled_tests_only=True): @@ -159,8 +159,9 @@ fetch_test_names_for_release(stdout) if release else fetch_test_names_for_debug(stdout)) enabled_test_names = ( - filter(lambda (_, test_method): test_method.startswith('test'), - all_test_names)) + list( + filter(lambda test_name: test_name[1].startswith('test'), + all_test_names))) return enabled_test_names if enabled_tests_only else all_test_names
diff --git a/ios/build/bots/scripts/test_apps.py b/ios/build/bots/scripts/test_apps.py index acedfb3..ecc1831 100644 --- a/ios/build/bots/scripts/test_apps.py +++ b/ios/build/bots/scripts/test_apps.py
@@ -67,7 +67,7 @@ '-c', 'Print:CFBundleIdentifier', os.path.join(app_path, 'Info.plist'), - ]).rstrip() + ]).rstrip().decode("utf-8") class GTestsApp(object):
diff --git a/ios/build/bots/scripts/xcode_log_parser.py b/ios/build/bots/scripts/xcode_log_parser.py index 2f00d5e..8a02623 100644 --- a/ios/build/bots/scripts/xcode_log_parser.py +++ b/ios/build/bots/scripts/xcode_log_parser.py
@@ -50,7 +50,7 @@ passed_test_regex = re.compile(r'Test [Cc]ase \'\-\[(.+?)\s(.+?)\]\' passed') for test_line in output: - m_test = passed_test_regex.search(test_line) + m_test = passed_test_regex.search(test_line.decode("utf-8")) if m_test: passed_tests.append('%s/%s' % (m_test.group(1), m_test.group(2))) LOGGER.info('%d passed tests for interrupted build.' % len(passed_tests))
diff --git a/ios/chrome/browser/browsing_data/browsing_data_remover_impl_unittest.mm b/ios/chrome/browser/browsing_data/browsing_data_remover_impl_unittest.mm index 1b3fa3b..6f84387 100644 --- a/ios/chrome/browser/browsing_data/browsing_data_remover_impl_unittest.mm +++ b/ios/chrome/browser/browsing_data/browsing_data_remover_impl_unittest.mm
@@ -11,7 +11,7 @@ #include "base/check_op.h" #include "base/macros.h" #include "base/run_loop.h" -#include "base/scoped_observer.h" +#include "base/scoped_observation.h" #import "base/test/ios/wait_util.h" #include "base/test/metrics/histogram_tester.h" #include "components/open_from_clipboard/clipboard_recent_content.h" @@ -114,9 +114,9 @@ TestBrowsingDataRemoverObserver observer; ASSERT_TRUE(observer.last_remove_mask() != kRemoveMask); - ScopedObserver<BrowsingDataRemover, BrowsingDataRemoverObserver> + base::ScopedObservation<BrowsingDataRemover, BrowsingDataRemoverObserver> scoped_observer(&observer); - scoped_observer.Add(&browsing_data_remover_); + scoped_observer.Observe(&browsing_data_remover_); browsing_data_remover_.Remove(browsing_data::TimePeriod::ALL_TIME, kRemoveMask, base::DoNothing());
diff --git a/ios/chrome/browser/chrome_browser_provider_observer_bridge.h b/ios/chrome/browser/chrome_browser_provider_observer_bridge.h index 828e3e61b..4b38250 100644 --- a/ios/chrome/browser/chrome_browser_provider_observer_bridge.h +++ b/ios/chrome/browser/chrome_browser_provider_observer_bridge.h
@@ -8,7 +8,7 @@ #import <Foundation/Foundation.h> #include "base/macros.h" -#include "base/scoped_observer.h" +#include "base/scoped_observation.h" #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" // Objective-C protocol mirroring ChromeBrowserProvider::Observer. @@ -36,9 +36,9 @@ void OnChromeBrowserProviderWillBeDestroyed() override; __weak id<ChromeBrowserProviderObserver> observer_; - ScopedObserver<ios::ChromeBrowserProvider, - ios::ChromeBrowserProvider::Observer> - scoped_observer_{this}; + base::ScopedObservation<ios::ChromeBrowserProvider, + ios::ChromeBrowserProvider::Observer> + scoped_observation_{this}; DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProviderObserverBridge); };
diff --git a/ios/chrome/browser/chrome_browser_provider_observer_bridge.mm b/ios/chrome/browser/chrome_browser_provider_observer_bridge.mm index c56344a..c2a0798 100644 --- a/ios/chrome/browser/chrome_browser_provider_observer_bridge.mm +++ b/ios/chrome/browser/chrome_browser_provider_observer_bridge.mm
@@ -12,7 +12,7 @@ id<ChromeBrowserProviderObserver> observer) : observer_(observer) { DCHECK(observer_); - scoped_observer_.Add(ios::GetChromeBrowserProvider()); + scoped_observation_.Observe(ios::GetChromeBrowserProvider()); } ChromeBrowserProviderObserverBridge::~ChromeBrowserProviderObserverBridge() {}
diff --git a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile/save_address_profile_infobar_banner_interaction_handler.mm b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile/save_address_profile_infobar_banner_interaction_handler.mm index 087d724..2495eff 100644 --- a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile/save_address_profile_infobar_banner_interaction_handler.mm +++ b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile/save_address_profile_infobar_banner_interaction_handler.mm
@@ -32,15 +32,21 @@ void SaveAddressProfileInfobarBannerInteractionHandler::BannerVisibilityChanged( InfoBarIOS* infobar, bool visible) { - if (!visible && !infobar->accepted()) + if (!visible && !infobar->accepted()) { GetInfobarDelegate(infobar)->InfoBarDismissed(); + if (!GetInfobarDelegate(infobar)->modal_was_shown()) { + // Remove the infobar to prevent showing the modal when the user has + // cancelled the banner. + infobar->RemoveSelf(); + } + } } void SaveAddressProfileInfobarBannerInteractionHandler::ShowModalButtonTapped( InfoBarIOS* infobar, web::WebState* web_state) { // Inform delegate that the modal is shown. - GetInfobarDelegate(infobar)->set_modal_is_shown_to_true(); + GetInfobarDelegate(infobar)->set_modal_was_shown_to_true(); InfobarBannerInteractionHandler::ShowModalButtonTapped(infobar, web_state); }
diff --git a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile/save_address_profile_infobar_modal_interaction_handler.h b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile/save_address_profile_infobar_modal_interaction_handler.h index ef7b88c5..70470c39 100644 --- a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile/save_address_profile_infobar_modal_interaction_handler.h +++ b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile/save_address_profile_infobar_modal_interaction_handler.h
@@ -23,7 +23,8 @@ // InfobarModalInteractionHandler: void PerformMainAction(InfoBarIOS* infobar) override; - void InfobarVisibilityChanged(InfoBarIOS* infobar, bool visible) override; + // Prevent the call to InfobarDismissed. + void InfobarVisibilityChanged(InfoBarIOS* infobar, bool visible) override {} // Instructs the handler that the user has edited and then saved the profile. virtual void SaveEditedProfile(InfoBarIOS* infobar,
diff --git a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile/save_address_profile_infobar_modal_interaction_handler.mm b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile/save_address_profile_infobar_modal_interaction_handler.mm index 13d7294..5535115ed 100644 --- a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile/save_address_profile_infobar_modal_interaction_handler.mm +++ b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/autofill_address_profile/save_address_profile_infobar_modal_interaction_handler.mm
@@ -31,16 +31,6 @@ infobar->RemoveSelf(); } -void SaveAddressProfileInfobarModalInteractionHandler::InfobarVisibilityChanged( - InfoBarIOS* infobar, - bool visible) { - if (!visible && !infobar->accepted()) { - // Inform the delegate that the modal has been dismissed. - GetInfoBarDelegate(infobar)->set_modal_is_dismissed_to_true(); - GetInfoBarDelegate(infobar)->InfoBarDismissed(); - } -} - void SaveAddressProfileInfobarModalInteractionHandler::SaveEditedProfile( InfoBarIOS* infobar, NSDictionary* profileData) {
diff --git a/ios/chrome/browser/ios_chrome_io_thread.h b/ios/chrome/browser/ios_chrome_io_thread.h index 883025fd..7a1568b7 100644 --- a/ios/chrome/browser/ios_chrome_io_thread.h +++ b/ios/chrome/browser/ios_chrome_io_thread.h
@@ -10,6 +10,7 @@ #include "ios/components/io_thread/ios_io_thread.h" #include "mojo/public/cpp/bindings/remote.h" #include "services/network/public/mojom/network_service.mojom.h" +#include "services/network/public/mojom/url_loader_factory.mojom.h" class PrefService;
diff --git a/ios/chrome/browser/metrics/pageload_foreground_duration_tab_helper_unittest.mm b/ios/chrome/browser/metrics/pageload_foreground_duration_tab_helper_unittest.mm index 7a24cd8f..a27a164 100644 --- a/ios/chrome/browser/metrics/pageload_foreground_duration_tab_helper_unittest.mm +++ b/ios/chrome/browser/metrics/pageload_foreground_duration_tab_helper_unittest.mm
@@ -4,6 +4,8 @@ #import "ios/chrome/browser/metrics/pageload_foreground_duration_tab_helper.h" +#import <UIKit/UIKit.h> + #include "components/ukm/ios/ukm_url_recorder.h" #include "components/ukm/test_ukm_recorder.h" #import "ios/web/public/test/fakes/fake_navigation_context.h"
diff --git a/ios/chrome/browser/policy/BUILD.gn b/ios/chrome/browser/policy/BUILD.gn index bfcb74b..af02cb3 100644 --- a/ios/chrome/browser/policy/BUILD.gn +++ b/ios/chrome/browser/policy/BUILD.gn
@@ -232,6 +232,7 @@ "//ios/chrome/browser:utils", "//ios/chrome/browser/translate:eg_test_support+eg2", "//ios/chrome/browser/ui/content_suggestions:constants", + "//ios/chrome/browser/ui/ntp:constants", "//ios/chrome/browser/ui/popup_menu:constants", "//ios/chrome/browser/ui/settings:constants", "//ios/chrome/browser/ui/settings/autofill:constants",
diff --git a/ios/chrome/browser/policy/policy_egtest.mm b/ios/chrome/browser/policy/policy_egtest.mm index 6af1f9b..87c502b 100644 --- a/ios/chrome/browser/policy/policy_egtest.mm +++ b/ios/chrome/browser/policy/policy_egtest.mm
@@ -16,6 +16,7 @@ #include "ios/chrome/browser/pref_names.h" #import "ios/chrome/browser/translate/translate_app_interface.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_constants.h" +#import "ios/chrome/browser/ui/ntp/new_tab_page_constants.h" #import "ios/chrome/browser/ui/popup_menu/popup_menu_constants.h" #import "ios/chrome/browser/ui/settings/autofill/autofill_constants.h" #import "ios/chrome/browser/ui/settings/elements/elements_constants.h" @@ -405,9 +406,8 @@ selectElementWithMatcher:grey_allOf(grey_accessibilityLabel(feedTitle), grey_sufficientlyVisible(), nil)] usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 200) - onElementWithMatcher:grey_accessibilityID( - kContentSuggestionsCollectionIdentifier)] - assertWithMatcher:grey_notNil()]; + onElementWithMatcher:grey_accessibilityID(kNTPCollectionViewIdentifier)] + assertWithMatcher:grey_sufficientlyVisible()]; SetPolicy(false, policy::key::kNTPContentSuggestionsEnabled);
diff --git a/ios/chrome/browser/safe_browsing/pending_unsafe_resource_storage.h b/ios/chrome/browser/safe_browsing/pending_unsafe_resource_storage.h index cad9291c..f454cb9 100644 --- a/ios/chrome/browser/safe_browsing/pending_unsafe_resource_storage.h +++ b/ios/chrome/browser/safe_browsing/pending_unsafe_resource_storage.h
@@ -5,7 +5,7 @@ #ifndef IOS_CHROME_BROWSER_SAFE_BROWSING_PENDING_UNSAFE_RESOURCE_STORAGE_H_ #define IOS_CHROME_BROWSER_SAFE_BROWSING_PENDING_UNSAFE_RESOURCE_STORAGE_H_ -#include "base/scoped_observer.h" +#include "base/scoped_observation.h" #include "base/stl_util.h" #import "components/safe_browsing/ios/browser/safe_browsing_url_allow_list.h" #include "components/security_interstitials/core/unsafe_resource.h" @@ -58,8 +58,9 @@ SafeBrowsingUrlAllowList* allow_list) override; PendingUnsafeResourceStorage* storage_ = nullptr; - ScopedObserver<SafeBrowsingUrlAllowList, SafeBrowsingUrlAllowList::Observer> - scoped_observer_{this}; + base::ScopedObservation<SafeBrowsingUrlAllowList, + SafeBrowsingUrlAllowList::Observer> + scoped_observation_{this}; }; // Updates |policy_observer_| for the current value of |resource_|.
diff --git a/ios/chrome/browser/safe_browsing/pending_unsafe_resource_storage.mm b/ios/chrome/browser/safe_browsing/pending_unsafe_resource_storage.mm index 982aa7a..9ad0eff 100644 --- a/ios/chrome/browser/safe_browsing/pending_unsafe_resource_storage.mm +++ b/ios/chrome/browser/safe_browsing/pending_unsafe_resource_storage.mm
@@ -78,14 +78,14 @@ PendingUnsafeResourceStorage::ResourcePolicyObserver::ResourcePolicyObserver( PendingUnsafeResourceStorage* storage) : storage_(storage) { - scoped_observer_.Add(SafeBrowsingUrlAllowList::FromWebState( + scoped_observation_.Observe(SafeBrowsingUrlAllowList::FromWebState( storage_->resource()->web_state_getter.Run())); } PendingUnsafeResourceStorage::ResourcePolicyObserver::ResourcePolicyObserver( const ResourcePolicyObserver& other) : storage_(other.storage_) { - scoped_observer_.Add(SafeBrowsingUrlAllowList::FromWebState( + scoped_observation_.Observe(SafeBrowsingUrlAllowList::FromWebState( storage_->resource()->web_state_getter.Run())); }
diff --git a/ios/chrome/browser/safe_browsing/safe_browsing_tab_helper.h b/ios/chrome/browser/safe_browsing/safe_browsing_tab_helper.h index ea78694..a36e26e 100644 --- a/ios/chrome/browser/safe_browsing/safe_browsing_tab_helper.h +++ b/ios/chrome/browser/safe_browsing/safe_browsing_tab_helper.h
@@ -12,7 +12,7 @@ #include "base/containers/unique_ptr_adapters.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "base/scoped_observer.h" +#include "base/scoped_observation.h" #include "components/safe_browsing/core/browser/safe_browsing_url_checker_impl.h" #include "components/safe_browsing/core/db/database_manager.h" #include "components/safe_browsing/core/db/v4_protocol_manager_util.h" @@ -178,8 +178,9 @@ web::WebState* web_state_ = nullptr; PolicyDecider* policy_decider_ = nullptr; - ScopedObserver<SafeBrowsingQueryManager, SafeBrowsingQueryManager::Observer> - scoped_observer_{this}; + base::ScopedObservation<SafeBrowsingQueryManager, + SafeBrowsingQueryManager::Observer> + scoped_observation_{this}; }; // Helper object that resets state for the policy decider when a navigation is @@ -202,7 +203,8 @@ void WebStateDestroyed(web::WebState* web_state) override; PolicyDecider* policy_decider_ = nullptr; - ScopedObserver<web::WebState, web::WebStateObserver> scoped_observer_{this}; + base::ScopedObservation<web::WebState, web::WebStateObserver> + scoped_observation_{this}; }; explicit SafeBrowsingTabHelper(web::WebState* web_state);
diff --git a/ios/chrome/browser/safe_browsing/safe_browsing_tab_helper.mm b/ios/chrome/browser/safe_browsing/safe_browsing_tab_helper.mm index 529aee0..9426981 100644 --- a/ios/chrome/browser/safe_browsing/safe_browsing_tab_helper.mm +++ b/ios/chrome/browser/safe_browsing/safe_browsing_tab_helper.mm
@@ -451,7 +451,8 @@ PolicyDecider* decider) : web_state_(web_state), policy_decider_(decider) { DCHECK(policy_decider_); - scoped_observer_.Add(SafeBrowsingQueryManager::FromWebState(web_state)); + scoped_observation_.Observe( + SafeBrowsingQueryManager::FromWebState(web_state)); } SafeBrowsingTabHelper::QueryObserver::~QueryObserver() = default; @@ -507,7 +508,8 @@ void SafeBrowsingTabHelper::QueryObserver::SafeBrowsingQueryManagerDestroyed( SafeBrowsingQueryManager* manager) { - scoped_observer_.Remove(manager); + DCHECK(scoped_observation_.IsObservingSource(manager)); + scoped_observation_.Reset(); } #pragma mark - SafeBrowsingTabHelper::NavigationObserver @@ -517,7 +519,7 @@ PolicyDecider* policy_decider) : policy_decider_(policy_decider) { DCHECK(policy_decider_); - scoped_observer_.Add(web_state); + scoped_observation_.Observe(web_state); } SafeBrowsingTabHelper::NavigationObserver::~NavigationObserver() = default; @@ -539,5 +541,6 @@ void SafeBrowsingTabHelper::NavigationObserver::WebStateDestroyed( web::WebState* web_state) { - scoped_observer_.Remove(web_state); + DCHECK(scoped_observation_.IsObservingSource(web_state)); + scoped_observation_.Reset(); }
diff --git a/ios/chrome/browser/search_engines/search_engine_tab_helper.h b/ios/chrome/browser/search_engines/search_engine_tab_helper.h index 330d6f16..34f14fa 100644 --- a/ios/chrome/browser/search_engines/search_engine_tab_helper.h +++ b/ios/chrome/browser/search_engines/search_engine_tab_helper.h
@@ -6,7 +6,7 @@ #define IOS_CHROME_BROWSER_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_ #include "base/macros.h" -#include "base/scoped_observer.h" +#include "base/scoped_observation.h" #include "components/favicon/ios/web_favicon_driver.h" #include "ios/web/public/web_state_observer.h" #import "ios/web/public/web_state_user_data.h" @@ -71,8 +71,9 @@ const gfx::Image& image) override; // Manages observation relationship between |this| and WebFaviconDriver. - ScopedObserver<favicon::FaviconDriver, favicon::FaviconDriverObserver> - favicon_driver_observer_{this}; + base::ScopedObservation<favicon::FaviconDriver, + favicon::FaviconDriverObserver> + favicon_driver_observation_{this}; // WebState this tab helper is attached to. web::WebState* web_state_ = nullptr;
diff --git a/ios/chrome/browser/search_engines/search_engine_tab_helper.mm b/ios/chrome/browser/search_engines/search_engine_tab_helper.mm index 7482df6..d28363c 100644 --- a/ios/chrome/browser/search_engines/search_engine_tab_helper.mm +++ b/ios/chrome/browser/search_engines/search_engine_tab_helper.mm
@@ -82,14 +82,14 @@ base::Unretained(this)), kCommandPrefix); DCHECK(favicon::WebFaviconDriver::FromWebState(web_state)); - favicon_driver_observer_.Add( + favicon_driver_observation_.Observe( favicon::WebFaviconDriver::FromWebState(web_state)); } void SearchEngineTabHelper::WebStateDestroyed(web::WebState* web_state) { web_state->RemoveObserver(this); web_state_ = nullptr; - favicon_driver_observer_.RemoveAll(); + favicon_driver_observation_.Reset(); } // When favicon is updated, notify TemplateURLService about the change.
diff --git a/ios/chrome/browser/ui/autofill/autofill_ui_type.h b/ios/chrome/browser/ui/autofill/autofill_ui_type.h index 712e3d7..a4d2de15 100644 --- a/ios/chrome/browser/ui/autofill/autofill_ui_type.h +++ b/ios/chrome/browser/ui/autofill/autofill_ui_type.h
@@ -34,7 +34,8 @@ AutofillUITypeProfileHomeAddressCountry, AutofillUITypeProfileHomePhoneWholeNumber, AutofillUITypeProfileEmailAddress, - AutofillUITypeNameFullWithHonorificPrefix + AutofillUITypeNameFullWithHonorificPrefix, + AutofillUITypeAddressHomeAddress }; #endif // IOS_CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_UI_TYPE_H_
diff --git a/ios/chrome/browser/ui/autofill/autofill_ui_type_util.mm b/ios/chrome/browser/ui/autofill/autofill_ui_type_util.mm index 4dd5943f..ab7f629 100644 --- a/ios/chrome/browser/ui/autofill/autofill_ui_type_util.mm +++ b/ios/chrome/browser/ui/autofill/autofill_ui_type_util.mm
@@ -52,6 +52,8 @@ return AutofillUITypeProfileEmailAddress; case autofill::NAME_FULL_WITH_HONORIFIC_PREFIX: return AutofillUITypeNameFullWithHonorificPrefix; + case autofill::ADDRESS_HOME_ADDRESS: + return AutofillUITypeAddressHomeAddress; default: NOTREACHED(); return AutofillUITypeUnknown; @@ -100,6 +102,8 @@ return autofill::EMAIL_ADDRESS; case AutofillUITypeNameFullWithHonorificPrefix: return autofill::NAME_FULL_WITH_HONORIFIC_PREFIX; + case AutofillUITypeAddressHomeAddress: + return autofill::ADDRESS_HOME_ADDRESS; case AutofillUITypeCreditCardExpDate: case AutofillUITypeCreditCardBillingAddress: case AutofillUITypeCreditCardSaveToChrome:
diff --git a/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm b/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm index 2eec6b9..0c7457e 100644 --- a/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm +++ b/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm
@@ -731,8 +731,14 @@ // Ensure that label is visible with correct text for visible feed. [self testNTPInitialPositionAndContent:collectionView]; - [[EarlGrey selectElementWithMatcher:chrome_test_util::DiscoverHeaderLabel()] + [[[EarlGrey + selectElementWithMatcher:grey_allOf( + chrome_test_util::DiscoverHeaderLabel(), + grey_sufficientlyVisible(), nil)] + usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 200) + onElementWithMatcher:grey_accessibilityID(kNTPCollectionViewIdentifier)] assertWithMatcher:grey_sufficientlyVisible()]; + UILabel* discoverHeaderLabel = [NewTabPageAppInterface discoverHeaderLabel]; GREYAssertTrue( [discoverHeaderLabel.text isEqualToString:labelTextForVisibleFeed], @@ -747,7 +753,12 @@ // Ensure that label is visible with correct text for hidden feed. [self testNTPInitialPositionAndContent:collectionView]; - [[EarlGrey selectElementWithMatcher:chrome_test_util::DiscoverHeaderLabel()] + [[[EarlGrey + selectElementWithMatcher:grey_allOf( + chrome_test_util::DiscoverHeaderLabel(), + grey_sufficientlyVisible(), nil)] + usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 200) + onElementWithMatcher:grey_accessibilityID(kNTPCollectionViewIdentifier)] assertWithMatcher:grey_sufficientlyVisible()]; discoverHeaderLabel = [NewTabPageAppInterface discoverHeaderLabel]; GREYAssertTrue( @@ -761,7 +772,12 @@ // Ensure that label is visible with correct text for feed being made visible. [self testNTPInitialPositionAndContent:collectionView]; - [[EarlGrey selectElementWithMatcher:chrome_test_util::DiscoverHeaderLabel()] + [[[EarlGrey + selectElementWithMatcher:grey_allOf( + chrome_test_util::DiscoverHeaderLabel(), + grey_sufficientlyVisible(), nil)] + usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 200) + onElementWithMatcher:grey_accessibilityID(kNTPCollectionViewIdentifier)] assertWithMatcher:grey_sufficientlyVisible()]; discoverHeaderLabel = [NewTabPageAppInterface discoverHeaderLabel]; GREYAssertTrue( @@ -776,7 +792,12 @@ // Ensure that label is visible with correct text for enabled feed. [self testNTPInitialPositionAndContent:collectionView]; - [[EarlGrey selectElementWithMatcher:chrome_test_util::DiscoverHeaderLabel()] + [[[EarlGrey + selectElementWithMatcher:grey_allOf( + chrome_test_util::DiscoverHeaderLabel(), + grey_sufficientlyVisible(), nil)] + usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 200) + onElementWithMatcher:grey_accessibilityID(kNTPCollectionViewIdentifier)] assertWithMatcher:grey_sufficientlyVisible()]; UILabel* discoverHeaderLabel = [NewTabPageAppInterface discoverHeaderLabel]; GREYAssertTrue( @@ -792,7 +813,7 @@ // Ensure that label is no longer visible. [self testNTPInitialPositionAndContent:collectionView]; [[EarlGrey selectElementWithMatcher:chrome_test_util::DiscoverHeaderLabel()] - assertWithMatcher:grey_notVisible()]; + assertWithMatcher:grey_nil()]; // Re-enable feed. [ChromeEarlGreyAppInterface @@ -801,7 +822,12 @@ // Ensure that label is once again visible. [self testNTPInitialPositionAndContent:collectionView]; - [[EarlGrey selectElementWithMatcher:chrome_test_util::DiscoverHeaderLabel()] + [[[EarlGrey + selectElementWithMatcher:grey_allOf( + chrome_test_util::DiscoverHeaderLabel(), + grey_sufficientlyVisible(), nil)] + usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 200) + onElementWithMatcher:grey_accessibilityID(kNTPCollectionViewIdentifier)] assertWithMatcher:grey_sufficientlyVisible()]; discoverHeaderLabel = [NewTabPageAppInterface discoverHeaderLabel]; GREYAssertTrue(
diff --git a/ios/chrome/browser/ui/default_promo/OWNERS b/ios/chrome/browser/ui/default_promo/OWNERS index c0b1566..c2536df3 100644 --- a/ios/chrome/browser/ui/default_promo/OWNERS +++ b/ios/chrome/browser/ui/default_promo/OWNERS
@@ -1,2 +1,2 @@ javierrobles@chromium.org -rkgibson@google.com \ No newline at end of file +rkgibson@google.com
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_util.mm b/ios/chrome/browser/ui/omnibox/omnibox_util.mm index 9f7e7fa..7c4b206 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_util.mm +++ b/ios/chrome/browser/ui/omnibox/omnibox_util.mm
@@ -33,7 +33,7 @@ case AutocompleteMatchType::PHYSICAL_WEB_OVERFLOW_DEPRECATED: case AutocompleteMatchType::URL_WHAT_YOU_TYPED: case AutocompleteMatchType::DOCUMENT_SUGGESTION: - case AutocompleteMatchType::PEDAL: + case AutocompleteMatchType::PEDAL_DEPRECATED: return DEFAULT_FAVICON; case AutocompleteMatchType::HISTORY_BODY: case AutocompleteMatchType::HISTORY_KEYWORD:
diff --git a/ios/chrome/browser/ui/omnibox/popup/omnibox_icon_formatter.mm b/ios/chrome/browser/ui/omnibox/popup/omnibox_icon_formatter.mm index 55f6fd9..5239662 100644 --- a/ios/chrome/browser/ui/omnibox/popup/omnibox_icon_formatter.mm +++ b/ios/chrome/browser/ui/omnibox/popup/omnibox_icon_formatter.mm
@@ -57,7 +57,7 @@ case AutocompleteMatchType::PHYSICAL_WEB_OVERFLOW_DEPRECATED: case AutocompleteMatchType::URL_WHAT_YOU_TYPED: case AutocompleteMatchType::DOCUMENT_SUGGESTION: - case AutocompleteMatchType::PEDAL: + case AutocompleteMatchType::PEDAL_DEPRECATED: case AutocompleteMatchType::HISTORY_BODY: case AutocompleteMatchType::HISTORY_KEYWORD: case AutocompleteMatchType::HISTORY_TITLE:
diff --git a/ios/chrome/browser/ui/settings/password/OWNERS b/ios/chrome/browser/ui/settings/password/OWNERS index 88b5bab6..8ee4bd2 100644 --- a/ios/chrome/browser/ui/settings/password/OWNERS +++ b/ios/chrome/browser/ui/settings/password/OWNERS
@@ -1 +1 @@ -vsemeniuk@google.com \ No newline at end of file +vsemeniuk@google.com
diff --git a/ios/chrome/browser/ui/start_surface/OWNERS b/ios/chrome/browser/ui/start_surface/OWNERS index 1edc2dd..0b8a6d31 100644 --- a/ios/chrome/browser/ui/start_surface/OWNERS +++ b/ios/chrome/browser/ui/start_surface/OWNERS
@@ -1,2 +1,2 @@ gogerald@chromium.org -thegreenfrog@chromium.org \ No newline at end of file +thegreenfrog@chromium.org
diff --git a/ios/chrome/browser/upgrade/upgrade_center.mm b/ios/chrome/browser/upgrade/upgrade_center.mm index 2a374b7..d70d160 100644 --- a/ios/chrome/browser/upgrade/upgrade_center.mm +++ b/ios/chrome/browser/upgrade/upgrade_center.mm
@@ -9,7 +9,7 @@ #include <utility> #include "base/mac/bundle_locations.h" -#include "base/scoped_observer.h" +#include "base/scoped_observation.h" #include "base/strings/sys_string_conversions.h" #include "base/version.h" #include "components/infobars/core/confirm_infobar_delegate.h" @@ -119,9 +119,7 @@ : public infobars::InfoBarManager::Observer { public: UpgradeInfoBarDismissObserver() - : infobar_delegate_(nullptr), - dismiss_delegate_(nil), - scoped_observer_(this) {} + : infobar_delegate_(nullptr), dismiss_delegate_(nil) {} ~UpgradeInfoBarDismissObserver() override {} @@ -129,7 +127,7 @@ UpgradeInfoBarDelegate* infobar_delegate, NSString* tab_id, UpgradeCenter* dismiss_delegate) { - scoped_observer_.Add(infobar_manager); + scoped_observation_.Observe(infobar_manager); infobar_delegate_ = infobar_delegate; dismiss_delegate_ = dismiss_delegate; tab_id_ = [tab_id copy]; @@ -148,14 +146,16 @@ void OnManagerShuttingDown( infobars::InfoBarManager* infobar_manager) override { - scoped_observer_.Remove(infobar_manager); + DCHECK(scoped_observation_.IsObservingSource(infobar_manager)); + scoped_observation_.Reset(); } UpgradeInfoBarDelegate* infobar_delegate_; __weak UpgradeCenter* dismiss_delegate_; __strong NSString* tab_id_; - ScopedObserver<infobars::InfoBarManager, infobars::InfoBarManager::Observer> - scoped_observer_; + base::ScopedObservation<infobars::InfoBarManager, + infobars::InfoBarManager::Observer> + scoped_observation_{this}; DISALLOW_COPY_AND_ASSIGN(UpgradeInfoBarDismissObserver); };
diff --git a/ios/chrome/browser/web/blocked_popup_tab_helper.h b/ios/chrome/browser/web/blocked_popup_tab_helper.h index 19ed2a8..721c4b0 100644 --- a/ios/chrome/browser/web/blocked_popup_tab_helper.h +++ b/ios/chrome/browser/web/blocked_popup_tab_helper.h
@@ -8,7 +8,7 @@ #include <vector> #include "base/macros.h" -#include "base/scoped_observer.h" +#include "base/scoped_observation.h" #include "components/infobars/core/infobar_manager.h" #include "ios/web/public/navigation/referrer.h" #import "ios/web/public/web_state_user_data.h" @@ -82,8 +82,9 @@ // For management of infobars::InfoBarManager::Observer registration. This // object will not start observing the InfoBarManager until ShowInfoBars() is // called. - ScopedObserver<infobars::InfoBarManager, infobars::InfoBarManager::Observer> - scoped_observer_; + base::ScopedObservation<infobars::InfoBarManager, + infobars::InfoBarManager::Observer> + scoped_observation_{this}; WEB_STATE_USER_DATA_KEY_DECL();
diff --git a/ios/chrome/browser/web/blocked_popup_tab_helper.mm b/ios/chrome/browser/web/blocked_popup_tab_helper.mm index 5ba7c53..ee1fa172 100644 --- a/ios/chrome/browser/web/blocked_popup_tab_helper.mm +++ b/ios/chrome/browser/web/blocked_popup_tab_helper.mm
@@ -117,7 +117,7 @@ } // namespace BlockedPopupTabHelper::BlockedPopupTabHelper(web::WebState* web_state) - : web_state_(web_state), infobar_(nullptr), scoped_observer_(this) {} + : web_state_(web_state), infobar_(nullptr) {} BlockedPopupTabHelper::~BlockedPopupTabHelper() = default; @@ -141,13 +141,14 @@ if (infobar == infobar_) { infobar_ = nullptr; popups_.clear(); - scoped_observer_.RemoveAll(); + scoped_observation_.Reset(); } } void BlockedPopupTabHelper::OnManagerShuttingDown( infobars::InfoBarManager* infobar_manager) { - scoped_observer_.Remove(infobar_manager); + DCHECK(scoped_observation_.IsObservingSource(infobar_manager)); + scoped_observation_.Reset(); } void BlockedPopupTabHelper::ShowInfoBar() { @@ -188,13 +189,13 @@ infobars::InfoBarManager* infobar_manager) { DCHECK(infobar_manager); - if (scoped_observer_.IsObserving(infobar_manager)) { + if (scoped_observation_.IsObservingSource(infobar_manager)) { return; } // Verify that this object is never observing more than one InfoBarManager. - DCHECK(!scoped_observer_.IsObservingSources()); - scoped_observer_.Add(infobar_manager); + DCHECK(!scoped_observation_.IsObserving()); + scoped_observation_.Observe(infobar_manager); } WEB_STATE_USER_DATA_KEY_IMPL(BlockedPopupTabHelper)
diff --git a/ios/chrome/browser/web/blocked_popup_tab_helper_unittest.mm b/ios/chrome/browser/web/blocked_popup_tab_helper_unittest.mm index 1aea9ad..3391a3a 100644 --- a/ios/chrome/browser/web/blocked_popup_tab_helper_unittest.mm +++ b/ios/chrome/browser/web/blocked_popup_tab_helper_unittest.mm
@@ -37,7 +37,7 @@ // Returns true if InfoBarManager is being observed. bool IsObservingSources() { - return GetBlockedPopupTabHelper()->scoped_observer_.IsObservingSources(); + return GetBlockedPopupTabHelper()->scoped_observation_.IsObserving(); } // Returns BlockedPopupTabHelper that is being tested.
diff --git a/ios/chrome/browser/web/java_script_console/OWNERS b/ios/chrome/browser/web/java_script_console/OWNERS index acff708..49ba79e 100644 --- a/ios/chrome/browser/web/java_script_console/OWNERS +++ b/ios/chrome/browser/web/java_script_console/OWNERS
@@ -1 +1 @@ -michaeldo@chromium.org \ No newline at end of file +michaeldo@chromium.org
diff --git a/ios/chrome/browser/web_state_list/active_web_state_observation_forwarder.h b/ios/chrome/browser/web_state_list/active_web_state_observation_forwarder.h index baab84c3..e379c7e 100644 --- a/ios/chrome/browser/web_state_list/active_web_state_observation_forwarder.h +++ b/ios/chrome/browser/web_state_list/active_web_state_observation_forwarder.h
@@ -6,7 +6,7 @@ #define IOS_CHROME_BROWSER_WEB_STATE_LIST_ACTIVE_WEB_STATE_OBSERVATION_FORWARDER_H_ #include "base/macros.h" -#include "base/scoped_observer.h" +#include "base/scoped_observation.h" #include "ios/chrome/browser/web_state_list/web_state_list.h" #include "ios/chrome/browser/web_state_list/web_state_list_observer.h" #import "ios/web/public/web_state.h" @@ -32,9 +32,10 @@ ActiveWebStateChangeReason reason) override; private: - ScopedObserver<WebStateList, WebStateListObserver> web_state_list_observer_{ - this}; - ScopedObserver<web::WebState, web::WebStateObserver> web_state_observer_; + base::ScopedObservation<WebStateList, WebStateListObserver> + web_state_list_observation_{this}; + base::ScopedObservation<web::WebState, web::WebStateObserver> + web_state_observation_; DISALLOW_COPY_AND_ASSIGN(ActiveWebStateObservationForwarder); };
diff --git a/ios/chrome/browser/web_state_list/active_web_state_observation_forwarder.mm b/ios/chrome/browser/web_state_list/active_web_state_observation_forwarder.mm index 868e7d09..3ba35ca 100644 --- a/ios/chrome/browser/web_state_list/active_web_state_observation_forwarder.mm +++ b/ios/chrome/browser/web_state_list/active_web_state_observation_forwarder.mm
@@ -13,14 +13,14 @@ ActiveWebStateObservationForwarder::ActiveWebStateObservationForwarder( WebStateList* web_state_list, web::WebStateObserver* observer) - : web_state_observer_(observer) { + : web_state_observation_(observer) { DCHECK(observer); DCHECK(web_state_list); - web_state_list_observer_.Add(web_state_list); + web_state_list_observation_.Observe(web_state_list); web::WebState* active_web_state = web_state_list->GetActiveWebState(); if (active_web_state) { - web_state_observer_.Add(active_web_state); + web_state_observation_.Observe(active_web_state); } } @@ -32,14 +32,7 @@ web::WebState* new_web_state, int active_index, ActiveWebStateChangeReason reason) { - // If this class is created inside a |WebStateActivatedAt| callback, then it - // will be initialized already observing |new_web_state|, so it doesn't need - // to start or stop observing anything. - if (old_web_state && web_state_observer_.IsObserving(old_web_state)) { - web_state_observer_.Remove(old_web_state); - } - - if (new_web_state && !web_state_observer_.IsObserving(new_web_state)) { - web_state_observer_.Add(new_web_state); - } + web_state_observation_.Reset(); + if (new_web_state) + web_state_observation_.Observe(new_web_state); }
diff --git a/ios/chrome/browser/web_state_list/all_web_state_observation_forwarder.h b/ios/chrome/browser/web_state_list/all_web_state_observation_forwarder.h index 4393ef050..1ea010d 100644 --- a/ios/chrome/browser/web_state_list/all_web_state_observation_forwarder.h +++ b/ios/chrome/browser/web_state_list/all_web_state_observation_forwarder.h
@@ -6,7 +6,8 @@ #define IOS_CHROME_BROWSER_WEB_STATE_LIST_ALL_WEB_STATE_OBSERVATION_FORWARDER_H_ #include "base/macros.h" -#include "base/scoped_observer.h" +#include "base/scoped_multi_source_observation.h" +#include "base/scoped_observation.h" #include "ios/chrome/browser/web_state_list/web_state_list.h" #include "ios/chrome/browser/web_state_list/web_state_list_observer.h" #import "ios/web/public/web_state.h" @@ -38,8 +39,10 @@ int index) override; private: - ScopedObserver<WebStateList, WebStateListObserver> web_state_list_observer_; - ScopedObserver<web::WebState, web::WebStateObserver> web_state_observer_; + base::ScopedObservation<WebStateList, WebStateListObserver> + web_state_list_observation_{this}; + base::ScopedMultiSourceObservation<web::WebState, web::WebStateObserver> + web_state_observations_; DISALLOW_COPY_AND_ASSIGN(AllWebStateObservationForwarder); };
diff --git a/ios/chrome/browser/web_state_list/all_web_state_observation_forwarder.mm b/ios/chrome/browser/web_state_list/all_web_state_observation_forwarder.mm index e79b2cc6..9eb5708 100644 --- a/ios/chrome/browser/web_state_list/all_web_state_observation_forwarder.mm +++ b/ios/chrome/browser/web_state_list/all_web_state_observation_forwarder.mm
@@ -13,14 +13,14 @@ AllWebStateObservationForwarder::AllWebStateObservationForwarder( WebStateList* web_state_list, web::WebStateObserver* observer) - : web_state_list_observer_(this), web_state_observer_(observer) { + : web_state_observations_(observer) { DCHECK(observer); DCHECK(web_state_list); - web_state_list_observer_.Add(web_state_list); + web_state_list_observation_.Observe(web_state_list); for (int ii = 0; ii < web_state_list->count(); ++ii) { web::WebState* web_state = web_state_list->GetWebStateAt(ii); - web_state_observer_.Add(web_state); + web_state_observations_.AddObservation(web_state); } } @@ -31,7 +31,7 @@ web::WebState* web_state, int index, bool activating) { - web_state_observer_.Add(web_state); + web_state_observations_.AddObservation(web_state); } void AllWebStateObservationForwarder::WebStateReplacedAt( @@ -39,13 +39,13 @@ web::WebState* old_web_state, web::WebState* new_web_state, int index) { - web_state_observer_.Remove(old_web_state); - web_state_observer_.Add(new_web_state); + web_state_observations_.RemoveObservation(old_web_state); + web_state_observations_.AddObservation(new_web_state); } void AllWebStateObservationForwarder::WebStateDetachedAt( WebStateList* web_state_list, web::WebState* web_state, int index) { - web_state_observer_.Remove(web_state); + web_state_observations_.RemoveObservation(web_state); }
diff --git a/ios/chrome/browser/web_state_list/web_state_list_favicon_driver_observer.h b/ios/chrome/browser/web_state_list/web_state_list_favicon_driver_observer.h index d740141..a2cfbfab 100644 --- a/ios/chrome/browser/web_state_list/web_state_list_favicon_driver_observer.h +++ b/ios/chrome/browser/web_state_list/web_state_list_favicon_driver_observer.h
@@ -8,7 +8,7 @@ #include <map> #include "base/macros.h" -#include "base/scoped_observer.h" +#include "base/scoped_observation.h" #include "components/favicon/core/favicon_driver_observer.h" #import "ios/chrome/browser/web_state_list/web_state_list.h" @@ -70,7 +70,8 @@ // notification to WebStateFaviconDriverObservers. std::map<favicon::FaviconDriver*, web::WebState*> driver_to_web_state_map_; - ScopedObserver<WebStateList, WebStateListObserver> web_state_list_observer_; + base::ScopedObservation<WebStateList, WebStateListObserver> + web_state_list_observation_{this}; DISALLOW_COPY_AND_ASSIGN(WebStateListFaviconDriverObserver); };
diff --git a/ios/chrome/browser/web_state_list/web_state_list_favicon_driver_observer.mm b/ios/chrome/browser/web_state_list/web_state_list_favicon_driver_observer.mm index 4a2e1f1..cb8edbc 100644 --- a/ios/chrome/browser/web_state_list/web_state_list_favicon_driver_observer.mm +++ b/ios/chrome/browser/web_state_list/web_state_list_favicon_driver_observer.mm
@@ -15,8 +15,8 @@ WebStateListFaviconDriverObserver::WebStateListFaviconDriverObserver( WebStateList* web_state_list, id<WebStateFaviconDriverObserver> observer) - : favicon_observer_(observer), web_state_list_observer_(this) { - web_state_list_observer_.Add(web_state_list); + : favicon_observer_(observer) { + web_state_list_observation_.Observe(web_state_list); for (int i = 0; i < web_state_list->count(); ++i) AddNewWebState(web_state_list->GetWebStateAt(i)); }
diff --git a/ios/chrome/browser/widget_kit/OWNERS b/ios/chrome/browser/widget_kit/OWNERS index 1bc5676e..93ecef3 100644 --- a/ios/chrome/browser/widget_kit/OWNERS +++ b/ios/chrome/browser/widget_kit/OWNERS
@@ -1 +1 @@ -javierrobles@chromium.org \ No newline at end of file +javierrobles@chromium.org
diff --git a/ios/chrome/content_widget_extension/OWNERS b/ios/chrome/content_widget_extension/OWNERS index f566e77..3ebff38d 100644 --- a/ios/chrome/content_widget_extension/OWNERS +++ b/ios/chrome/content_widget_extension/OWNERS
@@ -1 +1 @@ -olivierrobin@chromium.org \ No newline at end of file +olivierrobin@chromium.org
diff --git a/ios/chrome/search_widget_extension/OWNERS b/ios/chrome/search_widget_extension/OWNERS index f566e77..3ebff38d 100644 --- a/ios/chrome/search_widget_extension/OWNERS +++ b/ios/chrome/search_widget_extension/OWNERS
@@ -1 +1 @@ -olivierrobin@chromium.org \ No newline at end of file +olivierrobin@chromium.org
diff --git a/ios/chrome/share_extension/OWNERS b/ios/chrome/share_extension/OWNERS index f566e77..3ebff38d 100644 --- a/ios/chrome/share_extension/OWNERS +++ b/ios/chrome/share_extension/OWNERS
@@ -1 +1 @@ -olivierrobin@chromium.org \ No newline at end of file +olivierrobin@chromium.org
diff --git a/ios/chrome/test/wpt/tools/run_cwt_chromedriver.py b/ios/chrome/test/wpt/tools/run_cwt_chromedriver.py index 02000b1..ece697f 100755 --- a/ios/chrome/test/wpt/tools/run_cwt_chromedriver.py +++ b/ios/chrome/test/wpt/tools/run_cwt_chromedriver.py
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # 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.
diff --git a/ios/chrome/test/wpt/tools/run_fuzz_test.py b/ios/chrome/test/wpt/tools/run_fuzz_test.py index c576807..f0ab5d8 100755 --- a/ios/chrome/test/wpt/tools/run_fuzz_test.py +++ b/ios/chrome/test/wpt/tools/run_fuzz_test.py
@@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # Copyright 2021 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.
diff --git a/ios/components/security_interstitials/ios_blocking_page_tab_helper.h b/ios/components/security_interstitials/ios_blocking_page_tab_helper.h index 238a5ce7..9a5a160d 100644 --- a/ios/components/security_interstitials/ios_blocking_page_tab_helper.h +++ b/ios/components/security_interstitials/ios_blocking_page_tab_helper.h
@@ -5,7 +5,7 @@ #ifndef IOS_COMPONENTS_SECURITY_INTERSTITIALS_IOS_BLOCKING_PAGE_TAB_HELPER_H_ #define IOS_COMPONENTS_SECURITY_INTERSTITIALS_IOS_BLOCKING_PAGE_TAB_HELPER_H_ -#include "base/scoped_observer.h" +#include "base/scoped_observation.h" #include "ios/components/security_interstitials/ios_security_interstitial_page.h" #include "ios/web/public/web_state_observer.h" #import "ios/web/public/web_state_user_data.h" @@ -74,7 +74,8 @@ void WebStateDestroyed(web::WebState* web_state) override; IOSBlockingPageTabHelper* tab_helper_ = nullptr; - ScopedObserver<web::WebState, web::WebStateObserver> scoped_observer_{this}; + base::ScopedObservation<web::WebState, web::WebStateObserver> + scoped_observation_{this}; }; // The navigation ID of the last committed navigation. Used to associate
diff --git a/ios/components/security_interstitials/ios_blocking_page_tab_helper.mm b/ios/components/security_interstitials/ios_blocking_page_tab_helper.mm index f207fc4..71ae88b0b 100644 --- a/ios/components/security_interstitials/ios_blocking_page_tab_helper.mm +++ b/ios/components/security_interstitials/ios_blocking_page_tab_helper.mm
@@ -91,7 +91,7 @@ IOSBlockingPageTabHelper* tab_helper) : tab_helper_(tab_helper) { DCHECK(tab_helper_); - scoped_observer_.Add(web_state); + scoped_observation_.Observe(web_state); } IOSBlockingPageTabHelper::CommittedNavigationIDListener:: @@ -113,7 +113,8 @@ void IOSBlockingPageTabHelper::CommittedNavigationIDListener::WebStateDestroyed( web::WebState* web_state) { - scoped_observer_.Remove(web_state); + DCHECK(scoped_observation_.IsObservingSource(web_state)); + scoped_observation_.Reset(); } } // namespace security_interstitials
diff --git a/ios/public/provider/chrome/browser/discover_feed/OWNERS b/ios/public/provider/chrome/browser/discover_feed/OWNERS index 7f6375d3..90c007a 100644 --- a/ios/public/provider/chrome/browser/discover_feed/OWNERS +++ b/ios/public/provider/chrome/browser/discover_feed/OWNERS
@@ -1,2 +1,2 @@ sczs@chromium.org -gogerald@chromium.org \ No newline at end of file +gogerald@chromium.org
diff --git a/ios/showcase/first_run/OWNERS b/ios/showcase/first_run/OWNERS index cb5cffd..ec01c242 100644 --- a/ios/showcase/first_run/OWNERS +++ b/ios/showcase/first_run/OWNERS
@@ -1 +1 @@ -gujen@google.com \ No newline at end of file +gujen@google.com
diff --git a/ios/testing/data/http_server_files/simple_login_form.html b/ios/testing/data/http_server_files/simple_login_form.html index aee39422..912b2ca 100644 --- a/ios/testing/data/http_server_files/simple_login_form.html +++ b/ios/testing/data/http_server_files/simple_login_form.html
@@ -3,8 +3,8 @@ <html><body> Login form. <form name='login_form' id='signup_form' action='https://google.com/'> -<input type='text' name='username' id='un' value='Eguser'> -<input type='password' name='password' id='pw' value='Egpass'> -<button id='submit_button' value='Submit'>SubForm</button> + <input type='text' name='username' id='un' value='Eguser'><br/> + <input type='password' name='password' id='pw' value='Egpass'><br/> + <button id='submit_button' value='Submit'>SubForm</button> </form> </body></html>
diff --git a/ios/testing/data/http_server_files/simple_signup_form.html b/ios/testing/data/http_server_files/simple_signup_form.html index a226f0d..7f5f478 100644 --- a/ios/testing/data/http_server_files/simple_signup_form.html +++ b/ios/testing/data/http_server_files/simple_signup_form.html
@@ -3,8 +3,8 @@ <html><body> Signup form. <form name='signup_form' id='signup_form' action='https://google.com/'> -<input type='text' name='username' id='un' value='Eguser'> -<input type='password' name='new-password' id='pw' autocomplete='new-password'> -<button id='submit_button' value='Submit'>SubForm</button> + <input type='text' name='username' id='un' value='Eguser'><br/> + <input type='password' name='new-password' id='pw' autocomplete='new-password'><br/> + <button id='submit_button' value='Submit'>SubForm</button> </form> </body></html>
diff --git a/ios/third_party/gtx/OWNERS b/ios/third_party/gtx/OWNERS index 35e99669..3d38a67a2 100644 --- a/ios/third_party/gtx/OWNERS +++ b/ios/third_party/gtx/OWNERS
@@ -1,2 +1,2 @@ -lindsayw@google.com -rohitrao@google.com \ No newline at end of file +lindsayw@chromium.org +rohitrao@chromium.org
diff --git a/ios/web/common/user_agent.h b/ios/web/common/user_agent.h index 91755e7..fe205e7 100644 --- a/ios/web/common/user_agent.h +++ b/ios/web/common/user_agent.h
@@ -7,8 +7,6 @@ #include <string> -#import <UIKit/UIKit.h> - namespace web { // Enum type specifying a user agent's type.
diff --git a/ios/web/public/web_client.h b/ios/web/public/web_client.h index 5ae62d0..f8148ee7f 100644 --- a/ios/web/public/web_client.h +++ b/ios/web/public/web_client.h
@@ -24,6 +24,7 @@ class GURL; +@protocol UITraitEnvironment; @class UIWebView; @class NSString;
diff --git a/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc b/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc index 7e431f5..e70ff952 100644 --- a/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc +++ b/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "media/capture/video/chromeos/camera_hal_dispatcher_impl.h" + #include <fcntl.h> #include <grp.h> #include <poll.h> @@ -26,6 +27,7 @@ #include "components/device_event_log/device_event_log.h" #include "media/base/bind_to_current_loop.h" #include "media/capture/video/chromeos/mojom/camera_common.mojom.h" +#include "media/capture/video/chromeos/mojom/cros_camera_client.mojom.h" #include "media/capture/video/chromeos/video_capture_features_chromeos.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/platform/named_platform_channel.h"
diff --git a/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc b/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc index 565068e..f7b0265c 100644 --- a/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc +++ b/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc
@@ -14,6 +14,7 @@ #include "base/synchronization/waitable_event.h" #include "base/test/task_environment.h" #include "media/capture/video/chromeos/mojom/camera_common.mojom.h" +#include "media/capture/video/chromeos/mojom/cros_camera_client.mojom.h" #include "media/capture/video/chromeos/mojom/cros_camera_service.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc b/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc index ef4ea79..4c51ffe 100644 --- a/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc +++ b/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc
@@ -14,6 +14,7 @@ #include "mojo/public/cpp/system/wait.h" #include "mojo/public/cpp/test_support/test_utils.h" #include "mojo/public/interfaces/bindings/tests/sample_factory.mojom.h" +#include "mojo/public/interfaces/bindings/tests/sample_import.mojom.h" #include "testing/gtest/include/gtest/gtest.h" namespace mojo {
diff --git a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py index f6c3f236..74bafc9 100644 --- a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py +++ b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -728,14 +728,15 @@ def _IsFullHeaderRequiredForImport(self, imported_module): """Determines whether a given import module requires a full header include, or if the forward header is sufficient. The full header is required if any - imported structs, unions, interfaces, or typemapped types are referenced by + imported structs, unions, or typemapped types are referenced by the module we're generating bindings for; or if an imported enum is used as a map key.""" def requires_full_header(kind): if (mojom.IsUnionKind(kind) or mojom.IsStructKind(kind) - or mojom.IsInterfaceKind(kind) or self._IsTypemappedKind(kind)): + or self._IsTypemappedKind(kind)): return True + if mojom.IsEnumKind(kind): # Blink bindings need the full header for an enum used as a map key. # This is uncommon enough that we set the requirement generically for @@ -746,6 +747,10 @@ return False for spec, kind in imported_module.kinds.items(): + if kind.module != imported_module: + # If it wasn't defined directly in the imported module, it doesn't + # affect whether we need the module or not. + continue if spec in self.module.imported_kinds and requires_full_header(kind): return True return False
diff --git a/net/disk_cache/simple/simple_backend_impl.cc b/net/disk_cache/simple/simple_backend_impl.cc index b2b7777..75ef840 100644 --- a/net/disk_cache/simple/simple_backend_impl.cc +++ b/net/disk_cache/simple/simple_backend_impl.cc
@@ -137,13 +137,11 @@ if (!backend) return; - base::RepeatingCallback<void(int)> copyable_callback; - if (operation_callback) - copyable_callback = - base::AdaptCallbackForRepeating(std::move(operation_callback)); - const int operation_result = std::move(operation).Run(copyable_callback); - if (operation_result != net::ERR_IO_PENDING && copyable_callback) - copyable_callback.Run(operation_result); + auto split_callback = base::SplitOnceCallback(std::move(operation_callback)); + const int operation_result = + std::move(operation).Run(std::move(split_callback.first)); + if (operation_result != net::ERR_IO_PENDING && split_callback.second) + std::move(split_callback.second).Run(operation_result); } // Same but for things that work with EntryResult. @@ -154,13 +152,13 @@ if (!backend) return; - base::RepeatingCallback<void(EntryResult)> copyable_callback; - if (operation_callback) - copyable_callback = - base::AdaptCallbackForRepeating(std::move(operation_callback)); - EntryResult operation_result = std::move(operation).Run(copyable_callback); - if (operation_result.net_error() != net::ERR_IO_PENDING && copyable_callback) - copyable_callback.Run(std::move(operation_result)); + auto split_callback = base::SplitOnceCallback(std::move(operation_callback)); + EntryResult operation_result = + std::move(operation).Run(std::move(split_callback.first)); + if (operation_result.net_error() != net::ERR_IO_PENDING && + split_callback.second) { + std::move(split_callback.second).Run(std::move(operation_result)); + } } void RecordIndexLoad(net::CacheType cache_type, @@ -592,27 +590,26 @@ if (!hashes_to_enumerate_) hashes_to_enumerate_ = backend_->index()->GetAllHashes(); - auto copyable_callback = - base::AdaptCallbackForRepeating(std::move(callback)); - while (!hashes_to_enumerate_->empty()) { uint64_t entry_hash = hashes_to_enumerate_->back(); hashes_to_enumerate_->pop_back(); if (backend_->index()->Has(entry_hash)) { - EntryResultCallback continue_iteration = - base::BindOnce(&SimpleIterator::CheckIterationReturnValue, - weak_factory_.GetWeakPtr(), copyable_callback); + auto split_callback = base::SplitOnceCallback(std::move(callback)); + callback = std::move(split_callback.first); + EntryResultCallback continue_iteration = base::BindOnce( + &SimpleIterator::CheckIterationReturnValue, + weak_factory_.GetWeakPtr(), std::move(split_callback.second)); EntryResult open_result = backend_->OpenEntryFromHash( entry_hash, std::move(continue_iteration)); if (open_result.net_error() == net::ERR_IO_PENDING) return; if (open_result.net_error() != net::ERR_FAILED) { - copyable_callback.Run(std::move(open_result)); + std::move(callback).Run(std::move(open_result)); return; } } } - copyable_callback.Run(EntryResult::MakeError(net::ERR_FAILED)); + std::move(callback).Run(EntryResult::MakeError(net::ERR_FAILED)); } void CheckIterationReturnValue(EntryResultCallback callback,
diff --git a/net/http/mock_http_cache.cc b/net/http/mock_http_cache.cc index 541dce74..e6ea9bce 100644 --- a/net/http/mock_http_cache.cc +++ b/net/http/mock_http_cache.cc
@@ -436,13 +436,10 @@ net::RequestPriority request_priority, EntryResultCallback callback) { DCHECK(!callback.is_null()); - base::RepeatingCallback<void(EntryResult)> copyable_callback; - if (callback) - copyable_callback = base::AdaptCallbackForRepeating(std::move(callback)); if (force_fail_callback_later_) { CallbackLater(base::BindOnce( - copyable_callback, + std::move(callback), EntryResult::MakeError(ERR_CACHE_OPEN_OR_CREATE_FAILURE))); return EntryResult::MakeError(ERR_IO_PENDING); } @@ -453,12 +450,13 @@ EntryResult result; // First try opening the entry. - result = OpenEntry(key, request_priority, copyable_callback); + auto split_callback = base::SplitOnceCallback(std::move(callback)); + result = OpenEntry(key, request_priority, std::move(split_callback.first)); if (result.net_error() == OK || result.net_error() == ERR_IO_PENDING) return result; // Unable to open, try creating the entry. - result = CreateEntry(key, request_priority, copyable_callback); + result = CreateEntry(key, request_priority, std::move(split_callback.second)); if (result.net_error() == OK || result.net_error() == ERR_IO_PENDING) return result;
diff --git a/net/socket/websocket_transport_client_socket_pool.cc b/net/socket/websocket_transport_client_socket_pool.cc index 6f96c9b..37488be8 100644 --- a/net/socket/websocket_transport_client_socket_pool.cc +++ b/net/socket/websocket_transport_client_socket_pool.cc
@@ -423,24 +423,21 @@ stalled_request_queue_.pop_front(); stalled_request_map_.erase(request.handle); - // Wrap request.callback into a copyable (repeating) callback so that it can - // be passed to RequestSocket() and yet called if RequestSocket() returns - // synchronously. - auto copyable_callback = - base::AdaptCallbackForRepeating(std::move(request.callback)); + auto split_callback = base::SplitOnceCallback(std::move(request.callback)); int rv = RequestSocket( request.group_id, request.params, request.proxy_annotation_tag, request.priority, SocketTag(), // Stalled requests can't have |respect_limits| // DISABLED. - RespectLimits::ENABLED, request.handle, copyable_callback, + RespectLimits::ENABLED, request.handle, std::move(split_callback.first), request.proxy_auth_callback, request.net_log); // ActivateStalledRequest() never returns synchronously, so it is never // called re-entrantly. if (rv != ERR_IO_PENDING) - InvokeUserCallbackLater(request.handle, copyable_callback, rv); + InvokeUserCallbackLater(request.handle, std::move(split_callback.second), + rv); } }
diff --git a/net/test/embedded_test_server/http_connection.cc b/net/test/embedded_test_server/http_connection.cc index 5077814..1211e1f 100644 --- a/net/test/embedded_test_server/http_connection.cc +++ b/net/test/embedded_test_server/http_connection.cc
@@ -54,14 +54,15 @@ void HttpConnection::SendInternal(base::OnceClosure callback, scoped_refptr<DrainableIOBuffer> buf) { - base::RepeatingClosure repeating_callback = - base::AdaptCallbackForRepeating(std::move(callback)); while (buf->BytesRemaining() > 0) { - int rv = socket_->Write( - buf.get(), buf->BytesRemaining(), - base::BindOnce(&HttpConnection::OnSendInternalDone, - base::Unretained(this), repeating_callback, buf), - TRAFFIC_ANNOTATION_FOR_TESTS); + auto split_callback = base::SplitOnceCallback(std::move(callback)); + callback = std::move(split_callback.first); + int rv = + socket_->Write(buf.get(), buf->BytesRemaining(), + base::BindOnce(&HttpConnection::OnSendInternalDone, + base::Unretained(this), + std::move(split_callback.second), buf), + TRAFFIC_ANNOTATION_FOR_TESTS); if (rv == ERR_IO_PENDING) return; @@ -72,7 +73,7 @@ // The HttpConnection will be deleted by the callback since we only need to // serve a single request. - repeating_callback.Run(); + std::move(callback).Run(); } void HttpConnection::OnSendInternalDone(base::OnceClosure callback,
diff --git a/net/websockets/websocket_deflate_stream_test.cc b/net/websockets/websocket_deflate_stream_test.cc index 4f803427..6abcbff7 100644 --- a/net/websockets/websocket_deflate_stream_test.cc +++ b/net/websockets/websocket_deflate_stream_test.cc
@@ -74,28 +74,12 @@ class MockWebSocketStream : public WebSocketStream { public: - // GMock cannot save or forward move-only types like CompletionOnceCallback, - // therefore they have to be converted into a copyable type like - // CompletionRepeatingCallback. - int ReadFrames(std::vector<std::unique_ptr<WebSocketFrame>>* frames, - CompletionOnceCallback callback) { - return ReadFramesInternal( - frames, callback ? base::AdaptCallbackForRepeating(std::move(callback)) - : CompletionRepeatingCallback()); - } - int WriteFrames(std::vector<std::unique_ptr<WebSocketFrame>>* frames, - CompletionOnceCallback callback) { - return WriteFramesInternal( - frames, callback ? base::AdaptCallbackForRepeating(std::move(callback)) - : CompletionRepeatingCallback()); - } - - MOCK_METHOD2(ReadFramesInternal, + MOCK_METHOD2(ReadFrames, int(std::vector<std::unique_ptr<WebSocketFrame>>*, - const CompletionRepeatingCallback&)); - MOCK_METHOD2(WriteFramesInternal, + CompletionOnceCallback)); + MOCK_METHOD2(WriteFrames, int(std::vector<std::unique_ptr<WebSocketFrame>>*, - const CompletionRepeatingCallback&)); + CompletionOnceCallback)); MOCK_METHOD0(Close, void()); MOCK_CONST_METHOD0(GetSubProtocol, std::string()); @@ -321,23 +305,23 @@ } int Call(std::vector<std::unique_ptr<WebSocketFrame>>* frames, - const CompletionRepeatingCallback& callback) { + CompletionOnceCallback callback) { DCHECK(frames->empty()); frames_passed_ = frames; - callback_ = callback; + callback_ = std::move(callback); frames->swap(frames_to_output_); return result_; } int result() const { return result_; } - const CompletionRepeatingCallback& callback() const { return callback_; } + CompletionOnceCallback& callback() { return callback_; } std::vector<std::unique_ptr<WebSocketFrame>>* frames_passed() { return frames_passed_; } private: int result_; - CompletionRepeatingCallback callback_; + CompletionOnceCallback callback_; std::vector<std::unique_ptr<WebSocketFrame>> frames_to_output_; std::vector<std::unique_ptr<WebSocketFrame>>* frames_passed_; }; @@ -352,22 +336,22 @@ : result_(result), predictor_(predictor) {} int Call(std::vector<std::unique_ptr<WebSocketFrame>>* frames, - const CompletionRepeatingCallback& callback) { + CompletionOnceCallback callback) { frames_.insert(frames_.end(), std::make_move_iterator(frames->begin()), std::make_move_iterator(frames->end())); frames->clear(); - callback_ = callback; + callback_ = std::move(callback); predictor_->VerifySentFrames(frames_); return result_; } int result() const { return result_; } - const CompletionRepeatingCallback& callback() const { return callback_; } + CompletionOnceCallback& callback() { return callback_; } std::vector<std::unique_ptr<WebSocketFrame>>* frames() { return &frames_; } private: int result_; - CompletionRepeatingCallback callback_; + CompletionOnceCallback callback_; std::vector<std::unique_ptr<WebSocketFrame>> frames_; WebSocketDeflatePredictorMock* predictor_; }; @@ -376,7 +360,7 @@ std::vector<std::unique_ptr<WebSocketFrame>> frames; { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Return(ERR_FAILED)); } EXPECT_THAT(deflate_stream_->ReadFrames(&frames, CompletionOnceCallback()), @@ -394,7 +378,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } ASSERT_THAT(deflate_stream_->ReadFrames(&frames, CompletionOnceCallback()), @@ -414,7 +398,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); EXPECT_CALL(checkpoint, Run()); EXPECT_CALL(mock_callback, Run(OK)); @@ -429,7 +413,7 @@ WebSocketFrameHeader::kOpCodeText, kFinal, "hello"); - stub.callback().Run(OK); + std::move(stub.callback()).Run(OK); ASSERT_EQ(1u, frames.size()); EXPECT_EQ(WebSocketFrameHeader::kOpCodeText, frames[0]->header.opcode); EXPECT_TRUE(frames[0]->header.final); @@ -445,7 +429,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); EXPECT_CALL(checkpoint, Run()); EXPECT_CALL(mock_callback, Run(ERR_FAILED)); @@ -460,7 +444,7 @@ WebSocketFrameHeader::kOpCodeText, kFinal, "hello"); - stub.callback().Run(ERR_FAILED); + std::move(stub.callback()).Run(ERR_FAILED); ASSERT_EQ(0u, frames.size()); } @@ -474,7 +458,7 @@ std::vector<std::unique_ptr<WebSocketFrame>> frames; { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } ASSERT_THAT(deflate_stream_->ReadFrames(&frames, CompletionOnceCallback()), @@ -494,7 +478,7 @@ std::vector<std::unique_ptr<WebSocketFrame>> frames; { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); EXPECT_CALL(checkpoint, Run()); EXPECT_CALL(mock_callback, Run(OK)); @@ -508,7 +492,7 @@ WebSocketFrameHeader::kOpCodeText, kFinal | kReserved1, std::string("\xf2\x48\xcd\xc9\xc9\x07\x00", 7)); - stub.callback().Run(OK); + std::move(stub.callback()).Run(OK); ASSERT_EQ(1u, frames.size()); EXPECT_EQ(WebSocketFrameHeader::kOpCodeText, frames[0]->header.opcode); @@ -533,7 +517,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub1, &ReadFramesStub::Call)) .WillOnce(Invoke(&stub2, &ReadFramesStub::Call)); EXPECT_CALL(checkpoint, Run()); @@ -549,7 +533,7 @@ data2); checkpoint.Run(); - stub2.callback().Run(OK); + std::move(stub2.callback()).Run(OK); ASSERT_EQ(1u, frames.size()); EXPECT_EQ(WebSocketFrameHeader::kOpCodeText, frames[0]->header.opcode); @@ -570,7 +554,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } ASSERT_EQ(ERR_WS_PROTOCOL_ERROR, @@ -595,7 +579,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } ASSERT_THAT(deflate_stream_->ReadFrames(&frames, CompletionOnceCallback()), @@ -620,7 +604,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } ASSERT_THAT(deflate_stream_->ReadFrames(&frames, CompletionOnceCallback()), @@ -651,7 +635,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } ASSERT_THAT(deflate_stream_->ReadFrames(&frames, CompletionOnceCallback()), @@ -679,7 +663,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } ASSERT_THAT(deflate_stream_->ReadFrames(&frames, CompletionOnceCallback()), @@ -706,7 +690,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } ASSERT_THAT(deflate_stream_->ReadFrames(&frames, CompletionOnceCallback()), @@ -739,7 +723,7 @@ std::vector<std::unique_ptr<WebSocketFrame>> frames; { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } @@ -785,7 +769,7 @@ std::vector<std::unique_ptr<WebSocketFrame>> frames; { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } @@ -823,7 +807,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } ASSERT_EQ(ERR_WS_PROTOCOL_ERROR, @@ -846,7 +830,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } ASSERT_EQ(ERR_WS_PROTOCOL_ERROR, @@ -869,7 +853,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } ASSERT_THAT(deflate_stream_->ReadFrames(&frames, CompletionOnceCallback()), @@ -900,7 +884,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } ASSERT_THAT(deflate_stream_->ReadFrames(&frames, CompletionOnceCallback()), @@ -933,7 +917,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } ASSERT_THAT(deflate_stream_->ReadFrames(&frames, CompletionOnceCallback()), @@ -966,7 +950,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(&stub, &ReadFramesStub::Call)); } ASSERT_THAT(deflate_stream_->ReadFrames(&frames, CompletionOnceCallback()), @@ -992,10 +976,10 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(stub_vector[0].get(), &ReadFramesStub::Call)); - EXPECT_CALL(*mock_stream_, ReadFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, ReadFrames(&frames, _)) .WillOnce(Invoke(stub_vector[1].get(), &ReadFramesStub::Call)); EXPECT_CALL(mock_callback, Run(OK)); @@ -1007,12 +991,12 @@ WebSocketFrameHeader::kOpCodeText, kReserved1, std::string()); - stub_vector[0]->callback().Run(OK); + std::move(stub_vector[0]->callback()).Run(OK); AppendTo(stub_vector[1]->frames_passed(), WebSocketFrameHeader::kOpCodeContinuation, kFinal, std::string("\x02\x00")); - stub_vector[1]->callback().Run(OK); + std::move(stub_vector[1]->callback()).Run(OK); ASSERT_EQ(1u, frames.size()); EXPECT_EQ(WebSocketFrameHeader::kOpCodeText, frames[0]->header.opcode); EXPECT_EQ("", ToString(frames[0])); @@ -1022,7 +1006,7 @@ std::vector<std::unique_ptr<WebSocketFrame>> frames; { InSequence s; - EXPECT_CALL(*mock_stream_, WriteFramesInternal(&frames, _)).Times(0); + EXPECT_CALL(*mock_stream_, WriteFrames(&frames, _)).Times(0); } EXPECT_THAT(deflate_stream_->WriteFrames(&frames, CompletionOnceCallback()), IsOk()); @@ -1032,7 +1016,7 @@ std::vector<std::unique_ptr<WebSocketFrame>> frames; { InSequence s; - EXPECT_CALL(*mock_stream_, WriteFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, WriteFrames(&frames, _)) .WillOnce(Return(ERR_FAILED)); } @@ -1050,7 +1034,7 @@ predictor_->AddFramesToBeInput(frames); { InSequence s; - EXPECT_CALL(*mock_stream_, WriteFramesInternal(_, _)) + EXPECT_CALL(*mock_stream_, WriteFrames(_, _)) .WillOnce(Invoke(&stub, &WriteFramesStub::Call)); } ASSERT_THAT(deflate_stream_->WriteFrames(&frames, CompletionOnceCallback()), @@ -1072,7 +1056,7 @@ std::vector<std::unique_ptr<WebSocketFrame>> frames; { InSequence s; - EXPECT_CALL(*mock_stream_, WriteFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, WriteFrames(&frames, _)) .WillOnce(Invoke(&stub, &WriteFramesStub::Call)); EXPECT_CALL(checkpoint, Run()); EXPECT_CALL(mock_callback, Run(OK)); @@ -1083,7 +1067,7 @@ IsError(ERR_IO_PENDING)); checkpoint.Run(); - stub.callback().Run(OK); + std::move(stub.callback()).Run(OK); const std::vector<std::unique_ptr<WebSocketFrame>>& frames_passed = *stub.frames(); @@ -1105,7 +1089,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, WriteFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, WriteFrames(&frames, _)) .WillOnce(Invoke(&stub, &WriteFramesStub::Call)); } ASSERT_THAT(deflate_stream_->WriteFrames(&frames, CompletionOnceCallback()), @@ -1131,7 +1115,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, WriteFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, WriteFrames(&frames, _)) .WillOnce(Invoke(&stub, &WriteFramesStub::Call)); } ASSERT_THAT(deflate_stream_->WriteFrames(&frames, CompletionOnceCallback()), @@ -1156,7 +1140,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, WriteFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, WriteFrames(&frames, _)) .WillOnce(Invoke(&stub, &WriteFramesStub::Call)); } ASSERT_THAT(deflate_stream_->WriteFrames(&frames, CompletionOnceCallback()), @@ -1183,7 +1167,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, WriteFramesInternal(_, _)) + EXPECT_CALL(*mock_stream_, WriteFrames(_, _)) .WillRepeatedly(Invoke(&stub, &WriteFramesStub::Call)); } std::vector<std::unique_ptr<WebSocketFrame>> total_compressed_frames; @@ -1246,7 +1230,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, WriteFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, WriteFrames(&frames, _)) .WillOnce(Invoke(&stub, &WriteFramesStub::Call)); } ASSERT_THAT(deflate_stream_->WriteFrames(&frames, CompletionOnceCallback()), @@ -1275,7 +1259,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, WriteFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, WriteFrames(&frames, _)) .WillOnce(Invoke(&stub, &WriteFramesStub::Call)); } ASSERT_THAT(deflate_stream_->WriteFrames(&frames, CompletionOnceCallback()), @@ -1312,7 +1296,7 @@ { InSequence s; - EXPECT_CALL(*mock_stream_, WriteFramesInternal(&frames, _)) + EXPECT_CALL(*mock_stream_, WriteFrames(&frames, _)) .WillOnce(Invoke(&stub, &WriteFramesStub::Call)); } ASSERT_THAT(deflate_stream_->WriteFrames(&frames, CompletionOnceCallback()), @@ -1355,7 +1339,7 @@ WriteFramesStub stub(predictor_, OK); { InSequence s; - EXPECT_CALL(*mock_stream_, WriteFramesInternal(_, _)) + EXPECT_CALL(*mock_stream_, WriteFrames(_, _)) .WillOnce(Invoke(&stub, &WriteFramesStub::Call)); } ASSERT_THAT(deflate_stream_->WriteFrames(&frames_, CompletionOnceCallback()), @@ -1375,7 +1359,7 @@ WriteFramesStub stub(predictor_, OK); { InSequence s; - EXPECT_CALL(*mock_stream_, WriteFramesInternal(_, _)) + EXPECT_CALL(*mock_stream_, WriteFrames(_, _)) .WillOnce(Invoke(&stub, &WriteFramesStub::Call)); } ASSERT_THAT(deflate_stream_->WriteFrames(&frames_, CompletionOnceCallback()),
diff --git a/remoting/DIR_METADATA b/remoting/DIR_METADATA index 17a9dc5..1f0a2c0f7 100644 --- a/remoting/DIR_METADATA +++ b/remoting/DIR_METADATA
@@ -1,10 +1,10 @@ # Metadata information for this directory. # # For more information on DIR_METADATA files, see: -# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/README.md +# https://source.chromium.org/chromium/infra/infra/+/main:go/src/infra/tools/dirmd/README.md # # For the schema of this file, see Metadata message: -# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/proto/dir_metadata.proto +# https://source.chromium.org/chromium/infra/infra/+/main:go/src/infra/tools/dirmd/proto/dir_metadata.proto monorail { component: "Services>Chromoting"
diff --git a/remoting/host/BUILD.gn b/remoting/host/BUILD.gn index 8fae6f4..e519803 100644 --- a/remoting/host/BUILD.gn +++ b/remoting/host/BUILD.gn
@@ -3,7 +3,6 @@ # found in the LICENSE file. import("//build/config/chromeos/ui_mode.gni") -import("//build/config/python.gni") import("//build/util/process_version.gni") import("//remoting/build/config/remoting_build.gni") import("//remoting/build/config/remoting_logging.gni") @@ -816,8 +815,7 @@ } } - # TODO(crbug.com/1112471): Get this to run cleanly under Python 3. - python2_action_foreach("remoting_native_messaging_manifests") { + action_foreach("remoting_native_messaging_manifests") { if (is_mac) { me2me_host_path = "/Library/PrivilegedHelperTools/$me2me_host_bundle_name/Contents/MacOS/$native_messaging_host_bundle_name/Contents/MacOS/native_messaging_host" it2me_host_path = "/Library/PrivilegedHelperTools/$me2me_host_bundle_name/Contents/MacOS/$remote_assistance_host_bundle_name/Contents/MacOS/remote_assistance_host" @@ -859,9 +857,8 @@ ] } - # TODO(crbug.com/1112471): Get this to run cleanly under Python 3. if (is_mac) { - python2_action_foreach("remoting_infoplist_strings") { + action_foreach("remoting_infoplist_strings") { sources = [ "installer/mac/uninstaller/remoting_uninstaller-InfoPlist.strings.jinja2", "it2me/remote_assistance_host-InfoPlist.strings.jinja2",
diff --git a/remoting/ios/app/resources/BUILD.gn b/remoting/ios/app/resources/BUILD.gn index 700d36d..0e1d763b 100644 --- a/remoting/ios/app/resources/BUILD.gn +++ b/remoting/ios/app/resources/BUILD.gn
@@ -5,7 +5,6 @@ import("//build/config/chrome_build.gni") import("//build/config/ios/asset_catalog.gni") import("//build/config/ios/rules.gni") -import("//build/config/python.gni") import("//remoting/build/config/remoting_build.gni") import("//remoting/remoting_locales.gni") @@ -88,8 +87,7 @@ # i18n -# TODO(crbug.com/1112471): Get this to run cleanly under Python 3. -python2_action("infoplist_strings") { +action("infoplist_strings") { _source = "InfoPlist.strings.jinja2" sources = [ _source ]
diff --git a/remoting/tools/build/remoting_localize.gni b/remoting/tools/build/remoting_localize.gni index 1b4faf3..d354639 100644 --- a/remoting/tools/build/remoting_localize.gni +++ b/remoting/tools/build/remoting_localize.gni
@@ -2,8 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/python.gni") - # Calls the remoting_localize script with a jinja2 template. # # Arguments @@ -35,8 +33,7 @@ # deps (optional) # visibility (optional) template("remoting_localize") { - # TODO(crbug.com/1112471): Get this to run cleanly under Python 3. - python2_action_foreach(target_name) { + action_foreach(target_name) { if (defined(invoker.visibility)) { visibility = invoker.visibility }
diff --git a/remoting/tools/build/remoting_localize.py b/remoting/tools/build/remoting_localize.py index 0942fd1..13d26af 100755 --- a/remoting/tools/build/remoting_localize.py +++ b/remoting/tools/build/remoting_localize.py
@@ -585,7 +585,7 @@ values = {} for key in messages.keys(): - values[key] = unicode(messages[key]['message']); + values[key] = messages[key]['message']; return values
diff --git a/rlz/lib/rlz_lib_test.cc b/rlz/lib/rlz_lib_test.cc index 1188cdd..9e1fef6 100644 --- a/rlz/lib/rlz_lib_test.cc +++ b/rlz/lib/rlz_lib_test.cc
@@ -1104,6 +1104,7 @@ TEST_F(RlzLibTest, SetRlzPingSent) { TestDebugDaemonClient* debug_daemon_client = new TestDebugDaemonClient; + chromeos::DBusThreadManager::Initialize(); chromeos::DBusThreadManager::GetSetterForTesting()->SetDebugDaemonClient( std::unique_ptr<chromeos::DebugDaemonClient>(debug_daemon_client)); const char* kPingResponse = @@ -1124,6 +1125,7 @@ rlz_lib::ParsePingResponse(rlz_lib::TOOLBAR_NOTIFIER, kPingResponse)); EXPECT_EQ(debug_daemon_client->num_set_rlz_ping_sent(), 1 + rlz_lib::RlzValueStoreChromeOS::kMaxRetryCount); + chromeos::DBusThreadManager::Shutdown(); } TEST_F(RlzLibTest, NoRecordCAFEvent) {
diff --git a/services/data_decoder/public/cpp/data_decoder.h b/services/data_decoder/public/cpp/data_decoder.h index eb89bcb..f0f0080 100644 --- a/services/data_decoder/public/cpp/data_decoder.h +++ b/services/data_decoder/public/cpp/data_decoder.h
@@ -16,6 +16,10 @@ #include "services/data_decoder/public/mojom/data_decoder_service.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" +namespace mojo_base { +class BigBuffer; +} + namespace data_decoder { // Encapsulates an exclusive connection to an isolated instance of the Data
diff --git a/services/network/network_context_unittest.cc b/services/network/network_context_unittest.cc index b45f47f7..20c90d0 100644 --- a/services/network/network_context_unittest.cc +++ b/services/network/network_context_unittest.cc
@@ -121,6 +121,8 @@ #include "services/network/public/mojom/net_log.mojom.h" #include "services/network/public/mojom/network_context.mojom.h" #include "services/network/public/mojom/network_service.mojom.h" +#include "services/network/public/mojom/p2p.mojom.h" +#include "services/network/public/mojom/p2p_trusted.mojom.h" #include "services/network/public/mojom/proxy_config.mojom.h" #include "services/network/public/mojom/url_loader.mojom-shared.h" #include "services/network/test/fake_test_cert_verifier_params_factory.h"
diff --git a/services/network/network_service.cc b/services/network/network_service.cc index 65ac4fb..1fea71a 100644 --- a/services/network/network_service.cc +++ b/services/network/network_service.cc
@@ -64,6 +64,7 @@ #include "services/network/public/cpp/initiator_lock_compatibility.h" #include "services/network/public/cpp/load_info_util.h" #include "services/network/public/cpp/network_switches.h" +#include "services/network/public/mojom/network_service_test.mojom.h" #include "services/network/url_loader.h" #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
diff --git a/services/network/public/mojom/client_security_state.mojom b/services/network/public/mojom/client_security_state.mojom index 38c70be..fcd7c59 100644 --- a/services/network/public/mojom/client_security_state.mojom +++ b/services/network/public/mojom/client_security_state.mojom
@@ -9,21 +9,26 @@ // How to treat private network requests. // -// Private network requests are any requests to a resource served by a -// non-public IP address. +// Private network requests are requests from a less-private IP address space +// to a more-private IP address space. Concretely: // -// See the CORS-RFC1918 spec for details: https://wicg.github.io/cors-rfc1918. +// - unknown to private +// - unknown to local +// - public to private +// - public to local +// - private to local +// +// See the definition in the Private Network Access specification: +// https://wicg.github.io/private-network-access/#ip-address-space enum PrivateNetworkRequestPolicy { - // Allow all requests. + // Allow the requests. kAllow, - // Forbid requests to more-private address spaces than that of the initiator, - // when the initiator is not in a secure context. - kBlockFromInsecureToMorePrivate, + // Allow the requests, and display a warning in DevTools. + kWarn, - // Warn about requests to more-private address spaces than that of the - // initiator when the initiator is not in a secure context. - kWarnFromInsecureToMorePrivate, + // Block the requests with a CORS error. + kBlock, }; struct ClientSecurityState {
diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc index 355ba10..9f5850c 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc
@@ -1041,7 +1041,8 @@ if (options_ & mojom::kURLLoadOptionBlockLocalRequest && IsLessPublicAddressSpace(resource_address_space, network::mojom::IPAddressSpace::kPublic)) { - DVLOG(1) << "CORS-RFC1918 check: failed due to loader options."; + // Unconditionally block requests to non-public address spaces when the URL + // loader options say so. return false; } @@ -1050,62 +1051,43 @@ // a factory) or the URLLoaderFactory's params. We prefer the factory params // over the request params, as the former always come from the browser // process. - // - // We use a raw pointer instead of a const-ref to a StructPtr in order to be - // able to assign a new value to the variable. A ternary operator would let us - // define a const-ref but would prevent logging which branch was taken. - const mojom::ClientSecurityState* security_state = - factory_params_->client_security_state.get(); - if (security_state) { - DVLOG(1) << "CORS-RFC1918 check: using factory client security state."; - } else { - DVLOG(1) << "CORS-RFC1918 check: using request client security state."; - security_state = request_client_security_state_.get(); - } + const mojom::ClientSecurityStatePtr& security_state = + factory_params_->client_security_state + ? factory_params_->client_security_state + : request_client_security_state_; if (!security_state) { - DVLOG(1) << "CORS-RFC1918 check: skipped, missing client security state."; + // Missing security state: allow all requests. return true; } - DVLOG(1) << "CORS-RFC1918 check: running against client security state = { " - << "is_web_secure_context: " << security_state->is_web_secure_context - << ", ip_address_space: " << security_state->ip_address_space - << ", private_network_request_policy: " - << security_state->private_network_request_policy << " }."; + if (!IsLessPublicAddressSpace(resource_address_space, + security_state->ip_address_space)) { + // Resource is no less public than the initiator. + return true; + } bool is_warning = false; // We use a switch statement to force this code to be amended when values are // added to the PrivateNetworkRequestPolicy enum. switch (security_state->private_network_request_policy) { case mojom::PrivateNetworkRequestPolicy::kAllow: - DVLOG(1) << "CORS-RFC1918 check: unconditionally allowed."; + // Policy tells us to allow all. return true; - case mojom::PrivateNetworkRequestPolicy::kWarnFromInsecureToMorePrivate: + case mojom::PrivateNetworkRequestPolicy::kWarn: is_warning = true; break; - case mojom::PrivateNetworkRequestPolicy::kBlockFromInsecureToMorePrivate: + case mojom::PrivateNetworkRequestPolicy::kBlock: is_warning = false; break; } - if (!security_state->is_web_secure_context && - IsLessPublicAddressSpace(resource_address_space, - security_state->ip_address_space)) { - DVLOG(1) << "CORS-RFC1918 check: failed," - << (is_warning ? "but not enforcing blocking of insecure private " - "network request." - : "blocking insecure private network request."); - if (auto* devtools_observer = GetDevToolsObserver()) { - devtools_observer->OnPrivateNetworkRequest( - devtools_request_id(), url_request_->url(), is_warning, - resource_address_space, security_state->Clone()); - } - return is_warning; + if (auto* devtools_observer = GetDevToolsObserver()) { + devtools_observer->OnPrivateNetworkRequest( + devtools_request_id(), url_request_->url(), is_warning, + resource_address_space, security_state->Clone()); } - - DVLOG(1) << "CORS-RFC1918 check: success."; - return true; + return is_warning; } int URLLoader::OnConnected(net::URLRequest* url_request,
diff --git a/services/network/url_loader_unittest.cc b/services/network/url_loader_unittest.cc index bfceb7b..b9c780b 100644 --- a/services/network/url_loader_unittest.cc +++ b/services/network/url_loader_unittest.cc
@@ -466,7 +466,7 @@ auto result = mojom::ClientSecurityState::New(); result->is_web_secure_context = false; result->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kBlockFromInsecureToMorePrivate; + mojom::PrivateNetworkRequestPolicy::kBlock; result->ip_address_space = mojom::IPAddressSpace::kUnknown; return result; } @@ -1078,175 +1078,9 @@ EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); } -// These tests verify that requests from an secure page to an IP in the -// "local" address space are never blocked. - -TEST_F(URLLoaderTest, SecureUnknownToLocalIsOk) { - auto client_security_state = NewSecurityState(); - client_security_state->is_web_secure_context = true; - client_security_state->ip_address_space = mojom::IPAddressSpace::kUnknown; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -TEST_F(URLLoaderTest, SecureUnknownToLocalIsOkPolicyIsWarn) { - auto client_security_state = NewSecurityState(); - client_security_state->is_web_secure_context = true; - client_security_state->ip_address_space = mojom::IPAddressSpace::kUnknown; - client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kWarnFromInsecureToMorePrivate; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -TEST_F(URLLoaderTest, SecurePublicToLocalIsOk) { - auto client_security_state = NewSecurityState(); - client_security_state->is_web_secure_context = true; - client_security_state->ip_address_space = mojom::IPAddressSpace::kPublic; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -TEST_F(URLLoaderTest, SecurePublicToLocalIsOkPolicyIsWarn) { - auto client_security_state = NewSecurityState(); - client_security_state->is_web_secure_context = true; - client_security_state->ip_address_space = mojom::IPAddressSpace::kPublic; - client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kWarnFromInsecureToMorePrivate; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -TEST_F(URLLoaderTest, SecurePrivateToLocalIsBlocked) { - auto client_security_state = NewSecurityState(); - client_security_state->is_web_secure_context = true; - client_security_state->ip_address_space = mojom::IPAddressSpace::kPrivate; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -TEST_F(URLLoaderTest, SecurePrivateToLocalIsBlockedPolicyIsWarn) { - auto client_security_state = NewSecurityState(); - client_security_state->is_web_secure_context = true; - client_security_state->ip_address_space = mojom::IPAddressSpace::kPrivate; - client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kWarnFromInsecureToMorePrivate; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -TEST_F(URLLoaderTest, SecureLocalToLocalIsOk) { - auto client_security_state = NewSecurityState(); - client_security_state->is_web_secure_context = true; - client_security_state->ip_address_space = mojom::IPAddressSpace::kLocal; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -TEST_F(URLLoaderTest, SecureLocalToLocalIsOkPolicyIsWarn) { - auto client_security_state = NewSecurityState(); - client_security_state->is_web_secure_context = true; - client_security_state->ip_address_space = mojom::IPAddressSpace::kLocal; - client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kWarnFromInsecureToMorePrivate; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -// These tests verify that requests from any page to an IP in the "local" -// address space are never blocked when the request policy is kAllow. - -TEST_F(URLLoaderTest, PolicyIsAllowUnknownToLocalIsOk) { - auto client_security_state = NewSecurityState(); - client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kAllow; - client_security_state->ip_address_space = mojom::IPAddressSpace::kUnknown; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -TEST_F(URLLoaderTest, PolicyIsWarnUnknownToLocalIsOk) { - auto client_security_state = NewSecurityState(); - client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kWarnFromInsecureToMorePrivate; - client_security_state->ip_address_space = mojom::IPAddressSpace::kUnknown; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -TEST_F(URLLoaderTest, PolicyIsAllowPublicToLocalIsOk) { - auto client_security_state = NewSecurityState(); - client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kAllow; - client_security_state->ip_address_space = mojom::IPAddressSpace::kPublic; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -TEST_F(URLLoaderTest, PolicyIsWarnPublicToLocalIsOk) { - auto client_security_state = NewSecurityState(); - client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kWarnFromInsecureToMorePrivate; - client_security_state->ip_address_space = mojom::IPAddressSpace::kPublic; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -TEST_F(URLLoaderTest, PolicyIsAllowPrivateToLocalIsBlocked) { - auto client_security_state = NewSecurityState(); - client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kAllow; - client_security_state->ip_address_space = mojom::IPAddressSpace::kPrivate; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -TEST_F(URLLoaderTest, PolicyIsWarnPrivateToLocalIsBlocked) { - auto client_security_state = NewSecurityState(); - client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kWarnFromInsecureToMorePrivate; - client_security_state->ip_address_space = mojom::IPAddressSpace::kPrivate; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -TEST_F(URLLoaderTest, PolicyIsAllowLocalToLocalIsOk) { - auto client_security_state = NewSecurityState(); - client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kAllow; - client_security_state->ip_address_space = mojom::IPAddressSpace::kLocal; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -TEST_F(URLLoaderTest, PolicyIsWarnLocalToLocalIsOk) { - auto client_security_state = NewSecurityState(); - client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kWarnFromInsecureToMorePrivate; - client_security_state->ip_address_space = mojom::IPAddressSpace::kLocal; - set_factory_client_security_state(std::move(client_security_state)); - - EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); -} - -// These tests verify that requests from an insecure page to an IP in the -// "local" address space are blocked unless the page came from the same address -// space. In practice, the local address space contains only localhost. +// These tests verify that requests from both secure and non-secure contexts to +// an IP in the `kLocal` address space are only blocked when the policy is +// `kBlock` and the initiator's address space is not `kLocal`. // // NOTE: These tests exercise the same codepath as // URLLoaderFakeTransportInfoTest below, except they use real URLRequestJob and @@ -1254,9 +1088,9 @@ // the whole stack. OTOH, using an embedded test server prevents us from mocking // out the endpoint IP address. -TEST_F(URLLoaderTest, InsecureRequestToLocalResource) { +TEST_F(URLLoaderTest, SecureUnknownToLocalBlock) { auto client_security_state = NewSecurityState(); - client_security_state->is_web_secure_context = false; + client_security_state->is_web_secure_context = true; client_security_state->ip_address_space = mojom::IPAddressSpace::kUnknown; set_factory_client_security_state(std::move(client_security_state)); @@ -1266,9 +1100,62 @@ Optional(CorsErrorStatus(mojom::IPAddressSpace::kLocal))); } -TEST_F(URLLoaderTest, InsecurePublicToLocalIsBlocked) { +TEST_F(URLLoaderTest, SecureUnknownToLocalWarn) { auto client_security_state = NewSecurityState(); - client_security_state->is_web_secure_context = false; + client_security_state->is_web_secure_context = true; + client_security_state->ip_address_space = mojom::IPAddressSpace::kUnknown; + client_security_state->private_network_request_policy = + mojom::PrivateNetworkRequestPolicy::kWarn; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, SecureUnknownToLocalAllow) { + auto client_security_state = NewSecurityState(); + client_security_state->is_web_secure_context = true; + client_security_state->ip_address_space = mojom::IPAddressSpace::kUnknown; + client_security_state->private_network_request_policy = + mojom::PrivateNetworkRequestPolicy::kAllow; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, NonSecureUnknownToLocalBlock) { + auto client_security_state = NewSecurityState(); + client_security_state->ip_address_space = mojom::IPAddressSpace::kUnknown; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), + IsError(net::ERR_FAILED)); + EXPECT_THAT(client()->completion_status().cors_error_status, + Optional(CorsErrorStatus(mojom::IPAddressSpace::kLocal))); +} + +TEST_F(URLLoaderTest, NonSecureUnknownToLocalWarn) { + auto client_security_state = NewSecurityState(); + client_security_state->ip_address_space = mojom::IPAddressSpace::kUnknown; + client_security_state->private_network_request_policy = + mojom::PrivateNetworkRequestPolicy::kWarn; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, NonSecureUnknownToLocalAllow) { + auto client_security_state = NewSecurityState(); + client_security_state->ip_address_space = mojom::IPAddressSpace::kUnknown; + client_security_state->private_network_request_policy = + mojom::PrivateNetworkRequestPolicy::kAllow; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, SecurePublicToLocalBlock) { + auto client_security_state = NewSecurityState(); + client_security_state->is_web_secure_context = true; client_security_state->ip_address_space = mojom::IPAddressSpace::kPublic; set_factory_client_security_state(std::move(client_security_state)); @@ -1278,9 +1165,62 @@ Optional(CorsErrorStatus(mojom::IPAddressSpace::kLocal))); } -TEST_F(URLLoaderTest, InsecurePrivateToLocalIsBlocked) { +TEST_F(URLLoaderTest, SecurePublicToLocalWarn) { auto client_security_state = NewSecurityState(); - client_security_state->is_web_secure_context = false; + client_security_state->is_web_secure_context = true; + client_security_state->ip_address_space = mojom::IPAddressSpace::kPublic; + client_security_state->private_network_request_policy = + mojom::PrivateNetworkRequestPolicy::kWarn; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, SecurePublicToLocalAllow) { + auto client_security_state = NewSecurityState(); + client_security_state->is_web_secure_context = true; + client_security_state->ip_address_space = mojom::IPAddressSpace::kPublic; + client_security_state->private_network_request_policy = + mojom::PrivateNetworkRequestPolicy::kAllow; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, NonSecurePublicToLocalBlock) { + auto client_security_state = NewSecurityState(); + client_security_state->ip_address_space = mojom::IPAddressSpace::kPublic; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), + IsError(net::ERR_FAILED)); + EXPECT_THAT(client()->completion_status().cors_error_status, + Optional(CorsErrorStatus(mojom::IPAddressSpace::kLocal))); +} + +TEST_F(URLLoaderTest, NonSecurePublicToLocalWarn) { + auto client_security_state = NewSecurityState(); + client_security_state->ip_address_space = mojom::IPAddressSpace::kPublic; + client_security_state->private_network_request_policy = + mojom::PrivateNetworkRequestPolicy::kWarn; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, NonSecurePublicToLocalAllow) { + auto client_security_state = NewSecurityState(); + client_security_state->ip_address_space = mojom::IPAddressSpace::kPublic; + client_security_state->private_network_request_policy = + mojom::PrivateNetworkRequestPolicy::kAllow; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, SecurePrivateToLocalBlock) { + auto client_security_state = NewSecurityState(); + client_security_state->is_web_secure_context = true; client_security_state->ip_address_space = mojom::IPAddressSpace::kPrivate; set_factory_client_security_state(std::move(client_security_state)); @@ -1290,21 +1230,113 @@ Optional(CorsErrorStatus(mojom::IPAddressSpace::kLocal))); } -TEST_F(URLLoaderTest, InsecureLocalToLocalIsOk) { +TEST_F(URLLoaderTest, SecurePrivateToLocalWarn) { auto client_security_state = NewSecurityState(); - client_security_state->is_web_secure_context = false; + client_security_state->is_web_secure_context = true; + client_security_state->ip_address_space = mojom::IPAddressSpace::kPrivate; + client_security_state->private_network_request_policy = + mojom::PrivateNetworkRequestPolicy::kWarn; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, SecurePrivateToLocalAllow) { + auto client_security_state = NewSecurityState(); + client_security_state->is_web_secure_context = true; + client_security_state->ip_address_space = mojom::IPAddressSpace::kPrivate; + client_security_state->private_network_request_policy = + mojom::PrivateNetworkRequestPolicy::kAllow; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, NonSecurePrivateToLocalBlock) { + auto client_security_state = NewSecurityState(); + client_security_state->ip_address_space = mojom::IPAddressSpace::kPrivate; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), + IsError(net::ERR_FAILED)); + EXPECT_THAT(client()->completion_status().cors_error_status, + Optional(CorsErrorStatus(mojom::IPAddressSpace::kLocal))); +} + +TEST_F(URLLoaderTest, NonSecurePrivateToLocalWarn) { + auto client_security_state = NewSecurityState(); + client_security_state->ip_address_space = mojom::IPAddressSpace::kPrivate; + client_security_state->private_network_request_policy = + mojom::PrivateNetworkRequestPolicy::kWarn; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, NonSecurePrivateToLocalAllow) { + auto client_security_state = NewSecurityState(); + client_security_state->ip_address_space = mojom::IPAddressSpace::kPrivate; + client_security_state->private_network_request_policy = + mojom::PrivateNetworkRequestPolicy::kAllow; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, SecureLocalToLocalBlock) { + auto client_security_state = NewSecurityState(); + client_security_state->is_web_secure_context = true; client_security_state->ip_address_space = mojom::IPAddressSpace::kLocal; set_factory_client_security_state(std::move(client_security_state)); EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); } -TEST_F(URLLoaderTest, InsecureLocalToLocalIsOkPolicyIsWarn) { +TEST_F(URLLoaderTest, SecureLocalToLocalWarn) { auto client_security_state = NewSecurityState(); - client_security_state->is_web_secure_context = false; + client_security_state->is_web_secure_context = true; client_security_state->ip_address_space = mojom::IPAddressSpace::kLocal; client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kWarnFromInsecureToMorePrivate; + mojom::PrivateNetworkRequestPolicy::kWarn; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, SecureLocalToLocalAllow) { + auto client_security_state = NewSecurityState(); + client_security_state->is_web_secure_context = true; + client_security_state->ip_address_space = mojom::IPAddressSpace::kLocal; + client_security_state->private_network_request_policy = + mojom::PrivateNetworkRequestPolicy::kAllow; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, NonSecureLocalToLocalBlock) { + auto client_security_state = NewSecurityState(); + client_security_state->ip_address_space = mojom::IPAddressSpace::kLocal; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, NonSecureLocalToLocalWarn) { + auto client_security_state = NewSecurityState(); + client_security_state->ip_address_space = mojom::IPAddressSpace::kLocal; + client_security_state->private_network_request_policy = + mojom::PrivateNetworkRequestPolicy::kWarn; + set_factory_client_security_state(std::move(client_security_state)); + + EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); +} + +TEST_F(URLLoaderTest, NonSecureLocalToLocalAllow) { + auto client_security_state = NewSecurityState(); + client_security_state->ip_address_space = mojom::IPAddressSpace::kLocal; + client_security_state->private_network_request_policy = + mojom::PrivateNetworkRequestPolicy::kAllow; set_factory_client_security_state(std::move(client_security_state)); EXPECT_THAT(Load(test_server()->GetURL("/empty.html")), IsOk()); @@ -1314,9 +1346,8 @@ // security state indicating that the request initiator is not a secure context // and came from the public IP address space, requests to local IP addresses // are blocked. -TEST_F(URLLoaderTest, TrustedParamsInsecurePublicToLocalIsBlocked) { +TEST_F(URLLoaderTest, NonSecurePublicToLocalTrustedParams) { auto client_security_state = NewSecurityState(); - client_security_state->is_web_secure_context = false; client_security_state->ip_address_space = mojom::IPAddressSpace::kPublic; set_request_client_security_state(std::move(client_security_state)); @@ -6704,7 +6735,7 @@ TEST_F(URLLoaderMockSocketTest, PrivateNetworkRequestPolicyClosesSocket) { auto client_security_state = NewSecurityState(); client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kBlockFromInsecureToMorePrivate; + mojom::PrivateNetworkRequestPolicy::kBlock; set_factory_client_security_state(std::move(client_security_state)); // No data should be read or written. Trying to do so will assert. @@ -6756,7 +6787,7 @@ auto client_security_state = NewSecurityState(); client_security_state->is_web_secure_context = false; client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kWarnFromInsecureToMorePrivate; + mojom::PrivateNetworkRequestPolicy::kWarn; client_security_state->ip_address_space = mojom::IPAddressSpace::kPublic; set_factory_client_security_state(std::move(client_security_state)); @@ -6771,7 +6802,7 @@ ASSERT_TRUE(params.client_security_state); auto& state = params.client_security_state; EXPECT_EQ(state->private_network_request_policy, - mojom::PrivateNetworkRequestPolicy::kWarnFromInsecureToMorePrivate); + mojom::PrivateNetworkRequestPolicy::kWarn); EXPECT_EQ(state->is_web_secure_context, false); EXPECT_EQ(state->ip_address_space, mojom::IPAddressSpace::kPublic); EXPECT_EQ(params.resource_address_space, mojom::IPAddressSpace::kLocal); @@ -6794,7 +6825,7 @@ auto client_security_state = NewSecurityState(); client_security_state->is_web_secure_context = false; client_security_state->private_network_request_policy = - mojom::PrivateNetworkRequestPolicy::kBlockFromInsecureToMorePrivate; + mojom::PrivateNetworkRequestPolicy::kBlock; client_security_state->ip_address_space = mojom::IPAddressSpace::kPublic; set_factory_client_security_state(std::move(client_security_state)); @@ -6808,9 +6839,8 @@ auto& params = *devtools_observer.private_network_request_params(); ASSERT_TRUE(params.client_security_state); auto& state = params.client_security_state; - EXPECT_EQ( - state->private_network_request_policy, - mojom::PrivateNetworkRequestPolicy::kBlockFromInsecureToMorePrivate); + EXPECT_EQ(state->private_network_request_policy, + mojom::PrivateNetworkRequestPolicy::kBlock); EXPECT_EQ(state->is_web_secure_context, false); EXPECT_EQ(state->ip_address_space, mojom::IPAddressSpace::kPublic); EXPECT_EQ(params.resource_address_space, mojom::IPAddressSpace::kLocal);
diff --git a/services/network/web_bundle_url_loader_factory.cc b/services/network/web_bundle_url_loader_factory.cc index fe84274..242d89b3 100644 --- a/services/network/web_bundle_url_loader_factory.cc +++ b/services/network/web_bundle_url_loader_factory.cc
@@ -6,6 +6,7 @@ #include "base/metrics/histogram_functions.h" #include "base/threading/sequenced_task_runner_handle.h" +#include "base/trace_event/trace_event.h" #include "components/web_package/web_bundle_parser.h" #include "components/web_package/web_bundle_utils.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h" @@ -15,6 +16,7 @@ #include "net/http/http_status_code.h" #include "services/network/public/cpp/cors/cors.h" #include "services/network/public/cpp/cross_origin_read_blocking.h" +#include "services/network/public/mojom/url_loader.mojom.h" #include "services/network/web_bundle_chunked_buffer.h" #include "services/network/web_bundle_memory_quota_consumer.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/services/video_capture/lacros/video_frame_handler_proxy_lacros.h b/services/video_capture/lacros/video_frame_handler_proxy_lacros.h index 3cc1e2e..c3655d1 100644 --- a/services/video_capture/lacros/video_frame_handler_proxy_lacros.h +++ b/services/video_capture/lacros/video_frame_handler_proxy_lacros.h
@@ -12,6 +12,7 @@ #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" +#include "services/video_capture/public/mojom/scoped_access_permission.mojom.h" #include "services/video_capture/public/mojom/video_frame_handler.mojom.h" namespace video_capture {
diff --git a/skia/DIR_METADATA b/skia/DIR_METADATA index 6fcb4d6a..c3717e62 100644 --- a/skia/DIR_METADATA +++ b/skia/DIR_METADATA
@@ -1,10 +1,10 @@ # Metadata information for this directory. # # For more information on DIR_METADATA files, see: -# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/README.md +# https://source.chromium.org/chromium/infra/infra/+/main:go/src/infra/tools/dirmd/README.md # # For the schema of this file, see Metadata message: -# https://source.chromium.org/chromium/infra/infra/+/master:go/src/infra/tools/dirmd/proto/dir_metadata.proto +# https://source.chromium.org/chromium/infra/infra/+/main:go/src/infra/tools/dirmd/proto/dir_metadata.proto monorail { component: "Internals>Skia"
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index d4aea48..f566544 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -44651,7 +44651,7 @@ "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_all_tast_tests_amd64-generic", + "name": "lacros_fyi_tast_tests_amd64-generic", "resultdb": { "enable": true }, @@ -44667,8 +44667,8 @@ "idempotent": false, "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, - "test": "lacros_all_tast_tests", - "test_id_prefix": "ninja://chromeos/lacros:lacros_all_tast_tests/" + "test": "lacros_fyi_tast_tests", + "test_id_prefix": "ninja://chromeos/lacros:lacros_fyi_tast_tests/" }, { "args": [
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index f1a35589..ec50775 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl
@@ -1124,13 +1124,6 @@ "label": "//ash/keyboard/ui:keyboard_unittests", "type": "windowed_test_launcher", }, - "lacros_all_tast_tests": { - "label": "//chromeos/lacros:lacros_all_tast_tests", - "type": "generated_script", - "args": [ - "--logs-dir=${ISOLATED_OUTDIR}", - ], - }, "lacros_chrome_browsertests": { "label": "//chrome/test:lacros_chrome_browsertests", "type": "windowed_test_launcher", @@ -1139,6 +1132,13 @@ "label": "//chrome/test:lacros_chrome_unittests", "type": "console_test_launcher", }, + "lacros_fyi_tast_tests": { + "label": "//chromeos/lacros:lacros_fyi_tast_tests", + "type": "generated_script", + "args": [ + "--logs-dir=${ISOLATED_OUTDIR}", + ], + }, "lacros_smoke_tast_tests": { "label": "//chromeos/lacros:lacros_smoke_tast_tests", "type": "generated_script",
diff --git a/testing/buildbot/internal.chromeos.fyi.json b/testing/buildbot/internal.chromeos.fyi.json index 102f3ea..7273358 100644 --- a/testing/buildbot/internal.chromeos.fyi.json +++ b/testing/buildbot/internal.chromeos.fyi.json
@@ -1209,7 +1209,7 @@ "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_all_tast_tests_eve", + "name": "lacros_fyi_tast_tests_eve", "resultdb": { "enable": true }, @@ -1225,8 +1225,8 @@ "idempotent": false, "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" }, - "test": "lacros_all_tast_tests", - "test_id_prefix": "ninja://chromeos/lacros:lacros_all_tast_tests/", + "test": "lacros_fyi_tast_tests", + "test_id_prefix": "ninja://chromeos/lacros:lacros_fyi_tast_tests/", "trigger_script": { "script": "//testing/trigger_scripts/chromeos_device_trigger.py" }
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 7cfb22f..ea44486 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -4198,8 +4198,16 @@ } }, - 'lacros_all_tast_tests': { - 'lacros_all_tast_tests': { + # TODO(crbug.com/1204231): Re-enable vaapi_unittest. + 'lacros_device_or_vm_gtests': { + 'aura_unittests': {}, + 'cc_unittests': {}, + 'interactive_ui_tests': {}, + 'ozone_unittests': {}, + }, + + 'lacros_fyi_tast_tests': { + 'lacros_fyi_tast_tests': { 'swarming': { 'idempotent': False, # https://crbug.com/923426#c27 }, @@ -4209,14 +4217,6 @@ }, }, - # TODO(crbug.com/1204231): Re-enable vaapi_unittest. - 'lacros_device_or_vm_gtests': { - 'aura_unittests': {}, - 'cc_unittests': {}, - 'interactive_ui_tests': {}, - 'ozone_unittests': {}, - }, - 'lacros_skylab_poc': { 'mainline_lacros_tast_tests': { 'tast_expr': '("group:mainline" && "dep:lacros")', @@ -7252,14 +7252,6 @@ }, }, - 'lacros_all_tast_tests_eve': { - 'lacros_all_tast_tests': { - 'variants': [ - 'LACROS_EVE', - ] - }, - }, - # TODO(crbug.com/1195415): Add EVE variant once HW arrives and is deployed. 'lacros_device_or_vm_tests': { 'lacros_smoke_tast_tests': { @@ -7276,18 +7268,26 @@ # TODO(crbug.com/1195415): Add EVE variant once HW arrives and is deployed. 'lacros_device_or_vm_tests_fyi': { - 'lacros_all_tast_tests': { + 'lacros_device_or_vm_gtests': { 'variants': [ 'LACROS_AMD64_GENERIC', ] }, - 'lacros_device_or_vm_gtests': { + 'lacros_fyi_tast_tests': { 'variants': [ 'LACROS_AMD64_GENERIC', ] }, }, + 'lacros_fyi_tast_tests_eve': { + 'lacros_fyi_tast_tests': { + 'variants': [ + 'LACROS_EVE', + ] + }, + }, + # Check go/lacros-on-skylab for details of Skylab configurations. 'lacros_skylab_x86_64': { 'lacros_skylab_poc': {
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 92bae0d2..dedf7ab 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -6340,7 +6340,7 @@ 'chrome', ], 'test_suites': { - 'gtest_tests': 'lacros_all_tast_tests_eve', + 'gtest_tests': 'lacros_fyi_tast_tests_eve', 'skylab_tests': 'lacros_skylab_x86_64', }, 'swarming': {
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 6abc29b..cf460eb2 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -3391,13 +3391,11 @@ "name": "Enabled", "params": { "availability": "any", - "ephemeral_tab_open_mode": "1", "event_trigger": "name:ephemeral_tab_triggered;comparator:<2;window:90;storage:90", "event_used": "name:ephemeral_tab_used;comparator:==0;window:90;storage:90", "session_rate": "any" }, "enable_features": [ - "EphemeralTabUsingBottomSheet", "IPH_EphemeralTab" ] }
diff --git a/third_party/blink/common/messaging/web_message_port.cc b/third_party/blink/common/messaging/web_message_port.cc index 0af4908..98e6c3f 100644 --- a/third_party/blink/common/messaging/web_message_port.cc +++ b/third_party/blink/common/messaging/web_message_port.cc
@@ -9,6 +9,7 @@ #include "third_party/blink/public/common/messaging/string_message_codec.h" #include "third_party/blink/public/common/messaging/transferable_message.h" #include "third_party/blink/public/common/messaging/transferable_message_mojom_traits.h" +#include "third_party/blink/public/mojom/blob/blob.mojom.h" #include "third_party/blink/public/mojom/messaging/transferable_message.mojom.h" namespace blink {
diff --git a/third_party/blink/public/common/messaging/transferable_message.h b/third_party/blink/public/common/messaging/transferable_message.h index 4e717e7..37b25997 100644 --- a/third_party/blink/public/common/messaging/transferable_message.h +++ b/third_party/blink/public/common/messaging/transferable_message.h
@@ -13,6 +13,7 @@ #include "third_party/blink/public/common/messaging/cloneable_message.h" #include "third_party/blink/public/common/messaging/message_port_channel.h" #include "third_party/blink/public/mojom/array_buffer/array_buffer_contents.mojom.h" +#include "third_party/blink/public/mojom/blob/blob.mojom.h" #include "third_party/blink/public/mojom/messaging/user_activation_snapshot.mojom.h" #include "third_party/skia/include/core/SkBitmap.h"
diff --git a/third_party/blink/public/devtools_protocol/browser_protocol.pdl b/third_party/blink/public/devtools_protocol/browser_protocol.pdl index b55e897..a2336d6 100644 --- a/third_party/blink/public/devtools_protocol/browser_protocol.pdl +++ b/third_party/blink/public/devtools_protocol/browser_protocol.pdl
@@ -746,6 +746,11 @@ Page.FrameId frameId Network.LoaderId loaderId + type NavigatorUserAgentIssueDetails extends object + properties + string url + optional SourceCodeLocation location + # A unique identifier for the type of issue. Each type may use one of the # optional fields in InspectorIssueDetails to convey more specific # information about the kind of issue. @@ -762,6 +767,7 @@ CorsIssue AttributionReportingIssue QuirksModeIssue + NavigatorUserAgentIssue # This struct holds a list of optional fields with additional information # specific to the kind of issue. When adding a new issue code, please also @@ -779,6 +785,7 @@ optional CorsIssueDetails corsIssueDetails optional AttributionReportingIssueDetails attributionReportingIssueDetails optional QuirksModeIssueDetails quirksModeIssueDetails + optional NavigatorUserAgentIssueDetails navigatorUserAgentIssueDetails # An inspector issue reported from the back-end. type InspectorIssue extends object
diff --git a/third_party/blink/public/mojom/mediastream/media_stream.mojom b/third_party/blink/public/mojom/mediastream/media_stream.mojom index da8f81fa..9d6092c 100644 --- a/third_party/blink/public/mojom/mediastream/media_stream.mojom +++ b/third_party/blink/public/mojom/mediastream/media_stream.mojom
@@ -128,6 +128,9 @@ MediaStreamDevice new_device); // Requests to pause or resume the corresponding media stream device. OnDeviceRequestStateChange(string label, MediaStreamDevice device, MediaStreamStateChange new_state); + // Informs the render-side that the device's capture handle has changed. + OnDeviceCaptureHandleChange(string label, + MediaStreamDevice device); }; // Per-frame browser-side interface that is used by the renderer process to
diff --git a/third_party/blink/public/platform/internet_disconnected_web_url_loader.h b/third_party/blink/public/platform/internet_disconnected_web_url_loader.h index 9470dc4..ddb43591 100644 --- a/third_party/blink/public/platform/internet_disconnected_web_url_loader.h +++ b/third_party/blink/public/platform/internet_disconnected_web_url_loader.h
@@ -46,7 +46,6 @@ void LoadSynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool pass_response_pipe_to_client, bool no_mime_sniffing, base::TimeDelta timeout_interval, @@ -62,7 +61,6 @@ void LoadAsynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool no_mime_sniffing, std::unique_ptr<blink::ResourceLoadInfoNotifierWrapper> resource_load_info_notifier_wrapper,
diff --git a/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h b/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h index 8d2ada3..a5b5cbf4 100644 --- a/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h +++ b/third_party/blink/public/platform/modules/mediastream/web_platform_media_stream_source.h
@@ -53,6 +53,10 @@ // JavaScript call to GetUserMedia. F.E a camera or microphone. void SetDevice(const MediaStreamDevice& device); + // Sets the capture-handle for a source that has been created by a + // JavaScript call to one of the display-capture APIs (e.g. getDisplayMedia). + void SetCaptureHandle(media::mojom::CaptureHandlePtr capture_handle); + // Sets a callback that will be triggered when StopSource is called. void SetStopCallback(SourceStoppedCallback stop_callback);
diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h index 34308ebf0..ed2439ae 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h
@@ -193,8 +193,8 @@ // May return null if sandbox support is not necessary virtual WebSandboxSupport* GetSandboxSupport() { return nullptr; } - // May return null on some platforms. - virtual WebThemeEngine* ThemeEngine() { return nullptr; } + // Returns a theme engine. Should be non-null. + virtual WebThemeEngine* ThemeEngine(); // AppCache ----------------------------------------------------------
diff --git a/third_party/blink/public/platform/web_url_loader.h b/third_party/blink/public/platform/web_url_loader.h index 06d37605..042a383 100644 --- a/third_party/blink/public/platform/web_url_loader.h +++ b/third_party/blink/public/platform/web_url_loader.h
@@ -109,7 +109,6 @@ virtual void LoadSynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool pass_response_pipe_to_client, bool no_mime_sniffing, base::TimeDelta timeout_interval, @@ -129,7 +128,6 @@ virtual void LoadAsynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool no_mime_sniffing, std::unique_ptr<ResourceLoadInfoNotifierWrapper> resource_load_info_notifier_wrapper,
diff --git a/third_party/blink/public/web/modules/mediastream/web_media_stream_device_observer.h b/third_party/blink/public/web/modules/mediastream/web_media_stream_device_observer.h index dc25adc..529ddc1 100644 --- a/third_party/blink/public/web/modules/mediastream/web_media_stream_device_observer.h +++ b/third_party/blink/public/web/modules/mediastream/web_media_stream_device_observer.h
@@ -32,13 +32,16 @@ using OnDeviceRequestStateChangeCb = base::RepeatingCallback<void( const MediaStreamDevice& device, const mojom::MediaStreamStateChange new_state)>; + using OnDeviceCaptureHandleChangeCb = + base::RepeatingCallback<void(const MediaStreamDevice& device)>; void AddStream( const WebString& label, const MediaStreamDevices& audio_devices, const MediaStreamDevices& video_devices, OnDeviceStoppedCb on_device_stopped_cb, OnDeviceChangedCb on_device_changed_cb, - OnDeviceRequestStateChangeCb on_device_request_state_change_cb); + OnDeviceRequestStateChangeCb on_device_request_state_change_cb, + OnDeviceCaptureHandleChangeCb on_device_capture_handle_change_cb); void AddStream(const WebString& label, const MediaStreamDevice& device); bool RemoveStream(const WebString& label); void RemoveStreamDevice(const MediaStreamDevice& device);
diff --git a/third_party/blink/public/web/web_view_client.h b/third_party/blink/public/web/web_view_client.h index 22d7a35d..75bdef8f 100644 --- a/third_party/blink/public/web/web_view_client.h +++ b/third_party/blink/public/web/web_view_client.h
@@ -92,8 +92,6 @@ virtual void OnPageFrozenChanged(bool frozen) {} - virtual void DidUpdateRendererPreferences() {} - // UI ------------------------------------------------------------------ // Called when the View has changed size as a result of an auto-resize.
diff --git a/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc b/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc index 9afba48..1f9a644 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc
@@ -87,7 +87,6 @@ void LoadSynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool pass_response_pipe_to_client, bool no_mime_sniffing, base::TimeDelta timeout_interval, @@ -105,7 +104,6 @@ void LoadAsynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool no_mime_sniffing, std::unique_ptr<blink::ResourceLoadInfoNotifierWrapper> resource_load_info_notifier_wrapper,
diff --git a/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc b/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc index 4f60151..91b621d 100644 --- a/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc +++ b/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc
@@ -6,6 +6,7 @@ #include "third_party/blink/public/common/browser_interface_broker_proxy.h" #include "third_party/blink/public/mojom/file_system_access/file_system_access_manager.mojom-blink.h" +#include "third_party/blink/public/mojom/file_system_access/file_system_access_transfer_token.mojom-blink.h" #include "third_party/blink/public/mojom/filesystem/file_system.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_crypto.h"
diff --git a/third_party/blink/renderer/core/animation/css/css_scroll_timeline.cc b/third_party/blink/renderer/core/animation/css/css_scroll_timeline.cc index 7d84e57..854e05f9 100644 --- a/third_party/blink/renderer/core/animation/css/css_scroll_timeline.cc +++ b/third_party/blink/renderer/core/animation/css/css_scroll_timeline.cc
@@ -235,14 +235,14 @@ } void CSSScrollTimeline::AnimationAttached(Animation* animation) { - ScrollTimeline::AnimationAttached(animation); - if (AttachedAnimationsCount() == 1) + if (!HasAnimations()) SetObservers(CreateElementReferenceObservers(GetDocument(), rule_, this)); + ScrollTimeline::AnimationAttached(animation); } void CSSScrollTimeline::AnimationDetached(Animation* animation) { ScrollTimeline::AnimationDetached(animation); - if (AttachedAnimationsCount() == 0) + if (!HasAnimations()) SetObservers(HeapVector<Member<IdTargetObserver>>()); }
diff --git a/third_party/blink/renderer/core/animation/scroll_timeline.cc b/third_party/blink/renderer/core/animation/scroll_timeline.cc index 6e49738..f5b2ce5a 100644 --- a/third_party/blink/renderer/core/animation/scroll_timeline.cc +++ b/third_party/blink/renderer/core/animation/scroll_timeline.cc
@@ -594,17 +594,16 @@ } void ScrollTimeline::AnimationAttached(Animation* animation) { - AnimationTimeline::AnimationAttached(animation); - if (resolved_scroll_source_ && scroll_animations_.IsEmpty()) + if (resolved_scroll_source_ && !HasAnimations()) resolved_scroll_source_->RegisterScrollTimeline(this); - scroll_animations_.insert(animation); + AnimationTimeline::AnimationAttached(animation); } void ScrollTimeline::AnimationDetached(Animation* animation) { AnimationTimeline::AnimationDetached(animation); - scroll_animations_.erase(animation); - if (resolved_scroll_source_ && scroll_animations_.IsEmpty()) + + if (resolved_scroll_source_ && !HasAnimations()) resolved_scroll_source_->UnregisterScrollTimeline(this); } @@ -621,7 +620,6 @@ } void ScrollTimeline::Trace(Visitor* visitor) const { - visitor->Trace(scroll_animations_); visitor->Trace(scroll_source_); visitor->Trace(resolved_scroll_source_); visitor->Trace(scroll_offsets_); @@ -661,7 +659,7 @@ } void ScrollTimeline::InvalidateEffectTargetStyle() { - for (Animation* animation : scroll_animations_) + for (Animation* animation : GetAnimations()) animation->InvalidateEffectTargetStyle(); }
diff --git a/third_party/blink/renderer/core/animation/scroll_timeline.h b/third_party/blink/renderer/core/animation/scroll_timeline.h index 2ba5b54b..7c5a2fc 100644 --- a/third_party/blink/renderer/core/animation/scroll_timeline.h +++ b/third_party/blink/renderer/core/animation/scroll_timeline.h
@@ -133,7 +133,6 @@ double GetTimeRange() const { return time_range_ ? time_range_.value() : 0; } bool ScrollOffsetsEqual( const HeapVector<Member<ScrollTimelineOffset>>& other) const; - size_t AttachedAnimationsCount() const { return scroll_animations_.size(); } private: FRIEND_TEST_ALL_PREFIXES(ScrollTimelineTest, MultipleScrollOffsetsClamping); @@ -184,12 +183,6 @@ // Snapshotted value produced by the last SnapshotState call. TimelineState timeline_state_snapshotted_; - - // The only purpose of scroll_animations_ is keeping strong references to - // attached animations. This is required to keep attached animations alive - // as long as the timeline is alive. Scroll timeline is alive as long as its - // scroller is alive. - HeapHashSet<Member<Animation>> scroll_animations_; }; template <>
diff --git a/third_party/blink/renderer/core/animation/scroll_timeline_test.cc b/third_party/blink/renderer/core/animation/scroll_timeline_test.cc index 447a800..bdc9d1c9 100644 --- a/third_party/blink/renderer/core/animation/scroll_timeline_test.cc +++ b/third_party/blink/renderer/core/animation/scroll_timeline_test.cc
@@ -11,6 +11,7 @@ #include "third_party/blink/renderer/core/animation/keyframe_effect.h" #include "third_party/blink/renderer/core/animation/keyframe_effect_model.h" #include "third_party/blink/renderer/core/css/css_numeric_literal_value.h" +#include "third_party/blink/renderer/core/dom/dom_token_list.h" #include "third_party/blink/renderer/core/dom/events/native_event_listener.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" @@ -54,6 +55,17 @@ return scroll_offsets; } +Animation* CreateTestAnimation(AnimationTimeline* timeline) { + Timing timing; + timing.iteration_duration = AnimationTimeDelta::FromSecondsD(0.1); + return Animation::Create(MakeGarbageCollected<KeyframeEffect>( + nullptr, + MakeGarbageCollected<StringKeyframeEffectModel>( + StringKeyframeVector()), + timing), + timeline, ASSERT_NO_EXCEPTION); +} + } // namespace class ScrollTimelineTest : public RenderingTest { @@ -442,6 +454,116 @@ EXPECT_EQ(0u, AnimationsCount()); } +TEST_F(ScrollTimelineTest, AnimationPersistsWhenFinished) { + SetBodyInnerHTML(R"HTML( + <style> + #scroller { overflow: scroll; width: 100px; height: 100px; } + #spacer { width: 200px; height: 200px; } + </style> + <div id='scroller'> + <div id ='spacer'></div> + </div> + )HTML"); + + auto* scroller = + To<LayoutBoxModelObject>(GetLayoutObjectByElementId("scroller")); + PaintLayerScrollableArea* scrollable_area = scroller->GetScrollableArea(); + Persistent<TestScrollTimeline> scroll_timeline = + MakeGarbageCollected<TestScrollTimeline>(&GetDocument(), + GetElementById("scroller")); + Animation* animation = CreateTestAnimation(scroll_timeline); + animation->play(); + SimulateFrame(); + + // Scroll to finished: + scrollable_area->SetScrollOffset(ScrollOffset(0, 91), + mojom::blink::ScrollType::kProgrammatic); + SimulateFrame(); + EXPECT_EQ("finished", animation->playState()); + + // Animation should still persist after GC. + animation = nullptr; + ThreadState::Current()->CollectAllGarbageForTesting(); + ASSERT_EQ(1u, scroll_timeline->GetAnimations().size()); + animation = *scroll_timeline->GetAnimations().begin(); + + // Scroll back to 50%. The animation should update, even though it was + // previously in a finished state. + ScrollOffset offset(0, 50); // 10 + (90 - 10) * 0.5 = 50 + scrollable_area->SetScrollOffset(offset, + mojom::blink::ScrollType::kProgrammatic); + SimulateFrame(); + EXPECT_EQ("running", animation->playState()); + EXPECT_TIME_NEAR(50.0, animation->CurrentTimeInternal() + .value_or(AnimationTimeDelta()) + .InMillisecondsF()); +} + +TEST_F(ScrollTimelineTest, AnimationPersistsWhenSourceBecomesNonScrollable) { + SetBodyInnerHTML(R"HTML( + <style> + #scroller { width: 100px; height: 100px; } + #spacer { width: 200px; height: 200px; } + .scroll { overflow: scroll; } + </style> + <div id='scroller' class='scroll'> + <div id ='spacer'></div> + </div> + )HTML"); + + auto* scroller = + To<LayoutBoxModelObject>(GetLayoutObjectByElementId("scroller")); + Persistent<TestScrollTimeline> scroll_timeline = + MakeGarbageCollected<TestScrollTimeline>(&GetDocument(), + GetElementById("scroller")); + Animation* animation = CreateTestAnimation(scroll_timeline); + animation->play(); + SimulateFrame(); + + // Scroll to 50%: + ASSERT_TRUE(scroller->GetScrollableArea()); + ScrollOffset offset_50(0, 50); // 10 + (90 - 10) * 0.5 = 50 + scroller->GetScrollableArea()->SetScrollOffset( + offset_50, mojom::blink::ScrollType::kProgrammatic); + SimulateFrame(); + EXPECT_TIME_NEAR(50.0, animation->CurrentTimeInternal() + .value_or(AnimationTimeDelta()) + .InMillisecondsF()); + + // Make #scroller non-scrollable. + GetElementById("scroller")->classList().Remove("scroll"); + UpdateAllLifecyclePhasesForTest(); + scroller = To<LayoutBoxModelObject>(GetLayoutObjectByElementId("scroller")); + ASSERT_TRUE(scroller); + EXPECT_FALSE(scroller->GetScrollableArea()); + + // ScrollTimeline should now have an unresolved current time. + SimulateFrame(); + EXPECT_FALSE(scroll_timeline->CurrentTimeMilliseconds().has_value()); + + // Animation should still persist after GC. + animation = nullptr; + ThreadState::Current()->CollectAllGarbageForTesting(); + ASSERT_EQ(1u, scroll_timeline->GetAnimations().size()); + animation = *scroll_timeline->GetAnimations().begin(); + + // Make #scroller scrollable again. + GetElementById("scroller")->classList().Add("scroll"); + UpdateAllLifecyclePhasesForTest(); + scroller = To<LayoutBoxModelObject>(GetLayoutObjectByElementId("scroller")); + ASSERT_TRUE(scroller); + ASSERT_TRUE(scroller->GetScrollableArea()); + + // Scroll to 40%: + ScrollOffset offset_42(0, 42); // 10 + (90 - 10) * 0.4 = 42 + scroller->GetScrollableArea()->SetScrollOffset( + offset_42, mojom::blink::ScrollType::kProgrammatic); + SimulateFrame(); + EXPECT_TIME_NEAR(40.0, animation->CurrentTimeInternal() + .value_or(AnimationTimeDelta()) + .InMillisecondsF()); +} + TEST_F(ScrollTimelineTest, ScheduleFrameOnlyWhenScrollOffsetChanges) { SetBodyInnerHTML(R"HTML( <style> @@ -1015,4 +1137,51 @@ EXPECT_EQ(80, scroll_timeline->CurrentTimeMilliseconds().value()); } +TEST_F(ScrollTimelineTest, WeakReferences) { + SetBodyInnerHTML(R"HTML( + <style> + #scroller { overflow: scroll; width: 100px; height: 100px; } + #spacer { width: 200px; height: 200px; } + </style> + <div id='scroller'> + <div id ='spacer'></div> + </div> + )HTML"); + + Persistent<TestScrollTimeline> scroll_timeline = + MakeGarbageCollected<TestScrollTimeline>(&GetDocument(), + GetElementById("scroller")); + + EXPECT_EQ(0u, scroll_timeline->GetAnimations().size()); + + // Attaching an animation to a ScrollTimeline, and never playing it: + Animation* animation = CreateTestAnimation(scroll_timeline); + DCHECK(animation); + animation = nullptr; + EXPECT_EQ(1u, scroll_timeline->GetAnimations().size()); + + ThreadState::Current()->CollectAllGarbageForTesting(); + EXPECT_EQ(0u, scroll_timeline->GetAnimations().size()); + + // Playing, then canceling an animation: + animation = CreateTestAnimation(scroll_timeline); + EXPECT_EQ(1u, scroll_timeline->GetAnimations().size()); + + animation->play(); + UpdateAllLifecyclePhasesForTest(); + EXPECT_EQ(1u, scroll_timeline->GetAnimations().size()); + + animation->cancel(); + // UpdateAllLifecyclePhasesForTest does not call Animation::Update with + // reason=kTimingUpdateForAnimationFrame, which is required in order to lose + // all strong references to the animation. Hence the explicit call to + // SimulateFrame(). + SimulateFrame(); + UpdateAllLifecyclePhasesForTest(); + animation = nullptr; + + ThreadState::Current()->CollectAllGarbageForTesting(); + EXPECT_EQ(0u, scroll_timeline->GetAnimations().size()); +} + } // namespace blink
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 9e7f630..e80d0a9 100644 --- a/third_party/blink/renderer/core/execution_context/execution_context.cc +++ b/third_party/blink/renderer/core/execution_context/execution_context.cc
@@ -254,6 +254,13 @@ AddInspectorIssue(std::move(issue)); } +void ExecutionContext::ReportNavigatorUserAgentAccess() { + if (has_filed_navigator_user_agent_issue_) + return; + has_filed_navigator_user_agent_issue_ = true; + AuditsIssue::ReportNavigatorUserAgentAccess(this, Url().GetString()); +} + void ExecutionContext::AddConsoleMessageImpl(mojom::ConsoleMessageSource source, mojom::ConsoleMessageLevel level, const String& message,
diff --git a/third_party/blink/renderer/core/execution_context/execution_context.h b/third_party/blink/renderer/core/execution_context/execution_context.h index d1542ea..73e17bfa 100644 --- a/third_party/blink/renderer/core/execution_context/execution_context.h +++ b/third_party/blink/renderer/core/execution_context/execution_context.h
@@ -377,6 +377,9 @@ // the future. bool CheckSharedArrayBufferTransferAllowedAndReport(); + // Reports first usage of `navigator.userAgent` and related getters + void ReportNavigatorUserAgentAccess(); + virtual ukm::UkmRecorder* UkmRecorder() { return nullptr; } virtual ukm::SourceId UkmSourceID() const { return ukm::kInvalidSourceId; } @@ -471,6 +474,7 @@ bool has_filed_shared_array_buffer_transfer_issue_ = false; bool has_filed_shared_array_buffer_creation_issue_ = false; + bool has_filed_navigator_user_agent_issue_ = false; bool is_in_request_animation_frame_ = false;
diff --git a/third_party/blink/renderer/core/execution_context/navigator_base.h b/third_party/blink/renderer/core/execution_context/navigator_base.h index 4bc9c2e..eef786a 100644 --- a/third_party/blink/renderer/core/execution_context/navigator_base.h +++ b/third_party/blink/renderer/core/execution_context/navigator_base.h
@@ -27,6 +27,8 @@ #include "third_party/blink/renderer/core/frame/navigator_language.h" #include "third_party/blink/renderer/core/frame/navigator_on_line.h" #include "third_party/blink/renderer/core/frame/navigator_ua.h" +#include "third_party/blink/renderer/core/inspector/inspector_audits_issue.h" +#include "third_party/blink/renderer/core/inspector/protocol/Audits.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/supplementable.h" @@ -51,8 +53,11 @@ // NavigatorID override String userAgent() const override { - return GetExecutionContext() ? GetExecutionContext()->UserAgent() - : String(); + if (!GetExecutionContext()) + return String(); + + GetExecutionContext()->ReportNavigatorUserAgentAccess(); + return GetExecutionContext()->UserAgent(); } void Trace(Visitor* visitor) const override {
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index 32b9407..a30dd1ab 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -167,6 +167,7 @@ #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/scheduler/public/page_lifecycle_state.h" #include "third_party/blink/renderer/platform/scheduler/public/page_scheduler.h" +#include "third_party/blink/renderer/platform/theme/web_theme_engine_helper.h" #include "third_party/blink/renderer/platform/weborigin/known_ports.h" #include "third_party/blink/renderer/platform/widget/widget_base.h" #include "third_party/icu/source/common/unicode/uscript.h" @@ -3143,9 +3144,7 @@ for (auto& watcher : renderer_preference_watchers_) watcher->NotifyUpdate(renderer_preferences_); - // TODO(crbug.com/1102442): Remove once we no longer need to update theme - // preferences on Windows via content::WebThemeEngineDefault. - web_view_client_->DidUpdateRendererPreferences(); + WebThemeEngineHelper::DidUpdateRendererPreferences(preferences); UpdateFontRenderingFromRendererPrefs(); blink::SetCaretBlinkInterval(
diff --git a/third_party/blink/renderer/core/fetch/fetch_data_loader_test.cc b/third_party/blink/renderer/core/fetch/fetch_data_loader_test.cc index 9cc561e..17a0076 100644 --- a/third_party/blink/renderer/core/fetch/fetch_data_loader_test.cc +++ b/third_party/blink/renderer/core/fetch/fetch_data_loader_test.cc
@@ -8,6 +8,8 @@ #include "base/run_loop.h" #include "base/stl_util.h" +#include "mojo/public/cpp/bindings/receiver.h" +#include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/system/data_pipe_utils.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/blink/renderer/core/frame/navigator_id.cc b/third_party/blink/renderer/core/frame/navigator_id.cc index c4b66a3..01a5a61 100644 --- a/third_party/blink/renderer/core/frame/navigator_id.cc +++ b/third_party/blink/renderer/core/frame/navigator_id.cc
@@ -59,6 +59,9 @@ } String NavigatorID::platform() const { + // Call userAgent() so the usage can be reported + userAgent(); + // If the User-Agent string is frozen, platform should be a value // matching the frozen string per https://github.com/WICG/ua-client-hints. See // content::frozen_user_agent_strings.
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc index 3529001..c065d4a 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
@@ -104,6 +104,7 @@ #include "third_party/blink/public/mojom/frame/media_player_action.mojom-blink.h" #include "third_party/blink/public/mojom/frame/tree_scope_type.mojom-blink.h" #include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom-blink.h" +#include "third_party/blink/public/mojom/portal/portal.mojom-blink.h" #include "third_party/blink/public/platform/interface_registry.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/web_double_size.h"
diff --git a/third_party/blink/renderer/core/inspector/inspector_audits_issue.cc b/third_party/blink/renderer/core/inspector/inspector_audits_issue.cc index bdd2f75..06a0b5e 100644 --- a/third_party/blink/renderer/core/inspector/inspector_audits_issue.cc +++ b/third_party/blink/renderer/core/inspector/inspector_audits_issue.cc
@@ -182,4 +182,28 @@ reporting_execution_context->AddInspectorIssue(AuditsIssue(std::move(issue))); } +void AuditsIssue::ReportNavigatorUserAgentAccess( + ExecutionContext* execution_context, + String url) { + auto navigator_user_agent_details = + protocol::Audits::NavigatorUserAgentIssueDetails::create() + .setUrl(url) + .build(); + auto location = SourceLocation::Capture(execution_context); + if (location) { + navigator_user_agent_details->setLocation( + CreateProtocolLocation(*location)); + } + auto details = protocol::Audits::InspectorIssueDetails::create() + .setNavigatorUserAgentIssueDetails( + std::move(navigator_user_agent_details)) + .build(); + auto issue = + protocol::Audits::InspectorIssue::create() + .setCode( + protocol::Audits::InspectorIssueCodeEnum::NavigatorUserAgentIssue) + .setDetails(std::move(details)) + .build(); + execution_context->AddInspectorIssue(AuditsIssue(std::move(issue))); +} } // namespace blink
diff --git a/third_party/blink/renderer/core/inspector/inspector_audits_issue.h b/third_party/blink/renderer/core/inspector/inspector_audits_issue.h index e10555179..41d249b 100644 --- a/third_party/blink/renderer/core/inspector/inspector_audits_issue.h +++ b/third_party/blink/renderer/core/inspector/inspector_audits_issue.h
@@ -94,6 +94,10 @@ const absl::optional<String>& request_id = absl::nullopt, const absl::optional<String>& invalid_parameter = absl::nullopt); + static void ReportNavigatorUserAgentAccess( + ExecutionContext* execution_context, + WTF::String url); + private: explicit AuditsIssue(std::unique_ptr<protocol::Audits::InspectorIssue> issue);
diff --git a/third_party/blink/renderer/core/layout/ng/table/ng_table_borders.cc b/third_party/blink/renderer/core/layout/ng/table/ng_table_borders.cc index dd2b367a..30b2bce 100644 --- a/third_party/blink/renderer/core/layout/ng/table/ng_table_borders.cc +++ b/third_party/blink/renderer/core/layout/ng/table/ng_table_borders.cc
@@ -191,7 +191,6 @@ return table_borders; NGTableGroupedChildren grouped_children(table); - bool hide_empty_cells = table_style.EmptyCells() == EEmptyCells::kHide; WritingDirectionMode table_writing_direction = table.Style().GetWritingDirection(); @@ -221,11 +220,6 @@ table_column_count, NGTableAlgorithmHelpers::ComputeMaxColumn( tabulator.CurrentColumn(), cell_colspan, table.Style().IsFixedTableLayout())); - // https://stackoverflow.com/questions/18758373/why-do-the-css-property-border-collapse-and-empty-cells-conflict - if (hide_empty_cells && !To<NGBlockNode>(cell).FirstChild()) { - tabulator.ProcessCell(cell); - continue; - } if (!found_multispan_cells) { table_borders->MergeBorders( table_row_index, tabulator.CurrentColumn(), @@ -258,10 +252,6 @@ for (NGBlockNode cell = To<NGBlockNode>(row.FirstChild()); cell; cell = To<NGBlockNode>(cell.NextSibling())) { tabulator.FindNextFreeColumn(); - if (hide_empty_cells && !To<NGBlockNode>(cell).FirstChild()) { - tabulator.ProcessCell(cell); - continue; - } table_borders->MergeBorders( table_row_index, tabulator.CurrentColumn(), cell.TableCellRowspan(), cell.TableCellColspan(), cell.Style(),
diff --git a/third_party/blink/renderer/core/loader/address_space_feature.cc b/third_party/blink/renderer/core/loader/address_space_feature.cc index 97aa3779..3fb7df37 100644 --- a/third_party/blink/renderer/core/loader/address_space_feature.cc +++ b/third_party/blink/renderer/core/loader/address_space_feature.cc
@@ -32,11 +32,14 @@ #include <tuple> +#include "services/network/public/cpp/cors/cors_error_status.h" +#include "services/network/public/mojom/cors.mojom-forward.h" #include "third_party/blink/public/mojom/web_feature/web_feature.mojom-forward.h" #include "third_party/blink/renderer/core/frame/deprecation.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" +#include "third_party/blink/renderer/platform/loader/fetch/resource_error.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_response.h" namespace blink { @@ -147,8 +150,6 @@ // The list of features which should be reported as deprecated. constexpr Feature kDeprecatedFeatures[] = { - Feature::kAddressSpaceUnknownNonSecureContextEmbeddedPrivate, - Feature::kAddressSpaceUnknownNonSecureContextEmbeddedLocal, Feature::kAddressSpacePublicNonSecureContextEmbeddedPrivate, Feature::kAddressSpacePublicNonSecureContextEmbeddedLocal, Feature::kAddressSpacePrivateNonSecureContextEmbeddedLocal, @@ -215,4 +216,37 @@ } } +void RecordAddressSpaceFeature(FetchType fetch_type, + LocalFrame* client_frame, + const ResourceError& error) { + if (!client_frame) { + return; + } + + absl::optional<network::CorsErrorStatus> status = error.CorsErrorStatus(); + if (!status.has_value() || + status->cors_error != + network::mojom::CorsError::kInsecurePrivateNetwork) { + // Not the right kind of error, ignore. + return; + } + + LocalDOMWindow* window = client_frame->DomWindow(); + absl::optional<WebFeature> feature = AddressSpaceFeature( + fetch_type, window->AddressSpace(), window->IsSecureContext(), + status->resource_address_space); + if (!feature.has_value()) { + return; + } + + // This WebFeature encompasses all private network requests. + UseCounter::Count(window, + WebFeature::kMixedContentPrivateHostnameInPublicHostname); + + // Count the feature but do not log it as a deprecation, since its use is + // forbidden and has resulted in the fetch failing. In other words, the + // document only *attempted* to use a feature that is no longer available. + UseCounter::Count(window, *feature); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/loader/address_space_feature.h b/third_party/blink/renderer/core/loader/address_space_feature.h index a16fd39..db7c6f5 100644 --- a/third_party/blink/renderer/core/loader/address_space_feature.h +++ b/third_party/blink/renderer/core/loader/address_space_feature.h
@@ -39,6 +39,7 @@ namespace blink { class LocalFrame; +class ResourceError; class ResourceResponse; // Describes a type of fetch for the purposes of categorizing feature use. @@ -77,6 +78,13 @@ LocalFrame* client_frame, const ResourceResponse& response); +// Same as above, for cases where the fetch failed. +// Does nothing if the fetch failed due to an error other than a failed Private +// Network Access check. +void RecordAddressSpaceFeature(FetchType fetch_type, + LocalFrame* client_frame, + const ResourceError& error); + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_ADDRESS_SPACE_FEATURE_H_
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.cc b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.cc index 0e0f290..147409a 100644 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.cc +++ b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.h" +#include "services/network/public/mojom/url_loader_factory.mojom-blink.h" #include "third_party/blink/public/common/loader/url_loader_factory_bundle.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/core/events/application_cache_error_event.h"
diff --git a/third_party/blink/renderer/core/loader/prefetched_signed_exchange_manager.cc b/third_party/blink/renderer/core/loader/prefetched_signed_exchange_manager.cc index 918d6cd3..183cea3 100644 --- a/third_party/blink/renderer/core/loader/prefetched_signed_exchange_manager.cc +++ b/third_party/blink/renderer/core/loader/prefetched_signed_exchange_manager.cc
@@ -69,7 +69,6 @@ void LoadSynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool pass_response_pipe_to_client, bool no_mime_sniffing, base::TimeDelta timeout_interval, @@ -87,14 +86,13 @@ void LoadAsynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool no_mime_sniffing, std::unique_ptr<blink::ResourceLoadInfoNotifierWrapper> resource_load_info_notifier_wrapper, WebURLLoaderClient* client) override { if (url_loader_) { url_loader_->LoadAsynchronously( - std::move(request), std::move(url_request_extra_data), requestor_id, + std::move(request), std::move(url_request_extra_data), no_mime_sniffing, std::move(resource_load_info_notifier_wrapper), client); return; @@ -104,8 +102,8 @@ // |this| here. pending_method_calls_.push(WTF::Bind( &PrefetchedSignedExchangeLoader::LoadAsynchronously, GetWeakPtr(), - std::move(request), std::move(url_request_extra_data), requestor_id, - no_mime_sniffing, std::move(resource_load_info_notifier_wrapper), + std::move(request), std::move(url_request_extra_data), no_mime_sniffing, + std::move(resource_load_info_notifier_wrapper), WTF::Unretained(client))); } void SetDefersLoading(DeferType value) override {
diff --git a/third_party/blink/renderer/core/loader/resource_load_observer_for_frame.cc b/third_party/blink/renderer/core/loader/resource_load_observer_for_frame.cc index f1dc930..f6697ac36 100644 --- a/third_party/blink/renderer/core/loader/resource_load_observer_for_frame.cc +++ b/third_party/blink/renderer/core/loader/resource_load_observer_for_frame.cc
@@ -268,6 +268,8 @@ probe::DidFailLoading(GetProbe(), identifier, document_loader_, error, frame->GetDevToolsFrameToken()); + RecordAddressSpaceFeature(FetchType::kSubresource, frame, error); + // Notification to FrameConsole should come AFTER InspectorInstrumentation // call, DevTools front-end relies on this. if (!is_internal_request) {
diff --git a/third_party/blink/renderer/core/messaging/blink_transferable_message_mojom_traits.h b/third_party/blink/renderer/core/messaging/blink_transferable_message_mojom_traits.h index 4f04f00..9fec27d 100644 --- a/third_party/blink/renderer/core/messaging/blink_transferable_message_mojom_traits.h +++ b/third_party/blink/renderer/core/messaging/blink_transferable_message_mojom_traits.h
@@ -10,6 +10,7 @@ #include "third_party/blink/public/common/messaging/message_port_channel.h" #include "third_party/blink/public/common/messaging/message_port_descriptor.h" #include "third_party/blink/public/common/messaging/message_port_descriptor_mojom_traits.h" +#include "third_party/blink/public/mojom/blob/blob.mojom-blink.h" #include "third_party/blink/public/mojom/messaging/transferable_message.mojom-shared.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" #include "third_party/blink/renderer/core/core_export.h"
diff --git a/third_party/blink/renderer/core/messaging/message_port.cc b/third_party/blink/renderer/core/messaging/message_port.cc index 002ee34..bacf27d 100644 --- a/third_party/blink/renderer/core/messaging/message_port.cc +++ b/third_party/blink/renderer/core/messaging/message_port.cc
@@ -29,6 +29,7 @@ #include <memory> #include "mojo/public/cpp/base/big_buffer_mojom_traits.h" +#include "third_party/blink/public/mojom/blob/blob.mojom-blink.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/post_message_helper.h"
diff --git a/third_party/blink/renderer/core/paint/background_image_geometry.cc b/third_party/blink/renderer/core/paint/background_image_geometry.cc index f52614d..6f0e990e 100644 --- a/third_party/blink/renderer/core/paint/background_image_geometry.cc +++ b/third_party/blink/renderer/core/paint/background_image_geometry.cc
@@ -38,6 +38,11 @@ return space; } +LayoutUnit ComputeRoundedTileSize(LayoutUnit area_size, LayoutUnit tile_size) { + int nr_tiles = std::max(1, RoundToInt(area_size / tile_size)); + return area_size / nr_tiles; +} + LayoutUnit ComputeTilePhase(LayoutUnit position, LayoutUnit tile_extent) { // Assuming a non-integral number of tiles, find out how much of the // partial tile is visible. That is the phase. @@ -862,10 +867,8 @@ if (background_repeat_x == EFillRepeat::kRoundFill && snapped_positioning_area_size.width > LayoutUnit() && tile_size_.width > LayoutUnit()) { - int nr_tiles = std::max( - 1, RoundToInt(snapped_positioning_area_size.width / tile_size_.width)); - LayoutUnit rounded_width = snapped_positioning_area_size.width / nr_tiles; - + LayoutUnit rounded_width = ComputeRoundedTileSize( + snapped_positioning_area_size.width, tile_size_.width); // Maintain aspect ratio if background-size: auto is set if (fill_layer.SizeLength().Height().IsAuto() && background_repeat_y != EFillRepeat::kRoundFill) { @@ -883,9 +886,8 @@ if (background_repeat_y == EFillRepeat::kRoundFill && snapped_positioning_area_size.height > LayoutUnit() && tile_size_.height > LayoutUnit()) { - int nr_tiles = std::max(1, RoundToInt(snapped_positioning_area_size.height / - tile_size_.height)); - LayoutUnit rounded_height = snapped_positioning_area_size.height / nr_tiles; + LayoutUnit rounded_height = ComputeRoundedTileSize( + snapped_positioning_area_size.height, tile_size_.height); // Maintain aspect ratio if background-size: auto is set if (fill_layer.SizeLength().Width().IsAuto() && background_repeat_x != EFillRepeat::kRoundFill) {
diff --git a/third_party/blink/renderer/core/scroll/mac_scrollbar_animator_impl.mm b/third_party/blink/renderer/core/scroll/mac_scrollbar_animator_impl.mm index 6756e9c..bbd4417 100644 --- a/third_party/blink/renderer/core/scroll/mac_scrollbar_animator_impl.mm +++ b/third_party/blink/renderer/core/scroll/mac_scrollbar_animator_impl.mm
@@ -818,13 +818,11 @@ } void MacScrollbarAnimatorImpl::StartScrollbarPaintTimer() { - // Post a task with 1 ms delay to give a chance to run other immediate tasks - // that may cancel this. initial_scrollbar_paint_task_handle_ = PostDelayedCancellableTask( *task_runner_, FROM_HERE, WTF::Bind(&MacScrollbarAnimatorImpl::InitialScrollbarPaintTask, WrapWeakPersistent(this)), - base::TimeDelta::FromMilliseconds(1)); + base::TimeDelta::FromMilliseconds(100)); } bool MacScrollbarAnimatorImpl::ScrollbarPaintTimerIsActive() const {
diff --git a/third_party/blink/renderer/core/svg/graphics/svg_image.cc b/third_party/blink/renderer/core/svg/graphics/svg_image.cc index a02b1cc..f0d16f7 100644 --- a/third_party/blink/renderer/core/svg/graphics/svg_image.cc +++ b/third_party/blink/renderer/core/svg/graphics/svg_image.cc
@@ -96,7 +96,6 @@ void LoadSynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool pass_response_pipe_to_client, bool no_mime_sniffing, base::TimeDelta timeout_interval, @@ -114,7 +113,6 @@ void LoadAsynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool no_mime_sniffing, std::unique_ptr<blink::ResourceLoadInfoNotifierWrapper> resource_load_info_notifier_wrapper,
diff --git a/third_party/blink/renderer/modules/accessibility/ax_node_object.cc b/third_party/blink/renderer/modules/accessibility/ax_node_object.cc index f849ed5..4f38e8b 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_node_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_node_object.cc
@@ -3557,7 +3557,11 @@ void AXNodeObject::AddLayoutChildren() { // Children are added this way only for pseudo-element subtrees. // See AXObject::ShouldUseLayoutObjectTraversalForChildren(). - DCHECK(GetLayoutObject()); + if (!GetLayoutObject()) { + DCHECK(GetNode()); + DCHECK(GetNode()->IsPseudoElement()); + return; // Can't add children for hidden or display-locked pseudo elements. + } LayoutObject* child = GetLayoutObject()->SlowFirstChild(); while (child) { if (CanAddLayoutChild(*child)) {
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.cc b/third_party/blink/renderer/modules/accessibility/ax_object.cc index a8108d6..7978415 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object.cc
@@ -4143,24 +4143,30 @@ return ancestor; } -// Only use layout object traversal for pseudo elements and their descendants. +// Determine which traversal approach is used to get children of an object. bool AXObject::ShouldUseLayoutObjectTraversalForChildren() const { - if (!GetLayoutObject()) - return false; + // There are two types of traversal used to find AXObjects: + // 1. LayoutTreeBuilderTraversal, which takes FlatTreeTraversal and adds + // pseudo elements on top of that. This is the usual case. However, while this + // can add pseudo elements it cannot add important content descendants such as + // text and images. For this, LayoutObject traversal (#2) is required. + // 2. LayoutObject traversal, which just uses the children of a LayoutObject. + + // Therefore, if the object is a pseudo element or pseudo element descendant, + // use LayoutObject traversal (#2) to find the children. + if (GetNode() && GetNode()->IsPseudoElement()) + return true; // If no node, this is an anonymous layout object. The only way this can be // reached is inside a pseudo element subtree. - if (!GetNode()) { + if (!GetNode() && GetLayoutObject()) { DCHECK(GetLayoutObject()->IsAnonymous()); DCHECK(AXObjectCacheImpl::IsRelevantPseudoElementDescendant( *GetLayoutObject())); return true; } - // The only other case for using layout builder traversal is for a pseudo - // element, such as ::before. Pseudo element child text and images are not - // visibited by LayoutBuilderTraversal. - return GetNode()->IsPseudoElement(); + return false; } void AXObject::UpdateChildrenIfNecessary() {
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc index 725d3c06..04a4cc46 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc
@@ -94,6 +94,7 @@ #include "third_party/blink/renderer/modules/accessibility/ax_virtual_object.h" #include "third_party/blink/renderer/modules/permissions/permission_utils.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" +#include "ui/accessibility/ax_common.h" #include "ui/accessibility/ax_enums.mojom-blink.h" #include "ui/accessibility/ax_event.h" #include "ui/accessibility/ax_role_properties.h" @@ -2098,8 +2099,10 @@ continue; } +#if defined(AX_FAIL_FAST_BUILD) bool did_use_layout_object_traversal = object->ShouldUseLayoutObjectTraversalForChildren(); +#endif // Invalidate children on the first available non-detached parent that is // included in the tree. Sometimes a cached parent is detached because @@ -2136,19 +2139,15 @@ AXObject* new_object = refresh(object); MarkAXObjectDirtyWithCleanLayout(new_object, false); - // Children might change because child traversal style changed. - if (new_object && - new_object->ShouldUseLayoutObjectTraversalForChildren() != - did_use_layout_object_traversal) { - // TODO(accessibility) Add test or remove code. - SANITIZER_CHECK(false) - << "This should no longer be possible, an object only uses layout " - "object traversal if it is the descendant of a pseudo element, " - "and that never changes: " - << new_object->ToString(true, true); - DCHECK(!HashTraits<AXID>::IsDeletedValue(ax_id)); - pending_children_changed_ids.insert(ax_id); - } +#if defined(AX_FAIL_FAST_BUILD) + SANITIZER_CHECK(!new_object || + new_object->ShouldUseLayoutObjectTraversalForChildren() == + did_use_layout_object_traversal) + << "This should no longer be possible, an object only uses layout " + "object traversal if it is part of a pseudo element subtree, " + "and that never changes: " + << new_object->ToString(true, true); +#endif } // Update parents' children. for (AXID parent_id : pending_children_changed_ids) {
diff --git a/third_party/blink/renderer/modules/cookie_store/cookie_store.h b/third_party/blink/renderer/modules/cookie_store/cookie_store.h index 110af5c..3a37c02 100644 --- a/third_party/blink/renderer/modules/cookie_store/cookie_store.h +++ b/third_party/blink/renderer/modules/cookie_store/cookie_store.h
@@ -7,8 +7,8 @@ #include "mojo/public/cpp/bindings/remote.h" #include "net/cookies/site_for_cookies.h" -#include "services/network/public/mojom/cookie_manager.mojom-blink-forward.h" -#include "services/network/public/mojom/restricted_cookie_manager.mojom-blink-forward.h" +#include "services/network/public/mojom/cookie_manager.mojom-blink.h" +#include "services/network/public/mojom/restricted_cookie_manager.mojom-blink.h" #include "third_party/blink/public/mojom/cookie_store/cookie_store.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/core/dom/events/event_target.h"
diff --git a/third_party/blink/renderer/modules/file_system_access/file_system_underlying_sink.cc b/third_party/blink/renderer/modules/file_system_access/file_system_underlying_sink.cc index 9f902c91..ad275e1a 100644 --- a/third_party/blink/renderer/modules/file_system_access/file_system_underlying_sink.cc +++ b/third_party/blink/renderer/modules/file_system_access/file_system_underlying_sink.cc
@@ -5,6 +5,7 @@ #include "third_party/blink/renderer/modules/file_system_access/file_system_underlying_sink.h" #include "mojo/public/cpp/system/string_data_source.h" +#include "net/base/net_errors.h" #include "third_party/blink/public/common/blob/blob_utils.h" #include "third_party/blink/public/mojom/blob/blob.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/array_buffer_or_array_buffer_view_or_blob_or_usv_string.h"
diff --git a/third_party/blink/renderer/modules/indexeddb/indexed_db_blink_mojom_traits.cc b/third_party/blink/renderer/modules/indexeddb/indexed_db_blink_mojom_traits.cc index 5df392c..914f88c 100644 --- a/third_party/blink/renderer/modules/indexeddb/indexed_db_blink_mojom_traits.cc +++ b/third_party/blink/renderer/modules/indexeddb/indexed_db_blink_mojom_traits.cc
@@ -10,6 +10,7 @@ #include "mojo/public/cpp/base/string16_mojom_traits.h" #include "mojo/public/cpp/bindings/array_traits_wtf_vector.h" #include "mojo/public/cpp/bindings/pending_remote.h" +#include "third_party/blink/public/mojom/blob/blob.mojom-blink.h" #include "third_party/blink/public/platform/web_blob_info.h" #include "third_party/blink/renderer/modules/indexeddb/idb_key_range.h" #include "third_party/blink/renderer/platform/file_metadata.h"
diff --git a/third_party/blink/renderer/modules/indexeddb/indexed_db_blink_mojom_traits.h b/third_party/blink/renderer/modules/indexeddb/indexed_db_blink_mojom_traits.h index db0e666..18d2c240 100644 --- a/third_party/blink/renderer/modules/indexeddb/indexed_db_blink_mojom_traits.h +++ b/third_party/blink/renderer/modules/indexeddb/indexed_db_blink_mojom_traits.h
@@ -10,6 +10,8 @@ #include "mojo/public/cpp/bindings/array_traits_wtf_vector.h" #include "mojo/public/cpp/bindings/map_traits_wtf_hash_map.h" +#include "third_party/blink/public/mojom/blob/blob.mojom-blink.h" +#include "third_party/blink/public/mojom/file_system_access/file_system_access_transfer_token.mojom-blink.h" #include "third_party/blink/public/mojom/indexeddb/indexeddb.mojom-blink.h" #include "third_party/blink/renderer/modules/indexeddb/idb_metadata.h" #include "third_party/blink/renderer/modules/modules_export.h"
diff --git a/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc b/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc index ce343c7..d40f300 100644 --- a/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc +++ b/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc
@@ -71,6 +71,8 @@ #include "third_party/blink/renderer/platform/media_capabilities/web_media_configuration.h" #include "third_party/blink/renderer/platform/network/parsed_content_type.h" #include "third_party/blink/renderer/platform/peerconnection/transmission_encoding_info_handler.h" +#include "third_party/blink/renderer/platform/peerconnection/webrtc_decoding_info_handler.h" +#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/vector.h" #include "ui/gfx/geometry/rect.h" @@ -222,7 +224,9 @@ return std::isfinite(framerate) && framerate > 0; } -bool IsValidMimeType(const String& content_type, const String& prefix) { +bool IsValidMimeType(const String& content_type, + const String& prefix, + bool is_webrtc) { ParsedContentType parsed_content_type(content_type); if (!parsed_content_type.IsValid()) @@ -231,9 +235,14 @@ // Valid ParsedContentType implies we have a mime type. DCHECK(parsed_content_type.MimeType()); if (!parsed_content_type.MimeType().StartsWith(prefix) && - !parsed_content_type.MimeType().StartsWith(kApplicationMimeTypePrefix)) { + (is_webrtc || + !parsed_content_type.MimeType().StartsWith(kApplicationMimeTypePrefix))) return false; - } + + // No requirement on parameters for RTP MIME types. + if (is_webrtc) + return true; + const auto& parameters = parsed_content_type.GetParameters(); if (parameters.ParameterCount() > 1) @@ -251,6 +260,7 @@ bool IsValidMediaDecodingConfiguration( const MediaDecodingConfiguration* configuration, + bool is_webrtc, String* message) { if (!IsValidMediaConfiguration(configuration)) { *message = @@ -260,6 +270,13 @@ } if (configuration->hasKeySystemConfiguration()) { + if (is_webrtc) { + *message = + "The keySystemConfiguration object cannot be set for webrtc " + "MediaDecodingType."; + return false; + } + if (configuration->keySystemConfiguration()->hasAudio() && !configuration->hasAudio()) { *message = @@ -280,10 +297,11 @@ return true; } -bool IsValidVideoConfiguration(const VideoConfiguration* configuration) { +bool IsValidVideoConfiguration(const VideoConfiguration* configuration, + bool is_webrtc) { DCHECK(configuration->hasContentType()); - - if (!IsValidMimeType(configuration->contentType(), kVideoMimeTypePrefix)) + if (!IsValidMimeType(configuration->contentType(), kVideoMimeTypePrefix, + is_webrtc)) return false; DCHECK(configuration->hasFramerate()); @@ -293,10 +311,12 @@ return true; } -bool IsValidAudioConfiguration(const AudioConfiguration* configuration) { +bool IsValidAudioConfiguration(const AudioConfiguration* configuration, + bool is_webrtc) { DCHECK(configuration->hasContentType()); - if (!IsValidMimeType(configuration->contentType(), kAudioMimeTypePrefix)) + if (!IsValidMimeType(configuration->contentType(), kAudioMimeTypePrefix, + is_webrtc)) return false; return true; @@ -339,7 +359,6 @@ ParsedContentType parsed_content_type(configuration->contentType()); DCHECK(parsed_content_type.IsValid()); DCHECK(!parsed_content_type.GetParameters().HasDuplicatedNames()); - web_configuration.mime_type = parsed_content_type.MimeType().LowerASCII(); web_configuration.codec = parsed_content_type.ParameterValueForName( media_capabilities_names::kCodecs); @@ -673,19 +692,29 @@ WebFeature::kMediaCapabilitiesDecodingInfoWithKeySystemConfig); } + const bool is_webrtc = config->type() == "webrtc"; + if (is_webrtc && !RuntimeEnabledFeatures::MediaCapabilitiesWebRtcEnabled()) { + exception_state.ThrowTypeError( + "The provided value 'webrtc' is not a valid enum value of type " + "MediaDecodingType."); + return ScriptPromise(); + } + String message; - if (!IsValidMediaDecodingConfiguration(config, &message)) { + if (!IsValidMediaDecodingConfiguration(config, is_webrtc, &message)) { exception_state.ThrowTypeError(message); return ScriptPromise(); } - if (config->hasVideo() && !IsValidVideoConfiguration(config->video())) { + if (config->hasVideo() && + !IsValidVideoConfiguration(config->video(), is_webrtc)) { exception_state.ThrowTypeError( "The video configuration dictionary is not valid."); return ScriptPromise(); } - if (config->hasAudio() && !IsValidAudioConfiguration(config->audio())) { + if (config->hasAudio() && + !IsValidAudioConfiguration(config->audio(), is_webrtc)) { exception_state.ThrowTypeError( "The audio configuration dictionary is not valid."); return ScriptPromise(); @@ -694,6 +723,50 @@ // Validation errors should return above. DCHECK(message.IsEmpty()); + if (is_webrtc) { + auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); + + // IMPORTANT: Acquire the promise before potentially synchronously resolving + // it in the code that follows. Otherwise the promise returned to JS will be + // undefined. See comment above Promise() in script_promise_resolver.h + ScriptPromise promise = resolver->Promise(); + + if (auto* handler = WebrtcDecodingInfoHandler::Instance()) { + const int callback_id = CreateCallbackId(); + pending_cb_map_.insert( + callback_id, + MakeGarbageCollected<MediaCapabilities::PendingCallbackState>( + resolver, nullptr, request_time, absl::nullopt)); + + absl::optional<String> audio_mime_type = + config->hasAudio() + ? absl::make_optional(config->audio()->contentType()) + : absl::nullopt; + absl::optional<String> video_mime_type = + config->hasVideo() + ? absl::make_optional(config->video()->contentType()) + : absl::nullopt; + absl::optional<String> scalability_mode = + config->hasVideo() && config->video()->hasScalabilityMode() + ? absl::make_optional(config->video()->scalabilityMode()) + : absl::nullopt; + handler->DecodingInfo( + audio_mime_type, video_mime_type, scalability_mode, + WTF::Bind(&MediaCapabilities::OnWebrtcDecodingInfoSupport, + WrapPersistent(this), callback_id)); + + return promise; + } + // TODO(crbug.com/1187565): This should not happen unless we're out of + // memory or something similar. Add UMA metric to count how often it + // happens. + DCHECK(false); + DVLOG(2) << __func__ << " Could not get DecodingInfoHandler."; + MediaCapabilitiesDecodingInfo* info = CreateDecodingInfoWith(false); + resolver->Resolve(info); + return promise; + } + String audio_mime_str; String audio_codec_str; if (config->hasAudio()) { @@ -820,9 +893,9 @@ "specified and needs at least one of them.")); return promise; } - + const bool is_webrtc = configuration->type() == "webrtc"; if (configuration->hasVideo() && - !IsValidVideoConfiguration(configuration->video())) { + !IsValidVideoConfiguration(configuration->video(), is_webrtc)) { resolver->Reject(V8ThrowException::CreateTypeError( script_state->GetIsolate(), "The video configuration dictionary is not valid.")); @@ -830,7 +903,7 @@ } if (configuration->hasAudio() && - !IsValidAudioConfiguration(configuration->audio())) { + !IsValidAudioConfiguration(configuration->audio(), is_webrtc)) { resolver->Reject(V8ThrowException::CreateTypeError( script_state->GetIsolate(), "The audio configuration dictionary is not valid.")); @@ -1324,6 +1397,42 @@ pending_cb_map_.erase(callback_id); } +void MediaCapabilities::ResolveWebrtcDecodingCallbackIfReady(int callback_id) { + DCHECK(pending_cb_map_.Contains(callback_id)); + PendingCallbackState* pending_cb = pending_cb_map_.at(callback_id); + + if (!pending_cb->is_supported.has_value()) + return; + + // supported and gpu factories supported are set simultaneously. + DCHECK(pending_cb->is_gpu_factories_supported.has_value()); + + if (!pending_cb->db_is_smooth.has_value()) + return; + + if (!pending_cb->resolver->GetExecutionContext() || + pending_cb->resolver->GetExecutionContext()->IsContextDestroyed()) { + // We're too late! Now that all the callbacks have provided state, its safe + // to erase the entry in the map. + pending_cb_map_.erase(callback_id); + return; + } + + Persistent<MediaCapabilitiesDecodingInfo> info( + MediaCapabilitiesDecodingInfo::Create()); + info->setSupported(*pending_cb->is_supported); + info->setPowerEfficient(*pending_cb->is_gpu_factories_supported); + info->setSmooth(*pending_cb->db_is_smooth); + + const base::TimeDelta process_time = + base::TimeTicks::Now() - pending_cb->request_time; + UMA_HISTOGRAM_TIMES("Media.Capabilities.DecodingInfo.Time.Webrtc", + process_time); + + pending_cb->resolver->Resolve(std::move(info)); + pending_cb_map_.erase(callback_id); +} + void MediaCapabilities::OnBadWindowPrediction( int callback_id, const absl::optional<::media::learning::TargetHistogram>& histogram) { @@ -1395,6 +1504,22 @@ ResolveCallbackIfReady(callback_id); } +void MediaCapabilities::OnWebrtcDecodingInfoSupport(int callback_id, + bool is_supported, + bool is_power_efficient) { + DCHECK(pending_cb_map_.Contains(callback_id)); + PendingCallbackState* pending_cb = pending_cb_map_.at(callback_id); + + pending_cb->is_supported = is_supported; + pending_cb->is_gpu_factories_supported = is_power_efficient; + + // TODO(crbug.com/1187565): Add call in decodingInfo() to get smoothness score + // from database and remove this default assignment. + pending_cb->db_is_smooth = is_supported; + + ResolveWebrtcDecodingCallbackIfReady(callback_id); +} + int MediaCapabilities::CreateCallbackId() { // Search for the next available callback ID. 0 and -1 are reserved by // wtf::HashMap (meaning "empty" and "deleted").
diff --git a/third_party/blink/renderer/modules/media_capabilities/media_capabilities.h b/third_party/blink/renderer/modules/media_capabilities/media_capabilities.h index 9d36f99..babd98de 100644 --- a/third_party/blink/renderer/modules/media_capabilities/media_capabilities.h +++ b/third_party/blink/renderer/modules/media_capabilities/media_capabilities.h
@@ -67,6 +67,7 @@ Member<ScriptPromiseResolver> resolver; Member<MediaKeySystemAccess> key_system_access; + absl::optional<bool> is_supported; absl::optional<bool> is_bad_window_prediction_smooth; absl::optional<bool> is_nnr_prediction_smooth; absl::optional<bool> db_is_smooth; @@ -140,6 +141,12 @@ // |pending_callback_map_|. void ResolveCallbackIfReady(int callback_id); + void OnWebrtcDecodingInfoSupport(int callback_id, + bool is_supported, + bool is_power_efficient); + + void ResolveWebrtcDecodingCallbackIfReady(int callback_id); + // Creates a new (incremented) callback ID from |last_callback_id_| for // mapping in |pending_cb_map_|. int CreateCallbackId();
diff --git a/third_party/blink/renderer/modules/media_capabilities/media_capabilities_test.cc b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_test.cc index c4247de..d7578bf 100644 --- a/third_party/blink/renderer/modules/media_capabilities/media_capabilities_test.cc +++ b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_test.cc
@@ -355,31 +355,55 @@ const int kWidth = 3840; const int kHeight = 2160; const int kBitrate = 2391000; +const char kWebrtcContentType[] = "video/VP9; profile-id=\"0\""; +const char kWebrtcAudioContentType[] = "audio/opus"; -// Construct VideoConfig using the constants above. -MediaDecodingConfiguration* CreateAudioDecodingConfig() { +// Construct AudioConfig using the constants above. +MediaDecodingConfiguration* CreateAudioDecodingConfig(const char content_type[], + const char type[]) { auto* audio_config = MakeGarbageCollected<AudioConfiguration>(); - audio_config->setContentType(kAudioContentType); + audio_config->setContentType(content_type); auto* decoding_config = MakeGarbageCollected<MediaDecodingConfiguration>(); - decoding_config->setType("media-source"); + decoding_config->setType(type); decoding_config->setAudio(audio_config); return decoding_config; } +// Construct media-source AudioConfig using the constants above. +MediaDecodingConfiguration* CreateAudioDecodingConfig() { + return CreateAudioDecodingConfig(kAudioContentType, "media-source"); +} + +// Construct webrtc AudioConfig using the constants above. +MediaDecodingConfiguration* CreateWebrtcAudioDecodingConfig() { + return CreateAudioDecodingConfig(kWebrtcAudioContentType, "webrtc"); +} + // Construct VideoConfig using the constants above. -MediaDecodingConfiguration* CreateDecodingConfig() { +MediaDecodingConfiguration* CreateDecodingConfig(const char content_type[], + const char type[]) { auto* video_config = MakeGarbageCollected<VideoConfiguration>(); video_config->setFramerate(kFramerate); - video_config->setContentType(kContentType); + video_config->setContentType(content_type); video_config->setWidth(kWidth); video_config->setHeight(kHeight); video_config->setBitrate(kBitrate); auto* decoding_config = MakeGarbageCollected<MediaDecodingConfiguration>(); - decoding_config->setType("media-source"); + decoding_config->setType(type); decoding_config->setVideo(video_config); return decoding_config; } +// Construct media-source VideoConfig using the constants above. +MediaDecodingConfiguration* CreateDecodingConfig() { + return CreateDecodingConfig(kContentType, "media-source"); +} + +// Construct webrtc VideoConfig using the constants above. +MediaDecodingConfiguration* CreateWebrtcDecodingConfig() { + return CreateDecodingConfig(kWebrtcContentType, "webrtc"); +} + // Construct PredicitonFeatures matching the CreateDecodingConfig, using the // constants above. media::mojom::blink::PredictionFeatures CreateFeatures() { @@ -1005,4 +1029,66 @@ } while (std::next_permutation(callback_order.begin(), callback_order.end())); } +// WebRTC tests. +TEST(MediaCapabilitiesTests, WebrtcBasicAudio) { + MediaCapabilitiesTestContext context; + ON_CALL(context.GetMockPlatform(), GetGpuFactories()) + .WillByDefault(Return(nullptr)); + EXPECT_CALL(context.GetMockPlatform(), GetGpuFactories()) + .Times(testing::AtMost(1)); + + const MediaDecodingConfiguration* kDecodingConfig = + CreateWebrtcAudioDecodingConfig(); + MediaCapabilitiesInfo* info = DecodingInfo(kDecodingConfig, &context); + EXPECT_TRUE(info->supported()); + EXPECT_TRUE(info->smooth()); + EXPECT_TRUE(info->powerEfficient()); +} + +TEST(MediaCapabilitiesTests, WebrtcUnsupportedAudio) { + MediaCapabilitiesTestContext context; + ON_CALL(context.GetMockPlatform(), GetGpuFactories()) + .WillByDefault(Return(nullptr)); + EXPECT_CALL(context.GetMockPlatform(), GetGpuFactories()) + .Times(testing::AtMost(1)); + + const MediaDecodingConfiguration* kDecodingConfig = + CreateAudioDecodingConfig("audio/FooCodec", "webrtc"); + MediaCapabilitiesInfo* info = DecodingInfo(kDecodingConfig, &context); + EXPECT_FALSE(info->supported()); + EXPECT_FALSE(info->smooth()); + EXPECT_FALSE(info->powerEfficient()); +} + +TEST(MediaCapabilitiesTests, WebrtcBasicVideo) { + MediaCapabilitiesTestContext context; + ON_CALL(context.GetMockPlatform(), GetGpuFactories()) + .WillByDefault(Return(nullptr)); + EXPECT_CALL(context.GetMockPlatform(), GetGpuFactories()) + .Times(testing::AtMost(1)); + + const MediaDecodingConfiguration* kDecodingConfig = + CreateWebrtcDecodingConfig(); + MediaCapabilitiesInfo* info = DecodingInfo(kDecodingConfig, &context); + EXPECT_TRUE(info->supported()); + EXPECT_TRUE(info->smooth()); + EXPECT_FALSE(info->powerEfficient()); +} + +TEST(MediaCapabilitiesTests, WebrtcUnsupportedVideo) { + MediaCapabilitiesTestContext context; + ON_CALL(context.GetMockPlatform(), GetGpuFactories()) + .WillByDefault(Return(nullptr)); + EXPECT_CALL(context.GetMockPlatform(), GetGpuFactories()) + .Times(testing::AtMost(1)); + + const MediaDecodingConfiguration* kDecodingConfig = + CreateDecodingConfig("video/FooCodec", "webrtc"); + + MediaCapabilitiesInfo* info = DecodingInfo(kDecodingConfig, &context); + EXPECT_FALSE(info->supported()); + EXPECT_FALSE(info->smooth()); + EXPECT_FALSE(info->powerEfficient()); +} + } // namespace blink
diff --git a/third_party/blink/renderer/modules/media_capabilities/media_decoding_configuration.idl b/third_party/blink/renderer/modules/media_capabilities/media_decoding_configuration.idl index 26779a24..64aec03 100644 --- a/third_party/blink/renderer/modules/media_capabilities/media_decoding_configuration.idl +++ b/third_party/blink/renderer/modules/media_capabilities/media_decoding_configuration.idl
@@ -7,6 +7,7 @@ enum MediaDecodingType { "file", "media-source", + "webrtc", }; // https://wicg.github.io/media-capabilities/#dictdef-mediadecodingconfiguration
diff --git a/third_party/blink/renderer/modules/media_capabilities/media_encoding_configuration.idl b/third_party/blink/renderer/modules/media_capabilities/media_encoding_configuration.idl index 5ceaf91..0138db7 100644 --- a/third_party/blink/renderer/modules/media_capabilities/media_encoding_configuration.idl +++ b/third_party/blink/renderer/modules/media_capabilities/media_encoding_configuration.idl
@@ -7,6 +7,7 @@ enum MediaEncodingType { "record", "transmission", + "webrtc", }; dictionary MediaEncodingConfiguration : MediaConfiguration{
diff --git a/third_party/blink/renderer/modules/media_capabilities/video_configuration.idl b/third_party/blink/renderer/modules/media_capabilities/video_configuration.idl index 84dc8eff..cf9e35c6 100644 --- a/third_party/blink/renderer/modules/media_capabilities/video_configuration.idl +++ b/third_party/blink/renderer/modules/media_capabilities/video_configuration.idl
@@ -17,4 +17,5 @@ [RuntimeEnabled=MediaCapabilitiesDynamicRange] HdrMetadataType hdrMetadataType; [RuntimeEnabled=MediaCapabilitiesDynamicRange] ColorGamut colorGamut; [RuntimeEnabled=MediaCapabilitiesDynamicRange] TransferFunction transferFunction; + [RuntimeEnabled=MediaCapabilitiesWebRtc] DOMString scalabilityMode; };
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.cc b/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.cc index 9f1c338..967e364 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.cc
@@ -140,6 +140,25 @@ stream->on_device_request_state_change_cb.Run(device, new_state); } +void MediaStreamDeviceObserver::OnDeviceCaptureHandleChange( + const String& label, + const MediaStreamDevice& device) { + DVLOG(1) << __func__ << " label=" << label << " device_id=" << device.id; + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + auto it = label_stream_map_.find(label); + if (it == label_stream_map_.end()) { + // This can happen if a user stops a device from JS at the same + // time as the underlying media device is unplugged from the system. + return; + } + Stream* stream = &it->value; + + if (stream->on_device_capture_handle_change_cb) { + stream->on_device_capture_handle_change_cb.Run(device); + } +} + void MediaStreamDeviceObserver::BindMediaStreamDeviceObserverReceiver( mojo::PendingReceiver<mojom::blink::MediaStreamDeviceObserver> receiver) { receiver_.reset(); @@ -153,7 +172,9 @@ WebMediaStreamDeviceObserver::OnDeviceStoppedCb on_device_stopped_cb, WebMediaStreamDeviceObserver::OnDeviceChangedCb on_device_changed_cb, WebMediaStreamDeviceObserver::OnDeviceRequestStateChangeCb - on_device_request_state_change_cb) { + on_device_request_state_change_cb, + WebMediaStreamDeviceObserver::OnDeviceCaptureHandleChangeCb + on_device_capture_handle_change_cb) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); Stream stream; @@ -161,6 +182,8 @@ stream.on_device_changed_cb = std::move(on_device_changed_cb); stream.on_device_request_state_change_cb = std::move(on_device_request_state_change_cb); + stream.on_device_capture_handle_change_cb = + std::move(on_device_capture_handle_change_cb); stream.audio_devices = audio_devices; stream.video_devices = video_devices;
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.h b/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.h index 85d37d22..3e1e217 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.h +++ b/third_party/blink/renderer/modules/mediastream/media_stream_device_observer.h
@@ -41,7 +41,9 @@ WebMediaStreamDeviceObserver::OnDeviceStoppedCb on_device_stopped_cb, WebMediaStreamDeviceObserver::OnDeviceChangedCb on_device_changed_cb, WebMediaStreamDeviceObserver::OnDeviceRequestStateChangeCb - on_device_request_state_change_cb); + on_device_request_state_change_cb, + WebMediaStreamDeviceObserver::OnDeviceCaptureHandleChangeCb + on_device_capture_handle_change_cb); void AddStream(const String& label, const blink::MediaStreamDevice& device); bool RemoveStream(const String& label); void RemoveStreamDevice(const blink::MediaStreamDevice& device); @@ -72,6 +74,8 @@ WebMediaStreamDeviceObserver::OnDeviceChangedCb on_device_changed_cb; WebMediaStreamDeviceObserver::OnDeviceRequestStateChangeCb on_device_request_state_change_cb; + WebMediaStreamDeviceObserver::OnDeviceCaptureHandleChangeCb + on_device_capture_handle_change_cb; MediaStreamDevices audio_devices; MediaStreamDevices video_devices; }; @@ -86,6 +90,8 @@ const String& label, const MediaStreamDevice& device, const mojom::blink::MediaStreamStateChange new_state) override; + void OnDeviceCaptureHandleChange(const String& label, + const MediaStreamDevice& device) override; void BindMediaStreamDeviceObserverReceiver( mojo::PendingReceiver<mojom::blink::MediaStreamDeviceObserver> receiver);
diff --git a/third_party/blink/renderer/modules/mediastream/user_media_processor.cc b/third_party/blink/renderer/modules/mediastream/user_media_processor.cc index 3740b150..8c9ce4a 100644 --- a/third_party/blink/renderer/modules/mediastream/user_media_processor.cc +++ b/third_party/blink/renderer/modules/mediastream/user_media_processor.cc
@@ -1245,6 +1245,34 @@ } } +void UserMediaProcessor::OnDeviceCaptureHandleChange( + const MediaStreamDevice& device) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + SendLogMessage(base::StringPrintf( + "OnDeviceCaptureHandleChange({session_id=%s}, {device_id=%s})", + device.session_id().ToString().c_str(), device.id.c_str())); + + MediaStreamSource* const source = FindLocalSource(device); + if (!source) { + // This happens if the same device is used in several guM requests or + // if a user happens to stop a track from JS at the same time + // as the underlying media device is unplugged from the system. + return; + } + + auto capture_handle = media::mojom::CaptureHandle::New(); + if (device.display_media_info.has_value()) { + capture_handle = device.display_media_info.value()->capture_handle.Clone(); + } + + WebPlatformMediaStreamSource* const source_impl = source->GetPlatformSource(); + if (!source_impl) { + return; + } + + source_impl->SetCaptureHandle(std::move(capture_handle)); +} + void UserMediaProcessor::Trace(Visitor* visitor) const { visitor->Trace(dispatcher_host_); visitor->Trace(frame_); @@ -1454,6 +1482,8 @@ WTF::BindRepeating(&UserMediaProcessor::OnDeviceChanged, WrapWeakPersistent(this)), WTF::BindRepeating(&UserMediaProcessor::OnDeviceRequestStateChange, + WrapWeakPersistent(this)), + WTF::BindRepeating(&UserMediaProcessor::OnDeviceCaptureHandleChange, WrapWeakPersistent(this))); }
diff --git a/third_party/blink/renderer/modules/mediastream/user_media_processor.h b/third_party/blink/renderer/modules/mediastream/user_media_processor.h index bf1179c..4c2760d 100644 --- a/third_party/blink/renderer/modules/mediastream/user_media_processor.h +++ b/third_party/blink/renderer/modules/mediastream/user_media_processor.h
@@ -89,6 +89,7 @@ void OnDeviceRequestStateChange( const MediaStreamDevice& device, const mojom::blink::MediaStreamStateChange new_state); + void OnDeviceCaptureHandleChange(const MediaStreamDevice& device); void set_media_stream_dispatcher_host_for_testing( mojo::PendingRemote<blink::mojom::blink::MediaStreamDispatcherHost>
diff --git a/third_party/blink/renderer/modules/mediastream/web_media_stream_device_observer.cc b/third_party/blink/renderer/modules/mediastream/web_media_stream_device_observer.cc index 52effbe0..04ca976 100644 --- a/third_party/blink/renderer/modules/mediastream/web_media_stream_device_observer.cc +++ b/third_party/blink/renderer/modules/mediastream/web_media_stream_device_observer.cc
@@ -29,11 +29,13 @@ const MediaStreamDevices& video_devices, OnDeviceStoppedCb on_device_stopped_cb, OnDeviceChangedCb on_device_changed_cb, - OnDeviceRequestStateChangeCb on_device_request_state_change_cb) { + OnDeviceRequestStateChangeCb on_device_request_state_change_cb, + OnDeviceCaptureHandleChangeCb on_device_capture_handle_change_cb) { observer_->AddStream(label, audio_devices, video_devices, std::move(on_device_stopped_cb), std::move(on_device_changed_cb), - std::move(on_device_request_state_change_cb)); + std::move(on_device_request_state_change_cb), + std::move(on_device_capture_handle_change_cb)); } void WebMediaStreamDeviceObserver::AddStream(const WebString& label,
diff --git a/third_party/blink/renderer/modules/service_worker/fetch_respond_with_observer.cc b/third_party/blink/renderer/modules/service_worker/fetch_respond_with_observer.cc index 9cf7326..070ad8ef 100644 --- a/third_party/blink/renderer/modules/service_worker/fetch_respond_with_observer.cc +++ b/third_party/blink/renderer/modules/service_worker/fetch_respond_with_observer.cc
@@ -15,6 +15,7 @@ #include "third_party/blink/public/mojom/devtools/console_message.mojom-blink.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink-forward.h" #include "third_party/blink/public/mojom/loader/request_context_frame_type.mojom-blink.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_stream_handle.mojom-blink.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_container_test.cc b/third_party/blink/renderer/modules/service_worker/service_worker_container_test.cc index f9b6afc..b8f0493 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_container_test.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_container_test.cc
@@ -8,6 +8,7 @@ #include <utility> #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/mojom/script/script_type.mojom-blink.h" #include "third_party/blink/public/platform/modules/service_worker/web_service_worker_provider.h" #include "third_party/blink/public/platform/web_url.h" #include "third_party/blink/renderer/bindings/core/v8/dictionary.h"
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 68fbfff..c69fe07 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
@@ -47,6 +47,7 @@ #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/mojom/appcache/appcache.mojom-blink.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_fetch_response_callback.mojom-blink.h" #include "third_party/blink/public/mojom/timing/worker_timing_container.mojom-blink.h" #include "third_party/blink/public/mojom/web_feature/web_feature.mojom-blink.h" #include "third_party/blink/public/mojom/worker/subresource_loader_updater.mojom.h"
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 e572b2d..4c9bcb6 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
@@ -42,6 +42,7 @@ #include "third_party/blink/public/mojom/cache_storage/cache_storage.mojom-blink-forward.h" #include "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom-blink.h" #include "third_party/blink/public/mojom/service_worker/service_worker.mojom-blink.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_stream_handle.mojom-blink-forward.h" #include "third_party/blink/renderer/bindings/core/v8/request_or_usv_string.h" #include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/modules/modules_export.h"
diff --git a/third_party/blink/renderer/modules/service_worker/web_embedded_worker_impl_test.cc b/third_party/blink/renderer/modules/service_worker/web_embedded_worker_impl_test.cc index 1f4cd75..77ce064 100644 --- a/third_party/blink/renderer/modules/service_worker/web_embedded_worker_impl_test.cc +++ b/third_party/blink/renderer/modules/service_worker/web_embedded_worker_impl_test.cc
@@ -50,7 +50,6 @@ void LoadSynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool pass_response_pipe_to_client, bool no_mime_sniffing, base::TimeDelta timeout_interval, @@ -69,7 +68,6 @@ void LoadAsynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool no_mime_sniffing, std::unique_ptr<blink::ResourceLoadInfoNotifierWrapper> resource_load_info_notifier_wrapper,
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index 9da03c4..5cf25d7f 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -1353,6 +1353,8 @@ "peerconnection/video_codec_factory.h", "peerconnection/webrtc_audio_sink.cc", "peerconnection/webrtc_audio_sink.h", + "peerconnection/webrtc_decoding_info_handler.cc", + "peerconnection/webrtc_decoding_info_handler.h", "peerconnection/webrtc_util.h", "peerconnection/webrtc_video_track_source.cc", "peerconnection/webrtc_video_track_source.h", @@ -1427,6 +1429,10 @@ "text/writing_mode.cc", "text/writing_mode.h", "text/writing_mode_utils.h", + "theme/web_theme_engine_conversions.cc", + "theme/web_theme_engine_conversions.h", + "theme/web_theme_engine_helper.cc", + "theme/web_theme_engine_helper.h", "timer.cc", "timer.h", "transforms/affine_transform.cc", @@ -1585,6 +1591,8 @@ "mac/web_core_ns_cell_extras.mm", "text/locale_mac.h", "text/locale_mac.mm", + "theme/web_theme_engine_mac.cc", + "theme/web_theme_engine_mac.h", ] } @@ -1702,6 +1710,19 @@ "//ui/native_theme", ] + if (is_android) { + deps += [ "//third_party/android_ndk:cpu_features" ] + sources += [ + "theme/web_theme_engine_android.cc", + "theme/web_theme_engine_android.h", + ] + } else { + sources += [ + "theme/web_theme_engine_default.cc", + "theme/web_theme_engine_default.h", + ] + } + if (is_mac) { sources -= [ "fonts/skia/font_cache_skia.cc", @@ -2124,6 +2145,7 @@ "peerconnection/transmission_encoding_info_handler_test.cc", "peerconnection/two_keys_adapter_map_unittest.cc", "peerconnection/webrtc_audio_sink_test.cc", + "peerconnection/webrtc_decoding_info_handler_test.cc", "peerconnection/webrtc_video_track_source_test.cc", "runtime_enabled_features_test.cc", "text/bidi_resolver_test.cc", @@ -2144,6 +2166,7 @@ "text/text_run_test.cc", "text/unicode_utilities_test.cc", "text/writing_mode_utils_test.cc", + "theme/web_theme_engine_test.cc", "timer_test.cc", "transforms/affine_transform_test.cc", "transforms/rotation_test.cc",
diff --git a/third_party/blink/renderer/platform/blob/blob_data_test.cc b/third_party/blink/renderer/platform/blob/blob_data_test.cc index 6dbe746b..146f85d 100644 --- a/third_party/blink/renderer/platform/blob/blob_data_test.cc +++ b/third_party/blink/renderer/platform/blob/blob_data_test.cc
@@ -6,6 +6,7 @@ #include <memory> #include <utility> + #include "base/bind.h" #include "base/run_loop.h" #include "base/test/task_environment.h" @@ -13,6 +14,7 @@ #include "mojo/public/cpp/bindings/remote.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/mojom/blob/blob.mojom-blink.h" #include "third_party/blink/public/mojom/blob/blob_registry.mojom-blink.h" #include "third_party/blink/public/platform/file_path_conversion.h" #include "third_party/blink/renderer/platform/blob/blob_bytes_provider.h"
diff --git a/third_party/blink/renderer/platform/blob/serialized_blob_mojom_traits.cc b/third_party/blink/renderer/platform/blob/serialized_blob_mojom_traits.cc index 6b8bf78..a3eaecc 100644 --- a/third_party/blink/renderer/platform/blob/serialized_blob_mojom_traits.cc +++ b/third_party/blink/renderer/platform/blob/serialized_blob_mojom_traits.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/platform/blob/serialized_blob_mojom_traits.h" +#include "third_party/blink/public/mojom/blob/blob.mojom-blink.h" #include "third_party/blink/public/mojom/blob/serialized_blob.mojom-blink.h" namespace mojo {
diff --git a/third_party/blink/renderer/platform/blob/testing/fake_blob_registry.cc b/third_party/blink/renderer/platform/blob/testing/fake_blob_registry.cc index 17cec1f..175d1b2 100644 --- a/third_party/blink/renderer/platform/blob/testing/fake_blob_registry.cc +++ b/third_party/blink/renderer/platform/blob/testing/fake_blob_registry.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/platform/blob/testing/fake_blob_registry.h" +#include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "third_party/blink/public/mojom/blob/data_element.mojom-blink.h" #include "third_party/blink/renderer/platform/blob/testing/fake_blob.h"
diff --git a/third_party/blink/renderer/platform/exported/mediastream/web_platform_media_stream_source.cc b/third_party/blink/renderer/platform/exported/mediastream/web_platform_media_stream_source.cc index 00f4a54..880901ee2 100644 --- a/third_party/blink/renderer/platform/exported/mediastream/web_platform_media_stream_source.cc +++ b/third_party/blink/renderer/platform/exported/mediastream/web_platform_media_stream_source.cc
@@ -46,6 +46,16 @@ device_ = device; } +void WebPlatformMediaStreamSource::SetCaptureHandle( + media::mojom::CaptureHandlePtr capture_handle) { + if (!device_.display_media_info.has_value()) { + DVLOG(1) << "Not a display-capture device."; + return; + } + auto& info = device_.display_media_info.value(); + info->capture_handle = std::move(capture_handle); +} + void WebPlatformMediaStreamSource::SetStopCallback( SourceStoppedCallback stop_callback) { DCHECK(stop_callback_.is_null());
diff --git a/third_party/blink/renderer/platform/exported/platform.cc b/third_party/blink/renderer/platform/exported/platform.cc index b06edfc..5e808a7 100644 --- a/third_party/blink/renderer/platform/exported/platform.cc +++ b/third_party/blink/renderer/platform/exported/platform.cc
@@ -61,6 +61,7 @@ #include "third_party/blink/renderer/platform/scheduler/common/simple_thread_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/theme/web_theme_engine_helper.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" @@ -178,6 +179,10 @@ } // namespace +WebThemeEngine* Platform::ThemeEngine() { + return WebThemeEngineHelper::GetNativeThemeEngine(); +} + void Platform::InitializeBlink() { DCHECK(!did_initialize_blink_); WTF::Partitions::Initialize();
diff --git a/third_party/blink/renderer/platform/exported/web_url_request.cc b/third_party/blink/renderer/platform/exported/web_url_request.cc index b3efc969..c7ff377 100644 --- a/third_party/blink/renderer/platform/exported/web_url_request.cc +++ b/third_party/blink/renderer/platform/exported/web_url_request.cc
@@ -295,14 +295,6 @@ resource_request_->SetRequestDestination(destination); } -int WebURLRequest::RequestorID() const { - return resource_request_->RequestorID(); -} - -void WebURLRequest::SetRequestorID(int requestor_id) { - resource_request_->SetRequestorID(requestor_id); -} - bool WebURLRequest::PassResponsePipeToClient() const { return resource_request_->DownloadToBlob(); }
diff --git a/third_party/blink/renderer/platform/loader/child_url_loader_factory_bundle.cc b/third_party/blink/renderer/platform/loader/child_url_loader_factory_bundle.cc index 285ba0f22..5f34a63 100644 --- a/third_party/blink/renderer/platform/loader/child_url_loader_factory_bundle.cc +++ b/third_party/blink/renderer/platform/loader/child_url_loader_factory_bundle.cc
@@ -12,6 +12,7 @@ #include "base/check.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "net/base/load_flags.h" +#include "services/network/public/mojom/url_loader.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h" #include "url/gurl.h"
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc b/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc index 8dd0e67..3f4b252a 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc
@@ -1329,9 +1329,9 @@ blink::mojom::blink::RequestContextType::FETCH; loader_->LoadSynchronously( std::move(network_resource_request), request.GetURLRequestExtraData(), - request.RequestorID(), request.DownloadToBlob(), no_mime_sniffing, - request.TimeoutInterval(), this, response_out, error_out, data_out, - encoded_data_length, encoded_body_length, downloaded_blob, + request.DownloadToBlob(), no_mime_sniffing, request.TimeoutInterval(), + this, response_out, error_out, data_out, encoded_data_length, + encoded_body_length, downloaded_blob, Context().CreateResourceLoadInfoNotifierWrapper()); } // A message dispatched while synchronously fetching the resource @@ -1393,8 +1393,8 @@ request_body_ = ResourceRequestBody(std::move(form_body)); loader_->LoadAsynchronously( std::move(network_resource_request), request.GetURLRequestExtraData(), - request.RequestorID(), no_mime_sniffing, - Context().CreateResourceLoadInfoNotifierWrapper(), this); + no_mime_sniffing, Context().CreateResourceLoadInfoNotifierWrapper(), + this); if (code_cache_request_) { // Sets defers loading and initiates a fetch from code cache. code_cache_request_->FetchFromCodeCache(loader_.get(), this);
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_loader_defer_loading_test.cc b/third_party/blink/renderer/platform/loader/fetch/resource_loader_defer_loading_test.cc index 5ef04e66..06d89c4 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_loader_defer_loading_test.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource_loader_defer_loading_test.cc
@@ -64,7 +64,6 @@ void LoadSynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool pass_response_pipe_to_client, bool no_mime_sniffing, base::TimeDelta timeout_interval, @@ -82,7 +81,6 @@ void LoadAsynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool no_mime_sniffing, std::unique_ptr<blink::ResourceLoadInfoNotifierWrapper> resource_load_info_notifier_wrapper,
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_loader_test.cc b/third_party/blink/renderer/platform/loader/fetch/resource_loader_test.cc index 4ba8bbac..c58fa9b 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_loader_test.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource_loader_test.cc
@@ -116,7 +116,6 @@ void LoadSynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool pass_response_pipe_to_client, bool no_mime_sniffing, base::TimeDelta timeout_interval, @@ -134,7 +133,6 @@ void LoadAsynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool no_mime_sniffing, std::unique_ptr<blink::ResourceLoadInfoNotifierWrapper> resource_load_info_notifier_wrapper,
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_request.cc b/third_party/blink/renderer/platform/loader/fetch/resource_request.cc index 7a46083..02f375e7 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_request.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource_request.cc
@@ -102,7 +102,6 @@ site_for_cookies_set_(false), priority_(ResourceLoadPriority::kUnresolved), intra_priority_value_(0), - requestor_id_(0), previews_state_(PreviewsTypes::kPreviewsUnspecified), request_context_(mojom::blink::RequestContextType::UNSPECIFIED), destination_(network::mojom::RequestDestination::kEmpty),
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_request.h b/third_party/blink/renderer/platform/loader/fetch/resource_request.h index 105deb2e0..dc8caf2 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_request.h +++ b/third_party/blink/renderer/platform/loader/fetch/resource_request.h
@@ -238,10 +238,6 @@ report_raw_headers_ = report_raw_headers; } - // Allows the request to be matched up with its requestor. - int RequestorID() const { return requestor_id_; } - void SetRequestorID(int requestor_id) { requestor_id_ = requestor_id; } - // True if request was user initiated. bool HasUserGesture() const { return has_user_gesture_; } void SetHasUserGesture(bool); @@ -574,7 +570,6 @@ bool site_for_cookies_set_ : 1; ResourceLoadPriority priority_; int intra_priority_value_; - int requestor_id_; PreviewsState previews_state_; scoped_refptr<WebURLRequestExtraData> url_request_extra_data_; mojom::blink::RequestContextType request_context_;
diff --git a/third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc b/third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc index 31bd060..8584b3c 100644 --- a/third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc +++ b/third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc
@@ -23,6 +23,7 @@ #include "services/network/public/mojom/trust_tokens.mojom.h" #include "third_party/blink/public/common/buildflags.h" #include "third_party/blink/public/common/features.h" +#include "third_party/blink/public/mojom/blob/blob.mojom-blink.h" #include "third_party/blink/public/mojom/blob/blob.mojom.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h" #include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
diff --git a/third_party/blink/renderer/platform/loader/fetch/url_loader/web_resource_request_sender_unittest.cc b/third_party/blink/renderer/platform/loader/fetch/url_loader/web_resource_request_sender_unittest.cc index 1058d3a..890db95c 100644 --- a/third_party/blink/renderer/platform/loader/fetch/url_loader/web_resource_request_sender_unittest.cc +++ b/third_party/blink/renderer/platform/loader/fetch/url_loader/web_resource_request_sender_unittest.cc
@@ -27,6 +27,7 @@ #include "services/network/public/cpp/resource_request.h" #include "services/network/public/cpp/url_loader_completion_status.h" #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" +#include "services/network/public/mojom/url_loader.mojom.h" #include "services/network/public/mojom/url_response_head.mojom.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/features.h"
diff --git a/third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader.cc b/third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader.cc index b50689f..c346490 100644 --- a/third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader.cc +++ b/third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader.cc
@@ -62,6 +62,7 @@ #include "third_party/blink/public/common/net/ip_address_space_util.h" #include "third_party/blink/public/common/security/security_style.h" #include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h" +#include "third_party/blink/public/mojom/blob/blob.mojom.h" #include "third_party/blink/public/mojom/blob/blob_registry.mojom.h" #include "third_party/blink/public/mojom/frame/frame.mojom.h" #include "third_party/blink/public/platform/file_path_conversion.h" @@ -348,7 +349,6 @@ int intra_priority_value); void Start(std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool pass_response_pipe_to_client, bool no_mime_sniffing, base::TimeDelta timeout_interval, @@ -513,7 +513,6 @@ void WebURLLoader::Context::Start( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> passed_url_request_extra_data, - int requestor_id, bool pass_response_pipe_to_client, bool no_mime_sniffing, base::TimeDelta timeout_interval, @@ -964,7 +963,6 @@ void WebURLLoader::LoadSynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool pass_response_pipe_to_client, bool no_mime_sniffing, base::TimeDelta timeout_interval, @@ -988,7 +986,7 @@ const bool report_raw_headers = request->report_raw_headers; context_->Start(std::move(request), std::move(url_request_extra_data), - requestor_id, pass_response_pipe_to_client, no_mime_sniffing, + pass_response_pipe_to_client, no_mime_sniffing, timeout_interval, &sync_load_response, std::move(resource_load_info_notifier_wrapper)); @@ -1037,7 +1035,6 @@ void WebURLLoader::LoadAsynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool no_mime_sniffing, std::unique_ptr<ResourceLoadInfoNotifierWrapper> resource_load_info_notifier_wrapper, @@ -1051,7 +1048,6 @@ context_->set_client(client); context_->Start(std::move(request), std::move(url_request_extra_data), - requestor_id, /*pass_response_pipe_to_client=*/false, no_mime_sniffing, base::TimeDelta(), nullptr, std::move(resource_load_info_notifier_wrapper));
diff --git a/third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader_unittest.cc b/third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader_unittest.cc index e62265770..3ea13a9 100644 --- a/third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader_unittest.cc +++ b/third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader_unittest.cc
@@ -323,7 +323,6 @@ request->priority = net::IDLE; client()->loader()->LoadAsynchronously( std::move(request), /*url_request_extra_data=*/nullptr, - /*requestor_id=*/0, /*no_mime_sniffing=*/false, std::make_unique<ResourceLoadInfoNotifierWrapper>( /*resource_load_info_notifier=*/nullptr), @@ -682,7 +681,6 @@ client()->loader()->LoadSynchronously( std::move(request), /*url_request_extra_data=*/nullptr, - /*requestor_id=*/0, /*pass_response_pipe_to_client=*/false, /*no_mime_sniffing=*/false, base::TimeDelta(), nullptr, response, error, data, encoded_data_length, encoded_body_length, downloaded_blob,
diff --git a/third_party/blink/renderer/platform/loader/internet_disconnected_web_url_loader.cc b/third_party/blink/renderer/platform/loader/internet_disconnected_web_url_loader.cc index a8fb48f..6a1a976b 100644 --- a/third_party/blink/renderer/platform/loader/internet_disconnected_web_url_loader.cc +++ b/third_party/blink/renderer/platform/loader/internet_disconnected_web_url_loader.cc
@@ -42,7 +42,6 @@ void InternetDisconnectedWebURLLoader::LoadSynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool pass_response_pipe_to_client, bool no_mime_sniffing, base::TimeDelta timeout_interval, @@ -61,7 +60,6 @@ void InternetDisconnectedWebURLLoader::LoadAsynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool no_mime_sniffing, std::unique_ptr<blink::ResourceLoadInfoNotifierWrapper> resource_load_info_notifier_wrapper,
diff --git a/third_party/blink/renderer/platform/loader/web_url_request_util.cc b/third_party/blink/renderer/platform/loader/web_url_request_util.cc index 67ab799c..3ae478c 100644 --- a/third_party/blink/renderer/platform/loader/web_url_request_util.cc +++ b/third_party/blink/renderer/platform/loader/web_url_request_util.cc
@@ -13,6 +13,7 @@ #include "base/notreached.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "services/network/public/mojom/data_pipe_getter.mojom-blink.h" +#include "third_party/blink/public/mojom/blob/blob.mojom-blink.h" #include "third_party/blink/public/mojom/blob/blob_registry.mojom-blink.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h" #include "third_party/blink/public/mojom/loader/mixed_content.mojom-blink.h"
diff --git a/third_party/blink/renderer/platform/peerconnection/DEPS b/third_party/blink/renderer/platform/peerconnection/DEPS index 5cce35d5..daeaead 100644 --- a/third_party/blink/renderer/platform/peerconnection/DEPS +++ b/third_party/blink/renderer/platform/peerconnection/DEPS
@@ -28,6 +28,7 @@ "+media/video/video_encode_accelerator.h", "+third_party/blink/renderer/platform/bindings/script_wrappable.h", "+third_party/blink/renderer/platform/heap", + "+third_party/blink/renderer/platform/network/parsed_content_type.h", "+third_party/blink/renderer/platform/platform_export.h", "+third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h", "+third_party/blink/renderer/platform/wtf",
diff --git a/third_party/blink/renderer/platform/peerconnection/webrtc_decoding_info_handler.cc b/third_party/blink/renderer/platform/peerconnection/webrtc_decoding_info_handler.cc new file mode 100644 index 0000000..f85bb06 --- /dev/null +++ b/third_party/blink/renderer/platform/peerconnection/webrtc_decoding_info_handler.cc
@@ -0,0 +1,144 @@ +// Copyright 2021 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 "third_party/blink/renderer/platform/peerconnection/webrtc_decoding_info_handler.h" + +#include <utility> +#include <vector> + +#include "base/cpu.h" +#include "base/logging.h" +#include "base/system/sys_info.h" +#include "third_party/blink/public/platform/platform.h" +#include "third_party/blink/renderer/platform/network/parsed_content_type.h" +#include "third_party/blink/renderer/platform/peerconnection/audio_codec_factory.h" +#include "third_party/blink/renderer/platform/peerconnection/video_codec_factory.h" +#include "third_party/blink/renderer/platform/wtf/text/string_hash.h" +#include "third_party/webrtc/api/audio_codecs/audio_decoder_factory.h" +#include "third_party/webrtc/api/audio_codecs/audio_format.h" +#include "third_party/webrtc/api/scoped_refptr.h" +#include "third_party/webrtc/api/video_codecs/sdp_video_format.h" +#include "third_party/webrtc/api/video_codecs/video_decoder_factory.h" + +namespace blink { + +namespace { + +String ExtractCodecNameFromMimeType(const String& mime_type, + const char* prefix) { + if (mime_type.StartsWith(prefix)) { + size_t length = mime_type.length() - strlen(prefix) - 1; + const String codec_name = mime_type.Right(length); + return codec_name; + } + return ""; +} + +webrtc::SdpVideoFormat::Parameters ConvertToSdpVideoFormatParameters( + const ParsedContentHeaderFieldParameters& parameters) { + webrtc::SdpVideoFormat::Parameters sdp_parameters; + for (const auto& parameter : parameters) { + sdp_parameters[parameter.name.Utf8()] = parameter.value.Utf8(); + } + return sdp_parameters; +} + +// Composes elements of set<string> to a string with ", " delimiter. +String StringHashSetToString(const HashSet<String>& string_set) { + String result; + String delim; + for (auto& s : string_set) { + result = result + delim + s; + if (delim.IsEmpty()) + delim = ", "; + } + return result; +} + +} // namespace + +WebrtcDecodingInfoHandler* WebrtcDecodingInfoHandler::Instance() { + DEFINE_STATIC_LOCAL(WebrtcDecodingInfoHandler, instance, ()); + return &instance; +} + +WebrtcDecodingInfoHandler::WebrtcDecodingInfoHandler() + : WebrtcDecodingInfoHandler( + blink::CreateWebrtcVideoDecoderFactory( + Platform::Current()->GetGpuFactories(), + Platform::Current()->GetMediaDecoderFactory(), + Platform::Current()->MediaThreadTaskRunner(), + Platform::Current()->GetRenderingColorSpace()), + blink::CreateWebrtcAudioDecoderFactory()) {} + +WebrtcDecodingInfoHandler::WebrtcDecodingInfoHandler( + std::unique_ptr<webrtc::VideoDecoderFactory> video_decoder_factory, + rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) + : video_decoder_factory_(std::move(video_decoder_factory)), + audio_decoder_factory_(std::move(audio_decoder_factory)) { + std::vector<webrtc::AudioCodecSpec> supported_audio_specs = + audio_decoder_factory_->GetSupportedDecoders(); + for (const auto& audio_spec : supported_audio_specs) { + supported_audio_codecs_.insert( + String::FromUTF8(audio_spec.format.name).LowerASCII()); + } + DVLOG(2) << String::Format( + "supported_audio_codecs_:[%s]", + StringHashSetToString(supported_audio_codecs_).Utf8().c_str()); +} + +WebrtcDecodingInfoHandler::~WebrtcDecodingInfoHandler() = default; + +void WebrtcDecodingInfoHandler::DecodingInfo( + const absl::optional<String> audio_mime_type, + const absl::optional<String> video_mime_type, + const absl::optional<String> video_scalability_mode, + OnMediaCapabilitiesDecodingInfoCallback callback) const { + DCHECK(audio_mime_type || video_mime_type); + + // Set default values to true in case an audio configuration is not specified. + bool supported = true; + bool power_efficient = true; + if (audio_mime_type) { + ParsedContentType audio_content_type(audio_mime_type->LowerASCII()); + DCHECK(audio_content_type.IsValid()); + const String codec_name = + ExtractCodecNameFromMimeType(audio_content_type.MimeType(), "audio"); + supported = base::Contains(supported_audio_codecs_, codec_name); + // Audio is always assumed to be power efficient whenever it is + // supported. + power_efficient = supported; + DVLOG(1) << "Audio MIME type:" << codec_name << " supported:" << supported + << " power_efficient:" << power_efficient; + } + + // Only check video configuration if the audio configuration was supported (or + // not specified). + if (video_mime_type && supported) { + // Convert video_configuration to SdpVideoFormat. + ParsedContentType video_content_type(video_mime_type->LowerASCII()); + DCHECK(video_content_type.IsValid()); + const String codec_name = + ExtractCodecNameFromMimeType(video_content_type.MimeType(), "video"); + const webrtc::SdpVideoFormat::Parameters parameters = + ConvertToSdpVideoFormatParameters(video_content_type.GetParameters()); + webrtc::SdpVideoFormat sdp_video_format(codec_name.Utf8(), parameters); + absl::optional<std::string> scalability_mode = + video_scalability_mode + ? absl::make_optional(video_scalability_mode->Utf8()) + : absl::nullopt; + webrtc::VideoDecoderFactory::CodecSupport support = + video_decoder_factory_->QueryCodecSupport(sdp_video_format, + scalability_mode); + + supported = support.is_supported; + power_efficient = support.is_power_efficient; + + DVLOG(1) << "Video MIME type:" << codec_name << " supported:" << supported + << " power_efficient:" << power_efficient; + } + std::move(callback).Run(supported, power_efficient); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/platform/peerconnection/webrtc_decoding_info_handler.h b/third_party/blink/renderer/platform/peerconnection/webrtc_decoding_info_handler.h new file mode 100644 index 0000000..6d54519 --- /dev/null +++ b/third_party/blink/renderer/platform/peerconnection/webrtc_decoding_info_handler.h
@@ -0,0 +1,57 @@ +// Copyright 2021 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_RENDERER_PLATFORM_PEERCONNECTION_WEBRTC_DECODING_INFO_HANDLER_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_WEBRTC_DECODING_INFO_HANDLER_H_ + +#include <memory> + +#include "base/callback_forward.h" +#include "base/macros.h" +#include "third_party/blink/renderer/platform/peerconnection/audio_codec_factory.h" +#include "third_party/blink/renderer/platform/peerconnection/video_codec_factory.h" +#include "third_party/blink/renderer/platform/platform_export.h" +#include "third_party/blink/renderer/platform/wtf/hash_set.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" + +namespace blink { + +class PLATFORM_EXPORT WebrtcDecodingInfoHandler { + public: + static WebrtcDecodingInfoHandler* Instance(); + + WebrtcDecodingInfoHandler(); + // Constructor for unittest to inject video and audio decoder factory + // instances. + WebrtcDecodingInfoHandler( + std::unique_ptr<webrtc::VideoDecoderFactory> video_decoder_factory, + rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory); + // Not copyable or movable. + WebrtcDecodingInfoHandler(const WebrtcDecodingInfoHandler&) = delete; + WebrtcDecodingInfoHandler& operator=(const WebrtcDecodingInfoHandler&) = + delete; + ~WebrtcDecodingInfoHandler(); + + // Queries the capabilities of the given decoding configuration and passes + // WebMediaCapabilitiesInfo result via callbacks. + // It implements WICG Media Capabilities decodingInfo() call for webrtc + // encoding. + // https://wicg.github.io/media-capabilities/#media-capabilities-interface + using OnMediaCapabilitiesDecodingInfoCallback = + base::OnceCallback<void(bool, bool)>; + void DecodingInfo(const absl::optional<String> audio_mime_type, + const absl::optional<String> video_mime_type, + const absl::optional<String> video_scalability_mode, + OnMediaCapabilitiesDecodingInfoCallback callback) const; + + private: + std::unique_ptr<webrtc::VideoDecoderFactory> video_decoder_factory_; + rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory_; + // List of supported audio codecs. + HashSet<String> supported_audio_codecs_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_WEBRTC_DECODING_INFO_HANDLER_H_
diff --git a/third_party/blink/renderer/platform/peerconnection/webrtc_decoding_info_handler_test.cc b/third_party/blink/renderer/platform/peerconnection/webrtc_decoding_info_handler_test.cc new file mode 100644 index 0000000..ce32c30 --- /dev/null +++ b/third_party/blink/renderer/platform/peerconnection/webrtc_decoding_info_handler_test.cc
@@ -0,0 +1,195 @@ +// Copyright 2021 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 "third_party/blink/renderer/platform/peerconnection/webrtc_decoding_info_handler.h" + +#include <memory> +#include <utility> +#include <vector> + +#include "base/bind.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/platform/web_string.h" +#include "third_party/webrtc/api/audio_codecs/audio_decoder_factory.h" +#include "third_party/webrtc/api/video_codecs/sdp_video_format.h" +#include "third_party/webrtc/api/video_codecs/video_decoder.h" +#include "third_party/webrtc/api/video_codecs/video_decoder_factory.h" +#include "ui/gfx/geometry/size.h" + +namespace blink { + +namespace { + +class MockVideoDecoderFactory : public webrtc::VideoDecoderFactory { + public: + // webrtc::VideoDecoderFactory implementation: + MOCK_METHOD(std::unique_ptr<webrtc::VideoDecoder>, + CreateVideoDecoder, + (const webrtc::SdpVideoFormat& format), + (override)); + MOCK_METHOD(std::vector<webrtc::SdpVideoFormat>, + GetSupportedFormats, + (), + (const)); + MOCK_METHOD(webrtc::VideoDecoderFactory::CodecSupport, + QueryCodecSupport, + (const webrtc::SdpVideoFormat& format, + absl::optional<std::string> scalability_mode), + (const, override)); +}; + +class MediaCapabilitiesDecodingInfoCallback { + public: + void OnWebrtcDecodingInfoSupport(bool is_supported, bool is_power_efficient) { + is_success_ = true; + is_supported_ = is_supported; + is_power_efficient_ = is_power_efficient; + } + + void OnError() { is_error_ = true; } + + bool IsCalled() const { return is_success_ || is_error_; } + bool IsSuccess() const { return is_success_; } + bool IsError() const { return is_error_; } + bool IsSupported() const { return is_supported_; } + bool IsPowerEfficient() const { return is_power_efficient_; } + + private: + bool is_success_ = false; + bool is_error_ = false; + bool is_supported_ = false; + bool is_power_efficient_ = false; +}; + +} // namespace + +typedef webrtc::VideoDecoderFactory::CodecSupport CodecSupport; + +class WebrtcDecodingInfoHandlerTests : public ::testing::Test { + public: + WebrtcDecodingInfoHandlerTests() + : mock_video_decoder_factory_(new MockVideoDecoderFactory()), + video_decoder_factory_(mock_video_decoder_factory_), + audio_decoder_factory_(blink::CreateWebrtcAudioDecoderFactory()) {} + + void SetUp() override {} + + void VerifyDecodingInfo( + const absl::optional<String> audio_mime_type, + const absl::optional<String> video_mime_type, + const absl::optional<String> video_scalability_mode, + const absl::optional<webrtc::SdpVideoFormat> expected_format, + const CodecSupport support) { + if (expected_format) { + const absl::optional<std::string> expected_scalability_mode = + video_scalability_mode + ? absl::make_optional(video_scalability_mode->Utf8()) + : absl::nullopt; + + ON_CALL(*mock_video_decoder_factory_, QueryCodecSupport) + .WillByDefault(testing::Invoke( + [expected_format, expected_scalability_mode, support]( + const webrtc::SdpVideoFormat& format, + absl::optional<std::string> scalability_mode) { + format.IsSameCodec(*expected_format); + EXPECT_EQ(scalability_mode, expected_scalability_mode); + return support; + })); + EXPECT_CALL(*mock_video_decoder_factory_, QueryCodecSupport) + .Times(::testing::AtMost(1)); + } + WebrtcDecodingInfoHandler decoding_info_handler( + std::move(video_decoder_factory_), audio_decoder_factory_); + MediaCapabilitiesDecodingInfoCallback decoding_info_callback; + + decoding_info_handler.DecodingInfo( + audio_mime_type, video_mime_type, video_scalability_mode, + base::BindOnce( + &MediaCapabilitiesDecodingInfoCallback::OnWebrtcDecodingInfoSupport, + base::Unretained(&decoding_info_callback))); + + EXPECT_TRUE(decoding_info_callback.IsCalled()); + EXPECT_TRUE(decoding_info_callback.IsSuccess()); + EXPECT_EQ(decoding_info_callback.IsSupported(), support.is_supported); + EXPECT_EQ(decoding_info_callback.IsPowerEfficient(), + support.is_power_efficient); + } + + protected: + std::vector<webrtc::AudioCodecSpec> kSupportedAudioCodecs; + MockVideoDecoderFactory* mock_video_decoder_factory_; + std::unique_ptr<webrtc::VideoDecoderFactory> video_decoder_factory_; + rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory_; +}; + +TEST_F(WebrtcDecodingInfoHandlerTests, BasicAudio) { + VerifyDecodingInfo( + "audio/opus", /*video_mime_type=*/absl::nullopt, + /*video_scalability_mode=*/absl::nullopt, + /*expected_format=*/absl::nullopt, + CodecSupport{/*is_supported=*/true, /*is_power_efficient=*/true}); +} + +TEST_F(WebrtcDecodingInfoHandlerTests, UnsupportedAudio) { + VerifyDecodingInfo( + "audio/foo", /*video_mime_type=*/absl::nullopt, + /*video_scalability_mode=*/absl::nullopt, + /*expected_format=*/absl::nullopt, + CodecSupport{/*is_supported=*/false, /*is_power_efficient=*/false}); +} + +// These tests verify that the video MIME type is correctly parsed into +// SdpVideoFormat and that the return value from +// VideoDecoderFactory::QueryCodecSupport is correctly returned through the +// callback. +TEST_F(WebrtcDecodingInfoHandlerTests, BasicVideo) { + const webrtc::SdpVideoFormat kExpectedFormat("VP9"); + VerifyDecodingInfo( + /*audio_mime_type=*/absl::nullopt, "video/VP9", + /*video_scalability_mode=*/absl::nullopt, kExpectedFormat, + CodecSupport{/*is_supported=*/true, /*is_power_efficient=*/false}); +} + +TEST_F(WebrtcDecodingInfoHandlerTests, BasicVideoPowerEfficient) { + const webrtc::SdpVideoFormat kExpectedFormat("VP9"); + VerifyDecodingInfo( + /*audio_mime_type=*/absl::nullopt, "video/VP9", + /*video_scalability_mode=*/absl::nullopt, kExpectedFormat, + CodecSupport{/*is_supported=*/true, /*is_power_efficient=*/true}); +} + +TEST_F(WebrtcDecodingInfoHandlerTests, UnsupportedVideo) { + const webrtc::SdpVideoFormat kExpectedFormat( + "VP9", webrtc::SdpVideoFormat::Parameters{{"profile-level", "5"}}); + VerifyDecodingInfo( + /*audio_mime_type=*/absl::nullopt, "video/VP9; profile-level=5", + /*video_scalability_mode=*/absl::nullopt, kExpectedFormat, + CodecSupport{/*is_supported=*/true, /*is_power_efficient=*/false}); +} + +TEST_F(WebrtcDecodingInfoHandlerTests, VideoWithScalabilityMode) { + const webrtc::SdpVideoFormat kExpectedFormat("VP9"); + VerifyDecodingInfo( + /*audio_mime_type=*/absl::nullopt, "video/VP9", "L1T3", kExpectedFormat, + CodecSupport{/*is_supported=*/true, /*is_power_efficient=*/false}); +} + +TEST_F(WebrtcDecodingInfoHandlerTests, SupportedAudioUnsupportedVideo) { + const webrtc::SdpVideoFormat kExpectedFormat("foo"); + VerifyDecodingInfo( + "audio/opus", "video/foo", /*video_scalability_mode=*/absl::nullopt, + kExpectedFormat, + CodecSupport{/*is_supported=*/false, /*is_power_efficient=*/false}); +} + +TEST_F(WebrtcDecodingInfoHandlerTests, SupportedVideoUnsupportedAudio) { + const webrtc::SdpVideoFormat kExpectedFormat("VP9"); + VerifyDecodingInfo( + "audio/foo", "video/VP9", /*video_scalability_mode=*/absl::nullopt, + kExpectedFormat, + CodecSupport{/*is_supported=*/false, /*is_power_efficient=*/false}); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 14e454de..07b64723 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -339,6 +339,7 @@ }, { name: "CaptureHandle", + origin_trial_feature_name: "CaptureHandle", depends_on: ["GetDisplayMedia"], status: {"Android": "", "default": "experimental"}, }, @@ -1249,6 +1250,10 @@ status: "test", }, { + name: "MediaCapabilitiesWebRtc", + status: "experimental", + }, + { name: "MediaCapture", status: {"Android": "stable"}, },
diff --git a/third_party/blink/renderer/platform/testing/weburl_loader_mock.cc b/third_party/blink/renderer/platform/testing/weburl_loader_mock.cc index a6bbddff..3624ea4 100644 --- a/third_party/blink/renderer/platform/testing/weburl_loader_mock.cc +++ b/third_party/blink/renderer/platform/testing/weburl_loader_mock.cc
@@ -98,7 +98,6 @@ void WebURLLoaderMock::LoadSynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool pass_response_pipe_to_client, bool no_mime_sniffing, base::TimeDelta timeout_interval, @@ -119,7 +118,6 @@ void WebURLLoaderMock::LoadAsynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool no_mime_sniffing, std::unique_ptr<blink::ResourceLoadInfoNotifierWrapper> resource_load_info_notifier_wrapper,
diff --git a/third_party/blink/renderer/platform/testing/weburl_loader_mock.h b/third_party/blink/renderer/platform/testing/weburl_loader_mock.h index b53f174a..8cb21ae 100644 --- a/third_party/blink/renderer/platform/testing/weburl_loader_mock.h +++ b/third_party/blink/renderer/platform/testing/weburl_loader_mock.h
@@ -47,7 +47,6 @@ void LoadSynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool pass_response_pipe_to_client, bool no_mime_sniffing, base::TimeDelta timeout_interval, @@ -63,7 +62,6 @@ void LoadAsynchronously( std::unique_ptr<network::ResourceRequest> request, scoped_refptr<WebURLRequestExtraData> url_request_extra_data, - int requestor_id, bool no_mime_sniffing, std::unique_ptr<blink::ResourceLoadInfoNotifierWrapper> resource_load_info_notifier_wrapper,
diff --git a/third_party/blink/renderer/platform/theme/DEPS b/third_party/blink/renderer/platform/theme/DEPS new file mode 100644 index 0000000..1aea351 --- /dev/null +++ b/third_party/blink/renderer/platform/theme/DEPS
@@ -0,0 +1,4 @@ +include_rules = [ + "+base/win/windows_version", + "+ui/native_theme", +]
diff --git a/content/child/webthemeengine_impl_android.cc b/third_party/blink/renderer/platform/theme/web_theme_engine_android.cc similarity index 89% rename from content/child/webthemeengine_impl_android.cc rename to third_party/blink/renderer/platform/theme/web_theme_engine_android.cc index cbf0818..8fab52e 100644 --- a/content/child/webthemeengine_impl_android.cc +++ b/third_party/blink/renderer/platform/theme/web_theme_engine_android.cc
@@ -2,27 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/child/webthemeengine_impl_android.h" +#include "third_party/blink/renderer/platform/theme/web_theme_engine_android.h" #include "base/notreached.h" #include "base/system/sys_info.h" -#include "content/child/webthemeengine_impl_conversions.h" #include "skia/ext/platform_canvas.h" +#include "third_party/blink/renderer/platform/theme/web_theme_engine_conversions.h" #include "ui/native_theme/native_theme.h" -using blink::WebThemeEngine; - -namespace content { +namespace blink { namespace { - const int kVersionLollipop = 5; +const int kVersionLollipop = 5; - int getMajorVersion() { - int major, minor, bugfix; - base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); - return major; - } +int getMajorVersion() { + int major, minor, bugfix; + base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); + return major; } +} // namespace static void GetNativeThemeExtraParams( WebThemeEngine::Part part, @@ -166,22 +164,21 @@ blink::mojom::ColorScheme color_scheme, const absl::optional<SkColor>& accent_color) { ui::NativeTheme::ExtraParams native_theme_extra_params; - GetNativeThemeExtraParams( - part, state, extra_params, &native_theme_extra_params); + GetNativeThemeExtraParams(part, state, extra_params, + &native_theme_extra_params); ui::NativeTheme::GetInstanceForWeb()->Paint( canvas, NativeThemePart(part), NativeThemeState(state), rect, native_theme_extra_params, NativeColorScheme(color_scheme), accent_color); } -blink::ForcedColors WebThemeEngineAndroid::GetForcedColors() const { +ForcedColors WebThemeEngineAndroid::GetForcedColors() const { return ui::NativeTheme::GetInstanceForWeb()->InForcedColorsMode() - ? blink::ForcedColors::kActive - : blink::ForcedColors::kNone; + ? ForcedColors::kActive + : ForcedColors::kNone; } -void WebThemeEngineAndroid::SetForcedColors( - const blink::ForcedColors forced_colors) { +void WebThemeEngineAndroid::SetForcedColors(const ForcedColors forced_colors) { ui::NativeTheme::GetInstanceForWeb()->set_forced_colors( - forced_colors == blink::ForcedColors::kActive); + forced_colors == ForcedColors::kActive); } -} // namespace content +} // namespace blink
diff --git a/content/child/webthemeengine_impl_android.h b/third_party/blink/renderer/platform/theme/web_theme_engine_android.h similarity index 77% rename from content/child/webthemeengine_impl_android.h rename to third_party/blink/renderer/platform/theme/web_theme_engine_android.h index 96f17ae..04c297e 100644 --- a/content/child/webthemeengine_impl_android.h +++ b/third_party/blink/renderer/platform/theme/web_theme_engine_android.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_CHILD_WEBTHEMEENGINE_IMPL_ANDROID_H_ -#define CONTENT_CHILD_WEBTHEMEENGINE_IMPL_ANDROID_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_THEME_WEB_THEME_ENGINE_ANDROID_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_THEME_WEB_THEME_ENGINE_ANDROID_H_ #include "third_party/blink/public/platform/web_theme_engine.h" -namespace content { +namespace blink { class WebThemeEngineAndroid : public blink::WebThemeEngine { public: @@ -27,6 +27,6 @@ void SetForcedColors(const blink::ForcedColors forced_colors) override; }; -} // namespace content +} // namespace blink -#endif // CONTENT_CHILD_WEBTHEMEENGINE_IMPL_ANDROID_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_THEME_WEB_THEME_ENGINE_ANDROID_H_
diff --git a/third_party/blink/renderer/platform/theme/web_theme_engine_conversions.cc b/third_party/blink/renderer/platform/theme/web_theme_engine_conversions.cc new file mode 100644 index 0000000..fac48b19 --- /dev/null +++ b/third_party/blink/renderer/platform/theme/web_theme_engine_conversions.cc
@@ -0,0 +1,117 @@ +// 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 "third_party/blink/renderer/platform/theme/web_theme_engine_conversions.h" + +namespace blink { + +// TODO(https://crbug.com/988434): The mapping functions below are duplicated +// inside Blink and in the Android implementation of WebThemeEngine. They should +// be implemented in one place where dependencies between Blink and +// ui::NativeTheme make sense. +ui::NativeTheme::Part NativeThemePart(WebThemeEngine::Part part) { + switch (part) { + case WebThemeEngine::kPartScrollbarDownArrow: + return ui::NativeTheme::kScrollbarDownArrow; + case WebThemeEngine::kPartScrollbarLeftArrow: + return ui::NativeTheme::kScrollbarLeftArrow; + case WebThemeEngine::kPartScrollbarRightArrow: + return ui::NativeTheme::kScrollbarRightArrow; + case WebThemeEngine::kPartScrollbarUpArrow: + return ui::NativeTheme::kScrollbarUpArrow; + case WebThemeEngine::kPartScrollbarHorizontalThumb: + return ui::NativeTheme::kScrollbarHorizontalThumb; + case WebThemeEngine::kPartScrollbarVerticalThumb: + return ui::NativeTheme::kScrollbarVerticalThumb; + case WebThemeEngine::kPartScrollbarHorizontalTrack: + return ui::NativeTheme::kScrollbarHorizontalTrack; + case WebThemeEngine::kPartScrollbarVerticalTrack: + return ui::NativeTheme::kScrollbarVerticalTrack; + case WebThemeEngine::kPartScrollbarCorner: + return ui::NativeTheme::kScrollbarCorner; + case WebThemeEngine::kPartCheckbox: + return ui::NativeTheme::kCheckbox; + case WebThemeEngine::kPartRadio: + return ui::NativeTheme::kRadio; + case WebThemeEngine::kPartButton: + return ui::NativeTheme::kPushButton; + case WebThemeEngine::kPartTextField: + return ui::NativeTheme::kTextField; + case WebThemeEngine::kPartMenuList: + return ui::NativeTheme::kMenuList; + case WebThemeEngine::kPartSliderTrack: + return ui::NativeTheme::kSliderTrack; + case WebThemeEngine::kPartSliderThumb: + return ui::NativeTheme::kSliderThumb; + case WebThemeEngine::kPartInnerSpinButton: + return ui::NativeTheme::kInnerSpinButton; + case WebThemeEngine::kPartProgressBar: + return ui::NativeTheme::kProgressBar; + default: + return ui::NativeTheme::kScrollbarDownArrow; + } +} + +ui::NativeTheme::ScrollbarOverlayColorTheme +NativeThemeScrollbarOverlayColorTheme(WebScrollbarOverlayColorTheme theme) { + switch (theme) { + case WebScrollbarOverlayColorTheme::kWebScrollbarOverlayColorThemeLight: + return ui::NativeTheme::ScrollbarOverlayColorThemeLight; + case WebScrollbarOverlayColorTheme::kWebScrollbarOverlayColorThemeDark: + return ui::NativeTheme::ScrollbarOverlayColorThemeDark; + default: + return ui::NativeTheme::ScrollbarOverlayColorThemeDark; + } +} + +ui::NativeTheme::State NativeThemeState(WebThemeEngine::State state) { + switch (state) { + case WebThemeEngine::kStateDisabled: + return ui::NativeTheme::kDisabled; + case WebThemeEngine::kStateHover: + return ui::NativeTheme::kHovered; + case WebThemeEngine::kStateNormal: + return ui::NativeTheme::kNormal; + case WebThemeEngine::kStatePressed: + return ui::NativeTheme::kPressed; + default: + return ui::NativeTheme::kDisabled; + } +} + +ui::NativeTheme::ColorScheme NativeColorScheme( + mojom::ColorScheme color_scheme) { + switch (color_scheme) { + case mojom::ColorScheme::kLight: + return ui::NativeTheme::ColorScheme::kLight; + case mojom::ColorScheme::kDark: + return ui::NativeTheme::ColorScheme::kDark; + } +} + +ui::NativeTheme::SystemThemeColor NativeSystemThemeColor( + WebThemeEngine::SystemThemeColor theme_color) { + switch (theme_color) { + case WebThemeEngine::SystemThemeColor::kButtonFace: + return ui::NativeTheme::SystemThemeColor::kButtonFace; + case WebThemeEngine::SystemThemeColor::kButtonText: + return ui::NativeTheme::SystemThemeColor::kButtonText; + case WebThemeEngine::SystemThemeColor::kGrayText: + return ui::NativeTheme::SystemThemeColor::kGrayText; + case WebThemeEngine::SystemThemeColor::kHighlight: + return ui::NativeTheme::SystemThemeColor::kHighlight; + case WebThemeEngine::SystemThemeColor::kHighlightText: + return ui::NativeTheme::SystemThemeColor::kHighlightText; + case WebThemeEngine::SystemThemeColor::kHotlight: + return ui::NativeTheme::SystemThemeColor::kHotlight; + case WebThemeEngine::SystemThemeColor::kWindow: + return ui::NativeTheme::SystemThemeColor::kWindow; + case WebThemeEngine::SystemThemeColor::kWindowText: + return ui::NativeTheme::SystemThemeColor::kWindowText; + default: + return ui::NativeTheme::SystemThemeColor::kNotSupported; + } +} + +} // namespace blink
diff --git a/third_party/blink/renderer/platform/theme/web_theme_engine_conversions.h b/third_party/blink/renderer/platform/theme/web_theme_engine_conversions.h new file mode 100644 index 0000000..c519484 --- /dev/null +++ b/third_party/blink/renderer/platform/theme/web_theme_engine_conversions.h
@@ -0,0 +1,31 @@ +// 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_RENDERER_PLATFORM_THEME_WEB_THEME_ENGINE_CONVERSIONS_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_THEME_WEB_THEME_ENGINE_CONVERSIONS_H_ + +#include "third_party/blink/renderer/platform/platform_export.h" +#include "third_party/blink/renderer/platform/theme//web_theme_engine_default.h" +#include "ui/native_theme/native_theme.h" + +namespace blink { + +PLATFORM_EXPORT ui::NativeTheme::Part NativeThemePart( + WebThemeEngine::Part part); + +PLATFORM_EXPORT ui::NativeTheme::ScrollbarOverlayColorTheme +NativeThemeScrollbarOverlayColorTheme(WebScrollbarOverlayColorTheme theme); + +PLATFORM_EXPORT ui::NativeTheme::State NativeThemeState( + WebThemeEngine::State state); + +PLATFORM_EXPORT ui::NativeTheme::ColorScheme NativeColorScheme( + mojom::ColorScheme color_scheme); + +PLATFORM_EXPORT ui::NativeTheme::SystemThemeColor NativeSystemThemeColor( + WebThemeEngine::SystemThemeColor theme_color); + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_THEME_WEB_THEME_ENGINE_CONVERSIONS_H_
diff --git a/content/child/webthemeengine_impl_default.cc b/third_party/blink/renderer/platform/theme/web_theme_engine_default.cc similarity index 92% rename from content/child/webthemeengine_impl_default.cc rename to third_party/blink/renderer/platform/theme/web_theme_engine_default.cc index 183279e9..6abe68eb 100644 --- a/content/child/webthemeengine_impl_default.cc +++ b/third_party/blink/renderer/platform/theme/web_theme_engine_default.cc
@@ -2,19 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/child/webthemeengine_impl_default.h" +#include "third_party/blink/renderer/platform/theme/web_theme_engine_default.h" #include "build/build_config.h" -#include "content/child/webthemeengine_impl_conversions.h" #include "skia/ext/platform_canvas.h" +#include "third_party/blink/renderer/platform/theme/web_theme_engine_conversions.h" #include "ui/native_theme/native_theme.h" #include "ui/native_theme/overlay_scrollbar_constants_aura.h" -using blink::WebScrollbarOverlayColorTheme; -using blink::WebThemeEngine; -using blink::mojom::ColorScheme; +namespace blink { -namespace content { +using mojom::ColorScheme; + namespace { #if defined(OS_WIN) @@ -191,11 +190,11 @@ WebThemeEngine::State state, const gfx::Rect& rect, const WebThemeEngine::ExtraParams* extra_params, - blink::mojom::ColorScheme color_scheme, + mojom::ColorScheme color_scheme, const absl::optional<SkColor>& accent_color) { ui::NativeTheme::ExtraParams native_theme_extra_params; - GetNativeThemeExtraParams( - part, state, extra_params, &native_theme_extra_params); + GetNativeThemeExtraParams(part, state, extra_params, + &native_theme_extra_params); ui::NativeTheme::GetInstanceForWeb()->Paint( canvas, NativeThemePart(part), NativeThemeState(state), rect, native_theme_extra_params, NativeColorScheme(color_scheme), accent_color); @@ -225,7 +224,7 @@ } absl::optional<SkColor> WebThemeEngineDefault::GetSystemColor( - blink::WebThemeEngine::SystemThemeColor system_theme_color) const { + WebThemeEngine::SystemThemeColor system_theme_color) const { return ui::NativeTheme::GetInstanceForWeb()->GetSystemThemeColor( NativeSystemThemeColor(system_theme_color)); } @@ -244,16 +243,15 @@ } #endif -blink::ForcedColors WebThemeEngineDefault::GetForcedColors() const { +ForcedColors WebThemeEngineDefault::GetForcedColors() const { return ui::NativeTheme::GetInstanceForWeb()->InForcedColorsMode() - ? blink::ForcedColors::kActive - : blink::ForcedColors::kNone; + ? ForcedColors::kActive + : ForcedColors::kNone; } -void WebThemeEngineDefault::SetForcedColors( - const blink::ForcedColors forced_colors) { +void WebThemeEngineDefault::SetForcedColors(const ForcedColors forced_colors) { ui::NativeTheme::GetInstanceForWeb()->set_forced_colors( - forced_colors == blink::ForcedColors::kActive); + forced_colors == ForcedColors::kActive); } -} // namespace content +} // namespace blink
diff --git a/third_party/blink/renderer/platform/theme/web_theme_engine_default.h b/third_party/blink/renderer/platform/theme/web_theme_engine_default.h new file mode 100644 index 0000000..2543445 --- /dev/null +++ b/third_party/blink/renderer/platform/theme/web_theme_engine_default.h
@@ -0,0 +1,48 @@ +// Copyright 2014 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_RENDERER_PLATFORM_THEME_WEB_THEME_ENGINE_DEFAULT_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_THEME_WEB_THEME_ENGINE_DEFAULT_H_ + +#include <stdint.h> + +#include "build/build_config.h" +#include "third_party/blink/public/platform/web_theme_engine.h" + +namespace blink { + +class WebThemeEngineDefault : public WebThemeEngine { + public: + // WebThemeEngine methods: + ~WebThemeEngineDefault() override; + gfx::Size GetSize(WebThemeEngine::Part) override; + void Paint(cc::PaintCanvas* canvas, + WebThemeEngine::Part part, + WebThemeEngine::State state, + const gfx::Rect& rect, + const WebThemeEngine::ExtraParams* extra_params, + mojom::ColorScheme color_scheme, + const absl::optional<SkColor>& accent_color) override; + void GetOverlayScrollbarStyle(WebThemeEngine::ScrollbarStyle*) override; + bool SupportsNinePatch(Part part) const override; + gfx::Size NinePatchCanvasSize(Part part) const override; + gfx::Rect NinePatchAperture(Part part) const override; + absl::optional<SkColor> GetSystemColor( + WebThemeEngine::SystemThemeColor system_theme_color) const override; +#if defined(OS_WIN) + // Caches the scrollbar metrics. These are retrieved in the browser and passed + // to the renderer in RendererPreferences because the required Windows + // system calls cannot be made in sandboxed renderers. + static void cacheScrollBarMetrics(int32_t vertical_scroll_bar_width, + int32_t horizontal_scroll_bar_height, + int32_t vertical_arrow_bitmap_height, + int32_t horizontal_arrow_bitmap_width); +#endif + ForcedColors GetForcedColors() const override; + void SetForcedColors(const ForcedColors forced_colors) override; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_THEME_WEB_THEME_ENGINE_DEFAULT_H_
diff --git a/third_party/blink/renderer/platform/theme/web_theme_engine_helper.cc b/third_party/blink/renderer/platform/theme/web_theme_engine_helper.cc new file mode 100644 index 0000000..a4ceb7f --- /dev/null +++ b/third_party/blink/renderer/platform/theme/web_theme_engine_helper.cc
@@ -0,0 +1,51 @@ +// Copyright 2021 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 "third_party/blink/renderer/platform/theme/web_theme_engine_helper.h" + +#include "build/build_config.h" +#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" + +#if defined(OS_ANDROID) +#include "third_party/blink/renderer/platform/theme/web_theme_engine_android.h" +#elif defined(OS_MAC) +#include "third_party/blink/renderer/platform/theme/web_theme_engine_mac.h" +#else +#include "third_party/blink/renderer/platform/theme/web_theme_engine_default.h" +#endif + +namespace blink { + +namespace { +std::unique_ptr<WebThemeEngine> CreateWebThemeEngine() { +#if defined(OS_ANDROID) + return std::make_unique<WebThemeEngineAndroid>(); +#elif defined(OS_MAC) + return std::make_unique<WebThemeEngineMac>(); +#else + return std::make_unique<WebThemeEngineDefault>(); +#endif +} + +} // namespace + +WebThemeEngine* WebThemeEngineHelper::GetNativeThemeEngine() { + DEFINE_STATIC_LOCAL(std::unique_ptr<WebThemeEngine>, theme_engine, + {CreateWebThemeEngine()}); + return theme_engine.get(); +} + +void WebThemeEngineHelper::DidUpdateRendererPreferences( + const blink::RendererPreferences& renderer_prefs) { +#if defined(OS_WIN) + // Update Theme preferences on Windows. + WebThemeEngineDefault::cacheScrollBarMetrics( + renderer_prefs.vertical_scroll_bar_width_in_dips, + renderer_prefs.horizontal_scroll_bar_height_in_dips, + renderer_prefs.arrow_bitmap_height_vertical_scroll_bar_in_dips, + renderer_prefs.arrow_bitmap_width_horizontal_scroll_bar_in_dips); +#endif +} + +} // namespace blink
diff --git a/third_party/blink/renderer/platform/theme/web_theme_engine_helper.h b/third_party/blink/renderer/platform/theme/web_theme_engine_helper.h new file mode 100644 index 0000000..5ec38a8 --- /dev/null +++ b/third_party/blink/renderer/platform/theme/web_theme_engine_helper.h
@@ -0,0 +1,23 @@ +// Copyright 2021 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_RENDERER_PLATFORM_THEME_WEB_THEME_ENGINE_HELPER_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_THEME_WEB_THEME_ENGINE_HELPER_H_ + +#include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h" +#include "third_party/blink/public/platform/web_theme_engine.h" +#include "third_party/blink/renderer/platform/platform_export.h" + +namespace blink { + +class WebThemeEngineHelper { + public: + PLATFORM_EXPORT static WebThemeEngine* GetNativeThemeEngine(); + PLATFORM_EXPORT static void DidUpdateRendererPreferences( + const blink::RendererPreferences& renderer_prefs); +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_THEME_WEB_THEME_ENGINE_HELPER_H_
diff --git a/content/child/webthemeengine_impl_mac.cc b/third_party/blink/renderer/platform/theme/web_theme_engine_mac.cc similarity index 88% rename from content/child/webthemeengine_impl_mac.cc rename to third_party/blink/renderer/platform/theme/web_theme_engine_mac.cc index ece2eff9cb..c2dbbde 100644 --- a/content/child/webthemeengine_impl_mac.cc +++ b/third_party/blink/renderer/platform/theme/web_theme_engine_mac.cc
@@ -2,19 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/child/webthemeengine_impl_mac.h" +#include "third_party/blink/renderer/platform/theme/web_theme_engine_mac.h" -#include "content/child/webthemeengine_impl_conversions.h" +#include "third_party/blink/renderer/platform/theme/web_theme_engine_conversions.h" #include "ui/native_theme/native_theme.h" -namespace content { +namespace blink { void WebThemeEngineMac::Paint(cc::PaintCanvas* canvas, WebThemeEngine::Part part, WebThemeEngine::State state, const gfx::Rect& rect, const WebThemeEngine::ExtraParams* extra_params, - blink::mojom::ColorScheme color_scheme, + mojom::ColorScheme color_scheme, const absl::optional<SkColor>& accent_color) { if (IsScrollbarPart(part)) { PaintMacScrollBarParts(canvas, part, state, rect, extra_params, @@ -45,7 +45,7 @@ WebThemeEngine::State state, const gfx::Rect& rect, const WebThemeEngine::ExtraParams* extra_params, - blink::mojom::ColorScheme color_scheme) { + mojom::ColorScheme color_scheme) { ui::NativeTheme::ExtraParams native_theme_extra_params; native_theme_extra_params.scrollbar_extra.is_hovering = extra_params->scrollbar_extra.is_hovering; @@ -71,4 +71,4 @@ native_theme_extra_params, NativeColorScheme(color_scheme)); } -} // namespace content +} // namespace blink
diff --git a/third_party/blink/renderer/platform/theme/web_theme_engine_mac.h b/third_party/blink/renderer/platform/theme/web_theme_engine_mac.h new file mode 100644 index 0000000..5fce1ba --- /dev/null +++ b/third_party/blink/renderer/platform/theme/web_theme_engine_mac.h
@@ -0,0 +1,36 @@ +// Copyright 2014 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_RENDERER_PLATFORM_THEME_WEB_THEME_ENGINE_MAC_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_THEME_WEB_THEME_ENGINE_MAC_H_ + +#include "third_party/blink/renderer/platform/theme/web_theme_engine_default.h" + +namespace blink { + +class WebThemeEngineMac : public WebThemeEngineDefault { + public: + ~WebThemeEngineMac() override {} + + void Paint(cc::PaintCanvas* canvas, + WebThemeEngine::Part part, + WebThemeEngine::State state, + const gfx::Rect& rect, + const WebThemeEngine::ExtraParams* extra_params, + mojom::ColorScheme color_scheme, + const absl::optional<SkColor>& accent_color) override; + + static bool IsScrollbarPart(WebThemeEngine::Part part); + static void PaintMacScrollBarParts( + cc::PaintCanvas* canvas, + WebThemeEngine::Part part, + WebThemeEngine::State state, + const gfx::Rect& rect, + const WebThemeEngine::ExtraParams* extra_params, + mojom::ColorScheme color_scheme); +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_THEME_WEB_THEME_ENGINE_MAC_H_
diff --git a/content/child/webthemeengine_impl_unittest.cc b/third_party/blink/renderer/platform/theme/web_theme_engine_test.cc similarity index 96% rename from content/child/webthemeengine_impl_unittest.cc rename to third_party/blink/renderer/platform/theme/web_theme_engine_test.cc index 45bf16a6..90c63af 100644 --- a/content/child/webthemeengine_impl_unittest.cc +++ b/third_party/blink/renderer/platform/theme/web_theme_engine_test.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/child/webthemeengine_impl_conversions.h" +#include "third_party/blink/renderer/platform/theme//web_theme_engine_conversions.h" #include <vector> #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/web_theme_engine.h" -namespace content { +namespace blink { TEST(WebThemeEngineTest, NativeSystemThemeColor) { std::vector<blink::WebThemeEngine::SystemThemeColor> blink_inputs = { @@ -123,4 +123,4 @@ } } -} // namespace content +} // namespace blink
diff --git a/third_party/blink/renderer/platform/webrtc/legacy_webrtc_video_frame_adapter.cc b/third_party/blink/renderer/platform/webrtc/legacy_webrtc_video_frame_adapter.cc index aca7c83..459ff84 100644 --- a/third_party/blink/renderer/platform/webrtc/legacy_webrtc_video_frame_adapter.cc +++ b/third_party/blink/renderer/platform/webrtc/legacy_webrtc_video_frame_adapter.cc
@@ -455,6 +455,10 @@ DCHECK_EQ(source_frame->storage_type(), media::VideoFrame::STORAGE_GPU_MEMORY_BUFFER); + // This is necessary because mapping may require waiting on IO thread, + // but webrtc API is synchronous. + base::ScopedAllowBaseSyncPrimitivesOutsideBlockingScope allow_wait; + return media::ConvertToMemoryMappedFrame(std::move(source_frame)); }
diff --git a/third_party/blink/renderer/platform/webrtc/webrtc_video_frame_adapter.cc b/third_party/blink/renderer/platform/webrtc/webrtc_video_frame_adapter.cc index a57b0cd..069b433 100644 --- a/third_party/blink/renderer/platform/webrtc/webrtc_video_frame_adapter.cc +++ b/third_party/blink/renderer/platform/webrtc/webrtc_video_frame_adapter.cc
@@ -137,6 +137,10 @@ DCHECK_EQ(source_frame->storage_type(), media::VideoFrame::STORAGE_GPU_MEMORY_BUFFER); + // This is necessary because mapping may require waiting on IO thread, + // but webrtc API is synchronous. + base::ScopedAllowBaseSyncPrimitivesOutsideBlockingScope allow_wait; + return media::ConvertToMemoryMappedFrame(std::move(source_frame)); }
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 701d644..21afafa 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -2536,34 +2536,12 @@ crbug.com/626703 [ Mac ] editing/pasteboard/drag-selected-image-to-contenteditable.html [ Failure ] crbug.com/626703 [ Mac10.15 ] external/wpt/webrtc-encoded-transform/idlharness.https.window.html [ Failure Crash ] crbug.com/626703 [ Mac11.0 ] external/wpt/webrtc-encoded-transform/idlharness.https.window.html [ Failure Crash ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Create-valid-url-binaryType-blob.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-undefined.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/binaryType-wrong-value.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac11.0 ] external/wpt/webxr/xrSession_requestReferenceSpace_features.https.html [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-onlyReason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-2999-reason.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.14 ] external/wpt/focus/focus-already-focused-iframe-different-site.html [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-2999-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac11.0 ] external/wpt/webrtc-encoded-transform/sframe-keys.https.html [ Failure Timeout ] crbug.com/626703 [ Mac10.14 ] external/wpt/focus/focus-already-focused-iframe-same-site.html [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Send-0byte-data.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Send-binary-arraybufferview-uint16-offset-length.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Send-binary-blob.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac11.0 ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-020.html [ Failure ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-1005-verify-code.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Create-valid-url-protocol-string.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-readyState-Closing.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Send-data.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-readyState-Closed.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Send-binary-arraybufferview-float32.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Send-binary-arraybufferview-int32.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac11.0 ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-021.html [ Failure ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Send-binary-65K-arraybuffer.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Send-binary-arraybufferview-float32.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/binaryType-wrong-value.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Linux ] external/wpt/focus/focus-already-focused-iframe-deep-same-site.html [ Timeout ] crbug.com/626703 [ Mac10.12 ] external/wpt/focus/focus-already-focused-iframe-deep-same-site.html [ Timeout ] crbug.com/626703 [ Mac10.13 ] external/wpt/focus/focus-already-focused-iframe-deep-same-site.html [ Timeout ] @@ -2583,8 +2561,6 @@ crbug.com/626703 [ Win ] external/wpt/focus/focus-already-focused-iframe-different-site.html [ Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/html/dom/idlharness.https.html?include=HTML.\* [ Failure Crash ] crbug.com/626703 [ Mac11.0 ] external/wpt/html/dom/idlharness.https.html?include=HTML.\* [ Failure Crash ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-server-initiated-close.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-server-initiated-close.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Linux ] external/wpt/focus/focus-already-focused-iframe-same-site.html [ Timeout ] crbug.com/626703 [ Mac10.12 ] external/wpt/focus/focus-already-focused-iframe-same-site.html [ Timeout ] crbug.com/626703 [ Mac10.13 ] external/wpt/focus/focus-already-focused-iframe-same-site.html [ Timeout ] @@ -2600,11 +2576,6 @@ crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/basic-auth.any.worker.html?wpt_flags=h2 [ Failure Timeout ] crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/stream/tentative/backpressure-send.any.serviceworker.html?wpt_flags=h2 [ Failure Timeout ] crbug.com/626703 [ Mac10.14 ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-020.html [ Failure Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Close-2999-reason.any.worker.html?wpt_flags=h2 [ Failure Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Close-undefined.any.worker.html?wpt_flags=h2 [ Failure Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.worker.html?wpt_flags=h2 [ Failure Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Send-binary-65K-arraybuffer.any.worker.html?wpt_flags=h2 [ Failure Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.worker.html?wpt_flags=h2 [ Failure Timeout ] crbug.com/626703 [ Mac10.14 ] external/wpt/worklets/paint-worklet-credentials.https.html [ Failure Timeout ] crbug.com/626703 [ Mac10.14 ] inspector-protocol/debugger/wasm-streaming-url.js [ Failure Timeout ] crbug.com/626703 [ Mac11.0 ] external/wpt/css/css-images/image-set/image-set-parsing.html [ Failure Timeout ] @@ -2620,31 +2591,13 @@ crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/basic-auth.any.sharedworker.html?wpt_flags=h2 [ Failure Timeout ] crbug.com/626703 [ Mac11.0 ] external/wpt/webvtt/api/VTTCue/constructor.html [ Failure Timeout ] crbug.com/626703 [ Mac11.0 ] virtual/synchronous_html_parser/external/wpt/dom/xslt/transformToFragment.tentative.window.html [ Failure Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Send-binary-arraybufferview-float32.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Send-binary-arraybufferview-uint16-offset-length.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/binaryType-wrong-value.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-Reason-124Bytes.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/stream/tentative/backpressure-send.any.worker.html?wpt_flags=h2 [ Failure Crash ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-1005.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Send-binary-65K-arraybuffer.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac11.0 ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-018.html [ Failure ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Send-paired-surrogates.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-1000-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac11.0 ] external/wpt/html/cross-origin-embedder-policy/multi-globals/workers-coep-report.https.html [ Failure Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-undefined.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/stream/tentative/backpressure-send.any.html?wpt_flags=h2 [ Failure Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/stream/tentative/backpressure-receive.any.html?wpt_flags=h2 [ Pass Failure ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Close-1005-verify-code.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Close-2999-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Send-0byte-data.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Send-binary-arraybufferview-int32.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac ] external/wpt/websockets/bufferedAmount-unchanged-by-sync-xhr.any.worker.html?wpt_flags=h2 [ Pass Failure ] crbug.com/626703 [ Mac ] external/wpt/websockets/basic-auth.any.html?wpt_flags=h2 [ Pass Failure ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-reason-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Send-binary-blob.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Create-valid-url-protocol.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/worklets/audio-worklet-credentials.https.html [ Failure Crash ] crbug.com/626703 [ Win10 ] external/wpt/worklets/audio-worklet-credentials.https.html [ Failure Crash ] crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/stream/tentative/constructor.any.html?wpt_flags=h2 [ Failure Timeout ] @@ -2662,395 +2615,81 @@ crbug.com/626703 [ Win ] external/wpt/custom-elements/form-associated/ElementInternals-setFormValue.html [ Failure Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/html/browsers/sandboxing/window-open-blank-from-different-initiator.html [ Timeout ] crbug.com/626703 [ Win10 ] external/wpt/html/browsers/sandboxing/window-open-blank-from-different-initiator.html [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-reason-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/fetch/api/basic/request-upload.any.sharedworker.html [ Failure Timeout ] crbug.com/626703 [ Win10 ] external/wpt/fetch/api/basic/request-upload.any.sharedworker.html [ Failure Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Create-valid-url-protocol.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/mediacapture-image/MediaStreamTrack-getConstraints.https.html [ Failure Crash Timeout ] crbug.com/626703 [ Win10 ] external/wpt/mediacapture-image/MediaStreamTrack-getConstraints.https.html [ Failure Crash Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/webvtt/api/VTTCue/constructor.html [ Failure Crash ] crbug.com/626703 [ Win10 ] external/wpt/webvtt/api/VTTCue/constructor.html [ Failure Crash ] -crbug.com/626703 [ Mac ] external/wpt/websockets/Close-4999-reason.any.html?wpt_flags=h2 [ Pass Timeout ] -crbug.com/626703 [ Mac ] external/wpt/websockets/Send-binary-arraybufferview-float64.any.worker.html?wpt_flags=h2 [ Pass Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-arraybufferview-float64.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/webrtc-encoded-transform/sframe-keys.https.html [ Failure Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-arraybufferview-int8.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/dom/xslt/transformToFragment.tentative.window.html [ Failure Crash ] crbug.com/626703 [ Win10 ] external/wpt/dom/xslt/transformToFragment.tentative.window.html [ Failure Crash ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Close-1000-verify-code.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 external/wpt/webrtc-encoded-transform/script-transform.https.html [ Pass Failure Crash Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/shadow-dom/accesskey.tentative.html [ Failure Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Create-valid-url-binaryType-blob.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Win10 ] external/wpt/websockets/stream/tentative/backpressure-send.any.sharedworker.html?wpt_flags=h2 [ Failure Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Close-readyState-Closing.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/1167095 [ Linux ] virtual/synchronous_html_parser/external/wpt/html/semantics/forms/form-submission-0/multipart-formdata.window.html [ Failure Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-server-initiated-close.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Win10 ] external/wpt/webrtc-encoded-transform/sframe-keys.https.html [ Failure Timeout ] crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/stream/tentative/backpressure-send.any.html?wpt_flags=h2 [ Failure Timeout ] crbug.com/626703 [ Mac10.15 ] virtual/plz-dedicated-worker/external/wpt/html/cross-origin-embedder-policy/shared-workers.html [ Failure Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Send-binary-blob.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Win10 ] external/wpt/html/cross-origin-embedder-policy/cross-origin-isolated-permission.https.html [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Send-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Create-valid-url-protocol-string.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.14 ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-018.html [ Failure ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Send-data.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.15 ] virtual/composite-bgcolor-animation/external/wpt/css/css-backgrounds/parsing/background-image-computed.sub.html [ Failure Crash ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/binaryType-wrong-value.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-readyState-Closed.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/1167095 [ Mac ] external/wpt/html/semantics/forms/form-submission-0/multipart-formdata.window.html [ Pass Failure Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/webrtc-encoded-transform/sframe-transform-buffer-source.html [ Failure Crash Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Close-1000-reason.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 external/wpt/websockets/stream/tentative/close.any.worker.html?wpt_flags=h2 [ Failure Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/binaryType-wrong-value.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/binaryType-wrong-value.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/binaryType-wrong-value.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/binaryType-wrong-value.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/binaryType-wrong-value.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-arraybufferview-float64.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-2999-reason.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-2999-reason.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-2999-reason.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-2999-reason.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-2999-reason.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/Create-valid-url.any.html?wpt_flags=h2 [ Crash Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-null.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-null.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-2999-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-2999-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-2999-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-2999-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-2999-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-1005.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-1005.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-1005.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Close-1005.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-1005.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-1005.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/Close-3000-reason.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-4999-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-4999-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/Send-binary-arraybufferview-uint32-offset.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-0byte-data.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-0byte-data.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac ] virtual/plz-service-worker/external/wpt/html/cross-origin-embedder-policy/multi-globals/workers-coep-report.https.html [ Failure Crash ] crbug.com/626703 [ Win ] virtual/plz-service-worker/external/wpt/html/cross-origin-embedder-policy/multi-globals/workers-coep-report.https.html [ Failure Crash ] -crbug.com/626703 external/wpt/websockets/Close-1000.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.12 ] external/wpt/html/cross-origin-embedder-policy/multi-globals/workers-coep-report.https.html [ Failure Timeout ] crbug.com/626703 [ Win10 ] external/wpt/html/cross-origin-embedder-policy/multi-globals/workers-coep-report.https.html [ Failure Timeout ] -crbug.com/626703 external/wpt/websockets/Send-binary-arraybufferview-uint16-offset-length.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-arraybufferview-uint16-offset-length.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Send-binary-arraybufferview-uint16-offset-length.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Send-binary-arraybufferview-uint16-offset-length.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Send-binary-arraybufferview-uint16-offset-length.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-arraybufferview-uint16-offset-length.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Send-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Send-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Send-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Send-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-1005-verify-code.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-1005-verify-code.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-unicode-data.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-unicode-data.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-arraybufferview-int8.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac ] external/wpt/websockets/Send-binary-arraybufferview-int8.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-arraybufferview-int8.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-Reason-124Bytes.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-Reason-124Bytes.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-Reason-124Bytes.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Close-Reason-124Bytes.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-Reason-124Bytes.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-Reason-124Bytes.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-data.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Send-data.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Send-data.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Send-data.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-data.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-3000-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-3000-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-readyState-Closing.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-readyState-Closing.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-readyState-Closing.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-readyState-Closing.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-readyState-Closing.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-readyState-Closing.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-arraybufferview-float64.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-arraybufferview-float64.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Create-extensions-empty.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Create-extensions-empty.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-4999-reason.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-4999-reason.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-1000-verify-code.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-1000-verify-code.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-1000-verify-code.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-1000-verify-code.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-1000-verify-code.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-1000-verify-code.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-undefined.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-undefined.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-undefined.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-undefined.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-undefined.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/Send-binary-arraybufferview-uint8-offset-length.any.html?wpt_flags=h2 [ Timeout Crash ] -crbug.com/626703 external/wpt/websockets/Send-binary-arraybufferview-int32.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-server-initiated-close.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-server-initiated-close.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-server-initiated-close.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/Close-3000-verify-code.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-arraybufferview-int16-offset.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-arraybufferview-int16-offset.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-1005.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-1005.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-paired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-paired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-65K-arraybuffer.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Send-binary-65K-arraybuffer.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Send-binary-65K-arraybuffer.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Send-binary-65K-arraybuffer.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Send-binary-65K-arraybuffer.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-65K-arraybuffer.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-1005-verify-code.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-1005-verify-code.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-1005-verify-code.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-1005-verify-code.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-1005-verify-code.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-blob.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Send-binary-blob.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Send-binary-blob.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Send-binary-blob.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-blob.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-arraybufferview-int8.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac ] external/wpt/websockets/Send-binary-arraybufferview-int8.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Create-valid-url.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Create-valid-url.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Create-valid-url-protocol.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Create-valid-url-protocol.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Create-valid-url-protocol.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Create-valid-url-protocol.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Create-valid-url-protocol.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-readyState-Closing.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-readyState-Closing.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-readyState-Closing.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Close-readyState-Closing.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-readyState-Closing.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-readyState-Closing.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Linux ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-018.html [ Failure ] crbug.com/626703 [ Mac10.12 ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-018.html [ Failure ] crbug.com/626703 [ Mac10.13 ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-018.html [ Failure ] crbug.com/626703 [ Mac10.15 ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-018.html [ Failure ] crbug.com/626703 [ Win ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-018.html [ Failure ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-readyState-Closed.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-readyState-Closed.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-readyState-Closed.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Close-readyState-Closed.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-readyState-Closed.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-readyState-Closed.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/Create-valid-url-protocol-string.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.15 ] virtual/plz-dedicated-worker/external/wpt/fetch/api/basic/http-response-code.any.html [ Failure Crash ] crbug.com/626703 [ Win10 ] virtual/plz-dedicated-worker/external/wpt/fetch/api/basic/http-response-code.any.html [ Failure Crash ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-1000-reason.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-1000-reason.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-onlyReason.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-onlyReason.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.15 ] virtual/synchronous_html_parser/external/wpt/html/semantics/forms/form-submission-0/text-plain.window.html [ Failure Crash ] crbug.com/626703 [ Win10 ] virtual/synchronous_html_parser/external/wpt/html/semantics/forms/form-submission-0/text-plain.window.html [ Failure Crash ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Create-valid-url-binaryType-blob.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Create-valid-url-binaryType-blob.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Create-valid-url-binaryType-blob.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Create-valid-url-binaryType-blob.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Create-valid-url-binaryType-blob.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/fetch/api/basic/http-response-code.any.sharedworker.html [ Failure Crash ] crbug.com/626703 [ Win10 ] external/wpt/fetch/api/basic/http-response-code.any.sharedworker.html [ Failure Crash ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-Reason-124Bytes.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-Reason-124Bytes.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Create-extensions-empty.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac ] external/wpt/websockets/Create-extensions-empty.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Create-extensions-empty.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-undefined.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-undefined.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-undefined.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Close-undefined.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-undefined.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-undefined.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/html/semantics/forms/form-submission-0/text-plain.window.html [ Failure Timeout ] crbug.com/626703 [ Win10 ] external/wpt/html/semantics/forms/form-submission-0/text-plain.window.html [ Failure Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-null.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac ] external/wpt/websockets/Send-null.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-null.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/stream/tentative/backpressure-send.any.serviceworker.html?wpt_flags=h2 [ Failure Crash ] crbug.com/626703 [ Win10 ] external/wpt/websockets/stream/tentative/backpressure-send.any.serviceworker.html?wpt_flags=h2 [ Failure Crash ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Win10 ] external/wpt/url/a-element.html [ Failure Crash ] crbug.com/626703 [ Linux ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-020.html [ Failure ] crbug.com/626703 [ Mac10.12 ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-020.html [ Failure ] crbug.com/626703 [ Mac10.13 ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-020.html [ Failure ] crbug.com/626703 [ Mac10.15 ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-020.html [ Failure ] crbug.com/626703 [ Win ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-020.html [ Failure ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset-length.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset-length.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-arraybufferview-uint8-offset-length.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/Send-binary-arraybuffer.any.worker.html?wpt_flags=h2 [ Crash Timeout ] -crbug.com/626703 external/wpt/websockets/Close-reason-unpaired-surrogates.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-arraybufferview-float32.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Send-binary-arraybufferview-float32.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Send-binary-arraybufferview-float32.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Send-binary-arraybufferview-float32.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Send-binary-arraybufferview-float32.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-arraybufferview-float32.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-readyState-Closed.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-readyState-Closed.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Close-readyState-Closed.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-readyState-Closed.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac11.0 ] external/wpt/websockets/Close-readyState-Closed.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-readyState-Closed.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-019.html [ Failure Timeout ] -crbug.com/626703 external/wpt/websockets/Send-65K-data.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-onlyReason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-onlyReason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-onlyReason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Close-onlyReason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-onlyReason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-onlyReason.any.html?wpt_flags=h2 [ Timeout ] crbug.com/1167095 [ Mac ] virtual/synchronous_html_parser/external/wpt/html/semantics/forms/form-submission-0/multipart-formdata.window.html [ Pass Failure Crash ] crbug.com/1167095 [ Win10 ] virtual/synchronous_html_parser/external/wpt/html/semantics/forms/form-submission-0/multipart-formdata.window.html [ Failure Crash ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-unicode-data.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-unicode-data.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac ] external/wpt/FileAPI/file/send-file-formdata-controls.html [ Failure Crash ] crbug.com/626703 [ Win ] external/wpt/FileAPI/file/send-file-formdata-controls.html [ Failure Crash ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-1000-verify-code.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-1000-verify-code.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac ] external/wpt/websockets/stream/tentative/abort.any.serviceworker.html?wpt_flags=h2 [ Failure Crash Pass ] crbug.com/626703 [ Win10 ] external/wpt/websockets/stream/tentative/abort.any.serviceworker.html?wpt_flags=h2 [ Failure Crash ] crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/stream/tentative/abort.any.sharedworker.html?wpt_flags=h2 [ Failure Crash ] crbug.com/626703 [ Win10 ] external/wpt/websockets/stream/tentative/abort.any.sharedworker.html?wpt_flags=h2 [ Failure Crash ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-1000-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-1000-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Close-1000-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-1000-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-1000-reason.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Create-valid-url-array-protocols.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Create-valid-url-array-protocols.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/stream/tentative/backpressure-send.any.html?wpt_flags=h2 [ Failure Timeout ] crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/stream/tentative/backpressure-send.any.html?wpt_flags=h2 [ Failure Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-0byte-data.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Send-0byte-data.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Send-0byte-data.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Send-0byte-data.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-0byte-data.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-server-initiated-close.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-server-initiated-close.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-arraybufferview-float32.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Send-binary-arraybufferview-float32.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Send-binary-arraybufferview-float32.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Send-binary-arraybufferview-float32.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-arraybufferview-float32.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-1000.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-1000.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-blob.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Send-binary-blob.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Send-binary-blob.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Send-binary-blob.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-blob.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-paired-surrogates.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Send-paired-surrogates.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Send-paired-surrogates.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Send-paired-surrogates.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Send-paired-surrogates.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-paired-surrogates.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/stream/tentative/backpressure-send.any.worker.html?wpt_flags=h2 [ Failure Crash ] crbug.com/626703 [ Win10 ] external/wpt/websockets/stream/tentative/backpressure-send.any.worker.html?wpt_flags=h2 [ Failure Crash ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-reason-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Close-reason-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.14 ] external/wpt/websockets/Close-reason-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Close-reason-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-reason-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/Create-valid-url-array-protocols.any.worker.html?wpt_flags=h2 [ Crash Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Create-valid-url-protocol-string.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Create-valid-url-protocol-string.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Create-valid-url-protocol-string.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Create-valid-url-protocol-string.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Create-valid-url-protocol-string.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-unpaired-surrogates.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-unpaired-surrogates.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/binaryType-wrong-value.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/binaryType-wrong-value.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/binaryType-wrong-value.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/binaryType-wrong-value.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Create-valid-url-binaryType-blob.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Create-valid-url-binaryType-blob.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-arraybufferview-int32.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Send-binary-arraybufferview-int32.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Send-binary-arraybufferview-int32.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Send-binary-arraybufferview-int32.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-arraybufferview-int32.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-65K-data.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-65K-data.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-data.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-data.any.worker.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Linux ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-021.html [ Failure ] crbug.com/626703 [ Mac10.12 ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-021.html [ Failure ] crbug.com/626703 [ Mac10.13 ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-021.html [ Failure ] crbug.com/626703 [ Mac10.15 ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-021.html [ Failure ] crbug.com/626703 [ Win ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-021.html [ Failure ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-arraybuffer.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac ] external/wpt/websockets/Send-binary-arraybuffer.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-arraybuffer.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 [ Mac10.15 ] virtual/offsetparent-old-behavior/external/wpt/shadow-dom/accesskey.tentative.html [ Failure Crash ] crbug.com/626703 [ Win10 ] virtual/offsetparent-old-behavior/external/wpt/shadow-dom/accesskey.tentative.html [ Failure Crash ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-65K-arraybuffer.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Send-binary-65K-arraybuffer.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.13 ] external/wpt/websockets/Send-binary-65K-arraybuffer.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Mac10.15 ] external/wpt/websockets/Send-binary-65K-arraybuffer.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-65K-arraybuffer.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Create-valid-url-protocol.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Create-valid-url-protocol.any.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-data.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-data.worker.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Send-binary-arraybufferview-uint32-offset.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Send-binary-arraybufferview-uint32-offset.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Linux ] external/wpt/websockets/Close-3000-verify-code.any.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 [ Win ] external/wpt/websockets/Close-3000-verify-code.any.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 external/wpt/websockets/stream/tentative/close.any.html?wpt_flags=h2 [ Failure Timeout ] crbug.com/626703 external/wpt/websockets/stream/tentative/close.any.sharedworker.html?wpt_flags=h2 [ Failure Timeout ] crbug.com/626703 external/wpt/websockets/stream/tentative/close.any.serviceworker.html?wpt_flags=h2 [ Failure Timeout ] -crbug.com/626703 external/wpt/websockets/Send-binary-arraybufferview-int16-offset.any.html?wpt_flags=h2 [ Crash Timeout ] crbug.com/626703 external/wpt/css/css-ruby/ruby-intrinsic-isize-003.html [ Failure ] crbug.com/626703 [ Mac10.13 ] external/wpt/selection/contenteditable/modifying-selection-with-primary-mouse-button.tentative.html [ Failure Crash ] crbug.com/626703 [ Mac10.15 ] external/wpt/streams/readable-streams/tee.any.html [ Failure Crash ] crbug.com/626703 [ Mac10.15 ] external/wpt/url/url-origin.any.worker.html [ Failure Crash ] crbug.com/1191547 external/wpt/html/semantics/forms/the-label-element/proxy-modifier-click-to-associated-element.tentative.html [ Timeout ] -crbug.com/626703 external/wpt/websockets/extended-payload-length.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/binary/001.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/binary/002.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/binary/004.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/binary/005.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-arraybuffer.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-blob.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-large.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-unicode.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/interfaces/WebSocket/events/018.html?wpt_flags=h2 [ Timeout ] -crbug.com/626703 external/wpt/websockets/interfaces/WebSocket/send/006.html?wpt_flags=h2 [ Timeout ] crbug.com/626703 external/wpt/websockets/cookies/001.html?wss&wpt_flags=https [ Failure ] crbug.com/626703 external/wpt/websockets/cookies/002.html?wss&wpt_flags=https [ Failure ] crbug.com/626703 external/wpt/websockets/cookies/003.html?wss&wpt_flags=https [ Failure ] @@ -5616,6 +5255,13 @@ crbug.com/1031345 media/controls/overlay-play-button-tap-to-hide.html [ Timeout Pass ] +# TODO(michaelludwig): Suppressed for Skia roll requiring a rebaseline +crbug.com/1210861 svg/W3C-SVG-1.1/filters-image-01-b.svg [ Pass Failure ] +crbug.com/1210861 svg/W3C-SVG-1.1-SE/filters-image-03-f.svg [ Pass Failure ] +crbug.com/1210861 svg/W3C-SVG-1.1-SE/filters-image-05-f.svg [ Pass Failure ] +crbug.com/1210861 [ Mac ] svg/as-background-image/svg-as-tiled-background.html [ Pass Failure ] +crbug.com/1210861 svg/filters/feImage-preserveAspectRatio-all.svg [ Pass Failure ] + # Temporary SkiaRenderer regressions crbug.com/1029941 [ Linux ] external/wpt/css/css-paint-api/background-image-alpha.https.html [ Failure ] crbug.com/1029941 [ Linux ] transforms/3d/point-mapping/3d-point-mapping-deep.html [ Failure ] @@ -6435,8 +6081,7 @@ # Sheriff 2020-12-22 crbug.com/1161301 [ Mac10.15 ] external/wpt/webxr/xrSession_requestReferenceSpace_features.https.html [ Pass Timeout ] -crbug.com/1161352 [ Mac10.14 ] virtual/controls-refresh-hc/fast/forms/color-scheme/search/search-appearance-basic.html [ Pass Timeout ] -crbug.com/1161352 [ Mac10.14 ] external/wpt/webxr/xrSession_requestReferenceSpace_features.https.html [ Pass Failure Timeout ] +crbug.com/1161301 [ Mac10.14 ] external/wpt/webxr/xrSession_requestReferenceSpace_features.https.html [ Pass Failure Timeout ] # Failing on Webkit Linux Leak only: crbug.com/1046784 http/tests/devtools/tracing/timeline-receive-response-event.js [ Pass Failure ] @@ -6779,38 +6424,8 @@ # Sheriff 2021-04-27 crbug.com/1203309 [ Linux ] http/tests/devtools/tracing/trace-event-self-time.js [ Pass Failure ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Close-1000-reason.any.worker.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Close-1000-verify-code.any.worker.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Close-1000.any.worker.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Close-1005-verify-code.any.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Close-1005.any.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Close-3000-reason.any.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Close-3000-verify-code.any.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Close-4999-reason.any.worker.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Close-Reason-124Bytes.any.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Close-onlyReason.any.worker.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Close-server-initiated-close.any.worker.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Create-extensions-empty.any.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Create-valid-url-array-protocols.any.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Create-valid-url-binaryType-blob.any.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Create-valid-url-protocol.any.worker.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Create-valid-url.any.worker.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Send-0byte-data.any.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Send-65K-data.any.worker.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Send-binary-arraybufferview-float64.any.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Send-binary-arraybufferview-int16-offset.any.worker.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Send-binary-arraybufferview-uint32-offset.any.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Send-data.any.worker.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Send-data.worker.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Send-null.any.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Send-paired-surrogates.any.worker.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Send-unicode-data.any.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Send-unicode-data.any.worker.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac ] external/wpt/websockets/Send-unpaired-surrogates.any.html?wpt_flags=h2 [ Pass Failure Timeout ] # Sheriff 2021-04-29 -crbug.com/1203345 [ Mac10.14 ] external/wpt/websockets/Close-server-initiated-close.any.html?wpt_flags=h2 [ Pass Failure Timeout ] -crbug.com/1203345 [ Mac10.14 ] external/wpt/websockets/binaryType-wrong-value.any.html?wpt_flags=h2 [ Pass Failure Timeout ] crbug.com/1203963 [ Mac10.14 ] external/wpt/css/css-paint-api/idlharness.html [ Pass Failure Timeout ] crbug.com/1203963 [ Mac10.14 ] external/wpt/css/css-shapes/parsing/shape-outside-computed.html [ Pass Failure Timeout ] crbug.com/1203963 [ Mac10.14 ] external/wpt/css/css-sizing/aspect-ratio/grid-aspect-ratio-021.html [ Pass Failure Timeout ] @@ -6881,7 +6496,6 @@ crbug.com/1205669 [ Mac10.13 ] virtual/threaded/external/wpt/animation-worklet/idlharness.any.worker.html [ Failure ] # Sheriff 2021-05-07 -crbug.com/1206734 [ Mac10.13 ] external/wpt/websockets/Send-binary-blob.any.worker.html?wpt_flags=h2 [ Timeout ] ### external/wpt/pointerevents/ crbug.com/1206108 external/wpt/pointerevents/pointerevent_click_is_a_pointerevent_multiple_clicks.html?touch [ Failure Pass ] @@ -7105,3 +6719,104 @@ crbug.com/1210731 [ Linux ] http/tests/devtools/sources/debugger-step/debugger-step-out-document-write.js [ Pass Failure ] crbug.com/1210731 [ Linux ] http/tests/devtools/sources/debugger-breakpoints/dynamic-scripts-breakpoints.js [ Pass Failure ] crbug.com/1210731 [ Linux ] http/tests/devtools/sources/debugger/debug-inlined-scripts-fragment-id.js [ Pass Failure ] +# The wpt_flags=h2 variants of these tests fail, but the other variants pass. We +# can't handle this difference with -expected.txt files, so we have to list them +# here. +crbug.com/1048761 external/wpt/websockets/Close-1000-reason.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-1000-reason.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-1000-verify-code.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-1000-verify-code.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-1000.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-1000.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-1005-verify-code.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-1005-verify-code.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-1005.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-1005.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-2999-reason.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-2999-reason.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-3000-reason.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-3000-reason.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-3000-verify-code.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-3000-verify-code.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-4999-reason.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-4999-reason.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-Reason-124Bytes.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-Reason-124Bytes.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-onlyReason.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-onlyReason.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-readyState-Closed.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-readyState-Closed.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-readyState-Closing.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-readyState-Closing.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-reason-unpaired-surrogates.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-reason-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-server-initiated-close.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-server-initiated-close.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-undefined.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Close-undefined.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Create-extensions-empty.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Create-extensions-empty.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Create-valid-url-array-protocols.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Create-valid-url-array-protocols.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Create-valid-url-binaryType-blob.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Create-valid-url-binaryType-blob.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Create-valid-url-protocol-string.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Create-valid-url-protocol-string.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Create-valid-url-protocol.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Create-valid-url-protocol.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Create-valid-url.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Create-valid-url.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-0byte-data.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-0byte-data.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-65K-data.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-65K-data.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-65K-arraybuffer.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-65K-arraybuffer.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybuffer.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybuffer.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-float32.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-float32.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-float64.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-float64.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-int16-offset.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-int16-offset.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-int32.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-int32.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-int8.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-int8.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-uint16-offset-length.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-uint16-offset-length.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-uint32-offset.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-uint32-offset.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-uint8-offset-length.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-uint8-offset-length.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-blob.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-binary-blob.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-data.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-data.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-data.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-null.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-null.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-paired-surrogates.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-paired-surrogates.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-unicode-data.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-unicode-data.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-unpaired-surrogates.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/Send-unpaired-surrogates.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/binaryType-wrong-value.any.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/binaryType-wrong-value.any.worker.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/extended-payload-length.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/binary/001.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/binary/002.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/binary/004.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/binary/005.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-arraybuffer.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-blob.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-large.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-unicode.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/interfaces/WebSocket/events/018.html?wpt_flags=h2 [ Failure ] +crbug.com/1048761 external/wpt/websockets/interfaces/WebSocket/send/006.html?wpt_flags=h2 [ Failure ]
diff --git a/third_party/blink/web_tests/external/wpt/css/css-tables/border-collapse-empty-cell-ref.html b/third_party/blink/web_tests/external/wpt/css/css-tables/border-collapse-empty-cell-ref.html new file mode 100644 index 0000000..f6b2513 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-tables/border-collapse-empty-cell-ref.html
@@ -0,0 +1,21 @@ +<!doctype HTML> +<style> + table { + border-collapse: collapse; + } + td { + width:50px; + height:50px; + border: 10px solid gray; + } +</style> +<table> + <tr> + <td></td> + <td></td> + </tr> + <tr> + <td></td> + <td></td> + </tr> +</table>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-tables/border-collapse-empty-cell.html b/third_party/blink/web_tests/external/wpt/css/css-tables/border-collapse-empty-cell.html new file mode 100644 index 0000000..18894a3 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-tables/border-collapse-empty-cell.html
@@ -0,0 +1,26 @@ +<!doctype HTML> +<title>Collapsed borders of empty cells are painted</title> +<link rel="author" href="atotic@chromium.org"> +<link rel="match" href="border-collapse-empty-cell-ref.html"> +<link rel="help" href="https://stackoverflow.com/questions/18758373/why-do-the-css-property-border-collapse-and-empty-cells-conflict"> +<style> + table { + border-collapse: collapse; + empty-cells: hide; + } + td { + width:50px; + height:50px; + border: 10px solid gray; + } +</style> +<table> + <tr> + <td></td> + <td></td> + </tr> + <tr> + <td></td> + <td></td> + </tr> +</table>
diff --git a/third_party/blink/web_tests/external/wpt/media-capabilities/decodingInfo.webrtc.html b/third_party/blink/web_tests/external/wpt/media-capabilities/decodingInfo.webrtc.html new file mode 100644 index 0000000..91f03bd --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/media-capabilities/decodingInfo.webrtc.html
@@ -0,0 +1,217 @@ +<!DOCTYPE html> +<title>MediaCapabilities.decodingInfo() for webrtc</title> +<script src=/resources/testharness.js></script> +<script src="/resources/testharnessreport.js"></script> +<script> + +// Minimal VideoConfiguration that will be allowed per spec. All optional +// properties are missing. +var minimalVideoConfiguration = { + contentType: 'video/VP9; profile-level="0"', + width: 800, + height: 600, + bitrate: 3000, + framerate: 24, +}; + +// Minimal AudioConfiguration that will be allowed per spec. All optional +// properties are missing. +var minimalAudioConfiguration = { + contentType: 'audio/opus', +}; + +promise_test(t => { + return promise_rejects_js(t, TypeError, navigator.mediaCapabilities.decodingInfo({ + type: 'webrtc', + })); +}, "Test that decodingInfo rejects if the configuration doesn't have an audio or video field"); + +promise_test(t => { + return promise_rejects_js(t, TypeError, navigator.mediaCapabilities.decodingInfo({ + type: 'webrtc', + video: { + contentType: 'video/VP9', + width: 800, + height: 600, + bitrate: 3000, + framerate: -1, + }, + })); +}, "Test that decodingInfo rejects if the video configuration has a negative framerate"); + +promise_test(t => { + return promise_rejects_js(t, TypeError, navigator.mediaCapabilities.decodingInfo({ + type: 'webrtc', + video: { + contentType: 'video/VP9"', + width: 800, + height: 600, + bitrate: 3000, + framerate: 0, + }, + })); +}, "Test that decodingInfo rejects if the video configuration has a framerate set to 0"); + +promise_test(t => { + return promise_rejects_js(t, TypeError, navigator.mediaCapabilities.decodingInfo({ + type: 'webrtc', + video: { + contentType: 'video/VP9"', + width: 800, + height: 600, + bitrate: 3000, + framerate: Infinity, + }, + })); +}, "Test that decodingInfo rejects if the video configuration has a framerate set to Infinity"); + +promise_test(t => { + return promise_rejects_js(t, TypeError, navigator.mediaCapabilities.decodingInfo({ + type: 'webrtc', + video: { + contentType: 'fgeoa', + width: 800, + height: 600, + bitrate: 3000, + framerate: 24, + }, + })); +}, "Test that decodingInfo rejects if the video configuration contentType doesn't parse"); + +promise_test(t => { + return promise_rejects_js(t, TypeError, navigator.mediaCapabilities.decodingInfo({ + type: 'webrtc', + video: { + contentType: 'audio/fgeoa', + width: 800, + height: 600, + bitrate: 3000, + framerate: 24, + }, + })); +}, "Test that decodingInfo rejects if the video configuration contentType isn't of type video"); + +promise_test(t => { + return promise_rejects_js(t, TypeError, navigator.mediaCapabilities.decodingInfo({ + type: 'webrtc', + audio: { contentType: 'fgeoa' }, + })); +}, "Test that decodingInfo rejects if the audio configuration contentType doesn't parse"); + +promise_test(t => { + return promise_rejects_js(t, TypeError, navigator.mediaCapabilities.decodingInfo({ + type: 'webrtc', + audio: { contentType: 'video/fgeoa' }, + })); +}, "Test that decodingInfo rejects if the audio configuration contentType isn't of type audio"); + +promise_test(t => { + return navigator.mediaCapabilities.decodingInfo({ + type: 'webrtc', + video: minimalVideoConfiguration, + audio: minimalAudioConfiguration, + }).then(ability => { + assert_equals(typeof ability.supported, "boolean"); + assert_equals(typeof ability.smooth, "boolean"); + assert_equals(typeof ability.powerEfficient, "boolean"); + }); +}, "Test that decodingInfo returns a valid MediaCapabilitiesInfo objects"); + +promise_test(t => { + return navigator.mediaCapabilities.decodingInfo({ + type: 'webrtc', + video: { + contentType: 'video/webm; codecs="vp09.00.10.08"', + width: 800, + height: 600, + bitrate: 3000, + framerate: 24, + }, + audio: minimalAudioConfiguration, + }).then(ability => { + assert_false(ability.supported); + assert_false(ability.smooth); + assert_false(ability.powerEfficient); + }); +}, "Test that decodingInfo returns supported, smooth, and powerEfficient set to false for non-webrtc video content type."); + +promise_test(t => { + return navigator.mediaCapabilities.decodingInfo({ + type: 'webrtc', + video: minimalVideoConfiguration, + audio: { + contentType: 'audio/webm; codecs="opus"', + }, + }).then(ability => { + assert_false(ability.supported); + assert_false(ability.smooth); + assert_false(ability.powerEfficient); + }); +}, "Test that decodingInfo returns supported, smooth, and powerEfficient set to false for non-webrtc audio content type."); + +var validAudioCodecs = (() => { + // Some codecs that are returned by getCapabilities() are not real codecs, + // exclude these from the test. + var excludeList = [ 'audio/CN', 'audio/telephone-event' ]; + var audioCodecs = []; + RTCRtpReceiver.getCapabilities("audio")['codecs'].forEach(codec => { + if (excludeList.indexOf(codec.mimeType) < 0 && + audioCodecs.indexOf(codec.mimeType) < 0) { + audioCodecs.push(codec.mimeType); + } + }); + return audioCodecs; +})(); + +validAudioCodecs.forEach(codec => { + promise_test(t => { + return navigator.mediaCapabilities.decodingInfo({ + type: 'webrtc', + audio: { + contentType: codec + } + }).then(ability => { + assert_true(ability.supported); + }); +}, "Test that decodingInfo returns supported true for the codec " + codec + " returned by RTCRtpReceiver.getCapabilities()")} +); + +var validVideoCodecs = (() => { + // Some codecs that are returned by getCapabilities() are not real codecs but + // only used for error correction, exclude these from the test. + var excludeList = [ 'video/rtx', 'video/red', 'video/ulpfec', + 'video/flexfec-03' ]; + var videoCodecs = []; + + RTCRtpReceiver.getCapabilities("video")['codecs'].forEach(codec => { + if (excludeList.indexOf(codec.mimeType) < 0) { + var mimeType = codec.mimeType; + if ('sdpFmtpLine' in codec) { + mimeType += "; " + codec.sdpFmtpLine; + } + if (!(mimeType in videoCodecs)) { + videoCodecs.push(mimeType); + } + } + }); + return videoCodecs; +})(); + +validVideoCodecs.forEach(codec => { + promise_test(t => { + return navigator.mediaCapabilities.decodingInfo({ + type: 'webrtc', + video: { + contentType: codec, + width: 800, + height: 600, + bitrate: 3000, + framerate: 24, + } + }).then(ability => { + assert_true(ability.supported); + }); +}, "Test that decodingInfo returns supported true for the codec " + codec + " returned by RTCRtpReceiver.getCapabilities()")} +); + +</script>
diff --git a/third_party/blink/web_tests/external/wpt/media-capabilities/decodingInfoEncryptedMedia.https.html b/third_party/blink/web_tests/external/wpt/media-capabilities/decodingInfoEncryptedMedia.https.html index 0942284..7ac914de 100644 --- a/third_party/blink/web_tests/external/wpt/media-capabilities/decodingInfoEncryptedMedia.https.html +++ b/third_party/blink/web_tests/external/wpt/media-capabilities/decodingInfoEncryptedMedia.https.html
@@ -250,4 +250,13 @@ assert_false(ability.supported); }); }, "Test that supported=false when keySystemConfiguration is unsupported."); + +promise_test(t => { + return promise_rejects_js(t, TypeError, navigator.mediaCapabilities.decodingInfo({ + type: 'webrtc', + video: minimalVideoConfiguration, + keySystemConfiguration: minimalKeySystemConfiguration, + })); +}, "Test that decodingInfo() with type webrtc rejects key system configuration."); + </script>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/TAO-match.html b/third_party/blink/web_tests/external/wpt/resource-timing/TAO-match.html new file mode 100644 index 0000000..bd0e8db --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/resource-timing/TAO-match.html
@@ -0,0 +1,69 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8" /> +<title>Resource Timing TAO tests</title> +<link rel="author" title="Google" href="http://www.google.com/" /> +<link rel="help" + href="https://www.w3.org/TR/resource-timing-2/#timing-allow-origin"/> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/get-host-info.sub.js"></script> +<script src="resources/entry-invariants.js"></script> +<script src="resources/resource-loaders.js"></script> +<script> +const {REMOTE_ORIGIN} = get_host_info(); +const path = REMOTE_ORIGIN + '/resource-timing/resources/TAOResponse.py?tao='; + +attribute_test(load.xhr_sync, path + 'match_origin', + invariants.assert_tao_pass_no_redirect, +'The timing allow check algorithm will pass when the Timing-Allow-Origin ' + +'header value list contains a case-sensitive match.'); + +attribute_test(load.xhr_sync, path + 'match_wildcard', + invariants.assert_tao_pass_no_redirect, +'The timing allow check algorithm will pass when the Timing-Allow-Origin ' + +'header value list contains a wildcard.'); + +attribute_test(load.xhr_sync, path + 'null', + invariants.assert_tao_failure_resource, +'The timing allow check algorithm will fail when the Timing-Allow-Origin ' + +'header value list contains a null origin.'); + +attribute_test(load.xhr_sync, path + 'multi', + invariants.assert_tao_pass_no_redirect, +'The timing allow check algorithm will pass when the Timing-Allow-Origin ' + +'header value list contains the origin and a wildcard.'); + +attribute_test(load.xhr_sync, path + 'multi_wildcard', + invariants.assert_tao_pass_no_redirect, +'The timing allow check algorithm will pass when the Timing-Allow-Origin ' + +'header value list contains multiple wildcards.'); + +attribute_test(load.xhr_sync, path + 'origin', + invariants.assert_tao_pass_no_redirect, +'The timing allow check algorithm will pass when the Timing-Allow-Origin ' + +'header value contains only the origin.'); + +attribute_test(load.xhr_sync, path + 'uppercase', + invariants.assert_tao_failure_resource, +'The timing allow check algorithm will fail when the Timing-Allow-Origin ' + +'header value contains only the uppercased origin.'); + +attribute_test(load.xhr_sync, path + 'space', + invariants.assert_tao_failure_resource, +'The timing allow check algorithm will fail when the Timing-Allow-Origin ' + +'header value contains only a space.'); + +attribute_test(load.xhr_sync, path + 'wildcard', + invariants.assert_tao_pass_no_redirect, +'The timing allow check algorithm will fail when the Timing-Allow-Origin ' + +'header value contains only a wildcard.'); + +attribute_test(load.xhr_sync, path + 'zero', + invariants.assert_tao_failure_resource, +'The timing allow check algorithm will fail when the Timing-Allow-Origin ' + +'header is not present.'); +</script> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resource-TAO-match-origin.html b/third_party/blink/web_tests/external/wpt/resource-timing/resource-TAO-match-origin.html deleted file mode 100644 index 7e738f9..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resource-TAO-match-origin.html +++ /dev/null
@@ -1,21 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8" /> -<title>Resource Timing TAO tests</title> -<link rel="author" title="Google" href="http://www.google.com/" /> -<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#timing-allow-origin"/> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="/common/get-host-info.sub.js"></script> -<script src="resources/entry-invariants.js"></script> -<script src="resources/resource-loaders.js"></script> -<script> -const {REMOTE_ORIGIN} = get_host_info(); -const path = REMOTE_ORIGIN + '/resource-timing/resources/TAOResponse.py?tao=match_origin'; -attribute_test(load.xhr_sync, path, - invariants.assert_tao_pass_no_redirect, -'The timing allow check algorithm will pass when the Timing-Allow-Origin header value list contains a case-sensitive match.'); -</script> -</body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_match_wildcard.html b/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_match_wildcard.html deleted file mode 100644 index fe812f8..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_match_wildcard.html +++ /dev/null
@@ -1,56 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8" /> -<title>Resource Timing TAO tests</title> -<link rel="author" title="Google" href="http://www.google.com/" /> -<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#timing-allow-origin"/> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="resources/webperftestharness.js"></script> -<script src="resources/webperftestharnessextension.js"></script> -<script> -setup({explicit_done: true}); - -// explicitly test the namespace before we start testing -test_namespace("getEntriesByType"); - -var d; -var iframe; -var iframeBody; -var image; -var random = Math.random(); - -function setup_iframe() { - iframe = document.getElementById('frameContext'); - d = iframe.contentWindow.document; - iframeBody = d.body; - iframe.addEventListener('load', onload_test, false); -} -function onload_test() { - if (window.performance.getEntriesByType === undefined) { - done(); - return; - } - var context = new PerformanceContext(iframe.contentWindow.performance); - var entries = context.getEntriesByType('resource'); - - assert_greater_than(entries.length, 0, "The iframe should have at least one resource timing entry."); - if(entries.length > 0) { - entry = entries[0]; - - test_not_equals((entry.redirectStart + entry.redirectEnd + entry.domainLookupStart + entry.domainLookupEnd + entry.connectStart + entry.connectEnd + entry.secureConnectionStart + entry.requestStart + entry.responseStart), 0, 'redirectStart, redirectEnd, domainLookupStart, domainLookupEnd, connectStart, connectEnd, secureConnectionStart, requestStart, and responseStart -- should NOT be all returned as 0 when the Timing-Allow-Origin header value list contains a wildcard ("*") and TAO algorithm passes'); - } - - done(); -} -window.setup_iframe = setup_iframe; -</script> -</head> -<body> -<h1>Description</h1> -<p>This test validates that for a cross origin resource, the timing allow check algorithm will pass when the Timing-Allow-Origin header value list contains a wildcard ("*").</p> -<div id="log"></div> -<iframe id="frameContext" src="resources/iframe_TAO_match_wildcard.html"></iframe> -</body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_multi.html b/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_multi.html deleted file mode 100644 index bb774abc..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_multi.html +++ /dev/null
@@ -1,56 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8" /> -<title>Resource Timing TAO tests</title> -<link rel="author" title="Google" href="http://www.google.com/" /> -<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#timing-allow-origin"/> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="resources/webperftestharness.js"></script> -<script src="resources/webperftestharnessextension.js"></script> -<script> -setup({explicit_done: true}); - -// explicitly test the namespace before we start testing -test_namespace("getEntriesByType"); - -var d; -var iframe; -var iframeBody; -var image; -var random = Math.random(); - -function setup_iframe() { - iframe = document.getElementById('frameContext'); - d = iframe.contentWindow.document; - iframeBody = d.body; - iframe.addEventListener('load', onload_test, false); -} -function onload_test() { - if (window.performance.getEntriesByType === undefined) { - done(); - return; - } - var context = new PerformanceContext(iframe.contentWindow.performance); - var entries = context.getEntriesByType('resource'); - - assert_greater_than(entries.length, 0, "The iframe should have at least one resource timing entry."); - if(entries.length > 0) { - entry = entries[0]; - - test_not_equals((entry.redirectStart + entry.redirectEnd + entry.domainLookupStart + entry.domainLookupEnd + entry.connectStart + entry.connectEnd + entry.secureConnectionStart + entry.requestStart + entry.responseStart), 0, 'redirectStart, redirectEnd, domainLookupStart, domainLookupEnd, connectStart, connectEnd, secureConnectionStart, requestStart, and responseStart -- should not be all returned as 0 when the HTTP response has multiple Timing-Allow-Origin header fields and the subsequent field value is separated by a comma, i.e. TAO algorithm passes'); - } - - done(); -} -window.setup_iframe = setup_iframe; -</script> -</head> -<body> -<h1>Description</h1> -<p>This test validates that for a cross origin resource, the timing allow check algorithm will pass when the HTTP response has multiple Timing-Allow-Origin header fields and the subsequent field value is separated by a comma.</p> -<div id="log"></div> -<iframe id="frameContext" src="resources/iframe_TAO_multi.html"></iframe> -</body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_multi_wildcard.html b/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_multi_wildcard.html deleted file mode 100644 index 8448960..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_multi_wildcard.html +++ /dev/null
@@ -1,56 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8" /> -<title>Resource Timing TAO tests</title> -<link rel="author" title="Google" href="http://www.google.com/" /> -<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#timing-allow-origin"/> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="resources/webperftestharness.js"></script> -<script src="resources/webperftestharnessextension.js"></script> -<script> -setup({explicit_done: true}); - -// explicitly test the namespace before we start testing -test_namespace("getEntriesByType"); - -var d; -var iframe; -var iframeBody; -var image; -var random = Math.random(); - -function setup_iframe() { - iframe = document.getElementById('frameContext'); - d = iframe.contentWindow.document; - iframeBody = d.body; - iframe.addEventListener('load', onload_test, false); -} -function onload_test() { - if (window.performance.getEntriesByType === undefined) { - done(); - return; - } - var context = new PerformanceContext(iframe.contentWindow.performance); - var entries = context.getEntriesByType('resource'); - - assert_greater_than(entries.length, 0, "The iframe should have at least one resource timing entry."); - if(entries.length > 0) { - entry = entries[0]; - - test_not_equals((entry.redirectStart + entry.redirectEnd + entry.domainLookupStart + entry.domainLookupEnd + entry.connectStart + entry.connectEnd + entry.secureConnectionStart + entry.requestStart + entry.responseStart), 0, 'redirectStart, redirectEnd, domainLookupStart, domainLookupEnd, connectStart, connectEnd, secureConnectionStart, requestStart, and responseStart -- should not be all returned as 0 when the HTTP response has multiple Timing-Allow-Origin header fields and the subsequent field value is separated by a comma, i.e. TAO algorithm passes'); - } - - done(); -} -window.setup_iframe = setup_iframe; -</script> -</head> -<body> -<h1>Description</h1> -<p>This test validates that for a cross origin resource, the timing allow check algorithm will pass when the HTTP response has multiple Timing-Allow-Origin header fields and the subsequent field value is separated by a comma.</p> -<div id="log"></div> -<iframe id="frameContext" src="resources/iframe_TAO_multi_wildcard.html"></iframe> -</body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_null.html b/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_null.html deleted file mode 100644 index 1a86e09c..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_null.html +++ /dev/null
@@ -1,56 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8" /> -<title>Resource Timing TAO tests</title> -<link rel="author" title="Google" href="http://www.google.com/" /> -<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#timing-allow-origin"/> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="resources/webperftestharness.js"></script> -<script src="resources/webperftestharnessextension.js"></script> -<script> -setup({explicit_done: true}); - -// explicitly test the namespace before we start testing -test_namespace("getEntriesByType"); - -var d; -var iframe; -var iframeBody; -var image; -var random = Math.random(); - -function setup_iframe() { - iframe = document.getElementById('frameContext'); - d = iframe.contentWindow.document; - iframeBody = d.body; - iframe.addEventListener('load', onload_test, false); -} -function onload_test() { - if (window.performance.getEntriesByType === undefined) { - done(); - return; - } - var context = new PerformanceContext(iframe.contentWindow.performance); - var entries = context.getEntriesByType('resource'); - - assert_greater_than(entries.length, 0, "The iframe should have at least one resource timing entry."); - if(entries.length > 0) { - entry = entries[0]; - - test_equals((entry.redirectStart + entry.redirectEnd + entry.domainLookupStart + entry.domainLookupEnd + entry.connectStart + entry.connectEnd + entry.secureConnectionStart + entry.requestStart + entry.responseStart), 0, 'redirectStart, redirectEnd, domainLookupStart, domainLookupEnd, connectStart, connectEnd, secureConnectionStart, requestStart, and responseStart -- should be all returned as 0 when the value of Timing-Allow-Origin is null and TAO algorithm fails'); - } - - done(); -} -window.setup_iframe = setup_iframe; -</script> -</head> -<body> -<h1>Description</h1> -<p>This test validates that for a cross origin resource, the timing allow check algorithm will fail when the value of Timing-Allow-Origin is null.</p> -<div id="log"></div> -<iframe id="frameContext" src="resources/iframe_TAO_null.html"></iframe> -</body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_origin.html b/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_origin.html deleted file mode 100644 index a0c0465..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_origin.html +++ /dev/null
@@ -1,55 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8" /> -<title>Resource Timing TAO tests</title> -<link rel="author" title="Google" href="http://www.google.com/" /> -<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#timing-allow-origin"/> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="resources/webperftestharness.js"></script> -<script src="resources/webperftestharnessextension.js"></script> -<script> -setup({explicit_done: true}); - -// Explicitly test the namespace before we start testing. -test_namespace('getEntriesByType'); - -let iframe; -function setup_iframe() { - iframe = document.getElementById('frameContext'); - iframe.addEventListener('load', onload_test, false); -} -function onload_test() { - if (window.performance.getEntriesByType === undefined) { - done(); - return; - } - const context = new PerformanceContext(iframe.contentWindow.performance); - const entries = context.getEntriesByType('resource'); - - test_equals(entries.length, 1, 'The iframe should have one resource timing entry.'); - const entry = entries[0]; - test_equals(entry.redirectStart, 0, 'redirectStart should be 0 in cross-origin request since no redirect.'); - test_equals(entry.redirectEnd, 0, 'redirectEnd should be 0 in cross-origin request since no redirect.'); - test_greater_than(entry.domainLookupStart, 0, 'domainLookupStart should not be 0 in timing-allow cross-origin request.'); - test_greater_than(entry.domainLookupEnd, 0, 'domainLookupEnd should not be 0 in timing-allow cross-origin request.'); - test_greater_than(entry.connectStart, 0, 'connectStart should not be 0 in timing-allow cross-origin request.'); - test_greater_than(entry.connectEnd, 0, 'connectEnd should not be 0 in timing-allow cross-origin request.'); - test_greater_than(entry.requestStart, 0, 'requestStart should not be 0 in timing-allow cross-origin request.'); - test_greater_than(entry.responseStart, 0, 'responseStart should not be 0 in timing-allow cross-origin request.'); - test_equals(entry.secureConnectionStart, 0, 'secureConnectionStart should be 0 in cross-origin request since no ssl!'); - test_greater_than(entry.fetchStart, 0, 'fetchStart should not be 0 in timing-allow cross-origin request.'); - test_greater_than(entry.responseEnd, 0, 'responseEnd should not be 0 in timing-allow cross-origin request.'); - done(); -} -window.setup_iframe = setup_iframe; -</script> -</head> -<body> -<h1>Description</h1> -<p>This test validates that for a cross origin resource, the timing allow check algorithm will pass when the value of Timing-Allow-Origin is a case-sensitive match for the value of the origin of the current document.</p> -<div id="log"></div> -<iframe id="frameContext" src="resources/iframe_TAO_origin.html"></iframe> -</body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_origin_uppercase.html b/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_origin_uppercase.html deleted file mode 100644 index 1a03c714..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_origin_uppercase.html +++ /dev/null
@@ -1,56 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8" /> -<title>Resource Timing TAO tests</title> -<link rel="author" title="Google" href="http://www.google.com/" /> -<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#timing-allow-origin"/> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="resources/webperftestharness.js"></script> -<script src="resources/webperftestharnessextension.js"></script> -<script> -setup({explicit_done: true}); - -// explicitly test the namespace before we start testing -test_namespace("getEntriesByType"); - -var d; -var iframe; -var iframeBody; -var image; -var random = Math.random(); - -function setup_iframe() { - iframe = document.getElementById('frameContext'); - d = iframe.contentWindow.document; - iframeBody = d.body; - iframe.addEventListener('load', onload_test, false); -} -function onload_test() { - if (window.performance.getEntriesByType === undefined) { - done(); - return; - } - var context = new PerformanceContext(iframe.contentWindow.performance); - var entries = context.getEntriesByType('resource'); - - assert_greater_than(entries.length, 0, "The iframe should have at least one resource timing entry."); - if(entries.length > 0) { - entry = entries[0]; - - test_equals((entry.redirectStart + entry.redirectEnd + entry.domainLookupStart + entry.domainLookupEnd + entry.connectStart + entry.connectEnd + entry.secureConnectionStart + entry.requestStart + entry.responseStart), 0, 'redirectStart, redirectEnd, domainLookupStart, domainLookupEnd, connectStart, connectEnd, secureConnectionStart, requestStart, and responseStart -- should be all returned as 0 when the value of Timing-Allow-Origin is NOT a case-sensitive match for the value of the origin of the current document and TAO algorithm passes'); - } - - done(); -} -window.setup_iframe = setup_iframe; -</script> -</head> -<body> -<h1>Description</h1> -<p>This test validates that for a cross origin resource, the timing allow check algorithm will fail when the value of Timing-Allow-Origin is NOT a case-sensitive match for the value of the origin of the current document.</p> -<div id="log"></div> -<iframe id="frameContext" src="resources/iframe_TAO_origin_uppercase.html"></iframe> -</body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_space.html b/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_space.html deleted file mode 100644 index 9efefe15..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_space.html +++ /dev/null
@@ -1,56 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8" /> -<title>Resource Timing TAO tests</title> -<link rel="author" title="Google" href="http://www.google.com/" /> -<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#timing-allow-origin"/> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="resources/webperftestharness.js"></script> -<script src="resources/webperftestharnessextension.js"></script> -<script> -setup({explicit_done: true}); - -// explicitly test the namespace before we start testing -test_namespace("getEntriesByType"); - -var d; -var iframe; -var iframeBody; -var image; -var random = Math.random(); - -function setup_iframe() { - iframe = document.getElementById('frameContext'); - d = iframe.contentWindow.document; - iframeBody = d.body; - iframe.addEventListener('load', onload_test, false); -} -function onload_test() { - if (window.performance.getEntriesByType === undefined) { - done(); - return; - } - var context = new PerformanceContext(iframe.contentWindow.performance); - var entries = context.getEntriesByType('resource'); - - assert_greater_than(entries.length, 0, "The iframe should have at least one resource timing entry."); - if(entries.length > 0) { - entry = entries[0]; - - test_equals((entry.redirectStart + entry.redirectEnd + entry.domainLookupStart + entry.domainLookupEnd + entry.connectStart + entry.connectEnd + entry.secureConnectionStart + entry.requestStart + entry.responseStart), 0, 'redirectStart, redirectEnd, domainLookupStart, domainLookupEnd, connectStart, connectEnd, secureConnectionStart, requestStart, and responseStart -- should be all returned as 0 when the Timing-Allow-Origin header value of the HTTP response is a space separated origin/wildcard list'); - } - - done(); -} -window.setup_iframe = setup_iframe; -</script> -</head> -<body> -<h1>Description</h1> -<p>This test validates that for a cross origin resource, the timing allow check algorithm will fail if the Timing-Allow-Origin header value list contains [origin|*]{2,}, separated by space.</p> -<div id="log"></div> -<iframe id="frameContext" src="resources/iframe_TAO_space.html"></iframe> -</body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_wildcard.html b/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_wildcard.html deleted file mode 100644 index df27853..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_wildcard.html +++ /dev/null
@@ -1,56 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8" /> -<title>Resource Timing TAO tests</title> -<link rel="author" title="Google" href="http://www.google.com/" /> -<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#timing-allow-origin"/> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="resources/webperftestharness.js"></script> -<script src="resources/webperftestharnessextension.js"></script> -<script> -setup({explicit_done: true}); - -// explicitly test the namespace before we start testing -test_namespace("getEntriesByType"); - -var d; -var iframe; -var iframeBody; -var image; -var random = Math.random(); - -function setup_iframe() { - iframe = document.getElementById('frameContext'); - d = iframe.contentWindow.document; - iframeBody = d.body; - iframe.addEventListener('load', onload_test, false); -} -function onload_test() { - if (window.performance.getEntriesByType === undefined) { - done(); - return; - } - var context = new PerformanceContext(iframe.contentWindow.performance); - var entries = context.getEntriesByType('resource'); - - assert_greater_than(entries.length, 0, "The iframe should have at least one resource timing entry."); - if(entries.length > 0) { - entry = entries[0]; - - test_not_equals((entry.redirectStart + entry.redirectEnd + entry.domainLookupStart + entry.domainLookupEnd + entry.connectStart + entry.connectEnd + entry.secureConnectionStart + entry.requestStart + entry.responseStart), 0, "redirectStart, redirectEnd, domainLookupStart, domainLookupEnd, connectStart, connectEnd, secureConnectionStart, requestStart, and responseStart -- should NOT be all returned as 0 when the Timing-Allow-Origin header value is a wildcard ('*') and TAO algorithm pass"); - } - - done(); -} -window.setup_iframe = setup_iframe; -</script> -</head> -<body> -<h1>Description</h1> -<p>This test validates that for a cross origin resource, the timing allow check algorithm will pass when the Timing-Allow-Origin header value is a wildcard ("*").</p> -<div id="log"></div> -<iframe id="frameContext" src="resources/iframe_TAO_wildcard.html"></iframe> -</body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_zero.html b/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_zero.html deleted file mode 100644 index a15f54d0..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resource_TAO_zero.html +++ /dev/null
@@ -1,54 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8" /> -<title>Resource Timing TAO tests</title> -<link rel="author" title="Google" href="http://www.google.com/" /> -<link rel="help" href="https://www.w3.org/TR/resource-timing-2/#timing-allow-origin"/> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="resources/webperftestharness.js"></script> -<script src="resources/webperftestharnessextension.js"></script> -<script> -setup({explicit_done: true}); - -// explicitly test the namespace before we start testing -test_namespace('getEntriesByType'); - -let iframe; -function setup_iframe() { - iframe = document.getElementById('frameContext'); - iframe.addEventListener('load', onload_test, false); -} -function onload_test() { - if (window.performance.getEntriesByType === undefined) { - done(); - return; - } - const context = new PerformanceContext(iframe.contentWindow.performance); - const entries = context.getEntriesByType('resource'); - test_equals(entries.length, 1, 'There should be one resource timing entry.'); - const entry = entries[0]; - test_equals(entry.redirectStart, 0, 'redirectStart should be 0 in cross-origin request.'); - test_equals(entry.redirectEnd, 0, 'redirectEnd should be 0 in cross-origin request.'); - test_equals(entry.domainLookupStart, 0, 'domainLookupStart should be 0 in cross-origin request.'); - test_equals(entry.domainLookupEnd, 0, 'domainLookupEnd should be 0 in cross-origin request.'); - test_equals(entry.connectStart, 0, 'connectStart should be 0 in cross-origin request.'); - test_equals(entry.connectEnd, 0, 'connectEnd should be 0 in cross-origin request.'); - test_equals(entry.requestStart, 0, 'requestStart should be 0 in cross-origin request.'); - test_equals(entry.responseStart, 0, 'responseStart should be 0 in cross-origin request.'); - test_equals(entry.secureConnectionStart, 0, 'secureConnectionStart should be 0 in cross-origin request.'); - test_greater_than(entry.fetchStart, 0, 'fetchStart should be greater than 0 in cross-origin request.'); - test_greater_than(entry.responseEnd, 0, 'responseEnd should be greater than 0 in cross-origin request.'); - done(); -} -window.setup_iframe = setup_iframe; -</script> -</head> -<body> -<h1>Description</h1> -<p>This test validates that for a cross origin resource, the timing allow check algorithm will fail when the HTTP response includes zero Timing-Allow-Origin header value.</p> -<div id="log"></div> -<iframe id="frameContext" src="resources/iframe_TAO_zero.html"></iframe> -</body> -</html>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_match_wildcard.html b/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_match_wildcard.html deleted file mode 100644 index a6a03e06..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_match_wildcard.html +++ /dev/null
@@ -1,21 +0,0 @@ -<body> -<script> -function dirname(path) { - return path.replace(/\/[^\/]*$/, '/'); -} - -function request() { - var dirName = dirname(location.href); - var client = new XMLHttpRequest, - // create a cross-origin request - url = dirName.replace('://', '://www.') + 'TAOResponse.py?tao=match_wildcard'; - client.open("GET", url, false); - client.send(null); -} - -if(window.parent.setup_iframe) { - window.parent.setup_iframe(); - request(); -} -</script> -</body>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_multi.html b/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_multi.html deleted file mode 100644 index 0696dbe..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_multi.html +++ /dev/null
@@ -1,21 +0,0 @@ -<body> -<script> -function dirname(path) { - return path.replace(/\/[^\/]*$/, '/'); -} - -function request() { - var dirName = dirname(location.href); - var client = new XMLHttpRequest, - // create a cross-origin request - url = dirName.replace('://', '://www.') + 'TAOResponse.py?tao=multi'; - client.open("GET", url, false); - client.send(null); -} - -if(window.parent.setup_iframe) { - window.parent.setup_iframe(); - request(); -} -</script> -</body>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_multi_wildcard.html b/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_multi_wildcard.html deleted file mode 100644 index 977df01..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_multi_wildcard.html +++ /dev/null
@@ -1,21 +0,0 @@ -<body> -<script> -function dirname(path) { - return path.replace(/\/[^\/]*$/, '/'); -} - -function request() { - var dirName = dirname(location.href); - // create a cross-origin request - var url = dirName.replace('://', '://www.') + 'TAOResponse.py?tao=multi_wildcard'; - var img = new Image(); - img.crossOrigin = "anonymous"; - img.src = url; -} - -if(window.parent.setup_iframe) { - window.parent.setup_iframe(); - request(); -} -</script> -</body>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_null.html b/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_null.html deleted file mode 100644 index 7d47a207..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_null.html +++ /dev/null
@@ -1,21 +0,0 @@ -<body> -<script> -function dirname(path) { - return path.replace(/\/[^\/]*$/, '/'); -} - -function request() { - var dirName = dirname(location.href); - var client = new XMLHttpRequest, - // create a cross-origin request - url = dirName.replace('://', '://www.') + 'TAOResponse.py?tao=null'; - client.open("GET", url, false); - client.send(null); -} - -if(window.parent.setup_iframe) { - window.parent.setup_iframe(); - request(); -} -</script> -</body>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_origin.html b/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_origin.html deleted file mode 100644 index c75b075..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_origin.html +++ /dev/null
@@ -1,21 +0,0 @@ -<body> -<script> -function dirname(path) { - return path.replace(/\/[^\/]*$/, '/'); -} - -function request() { - var dirName = dirname(location.href); - var client = new XMLHttpRequest, - // create a cross-origin request - url = dirName.replace('://', '://www.') + 'TAOResponse.py?tao=origin'; - client.open("GET", url, false); - client.send(null); -} - -if(window.parent.setup_iframe) { - window.parent.setup_iframe(); - request(); -} -</script> -</body>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_origin_uppercase.html b/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_origin_uppercase.html deleted file mode 100644 index 7404035..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_origin_uppercase.html +++ /dev/null
@@ -1,21 +0,0 @@ -<body> -<script> -function dirname(path) { - return path.replace(/\/[^\/]*$/, '/'); -} - -function request() { - var dirName = dirname(location.href); - var client = new XMLHttpRequest, - // create a cross-origin request - url = dirName.replace('://', '://www.') + 'TAOResponse.py?tao=uppercase'; - client.open("GET", url, false); - client.send(null); -} - -if(window.parent.setup_iframe) { - window.parent.setup_iframe(); - request(); -} -</script> -</body>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_space.html b/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_space.html deleted file mode 100644 index 2a484ed5..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_space.html +++ /dev/null
@@ -1,21 +0,0 @@ -<body> -<script> -function dirname(path) { - return path.replace(/\/[^\/]*$/, '/'); -} - -function request() { - var dirName = dirname(location.href); - var client = new XMLHttpRequest, - // create a cross-origin request - url = dirName.replace('://', '://www.') + 'TAOResponse.py?tao=space'; - client.open("GET", url, false); - client.send(null); -} - -if(window.parent.setup_iframe) { - window.parent.setup_iframe(); - request(); -} -</script> -</body>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_wildcard.html b/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_wildcard.html deleted file mode 100644 index 3b5be4cd..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_wildcard.html +++ /dev/null
@@ -1,21 +0,0 @@ -<body> -<script> -function dirname(path) { - return path.replace(/\/[^\/]*$/, '/'); -} - -function request() { - var dirName = dirname(location.href); - var client = new XMLHttpRequest, - // create a cross-origin request - url = dirName.replace('://', '://www.') + 'TAOResponse.py?tao=wildcard'; - client.open("GET", url, false); - client.send(null); -} - -if(window.parent.setup_iframe) { - window.parent.setup_iframe(); - request(); -} -</script> -</body>
diff --git a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_zero.html b/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_zero.html deleted file mode 100644 index 76c5938..0000000 --- a/third_party/blink/web_tests/external/wpt/resource-timing/resources/iframe_TAO_zero.html +++ /dev/null
@@ -1,21 +0,0 @@ -<body> -<script> -function dirname(path) { - return path.replace(/\/[^\/]*$/, '/'); -} - -function request() { - var dirName = dirname(location.href); - var client = new XMLHttpRequest, - // create a cross-origin request - url = dirName.replace('://', '://www.') + 'TAOResponse.py?tao=zero'; - client.open("GET", url, false); - client.send(null); -} - -if(window.parent.setup_iframe) { - window.parent.setup_iframe(); - request(); -} -</script> -</body>
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-1000-reason.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-1000-reason.any.js index 1b1a101..6fc3c1fad 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-1000-reason.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-1000-reason.any.js
@@ -3,21 +3,19 @@ // META: variant=?wss // META: variant=?wpt_flags=h2 -var testOpen = async_test("Create WebSocket - Close the Connection - Connection should be opened"); -var testClose = async_test("Create WebSocket - Close the Connection - close(1000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); +var test = async_test("Create WebSocket - Close the Connection - close(1000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.close(1000, "Clean Close"); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be opened"); assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); assert_equals(evt.wasClean, true, "wasClean should be TRUE"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-1000-verify-code.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-1000-verify-code.any.js index 5adad3dc9..de501306 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-1000-verify-code.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-1000-verify-code.any.js
@@ -3,21 +3,19 @@ // META: variant=?wss // META: variant=?wpt_flags=h2 -var testOpen = async_test("Create WebSocket - Close the Connection - close(1000, reason) - Connection should be opened"); -var testClose = async_test("Create WebSocket - Close the Connection - close(1000, reason) - event.code == 1000 and event.reason = 'Clean Close'"); +var test = async_test("Create WebSocket - Close the Connection - close(1000, reason) - event.code == 1000 and event.reason = 'Clean Close'"); var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.close(1000, "Clean Close"); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); assert_equals(evt.code, 1000, "CloseEvent.code should be 1000"); assert_equals(evt.reason, "Clean Close", "CloseEvent.reason should be the same as the reason sent in close"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-1000.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-1000.any.js index 6a3e73e..f3100c6c 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-1000.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-1000.any.js
@@ -3,21 +3,19 @@ // META: variant=?wss // META: variant=?wpt_flags=h2 -var testOpen = async_test("Create WebSocket - Connection should be opened"); -var testClose = async_test("Create WebSocket - Close the Connection - close(1000) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); +var test = async_test("Create WebSocket - Close the Connection - close(1000) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.close(1000); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be opened"); assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); assert_equals(evt.wasClean, true, "wasClean should be TRUE"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-1005-verify-code.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-1005-verify-code.any.js index 34ebfc9..afa7d7b 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-1005-verify-code.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-1005-verify-code.any.js
@@ -3,21 +3,19 @@ // META: variant=?wss // META: variant=?wpt_flags=h2 -var testOpen = async_test("Create WebSocket - Close the Connection - close() - Connection should be opened"); -var testClose = async_test("Create WebSocket - Close the Connection - close() - return close code is 1005 - Connection should be closed"); +var test = async_test("Create WebSocket - Close the Connection - close() - return close code is 1005 - Connection should be closed"); var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.close(); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); assert_equals(evt.code, 1005, "CloseEvent.code should be 1005"); assert_equals(evt.reason, "", "CloseEvent.reason should be empty"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-1005.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-1005.any.js index 681194a..514d03a 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-1005.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-1005.any.js
@@ -14,3 +14,5 @@ }); test.done(); }), true); + +wsocket.addEventListener('close', test.unreached_func('close event should not fire'), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-2999-reason.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-2999-reason.any.js index baaa456..95e481e 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-2999-reason.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-2999-reason.any.js
@@ -13,3 +13,5 @@ }); test.done(); }), true); + +wsocket.addEventListener('close', test.unreached_func('close event should not fire'), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-3000-reason.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-3000-reason.any.js index 4a048e2..2db12293 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-3000-reason.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-3000-reason.any.js
@@ -3,21 +3,19 @@ // META: variant=?wss // META: variant=?wpt_flags=h2 -var testOpen = async_test("Create WebSocket - Close the Connection - close(3000, reason) - Connection should be opened"); -var testClose = async_test("Create WebSocket - Close the Connection - close(3000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); +var test = async_test("Create WebSocket - Close the Connection - close(3000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.close(3000, "Clean Close with code - 3000"); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); assert_equals(evt.wasClean, true, "wasClean should be TRUE"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-3000-verify-code.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-3000-verify-code.any.js index 1191dea1..bfa441f1 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-3000-verify-code.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-3000-verify-code.any.js
@@ -3,20 +3,18 @@ // META: variant=?wss // META: variant=?wpt_flags=h2 -var testOpen = async_test("Create WebSocket - Close the Connection - close(3000, reason) - Connection should be opened"); -var testClose = async_test("Create WebSocket - Close the Connection - close(3000, reason) - verify return code is 3000 - Connection should be closed"); +var test = async_test("Create WebSocket - Close the Connection - close(3000, reason) - verify return code is 3000 - Connection should be closed"); var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.close(3000, "Clean Close"); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); assert_equals(evt.code, 3000, "CloseEvent.code should be 3000"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-4999-reason.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-4999-reason.any.js index 4112d01..3516dc2 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-4999-reason.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-4999-reason.any.js
@@ -3,21 +3,19 @@ // META: variant=?wss // META: variant=?wpt_flags=h2 -var testOpen = async_test("Create WebSocket - Close the Connection - close(4999, reason) - Connection should be opened"); -var testClose = async_test("Create WebSocket - Close the Connection - close(4999, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); +var test = async_test("Create WebSocket - Close the Connection - close(4999, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.close(3000, "Clean Close with code - 4999"); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); assert_equals(evt.wasClean, true, "wasClean should be TRUE"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-Reason-124Bytes.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-Reason-124Bytes.any.js index f42b7f4..aa7fc8f 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-Reason-124Bytes.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-Reason-124Bytes.any.js
@@ -16,3 +16,5 @@ }); test.done(); }), true); + +wsocket.addEventListener('close', test.unreached_func('close event should not fire'), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-onlyReason.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-onlyReason.any.js index b99595c..7c5d10d 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-onlyReason.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-onlyReason.any.js
@@ -13,3 +13,5 @@ }); test.done(); }), true); + +wsocket.addEventListener('close', test.unreached_func('close event should not fire'), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-readyState-Closed.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-readyState-Closed.any.js index f2878ad..bfd61c4 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-readyState-Closed.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-readyState-Closed.any.js
@@ -3,21 +3,19 @@ // META: variant=?wss // META: variant=?wpt_flags=h2 -var testOpen = async_test("Create WebSocket - Close the Connection - Connection should be opened"); -var testClose = async_test("Create WebSocket - Close the Connection - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); +var test = async_test("Create WebSocket - Close the Connection - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.close(); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); assert_equals(evt.wasClean, true, "wasClean should be TRUE"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-readyState-Closing.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-readyState-Closing.any.js index bbed4ed..554744d 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-readyState-Closing.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-readyState-Closing.any.js
@@ -9,7 +9,12 @@ var isOpenCalled = false; wsocket.addEventListener('open', test.step_func(function(evt) { + isOpenCalled = true; wsocket.close(); assert_equals(wsocket.readyState, 2, "readyState should be 2(CLOSING)"); +}), true); + +wsocket.addEventListener('close', test.step_func(function(evt) { + assert_true(isOpenCalled, 'open must be called'); test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-reason-unpaired-surrogates.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-reason-unpaired-surrogates.any.js index 5e0fbe2..647a1216 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-reason-unpaired-surrogates.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-reason-unpaired-surrogates.any.js
@@ -3,22 +3,20 @@ // META: variant=?wss // META: variant=?wpt_flags=h2 -var testOpen = async_test("Create WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get opened"); -var testClose = async_test("Create WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get closed"); +var test = async_test("Create WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get closed"); var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; var replacementChar = "\uFFFD"; var reason = "\uD807"; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.close(1000, reason); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be opened"); assert_equals(evt.reason, replacementChar, "reason replaced with replacement character"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-server-initiated-close.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-server-initiated-close.any.js index c70477ee..c86793b2 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-server-initiated-close.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-server-initiated-close.any.js
@@ -3,21 +3,19 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Create WebSocket - Server initiated Close - Client sends back a CLOSE - Connection should be opened"); -var testClose = async_test("Create WebSocket - Server initiated Close - Client sends back a CLOSE - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); +var test = async_test("Create WebSocket - Server initiated Close - Client sends back a CLOSE - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed"); var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.send("Goodbye"); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); assert_equals(wsocket.readyState, 3, "readyState should be 3(CLOSED)"); assert_equals(evt.wasClean, true, "wasClean should be TRUE"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Close-undefined.any.js b/third_party/blink/web_tests/external/wpt/websockets/Close-undefined.any.js index 9130aa1..a8106c6 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Close-undefined.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Close-undefined.any.js
@@ -9,6 +9,11 @@ var isOpenCalled = false; wsocket.addEventListener('open', test.step_func(function(evt) { + isOpenCalled = true; wsocket.close(undefined); +}), true); + +wsocket.addEventListener('close', test.step_func(function(evt) { + assert_true(isOpenCalled, 'open event must fire'); test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Create-extensions-empty.any.js b/third_party/blink/web_tests/external/wpt/websockets/Create-extensions-empty.any.js index b2de9041..1fba4bd 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Create-extensions-empty.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Create-extensions-empty.any.js
@@ -4,18 +4,17 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Create WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be opened"); -var testClose = async_test("Create WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be closed"); +var test = async_test("Create WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be closed"); var wsocket = new WebSocket(SCHEME_DOMAIN_PORT + "/handshake_no_extensions"); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func_done(function(evt) { +wsocket.addEventListener('open', test.step_func_done(function(evt) { wsocket.close(); isOpenCalled = true; assert_equals(wsocket.extensions, "", "extensions should be empty"); }), true); -wsocket.addEventListener('close', testClose.step_func_done(function(evt) { +wsocket.addEventListener('close', test.step_func_done(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be closed"); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-array-protocols.any.js b/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-array-protocols.any.js index 3989616..00ab1ca 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-array-protocols.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-array-protocols.any.js
@@ -3,21 +3,19 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Create WebSocket - Pass a valid URL and array of protocol strings - Connection should be opened"); -var testClose = async_test("Create WebSocket - Pass a valid URL and array of protocol strings - Connection should be closed"); +var test = async_test("Create WebSocket - Pass a valid URL and array of protocol strings - Connection should be closed"); var wsocket = CreateWebSocket(false, true); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); wsocket.close(); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-binaryType-blob.any.js b/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-binaryType-blob.any.js index b161349..59eec8e 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-binaryType-blob.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-binaryType-blob.any.js
@@ -3,21 +3,19 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Create WebSocket - wsocket.binaryType should be set to 'blob' after connection is established - Connection should be opened"); -var testClose = async_test("Create WebSocket - wsocket.binaryType should be set to 'blob' after connection is established - Connection should be closed"); +var test = async_test("Create WebSocket - wsocket.binaryType should be set to 'blob' after connection is established - Connection should be closed"); var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { assert_equals(wsocket.binaryType, "blob", "binaryType should be set to Blob"); wsocket.close(); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.js b/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.js index b4e3458..bb1f32f 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-protocol-setCorrectly.any.js
@@ -3,21 +3,19 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Create WebSocket - Pass a valid URL and protocol string - protocol should be set correctly - Connection should be opened"); -var testClose = async_test("Create WebSocket - Pass a valid URL and protocol string - Connection should be closed"); +var test = async_test("Create WebSocket - Pass a valid URL and protocol string - Connection should be closed"); var wsocket = CreateWebSocket(true, false); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { assert_equals(wsocket.protocol, "echo", "protocol should be set to echo"); wsocket.close(); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-protocol-string.any.js b/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-protocol-string.any.js index 46d613b..4f730db 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-protocol-string.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-protocol-string.any.js
@@ -3,21 +3,19 @@ // META: variant=?wss // META: variant=?wpt_flags=h2 -var testOpen = async_test("Create WebSocket - Check readyState is 1"); -var testClose = async_test("Create WebSocket - Pass a valid URL and protocol string - Connection should be closed"); +var test = async_test("Create WebSocket - Pass a valid URL and protocol string - Connection should be closed"); var wsocket = CreateWebSocket(true, false); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); wsocket.close(); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-protocol.any.js b/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-protocol.any.js index 7572d59..599a9eb 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-protocol.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url-protocol.any.js
@@ -3,21 +3,19 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Create WebSocket - Pass a valid URL and a protocol string - Connection should be opened"); -var testClose = async_test("Create WebSocket - Pass a valid URL and a protocol string - Connection should be closed"); +var test = async_test("Create WebSocket - Pass a valid URL and a protocol string - Connection should be closed"); var wsocket = CreateWebSocket(true, false); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); wsocket.close(); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url.any.js b/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url.any.js index f63d973..edb27f6 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Create-valid-url.any.js
@@ -3,21 +3,19 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Create WebSocket - Pass a valid URL - Connection should be opened"); -var testClose = async_test("Create WebSocket - Pass a valid URL - Connection should be closed"); +var test = async_test("Create WebSocket - Pass a valid URL - Connection should be closed"); var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); wsocket.close(); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-0byte-data.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-0byte-data.any.js index 085c852..b984b641 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-0byte-data.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-0byte-data.any.js
@@ -3,29 +3,28 @@ // META: variant=?wss // META: variant=?wpt_flags=h2 -var testOpen = async_test("Send 0 byte data on a WebSocket - Connection should be opened"); -var testMessage = async_test("Send 0 byte data on a WebSocket - Message should be received"); -var testClose = async_test("Send 0 byte data on a WebSocket - Connection should be closed"); +var test = async_test("Send 0 byte data on a WebSocket - Connection should be closed"); var data = ""; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.send(data); assert_equals(data.length, wsocket.bufferedAmount); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; assert_equals(evt.data, data); wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received") assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-65K-data.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-65K-data.any.js index 957fc48..5c3437999 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-65K-data.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-65K-data.any.js
@@ -3,32 +3,31 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Send 65K data on a WebSocket - Connection should be opened"); -var testMessage = async_test("Send 65K data on a WebSocket - Message should be received"); -var testClose = async_test("Send 65K data on a WebSocket - Connection should be closed"); +var test = async_test("Send 65K data on a WebSocket - Connection should be closed"); var data = ""; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { for (var i = 0; i < 65000; i++) { data = data + "c"; } wsocket.send(data); assert_equals(data.length, wsocket.bufferedAmount); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; assert_equals(evt.data, data); wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received") assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-65K-arraybuffer.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-65K-arraybuffer.any.js index 7269eb20..1e02ac2 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-65K-arraybuffer.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-65K-arraybuffer.any.js
@@ -3,32 +3,31 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Send 65K binary data on a WebSocket - ArrayBuffer - Connection should be opened"); -var testMessage = async_test("Send 65K binary data on a WebSocket - ArrayBuffer - Message should be received"); -var testClose = async_test("Send 65K binary data on a WebSocket - ArrayBuffer - Connection should be closed"); +var test = async_test("Send 65K binary data on a WebSocket - ArrayBuffer - Connection should be closed"); var data = ""; var datasize = 65000; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.binaryType = "arraybuffer"; data = new ArrayBuffer(datasize); wsocket.send(data); assert_equals(datasize, wsocket.bufferedAmount); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; assert_equals(evt.data.byteLength, datasize); wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received") assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybuffer.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybuffer.any.js index 8b87f1b59..5c985ed 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybuffer.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybuffer.any.js
@@ -3,32 +3,31 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Send binary data on a WebSocket - ArrayBuffer - Connection should be opened"); -var testMessage = async_test("Send binary data on a WebSocket - ArrayBuffer - Message should be received"); -var testClose = async_test("Send binary data on a WebSocket - ArrayBuffer - Connection should be closed"); +var test = async_test("Send binary data on a WebSocket - ArrayBuffer - Connection should be closed"); var data = ""; var datasize = 15; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.binaryType = "arraybuffer"; data = new ArrayBuffer(datasize); wsocket.send(data); assert_equals(datasize, wsocket.bufferedAmount); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; assert_equals(evt.data.byteLength, datasize); wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received") assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-float32.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-float32.any.js index 2e9fbae..9a8e3426 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-float32.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-float32.any.js
@@ -3,17 +3,16 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Send binary data on a WebSocket - ArrayBufferView - Float32Array - Connection should be opened"); -var testMessage = async_test("Send binary data on a WebSocket - ArrayBufferView - Float32Array - Message should be received"); -var testClose = async_test("Send binary data on a WebSocket - ArrayBufferView - Float32Array - Connection should be closed"); +var test = async_test("Send binary data on a WebSocket - ArrayBufferView - Float32Array - Connection should be closed"); var data = ""; var datasize = 8; var view; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.binaryType = "arraybuffer"; data = new ArrayBuffer(datasize); view = new Float32Array(data); @@ -22,20 +21,20 @@ } wsocket.send(view); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; var resultView = new Float32Array(evt.data); for (var i = 0; i < resultView.length; i++) { assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); } wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received") assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-float64.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-float64.any.js index 3759177..d71d2d8 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-float64.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-float64.any.js
@@ -3,17 +3,16 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Send binary data on a WebSocket - ArrayBufferView - Float64Array - Connection should be opened"); -var testMessage = async_test("Send binary data on a WebSocket - ArrayBufferView - Float64Array - Message should be received"); -var testClose = async_test("Send binary data on a WebSocket - ArrayBufferView - Float64Array - Connection should be closed"); +var test = async_test("Send binary data on a WebSocket - ArrayBufferView - Float64Array - Connection should be closed"); var data = ""; var datasize = 8; var view; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.binaryType = "arraybuffer"; data = new ArrayBuffer(datasize); view = new Float64Array(data); @@ -22,20 +21,20 @@ } wsocket.send(view); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; var resultView = new Float64Array(evt.data); for (var i = 0; i < resultView.length; i++) { assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); } wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received") assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-int16-offset.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-int16-offset.any.js index abed1bb2..bb77d300 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-int16-offset.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-int16-offset.any.js
@@ -3,17 +3,16 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Send binary data on a WebSocket - ArrayBufferView - Int16Array with offset - Connection should be opened"); -var testMessage = async_test("Send binary data on a WebSocket - ArrayBufferView - Int16Array with offset - Message should be received"); -var testClose = async_test("Send binary data on a WebSocket - ArrayBufferView - Int16Array with offset - Connection should be closed"); +var test = async_test("Send binary data on a WebSocket - ArrayBufferView - Int16Array with offset - Connection should be closed"); var data = ""; var datasize = 8; var view; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.binaryType = "arraybuffer"; data = new ArrayBuffer(datasize); view = new Int16Array(data, 2); @@ -22,20 +21,20 @@ } wsocket.send(view); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; var resultView = new Int16Array(evt.data); for (var i = 0; i < resultView.length; i++) { assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); } wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received") assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-int32.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-int32.any.js index be08fc5d..f4312e4 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-int32.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-int32.any.js
@@ -3,17 +3,16 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Send binary data on a WebSocket - ArrayBufferView - Int32Array - Connection should be opened"); -var testMessage = async_test("Send binary data on a WebSocket - ArrayBufferView - Int32Array - Message should be received"); -var testClose = async_test("Send binary data on a WebSocket - ArrayBufferView - Int32Array - Connection should be closed"); +var test = async_test("Send binary data on a WebSocket - ArrayBufferView - Int32Array - Connection should be closed"); var data = ""; var datasize = 8; var view; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.binaryType = "arraybuffer"; data = new ArrayBuffer(datasize); view = new Int32Array(data); @@ -22,20 +21,20 @@ } wsocket.send(view); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; var resultView = new Int32Array(evt.data); for (var i = 0; i < resultView.length; i++) { assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); } wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received") assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-int8.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-int8.any.js index 5ca9e64..f2374fb4 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-int8.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-int8.any.js
@@ -3,17 +3,16 @@ // META: variant=?wss // META: variant=?wpt_flags=h2 -var testOpen = async_test("Send binary data on a WebSocket - ArrayBufferView - Int8Array - Connection should be opened"); -var testMessage = async_test("Send binary data on a WebSocket - ArrayBufferView - Int8Array - Message should be received"); -var testClose = async_test("Send binary data on a WebSocket - ArrayBufferView - Int8Array - Connection should be closed"); +var test = async_test("Send binary data on a WebSocket - ArrayBufferView - Int8Array - Connection should be closed"); var data = ""; var datasize = 8; var int8View; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.binaryType = "arraybuffer"; data = new ArrayBuffer(datasize); int8View = new Int8Array(data); @@ -22,20 +21,20 @@ } wsocket.send(int8View); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; var resultView = new Int8Array(evt.data); for (var i = 0; i < resultView.length; i++) { assert_equals(resultView[i], int8View[i], "ArrayBufferView returned is the same"); } wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received") assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint16-offset-length.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint16-offset-length.any.js index dac79cb..f917a3a 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint16-offset-length.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint16-offset-length.any.js
@@ -3,17 +3,16 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Connection should be opened"); -var testMessage = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Message should be received"); -var testClose = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Connection should be closed"); +var test = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint16Array with offset and length - Connection should be closed"); var data = ""; var datasize = 8; var view; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.binaryType = "arraybuffer"; data = new ArrayBuffer(datasize); view = new Uint16Array(data, 2, 2); @@ -22,20 +21,20 @@ } wsocket.send(view); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; var resultView = new Uint16Array(evt.data); for (var i = 0; i < resultView.length; i++) { assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); } wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received") assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint32-offset.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint32-offset.any.js index 46de946..33758dc 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint32-offset.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint32-offset.any.js
@@ -3,17 +3,16 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Connection should be opened"); -var testMessage = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Message should be received"); -var testClose = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Connection should be closed"); +var test = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint32Array with offset - Connection should be closed"); var data = ""; var datasize = 8; var view; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.binaryType = "arraybuffer"; data = new ArrayBuffer(datasize); view = new Uint32Array(data, 0); @@ -22,20 +21,20 @@ } wsocket.send(view); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; var resultView = new Uint32Array(evt.data); for (var i = 0; i < resultView.length; i++) { assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); } wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received") assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint8-offset-length.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint8-offset-length.any.js index ec1a59a..1d256db 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint8-offset-length.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint8-offset-length.any.js
@@ -3,17 +3,16 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset and length - Connection should be opened"); -var testMessage = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset and length - Message should be received"); -var testClose = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset and length - Connection should be closed"); +var test = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset and length - Connection should be closed"); var data = ""; var datasize = 8; var view; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.binaryType = "arraybuffer"; data = new ArrayBuffer(datasize); view = new Uint8Array(data, 2, 4); @@ -22,20 +21,20 @@ } wsocket.send(view); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; var resultView = new Uint8Array(evt.data); for (var i = 0; i < resultView.length; i++) { assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); } wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received") assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.js index 7029080..43e9fe68 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-arraybufferview-uint8-offset.any.js
@@ -3,17 +3,16 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset - Connection should be opened"); -var testMessage = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset - Message should be received"); -var testClose = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset - Connection should be closed"); +var test = async_test("Send binary data on a WebSocket - ArrayBufferView - Uint8Array with offset - Connection should be closed"); var data = ""; var datasize = 8; var view; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.binaryType = "arraybuffer"; data = new ArrayBuffer(datasize); view = new Uint8Array(data, 2); @@ -22,20 +21,20 @@ } wsocket.send(view); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; var resultView = new Uint8Array(evt.data); for (var i = 0; i < resultView.length; i++) { assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same"); } wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received") assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-blob.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-blob.any.js index c5f9031..56c89a1 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-binary-blob.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-binary-blob.any.js
@@ -3,35 +3,34 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Send binary data on a WebSocket - Blob - Connection should be opened"); -var testMessage = async_test("Send binary data on a WebSocket - Blob - Message should be received"); -var testClose = async_test("Send binary data on a WebSocket - Blob - Connection should be closed"); +var test = async_test("Send binary data on a WebSocket - Blob - Connection should be closed"); var data = ""; var datasize = 65000; var isOpenCalled = false; +var isMessageCalled = false; var wsocket = CreateWebSocket(false, false); -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.binaryType = "blob"; for (var i = 0; i < datasize; i++) data += String.fromCharCode(0); data = new Blob([data]); isOpenCalled = true; wsocket.send(data); - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; assert_true(evt.data instanceof Blob); assert_equals(evt.data.size, datasize); wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received"); assert_true(evt.wasClean, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-data.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-data.any.js index 4d48f19..203ab54 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-data.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-data.any.js
@@ -3,29 +3,28 @@ // META: variant=?wss // META: variant=?wpt_flags=h2 -var testOpen = async_test("Send data on a WebSocket - Connection should be opened"); -var testMessage = async_test("Send data on a WebSocket - Message should be received"); -var testClose = async_test("Send data on a WebSocket - Connection should be closed"); +var test = async_test("Send data on a WebSocket - Connection should be closed"); var data = "Message to send"; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.send(data); assert_equals(data.length, wsocket.bufferedAmount); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; assert_equals(evt.data, data); wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { + assert_true(isMessageCalled, "message should be received"); assert_true(isOpenCalled, "WebSocket connection should be open"); assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-data.worker.js b/third_party/blink/web_tests/external/wpt/websockets/Send-data.worker.js index 8537255..b141fb38 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-data.worker.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-data.worker.js
@@ -17,9 +17,10 @@ wsocket.addEventListener('message', t.step_func_done(function(e) { assert_equals(e.data, data); - done(); }), true); + wsocket.addEventListener('close', t.unreached_func('the close event should not fire'), true); + }, "Send data on a WebSocket in a Worker") - +done();
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-null.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-null.any.js index 4a77a5f..a12eaf9 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-null.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-null.any.js
@@ -3,31 +3,30 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Send null data on a WebSocket - Connection should be opened"); -var testMessage = async_test("Send null data on a WebSocket - Message should be received"); -var testClose = async_test("Send null data on a WebSocket - Connection should be closed"); +var test = async_test("Send null data on a WebSocket - Connection should be closed"); var data = null; var nullReturned = false; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.send(data); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; if ("null" == evt.data || "" == evt.data) nullReturned = true; assert_true(nullReturned); wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received"); assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-paired-surrogates.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-paired-surrogates.any.js index 6d7ab08b..e2dc004 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-paired-surrogates.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-paired-surrogates.any.js
@@ -3,29 +3,28 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Send paired surrogates data on a WebSocket - Connection should be opened"); -var testMessage = async_test("Send paired surrogates data on a WebSocket - Message should be received"); -var testClose = async_test("Send paired surrogates data on a WebSocket - Connection should be closed"); +var test = async_test("Send paired surrogates data on a WebSocket - Connection should be closed"); var data = "\uD801\uDC07"; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.send(data); assert_equals(data.length * 2, wsocket.bufferedAmount); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; assert_equals(evt.data, data); wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received"); assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-unicode-data.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-unicode-data.any.js index 51bd15c5..f22094a 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-unicode-data.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-unicode-data.any.js
@@ -3,29 +3,28 @@ // META: variant=?wpt_flags=h2 // META: variant=?wss -var testOpen = async_test("Send unicode data on a WebSocket - Connection should be opened"); -var testMessage = async_test("Send unicode data on a WebSocket - Message should be received"); -var testClose = async_test("Send unicode data on a WebSocket - Connection should be closed"); +var test = async_test("Send unicode data on a WebSocket - Connection should be closed"); var data = "¥¥¥¥¥¥"; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.send(data); assert_equals(data.length * 2, wsocket.bufferedAmount); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; assert_equals(evt.data, data); wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received"); assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/Send-unpaired-surrogates.any.js b/third_party/blink/web_tests/external/wpt/websockets/Send-unpaired-surrogates.any.js index 8e06a467..1cb5d0a 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/Send-unpaired-surrogates.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/Send-unpaired-surrogates.any.js
@@ -3,29 +3,28 @@ // META: variant=?wss // META: variant=?wpt_flags=h2 -var testOpen = async_test("Send unpaired surrogates on a WebSocket - Connection should be opened"); -var testMessage = async_test("Send unpaired surrogates on a WebSocket - Message should be received"); -var testClose = async_test("Send unpaired surrogates on a WebSocket - Connection should be closed"); +var test = async_test("Send unpaired surrogates on a WebSocket - Connection should be closed"); var data = "\uD807"; var replacementChar = "\uFFFD"; var wsocket = CreateWebSocket(false, false); var isOpenCalled = false; +var isMessageCalled = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { wsocket.send(data); isOpenCalled = true; - testOpen.done(); }), true); -wsocket.addEventListener('message', testMessage.step_func(function(evt) { +wsocket.addEventListener('message', test.step_func(function(evt) { + isMessageCalled = true; assert_equals(evt.data, replacementChar); wsocket.close(); - testMessage.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { assert_true(isOpenCalled, "WebSocket connection should be open"); + assert_true(isMessageCalled, "message should be received"); assert_equals(evt.wasClean, true, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/binary/001.html b/third_party/blink/web_tests/external/wpt/websockets/binary/001.html index d20f5ad..21ffff4 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/binary/001.html +++ b/third_party/blink/web_tests/external/wpt/websockets/binary/001.html
@@ -22,6 +22,6 @@ assert_equals(e.data.size, datasize); t.done(); }) - + ws.onclose = t.unreached_func('close event should not fire'); }); </script>
diff --git a/third_party/blink/web_tests/external/wpt/websockets/binary/002.html b/third_party/blink/web_tests/external/wpt/websockets/binary/002.html index 6bad9e9..ffd1ee7a 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/binary/002.html +++ b/third_party/blink/web_tests/external/wpt/websockets/binary/002.html
@@ -23,6 +23,6 @@ assert_equals(e.data.size, datasize); t.done(); }); - + ws.onclose = t.unreached_func('close event should not fire'); }); </script>
diff --git a/third_party/blink/web_tests/external/wpt/websockets/binary/004.html b/third_party/blink/web_tests/external/wpt/websockets/binary/004.html index d679c5c..76bb902 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/binary/004.html +++ b/third_party/blink/web_tests/external/wpt/websockets/binary/004.html
@@ -22,6 +22,6 @@ assert_equals(e.data.byteLength, datasize); t.done(); }) - + ws.onclose = t.unreached_func('close event should not fire'); }); </script>
diff --git a/third_party/blink/web_tests/external/wpt/websockets/binary/005.html b/third_party/blink/web_tests/external/wpt/websockets/binary/005.html index e8c2b38..9b8b2c4e 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/binary/005.html +++ b/third_party/blink/web_tests/external/wpt/websockets/binary/005.html
@@ -21,5 +21,6 @@ assert_equals(e.data.byteLength, datasize); t.done(); }); + ws.onclose = t.unreached_func('close event should not fire'); }); </script>
diff --git a/third_party/blink/web_tests/external/wpt/websockets/binaryType-wrong-value.any.js b/third_party/blink/web_tests/external/wpt/websockets/binaryType-wrong-value.any.js index 9b382e8..007510d0 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/binaryType-wrong-value.any.js +++ b/third_party/blink/web_tests/external/wpt/websockets/binaryType-wrong-value.any.js
@@ -3,20 +3,21 @@ // META: variant=?wss // META: variant=?wpt_flags=h2 -var testOpen = async_test("Create WebSocket - set binaryType to something other than blob or arraybuffer - SYNTAX_ERR is returned - Connection should be opened"); -var testClose = async_test("Create WebSocket - set binaryType to something other than blob or arraybuffer - SYNTAX_ERR is returned - Connection should be closed"); +var test = async_test("Create WebSocket - set binaryType to something other than blob or arraybuffer - SYNTAX_ERR is returned - Connection should be closed"); -var wsocket = CreateWebSocket(false, false); +let wsocket = CreateWebSocket(false, false); +let opened = false; -wsocket.addEventListener('open', testOpen.step_func(function(evt) { +wsocket.addEventListener('open', test.step_func(function(evt) { + opened = true; assert_equals(wsocket.binaryType, "blob"); wsocket.binaryType = "notBlobOrArrayBuffer"; assert_equals(wsocket.binaryType, "blob"); wsocket.close(); - testOpen.done(); }), true); -wsocket.addEventListener('close', testClose.step_func(function(evt) { +wsocket.addEventListener('close', test.step_func(function(evt) { + assert_true(opened, "connection should be opened"); assert_true(evt.wasClean, "wasClean should be true"); - testClose.done(); + test.done(); }), true);
diff --git a/third_party/blink/web_tests/external/wpt/websockets/extended-payload-length.html b/third_party/blink/web_tests/external/wpt/websockets/extended-payload-length.html index 62b5f923..23caedc4 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/extended-payload-length.html +++ b/third_party/blink/web_tests/external/wpt/websockets/extended-payload-length.html
@@ -21,6 +21,7 @@ assert_equals(e.data, data); t.done(); }); + ws.onclose = t.unreached_func('close event should not fire'); }, "Application data is 125 byte which means any 'Extended payload length' field isn't used at all."); async_test(function(t){ @@ -35,6 +36,7 @@ assert_equals(e.data, data); t.done(); }); + ws.onclose = t.unreached_func('close event should not fire'); }, "Application data is 126 byte which starts to use the 16 bit 'Extended payload length' field."); async_test(function(t){ @@ -49,6 +51,7 @@ assert_equals(e.data, data); t.done(); }); + ws.onclose = t.unreached_func('close event should not fire'); }, "Application data is 0xFFFF byte which means the upper bound of the 16 bit 'Extended payload length' field."); async_test(function(t){ @@ -63,6 +66,7 @@ assert_equals(e.data, data); t.done(); }); + ws.onclose = t.unreached_func('close event should not fire'); }, "Application data is (0xFFFF + 1) byte which starts to use the 64 bit 'Extended payload length' field"); </script>
diff --git a/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-arraybuffer.html b/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-arraybuffer.html index 240660e..258eaa78 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-arraybuffer.html +++ b/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-arraybuffer.html
@@ -22,5 +22,6 @@ assert_equals(e.data.byteLength, datasize); t.done(); }) + ws.onclose = t.unreached_func('close event should not fire'); }); </script>
diff --git a/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-blob.html b/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-blob.html index 4ed0d98..ac5140de 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-blob.html +++ b/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-blob.html
@@ -23,5 +23,6 @@ assert_equals(e.data.size, datasize); t.done(); }); + ws.onclose = t.unreached_func('close event should not fire'); }); </script>
diff --git a/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-large.html b/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-large.html index caf3368c..e599614 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-large.html +++ b/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-large.html
@@ -24,5 +24,6 @@ assert_equals(e.data, data); t.done(); }) + ws.onclose = t.unreached_func('close event should not fire'); }); </script>
diff --git a/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-unicode.html b/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-unicode.html index de08a73..ba25caeb 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-unicode.html +++ b/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/bufferedAmount/bufferedAmount-unicode.html
@@ -20,5 +20,6 @@ assert_equals(e.data, data); t.done(); }); + ws.onclose = t.unreached_func('close event should not fire'); }); </script>
diff --git a/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/events/018.html b/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/events/018.html index 7b909cd..3dc36d0c 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/events/018.html +++ b/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/events/018.html
@@ -14,7 +14,11 @@ }); async_test(function(t) { - ws.addEventListener('open', t.step_func_done(function(e) { + let openFired = false; + let messageFired = false; + let errorFired = false; + ws.addEventListener('open', t.step_func(function(e) { + openFired = true; // first a text frame, then a frame with reserved opcode 3 // which should fail the connection @@ -24,29 +28,25 @@ assert_equals(e.bubbles, false, 'open e.bubbles'); assert_equals(e.cancelable, false, 'open e.cancelable'); }), false); -}, "open event"); - -async_test(function(t) { - ws.addEventListener('message', t.step_func_done(function(e) { + ws.addEventListener('message', t.step_func(function(e) { + messageFired = true; assert_equals(e.toString(), '[object MessageEvent]', "message e.toString()"); assert_equals(e.bubbles, false, 'message e.bubbles'); assert_equals(e.cancelable, false, 'message e.cancelable'); }), false); -}, "message event"); - -async_test(function(t) { - ws.addEventListener('error', t.step_func_done(function(e) { + ws.addEventListener('error', t.step_func(function(e) { + errorFired = true; assert_equals(e.toString(), '[object Event]', "error e.toString()"); assert_equals(e.bubbles, false, 'error e.bubbles'); assert_equals(e.cancelable, false, 'error e.cancelable'); }), false); -}, "error event"); - -async_test(function(t) { ws.addEventListener('close', t.step_func_done(function(e) { + assert_true(openFired, 'open event should fire'); + assert_true(messageFired, 'message event should fire'); + assert_true(errorFired, 'error event should fire'); assert_equals(e.toString(), '[object CloseEvent]', "close e.toString()"); assert_equals(e.bubbles, false, 'close e.bubbles'); assert_equals(e.cancelable, false, 'close e.cancelable'); }), false); -}, "close event"); +}, "open, message, error and close events"); </script>
diff --git a/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/send/006.html b/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/send/006.html index ec008e9..a7c00b15 100644 --- a/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/send/006.html +++ b/third_party/blink/web_tests/external/wpt/websockets/interfaces/WebSocket/send/006.html
@@ -22,5 +22,7 @@ }); ws.close(); }) + // This will be overridden if the message event fires. + ws.onclose = t.unreached_func('close event should not fire before message event'); }); </script>
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-app-version-issues-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-app-version-issues-expected.txt new file mode 100644 index 0000000..418b8649 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-app-version-issues-expected.txt
@@ -0,0 +1,22 @@ +Test to make sure navigator.userAgent usage is correctly reported. +{ + method : Audits.issueAdded + params : { + issue : { + code : NavigatorUserAgentIssue + details : { + navigatorUserAgentIssueDetails : { + location : { + columnNumber : 29 + lineNumber : 1 + scriptId : <string> + url : + } + url : http://127.0.0.1:8000/inspector-protocol/resources/inspector-protocol-page.html + } + } + } + } + sessionId : <string> +} +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-app-version-issues.js b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-app-version-issues.js new file mode 100644 index 0000000..f91fcb8 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-app-version-issues.js
@@ -0,0 +1,15 @@ +(async function(testRunner) { + const {page, session, dp} = await testRunner.startBlank( + `Test to make sure navigator.userAgent usage is correctly reported.`); + + await dp.Audits.enable(); + + const result = session.evaluate(` + console.log(navigator.appVersion); + `); + + const issue = await dp.Audits.onceIssueAdded(); + + testRunner.log(issue); + testRunner.completeTest(); +})
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-platform-issues-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-platform-issues-expected.txt new file mode 100644 index 0000000..418b8649 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-platform-issues-expected.txt
@@ -0,0 +1,22 @@ +Test to make sure navigator.userAgent usage is correctly reported. +{ + method : Audits.issueAdded + params : { + issue : { + code : NavigatorUserAgentIssue + details : { + navigatorUserAgentIssueDetails : { + location : { + columnNumber : 29 + lineNumber : 1 + scriptId : <string> + url : + } + url : http://127.0.0.1:8000/inspector-protocol/resources/inspector-protocol-page.html + } + } + } + } + sessionId : <string> +} +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-platform-issues.js b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-platform-issues.js new file mode 100644 index 0000000..0dbaccac --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-platform-issues.js
@@ -0,0 +1,15 @@ +(async function(testRunner) { + const {page, session, dp} = await testRunner.startBlank( + `Test to make sure navigator.userAgent usage is correctly reported.`); + + await dp.Audits.enable(); + + const result = session.evaluate(` + console.log(navigator.platform); + `); + + const issue = await dp.Audits.onceIssueAdded(); + + testRunner.log(issue); + testRunner.completeTest(); +})
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-user-agent-issues-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-user-agent-issues-expected.txt new file mode 100644 index 0000000..418b8649 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-user-agent-issues-expected.txt
@@ -0,0 +1,22 @@ +Test to make sure navigator.userAgent usage is correctly reported. +{ + method : Audits.issueAdded + params : { + issue : { + code : NavigatorUserAgentIssue + details : { + navigatorUserAgentIssueDetails : { + location : { + columnNumber : 29 + lineNumber : 1 + scriptId : <string> + url : + } + url : http://127.0.0.1:8000/inspector-protocol/resources/inspector-protocol-page.html + } + } + } + } + sessionId : <string> +} +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-user-agent-issues.js b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-user-agent-issues.js new file mode 100644 index 0000000..50f1dba6 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/issues/navigator-user-agent-issues.js
@@ -0,0 +1,15 @@ +(async function(testRunner) { + const {page, session, dp} = await testRunner.startBlank( + `Test to make sure navigator.userAgent usage is correctly reported.`); + + await dp.Audits.enable(); + + const result = session.evaluate(` + console.log(navigator.userAgent); + `); + + const issue = await dp.Audits.onceIssueAdded(); + + testRunner.log(issue); + testRunner.completeTest(); +})
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/network/request-will-be-sent-extra-info-client-security-state-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/network/request-will-be-sent-extra-info-client-security-state-expected.txt index bec1974..74b74094 100644 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/network/request-will-be-sent-extra-info-client-security-state-expected.txt +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/network/request-will-be-sent-extra-info-client-security-state-expected.txt
@@ -3,6 +3,6 @@ { initiatorIPAddressSpace : Local initiatorIsSecureContext : true - privateNetworkRequestPolicy : BlockFromInsecureToMorePrivate + privateNetworkRequestPolicy : WarnFromInsecureToMorePrivate }
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/network/request-will-be-sent-extra-info-client-security-state-multiclient-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/network/request-will-be-sent-extra-info-client-security-state-multiclient-expected.txt index ee26d281..2a063ca 100644 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/network/request-will-be-sent-extra-info-client-security-state-multiclient-expected.txt +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/network/request-will-be-sent-extra-info-client-security-state-multiclient-expected.txt
@@ -3,11 +3,11 @@ { initiatorIPAddressSpace : Local initiatorIsSecureContext : true - privateNetworkRequestPolicy : BlockFromInsecureToMorePrivate + privateNetworkRequestPolicy : WarnFromInsecureToMorePrivate } { initiatorIPAddressSpace : Local initiatorIsSecureContext : true - privateNetworkRequestPolicy : BlockFromInsecureToMorePrivate + privateNetworkRequestPolicy : WarnFromInsecureToMorePrivate }
diff --git a/third_party/blink/web_tests/platform/linux/fast/table/backgr_layers-hide-collapsed-border-expected.png b/third_party/blink/web_tests/platform/linux/fast/table/backgr_layers-hide-collapsed-border-expected.png index e095d277..7bca9869 100644 --- a/third_party/blink/web_tests/platform/linux/fast/table/backgr_layers-hide-collapsed-border-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/table/backgr_layers-hide-collapsed-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png b/third_party/blink/web_tests/platform/linux/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png index e095d277..7bca9869 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac-arm11.0/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png b/third_party/blink/web_tests/platform/mac-mac-arm11.0/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png new file mode 100644 index 0000000..5827ee4 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac-mac-arm11.0/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/fast/table/backgr_layers-hide-collapsed-border-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/fast/table/backgr_layers-hide-collapsed-border-expected.png index 0c8e3eb..e6fca27b 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/fast/table/backgr_layers-hide-collapsed-border-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/fast/table/backgr_layers-hide-collapsed-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png index 0c8e3eb..e6fca27b 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.14/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.14/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png b/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png deleted file mode 100644 index 98b375f..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.15/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/table/backgr_layers-hide-collapsed-border-expected.png b/third_party/blink/web_tests/platform/mac/fast/table/backgr_layers-hide-collapsed-border-expected.png index 98b375f..5c021ec8 100644 --- a/third_party/blink/web_tests/platform/mac/fast/table/backgr_layers-hide-collapsed-border-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/table/backgr_layers-hide-collapsed-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/table/backgr_layers-hide-collapsed-border-expected.png b/third_party/blink/web_tests/platform/win/fast/table/backgr_layers-hide-collapsed-border-expected.png index 4771987..9445f1d 100644 --- a/third_party/blink/web_tests/platform/win/fast/table/backgr_layers-hide-collapsed-border-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/table/backgr_layers-hide-collapsed-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/fast/table/backgr_layers-hide-collapsed-border-expected.png b/third_party/blink/web_tests/platform/win7/fast/table/backgr_layers-hide-collapsed-border-expected.png index f1b5678..13f1757 100644 --- a/third_party/blink/web_tests/platform/win7/fast/table/backgr_layers-hide-collapsed-border-expected.png +++ b/third_party/blink/web_tests/platform/win7/fast/table/backgr_layers-hide-collapsed-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png b/third_party/blink/web_tests/platform/win7/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png index f1b5678..13f1757 100644 --- a/third_party/blink/web_tests/platform/win7/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png +++ b/third_party/blink/web_tests/platform/win7/virtual/layout_ng_fragment_traversal/fast/table/backgr_layers-hide-collapsed-border-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/css-content-visibility/accessibility/content-visibility-accessibility-001.html b/third_party/blink/web_tests/wpt_internal/display-lock/css-content-visibility/accessibility/content-visibility-accessibility-001.html index b8b0eec1..ae758a5 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/css-content-visibility/accessibility/content-visibility-accessibility-001.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/css-content-visibility/accessibility/content-visibility-accessibility-001.html
@@ -16,7 +16,7 @@ </style> <div id=spacer style="height: 3000px"></div> <div id="container"> - <div id="target" class=auto aria-labelledby="target_label"> + <div role="group" id="target" class=auto aria-labelledby="target_label"> target <div id="child"> child
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/css-content-visibility/accessibility/content-visibility-accessibility-002.html b/third_party/blink/web_tests/wpt_internal/display-lock/css-content-visibility/accessibility/content-visibility-accessibility-002.html index 9c9eb93..3618244 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/css-content-visibility/accessibility/content-visibility-accessibility-002.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/css-content-visibility/accessibility/content-visibility-accessibility-002.html
@@ -15,7 +15,7 @@ } </style> <div id="container"> - <div id="target" class=hidden aria-labelledby="target_label"> + <div role="group" id="target" class=hidden aria-labelledby="target_label"> target <div id="child"> child
diff --git a/third_party/blink/web_tests/wpt_internal/display-lock/css-content-visibility/accessibility/content-visibility-accessibility-008.html b/third_party/blink/web_tests/wpt_internal/display-lock/css-content-visibility/accessibility/content-visibility-accessibility-008.html index 2cd76f4..d13fd79 100644 --- a/third_party/blink/web_tests/wpt_internal/display-lock/css-content-visibility/accessibility/content-visibility-accessibility-008.html +++ b/third_party/blink/web_tests/wpt_internal/display-lock/css-content-visibility/accessibility/content-visibility-accessibility-008.html
@@ -15,7 +15,7 @@ } </style> <div id="container"> - <div id="target" aria-labelledby="target_label"> + <div role="group" id="target" aria-labelledby="target_label"> target <div id="child"> child
diff --git a/third_party/closure_compiler/externs/automation.js b/third_party/closure_compiler/externs/automation.js index f3e3f6e..e0e9cd04 100644 --- a/third_party/closure_compiler/externs/automation.js +++ b/third_party/closure_compiler/externs/automation.js
@@ -1531,13 +1531,6 @@ chrome.automation.AutomationNode.prototype.textSelEnd; /** - * The input type, like email or number. - * @type {(string|undefined)} - * @see https://developer.chrome.com/extensions/automation#type-textInputType - */ -chrome.automation.AutomationNode.prototype.textInputType; - -/** * An array of Marker objects for this node. * @type {(!Array<!chrome.automation.Marker>|undefined)} * @see https://developer.chrome.com/extensions/automation#type-markers
diff --git a/third_party/freetype/README.chromium b/third_party/freetype/README.chromium index 799af2f..d3aa929 100644 --- a/third_party/freetype/README.chromium +++ b/third_party/freetype/README.chromium
@@ -1,7 +1,7 @@ Name: FreeType URL: http://www.freetype.org/ -Version: VER-2-10-4-249-g1bc801b0d -Revision: 1bc801b0d6ae70683c0a7952e949d2b3edff76e2 +Version: VER-2-10-4-251 +Revision: 06e21ffedfac81edfa79137959141a9d78b6f858 CPEPrefix: cpe:/a:freetype:freetype:2.10.4 License: Custom license "inspired by the BSD, Artistic, and IJG (Independent JPEG Group) licenses"
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index a3b51fd..04649c6 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -7418,8 +7418,6 @@ label="CPMD_BAD_ORIGIN_SHOW_MANUAL_PASSWORD_GENERATION_POPUP"/> <int value="12" label="CPMD_BAD_ORIGIN_SHOW_PASSWORD_EDITING_POPUP"/> <int value="13" label="CPMD_BAD_ORIGIN_GENERATION_AVAILABLE_FOR_FORM"/> - <int value="14" label="CPMD_BAD_ORIGIN_PASSWORD_FORM_CLEARED"/> - <int value="15" label="CPMD_BAD_ORIGIN_CHECK_SAFE_BROWSING_REPUTATION"/> </enum> <enum name="BadSyncDataReason"> @@ -20926,6 +20924,7 @@ <int value="16" label="DEEP_SCANNED_OPENED_DANGEROUS"/> <int value="17" label="PROMPT_FOR_SCANNING"/> <int value="18" label="BLOCKED_UNSUPPORTED_FILETYPE"/> + <int value="19" label="DANGEROUS_ACCOUNT_COMPROMISE"/> </enum> <enum name="DownloadLaterDialogChoice"> @@ -43738,6 +43737,11 @@ <int value="20" label="kOtherReason"/> </enum> +<enum name="LinkGenerationCopiedLinkType"> + <int value="0" label="Copied from new right-click menu generation"/> + <int value="1" label="Copied from existing highlight right-click menu"/> +</enum> + <enum name="LinkGenerationError"> <int value="0" label="Incorrect selector"/> <int value="1" label="No range available"/> @@ -45060,6 +45064,7 @@ <int value="-1684773837" label="TabEngagementReportingAndroid:disabled"/> <int value="-1684123448" label="disable-best-effort-tasks"/> <int value="-1682843294" label="DataReductionProxyDecidesTransform:enabled"/> + <int value="-1679849626" label="AuraWindowSubtreeCapture:disabled"/> <int value="-1679829698" label="ColorProviderRedirection:disabled"/> <int value="-1679624666" label="NtpRealbox:enabled"/> <int value="-1677715989" label="UnifiedConsent:disabled"/> @@ -46405,6 +46410,7 @@ <int value="-560114351" label="OfflinePagesRenovations:disabled"/> <int value="-558471324" label="PreviewsCoinFlipHoldback_UKMOnly:disabled"/> <int value="-557742250" label="ContentSuggestionsCategories:disabled"/> + <int value="-556662059" label="AuraWindowSubtreeCapture:enabled"/> <int value="-556218705" label="SlowDCTimerInterruptsWin:enabled"/> <int value="-555341956" label="AutofillSaveAndFillVPA:enabled"/> <int value="-548082154" label="protect-sync-credential:disabled"/> @@ -47221,6 +47227,7 @@ <int value="176773784" label="EnableHardwareMirrorMode:disabled"/> <int value="178337215" label="enable-md-history"/> <int value="178693406" label="LockScreenMediaControls:disabled"/> + <int value="179687667" label="PwaUpdateDialogForNameAndIcon:enabled"/> <int value="179871410" label="ui-debug-tools:disabled"/> <int value="180074362" label="memory-pressure-thresholds"/> <int value="181150000" label="CrosVmCupsProxy:enabled"/> @@ -47702,6 +47709,7 @@ <int value="603988014" label="NetworkService:enabled"/> <int value="604334859" label="Prerender2:enabled"/> <int value="605150752" label="WebUSB:disabled"/> + <int value="605672144" label="PwaUpdateDialogForNameAndIcon:disabled"/> <int value="606288133" label="enable-print-preview-register-promos"/> <int value="606512202" label="AutofillCreditCardPopupLayout:enabled"/> <int value="606611135" label="ContextMenuTranslateWithGoogleLens:disabled"/> @@ -57141,6 +57149,15 @@ <int value="0" label="0x00000000 - STATUS_SUCCESS"/> </enum> +<enum name="NukeProfileResult"> + <int value="0" label="Success (1st attempt)"/> + <int value="1" label="Success (2nd attempt)"/> + <int value="2" label="Success (3rd attempt)"/> + <int value="10" label="Failure (1st attempt)"/> + <int value="11" label="Failure (2nd attempt)"/> + <int value="12" label="Failure (3rd attempt)"/> +</enum> + <enum name="NullableBoolean"> <summary> A Nullable Boolean can True, False or Null (ie: unset or absent). @@ -70627,6 +70644,7 @@ <int value="4" label="Native was not initialized"/> <int value="5" label="Already extracting"/> <int value="6" label="WebContents had non-SRP URL"/> + <int value="7" label="Not enough results"/> </enum> <enum name="SearchTemplateURLEvent"> @@ -70741,6 +70759,11 @@ <int value="1" label="Accepted"/> </enum> +<enum name="SecurityAnomaly"> + <int value="0" + label="Writable+executable mount found in the init mount namespace."/> +</enum> + <enum name="SecurityFilteredTouchResult"> <int value="0" label="Touch event was handled by security sensitive dialog"/> <int value="1"
diff --git a/tools/metrics/histograms/histograms_xml/chromeos/histograms.xml b/tools/metrics/histograms/histograms_xml/chromeos/histograms.xml index 8c07aae7..9886f198 100644 --- a/tools/metrics/histograms/histograms_xml/chromeos/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/chromeos/histograms.xml
@@ -970,6 +970,19 @@ </summary> </histogram> +<histogram name="ChromeOS.SecurityAnomaly" enum="SecurityAnomaly" + expires_after="M98"> + <owner>jorgelo@chromium.org</owner> + <owner>chromeos-security-core@google.com</owner> + <summary> + Records when an event representing a deviation from the Chrome OS security + posture happens. + + Writable+executable mount events are checked every thirty seconds, but each + anomalous event is reported only once per boot. + </summary> +</histogram> + <histogram name="ChromeOS.Settings.Accessibility.FullscreenMagnifierFocusFollowing" enum="BooleanToggled" expires_after="2021-10-29">
diff --git a/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml b/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml index 21133381..be057d5 100644 --- a/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml +++ b/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml
@@ -5713,6 +5713,8 @@ <affected-histogram name="Download.DownloadDangerPrompt.BlockedTooLarge"/> <affected-histogram name="Download.DownloadDangerPrompt.BlockedUnsupportedFiletype"/> + <affected-histogram + name="Download.DownloadDangerPrompt.DangerousAccountCompromise"/> <affected-histogram name="Download.DownloadDangerPrompt.DangerousContent"/> <affected-histogram name="Download.DownloadDangerPrompt.DangerousFile"/> <affected-histogram name="Download.DownloadDangerPrompt.DangerousHost"/> @@ -5736,6 +5738,8 @@ <suffix name="BlockedTooLarge" label="File marked BLOCKED_TOO_LARGE"/> <suffix name="BlockedUnsupportedFiletype" label="File marked BLOCKED_UNSUPPORTED_FILETYPE"/> + <suffix name="DangerousAccountCompromise" + label="File marked DANGEROUS_ACCOUNT_COMPROMISE"/> <suffix name="DangerousContent" label="File marked DANGEROUS_CONTENT"/> <suffix name="DangerousFile" label="File marked DANGEROUS_FILE"/> <suffix name="DangerousHost" label="File marked DANGEROUS_HOST"/>
diff --git a/tools/metrics/histograms/histograms_xml/others/histograms.xml b/tools/metrics/histograms/histograms_xml/others/histograms.xml index 3d07e77..d13f132c 100644 --- a/tools/metrics/histograms/histograms_xml/others/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/others/histograms.xml
@@ -14213,6 +14213,15 @@ </summary> </histogram> +<histogram name="SharedHighlights.Desktop.CopiedLinkType" + enum="LinkGenerationCopiedLinkType" expires_after="2021-11-12"> + <owner>sebsg@chromium.org</owner> + <owner>chrome-shared-highlighting@google.com</owner> + <summary> + Records the type of shared highlighting link the user copied on desktop. + </summary> +</histogram> + <histogram name="SharedHighlights.LinkGenerated.Error" enum="LinkGenerationError" expires_after="2021-12-31"> <owner>gayane@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/profile/histograms.xml b/tools/metrics/histograms/histograms_xml/profile/histograms.xml index 0a0ef72..4a202d4 100644 --- a/tools/metrics/histograms/histograms_xml/profile/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/profile/histograms.xml
@@ -375,6 +375,20 @@ </summary> </histogram> +<histogram name="Profile.NukeFromDisk.Result" enum="NukeProfileResult" + expires_after="2021-08-29"> + <owner>nicolaso@chromium.org</owner> + <owner>cbe-eng@google.com</owner> + <summary> + Recorded when a profile directory gets deleted from disk, e.g. because it + was an ephemeral profile, or the user requested its destruction. Indicates + whether the operation succeeded or failed. + + If the operation fails, it may be retried (up to 3 times). Each try is + tracked as a separate enum value. + </summary> +</histogram> + <histogram name="Profile.NumberOfAccountsPerProfile" units="units" expires_after="2021-10-25"> <owner>msarda@chromium.org</owner>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 6edea65..62bf38ba 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -2,7 +2,7 @@ "trace_processor_shell": { "win": { "hash": "1a68e36202f77491d3c0993d3abd36004f3a0eac", - "remote_path": "perfetto_binaries/trace_processor_shell/win/7d6375fd3e2f91b5880195a9c02de2334a3fa0d4/trace_processor_shell.exe" + "remote_path": "perfetto_binaries/trace_processor_shell/win/3baa021c258ba7670ab363a7ef73b3fd24fee97a/trace_processor_shell.exe" }, "mac": { "hash": "d60c6038003ec1b551e16068d49f4d55ee20656f", @@ -10,7 +10,7 @@ }, "linux": { "hash": "dd23313e9aabc34dcaed1743f3bb1938be1c63b2", - "remote_path": "perfetto_binaries/trace_processor_shell/linux/7d6375fd3e2f91b5880195a9c02de2334a3fa0d4/trace_processor_shell" + "remote_path": "perfetto_binaries/trace_processor_shell/linux/3baa021c258ba7670ab363a7ef73b3fd24fee97a/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/ui/base/clipboard/BUILD.gn b/ui/base/clipboard/BUILD.gn index 86e7a85d..42d2fb4 100644 --- a/ui/base/clipboard/BUILD.gn +++ b/ui/base/clipboard/BUILD.gn
@@ -211,6 +211,7 @@ "//build:chromecast_buildflags", "//build:chromeos_buildflags", "//ui/base:features", + "//ui/gfx", ] if (is_android) {
diff --git a/ui/base/clipboard/clipboard_data.cc b/ui/base/clipboard/clipboard_data.cc index 0f93ad74..0bc1e93e 100644 --- a/ui/base/clipboard/clipboard_data.cc +++ b/ui/base/clipboard/clipboard_data.cc
@@ -10,6 +10,7 @@ #include "base/notreached.h" #include "skia/ext/skia_utils_base.h" #include "ui/base/data_transfer_policy/data_transfer_endpoint.h" +#include "ui/gfx/codec/png_codec.h" #include "ui/gfx/skia_util.h" namespace ui { @@ -22,7 +23,7 @@ markup_data_ = other.markup_data_; url_ = other.url_; rtf_data_ = other.rtf_data_; - bitmap_ = other.bitmap(); + png_ = other.png_; bookmark_title_ = other.bookmark_title_; bookmark_url_ = other.bookmark_url_; custom_data_format_ = other.custom_data_format_; @@ -48,7 +49,7 @@ custom_data_data_ == that.custom_data_data() && web_smart_paste_ == that.web_smart_paste() && svg_data_ == that.svg_data() && filenames_ == that.filenames() && - gfx::BitmapsAreEqual(bitmap_, that.bitmap()) && + png_ == that.png() && (src_.get() ? (that.source() && *src_.get() == *that.source()) : !that.source()); } @@ -57,10 +58,22 @@ return !(*this == that); } +void ClipboardData::SetPngData(std::vector<uint8_t> png) { + png_ = std::move(png); + format_ |= static_cast<int>(ClipboardInternalFormat::kPng); +} + +SkBitmap ClipboardData::bitmap() const { + SkBitmap bitmap; + gfx::PNGCodec::Decode(png_.data(), png_.size(), &bitmap); + return bitmap; +} + void ClipboardData::SetBitmapData(const SkBitmap& bitmap) { DCHECK_EQ(bitmap.colorType(), kN32_SkColorType); - bitmap_ = bitmap; - format_ |= static_cast<int>(ClipboardInternalFormat::kBitmap); + gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, /*discard_transparency=*/false, + &png_); + format_ |= static_cast<int>(ClipboardInternalFormat::kPng); } void ClipboardData::SetCustomData(const std::string& data_format,
diff --git a/ui/base/clipboard/clipboard_data.h b/ui/base/clipboard/clipboard_data.h index 5f7fef4..3f4a550 100644 --- a/ui/base/clipboard/clipboard_data.h +++ b/ui/base/clipboard/clipboard_data.h
@@ -24,7 +24,7 @@ kSvg = 1 << 2, kRtf = 1 << 3, kBookmark = 1 << 4, - kBitmap = 1 << 5, + kPng = 1 << 5, kCustom = 1 << 6, kWeb = 1 << 7, kFilenames = 1 << 8, @@ -88,7 +88,12 @@ format_ |= static_cast<int>(ClipboardInternalFormat::kBookmark); } - const SkBitmap& bitmap() const { return bitmap_; } + const std::vector<uint8_t>& png() const { return png_; } + void SetPngData(std::vector<uint8_t> png); + + // Bitmaps are stored as encoded bytes in the `png_` member. This means we + // cannot return a const reference, since the bitmap is created on request. + SkBitmap bitmap() const; void SetBitmapData(const SkBitmap& bitmap); const std::string& custom_data_format() const { return custom_data_format_; } @@ -130,8 +135,8 @@ std::string bookmark_title_; std::string bookmark_url_; - // Bitmap images. - SkBitmap bitmap_; + // PNG image data. Bitmaps are encoded into and decoded from this member. + std::vector<uint8_t> png_; // Data with custom format. std::string custom_data_format_;
diff --git a/ui/base/clipboard/clipboard_data_unittest.cc b/ui/base/clipboard/clipboard_data_unittest.cc index 627793f..35baa44 100644 --- a/ui/base/clipboard/clipboard_data_unittest.cc +++ b/ui/base/clipboard/clipboard_data_unittest.cc
@@ -9,13 +9,14 @@ #include "base/strings/string_piece_forward.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/data_transfer_policy/data_transfer_endpoint.h" +#include "ui/gfx/skia_util.h" #include "url/gurl.h" namespace ui { // Tests that two ClipboardData objects won't be equal if they don't have the // same bitmap. -TEST(ClipboardDataTest, BitMapTest) { +TEST(ClipboardDataTest, BitmapTest) { ClipboardData data1; SkBitmap test_bitmap; test_bitmap.allocN32Pixels(3, 2); @@ -43,4 +44,15 @@ EXPECT_EQ(data1, data2); } +// Tests that encoding/decoding bitmaps as PNG bytes works as intended. +TEST(ClipboardDataTest, BitmapAsBytesTest) { + ClipboardData data1; + SkBitmap test_bitmap; + test_bitmap.allocN32Pixels(3, 2); + test_bitmap.eraseARGB(255, 0, 255, 0); + EXPECT_FALSE(gfx::BitmapsAreEqual(data1.bitmap(), test_bitmap)); + data1.SetBitmapData(test_bitmap); + EXPECT_TRUE(gfx::BitmapsAreEqual(data1.bitmap(), test_bitmap)); +} + } // namespace ui \ No newline at end of file
diff --git a/ui/base/clipboard/clipboard_format_type.h b/ui/base/clipboard/clipboard_format_type.h index 210343f..0345196 100644 --- a/ui/base/clipboard/clipboard_format_type.h +++ b/ui/base/clipboard/clipboard_format_type.h
@@ -62,6 +62,8 @@ static const ClipboardFormatType& GetHtmlType(); static const ClipboardFormatType& GetSvgType(); static const ClipboardFormatType& GetRtfType(); + static const ClipboardFormatType& GetPngType(); + // TODO(crbug.com/1201018): Remove this type. static const ClipboardFormatType& GetBitmapType(); static const ClipboardFormatType& GetWebCustomDataType(); @@ -83,9 +85,6 @@ static const ClipboardFormatType& GetFilenameType(); static const ClipboardFormatType& GetIDListType(); static const ClipboardFormatType& GetMozUrlType(); - - // Specific image types that handle transparency on Windows. - static const ClipboardFormatType& GetPNGType(); #endif // ClipboardFormatType can be used in a set on some platforms.
diff --git a/ui/base/clipboard/clipboard_format_type_android.cc b/ui/base/clipboard/clipboard_format_type_android.cc index 2e1b66e..ded6f0c 100644 --- a/ui/base/clipboard/clipboard_format_type_android.cc +++ b/ui/base/clipboard/clipboard_format_type_android.cc
@@ -90,12 +90,17 @@ } // static -const ClipboardFormatType& ClipboardFormatType::GetBitmapType() { +const ClipboardFormatType& ClipboardFormatType::GetPngType() { static base::NoDestructor<ClipboardFormatType> type(kMimeTypePNG); return *type; } // static +const ClipboardFormatType& ClipboardFormatType::GetBitmapType() { + return ClipboardFormatType::GetPngType(); +} + +// static const ClipboardFormatType& ClipboardFormatType::GetWebCustomDataType() { static base::NoDestructor<ClipboardFormatType> type(kMimeTypeWebCustomData); return *type;
diff --git a/ui/base/clipboard/clipboard_format_type_aura.cc b/ui/base/clipboard/clipboard_format_type_aura.cc index 0e18234..a47fd9ae 100644 --- a/ui/base/clipboard/clipboard_format_type_aura.cc +++ b/ui/base/clipboard/clipboard_format_type_aura.cc
@@ -86,12 +86,17 @@ } // static -const ClipboardFormatType& ClipboardFormatType::GetBitmapType() { +const ClipboardFormatType& ClipboardFormatType::GetPngType() { static base::NoDestructor<ClipboardFormatType> type(kMimeTypePNG); return *type; } // static +const ClipboardFormatType& ClipboardFormatType::GetBitmapType() { + return ClipboardFormatType::GetPngType(); +} + +// static const ClipboardFormatType& ClipboardFormatType::GetWebKitSmartPasteType() { static base::NoDestructor<ClipboardFormatType> type( kMimeTypeWebkitSmartPaste);
diff --git a/ui/base/clipboard/clipboard_format_type_mac.mm b/ui/base/clipboard/clipboard_format_type_mac.mm index c87c9bc..719582aa 100644 --- a/ui/base/clipboard/clipboard_format_type_mac.mm +++ b/ui/base/clipboard/clipboard_format_type_mac.mm
@@ -99,6 +99,12 @@ } // static +const ClipboardFormatType& ClipboardFormatType::GetPngType() { + static base::NoDestructor<ClipboardFormatType> type(NSPasteboardTypePNG); + return *type; +} + +// static const ClipboardFormatType& ClipboardFormatType::GetBitmapType() { static base::NoDestructor<ClipboardFormatType> type(NSTIFFPboardType); return *type;
diff --git a/ui/base/clipboard/clipboard_format_type_win.cc b/ui/base/clipboard/clipboard_format_type_win.cc index 8486fc4..8834346 100644 --- a/ui/base/clipboard/clipboard_format_type_win.cc +++ b/ui/base/clipboard/clipboard_format_type_win.cc
@@ -212,6 +212,13 @@ } // static +const ClipboardFormatType& ClipboardFormatType::GetPngType() { + static base::NoDestructor<ClipboardFormatType> format( + ::RegisterClipboardFormat(L"PNG")); + return *format; +} + +// static const ClipboardFormatType& ClipboardFormatType::GetBitmapType() { static base::NoDestructor<ClipboardFormatType> format(CF_DIBV5); return *format; @@ -340,11 +347,4 @@ return *format; } -// static -const ClipboardFormatType& ClipboardFormatType::GetPNGType() { - static base::NoDestructor<ClipboardFormatType> format( - ::RegisterClipboardFormat(L"PNG")); - return *format; -} - } // namespace ui
diff --git a/ui/base/clipboard/clipboard_non_backed.cc b/ui/base/clipboard/clipboard_non_backed.cc index 10a78445..3cacd71 100644 --- a/ui/base/clipboard/clipboard_non_backed.cc +++ b/ui/base/clipboard/clipboard_non_backed.cc
@@ -183,7 +183,7 @@ // Reads image from the ClipboardData. SkBitmap ReadImage() const { SkBitmap img; - if (!HasFormat(ClipboardInternalFormat::kBitmap)) + if (!HasFormat(ClipboardInternalFormat::kPng)) return img; // A shallow copy should be fine here, but just to be safe... @@ -435,9 +435,10 @@ if (format == ClipboardFormatType::GetRtfType()) return clipboard_internal_->IsFormatAvailable( ClipboardInternalFormat::kRtf); - if (format == ClipboardFormatType::GetBitmapType()) + if (format == ClipboardFormatType::GetPngType() || + format == ClipboardFormatType::GetBitmapType()) return clipboard_internal_->IsFormatAvailable( - ClipboardInternalFormat::kBitmap); + ClipboardInternalFormat::kPng); if (format == ClipboardFormatType::GetWebKitSmartPasteType()) return clipboard_internal_->IsFormatAvailable( ClipboardInternalFormat::kWeb);
diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc index d1f1092..868de231 100644 --- a/ui/base/clipboard/clipboard_win.cc +++ b/ui/base/clipboard/clipboard_win.cc
@@ -779,7 +779,7 @@ &png_encoded_bitmap)) { HGLOBAL png_hglobal = skia::CreateHGlobalForByteArray(png_encoded_bitmap); if (png_hglobal) - WriteToClipboard(ClipboardFormatType::GetPNGType(), png_hglobal); + WriteToClipboard(ClipboardFormatType::GetPngType(), png_hglobal); } HGLOBAL dibv5_hglobal = skia::CreateDIBV5ImageDataFromN32SkBitmap(bitmap); if (dibv5_hglobal)
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc index d84ff09..bc4437e 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc
@@ -57,6 +57,7 @@ #include "ui/compositor/scoped_animation_duration_scale_mode.h" #include "ui/display/display_switches.h" #include "ui/gfx/icc_profile.h" +#include "ui/gfx/presentation_feedback.h" #include "ui/gfx/switches.h" #include "ui/gl/gl_switches.h"
diff --git a/ui/ozone/platform/wayland/host/DEPS b/ui/ozone/platform/wayland/host/DEPS index 46b4577c..8f2915a 100644 --- a/ui/ozone/platform/wayland/host/DEPS +++ b/ui/ozone/platform/wayland/host/DEPS
@@ -2,7 +2,7 @@ # For Lacros. "+chromeos/crosapi/mojom", "+chromeos/crosapi/cpp/crosapi_constants.h", - "+chromeos/lacros/lacros_chrome_service_impl.h", + "+chromeos/lacros/lacros_service.h", "+chromeos/ui/base", # Common includes. "+ui/base/linux",
diff --git a/ui/ozone/platform/wayland/host/wayland_input_method_context.cc b/ui/ozone/platform/wayland/host/wayland_input_method_context.cc index 28bc808d..cca68fd 100644 --- a/ui/ozone/platform/wayland/host/wayland_input_method_context.cc +++ b/ui/ozone/platform/wayland/host/wayland_input_method_context.cc
@@ -33,7 +33,7 @@ #if BUILDFLAG(IS_CHROMEOS_LACROS) #include "base/check.h" #include "chromeos/crosapi/mojom/crosapi.mojom.h" -#include "chromeos/lacros/lacros_chrome_service_impl.h" +#include "chromeos/lacros/lacros_service.h" #endif namespace ui { @@ -69,13 +69,13 @@ // Lacros-chrome side, which helps us on releasing. // TODO(crbug.com/1159237): In the future, we may want to unify the behavior // of ozone/wayland across platforms. - const auto* lacros_chrome_service = chromeos::LacrosChromeServiceImpl::Get(); + const auto* lacros_service = chromeos::LacrosService::Get(); // Note: |init_params| may be null, if ash-chrome is too old. // TODO(crbug.com/1156033): Clean up the condition, after ash-chrome in the // world becomes new enough. const crosapi::mojom::BrowserInitParams* init_params = - lacros_chrome_service->init_params(); + lacros_service ? lacros_service->init_params() : nullptr; if (init_params && init_params->exo_ime_support != crosapi::mojom::ExoImeSupport::kUnsupported) { return true;
diff --git a/ui/strings/ui_strings.grd b/ui/strings/ui_strings.grd index 1613ffe6..32b38281 100644 --- a/ui/strings/ui_strings.grd +++ b/ui/strings/ui_strings.grd
@@ -1074,7 +1074,7 @@ </message> <!-- Clipboard history menu --> - <message name="IDS_CLIPBOARD_HISTORY_MENU_BITMAP_IMAGE" desc="Accessibility text for the bitmap image shown on the clipboard history menu"> + <message name="IDS_CLIPBOARD_HISTORY_MENU_PNG_IMAGE" desc="Accessibility text for the PNG image shown on the clipboard history menu"> Image. </message> <message name="IDS_CLIPBOARD_HISTORY_MENU_HTML_IMAGE" desc="Accessibility text for the HTML-rendered image shown on the clipboard history menu">
diff --git a/ui/strings/ui_strings_grd/IDS_CLIPBOARD_HISTORY_MENU_BITMAP_IMAGE.png.sha1 b/ui/strings/ui_strings_grd/IDS_CLIPBOARD_HISTORY_MENU_PNG_IMAGE.png.sha1 similarity index 100% rename from ui/strings/ui_strings_grd/IDS_CLIPBOARD_HISTORY_MENU_BITMAP_IMAGE.png.sha1 rename to ui/strings/ui_strings_grd/IDS_CLIPBOARD_HISTORY_MENU_PNG_IMAGE.png.sha1
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index 4136366..aabbdffa0 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc
@@ -996,7 +996,7 @@ LRESULT HWNDMessageHandler::OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) { - TRACE_EVENT("ui", "HWNDMessageHandler::OnWndProc", + TRACE_EVENT("ui,toplevel", "HWNDMessageHandler::OnWndProc", [&](perfetto::EventContext ctx) { perfetto::protos::pbzero::ChromeWindowHandleEventInfo* args = ctx.event()->set_chrome_window_handle_event_info();
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/TabImpl.java b/weblayer/browser/java/org/chromium/weblayer_private/TabImpl.java index 6b2d60c..96dc78868 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/TabImpl.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/TabImpl.java
@@ -359,8 +359,10 @@ if (mBrowser.getContext() == null) { // The Context and ViewContainer in which Autofill was previously operating have // gone away, so tear down |mAutofillProvider|. - mAutofillProvider = null; - TabImplJni.get().onAutofillProviderChanged(mNativeTab, null); + if (mAutofillProvider != null) { + mAutofillProvider.destroy(); + mAutofillProvider = null; + } selectionController.setNonSelectionActionModeCallback(null); } else { if (mAutofillProvider == null) { @@ -368,8 +370,9 @@ // the context won't change unless it is first nulled out, since the fragment // must be detached before it can be reattached to a new Context. mAutofillProvider = new AutofillProvider(mBrowser.getContext(), - mBrowser.getViewAndroidDelegateContainerView(), "WebLayer"); - TabImplJni.get().onAutofillProviderChanged(mNativeTab, mAutofillProvider); + mBrowser.getViewAndroidDelegateContainerView(), mWebContents, + "WebLayer"); + TabImplJni.get().initializeAutofillIfNecessary(mNativeTab); } mAutofillProvider.onContainerViewChanged( mBrowser.getViewAndroidDelegateContainerView()); @@ -1013,6 +1016,11 @@ mMediaSessionHelper = null; } + if (mAutofillProvider != null) { + mAutofillProvider.destroy(); + mAutofillProvider = null; + } + // Destroying FaviconCallbackProxy removes from mFaviconCallbackProxies. Copy to avoid // problems. Set<FaviconCallbackProxy> faviconCallbackProxies = mFaviconCallbackProxies; @@ -1258,7 +1266,7 @@ void removeTabFromBrowserBeforeDestroying(long nativeTabImpl); void deleteTab(long tab); void setJavaImpl(long nativeTabImpl, TabImpl impl); - void onAutofillProviderChanged(long nativeTabImpl, AutofillProvider autofillProvider); + void initializeAutofillIfNecessary(long nativeTabImpl); void setBrowserControlsContainerViews(long nativeTabImpl, long nativeTopBrowserControlsContainerView, long nativeBottomBrowserControlsContainerView);
diff --git a/weblayer/browser/tab_impl.cc b/weblayer/browser/tab_impl.cc index eee7208..8c282aa 100644 --- a/weblayer/browser/tab_impl.cc +++ b/weblayer/browser/tab_impl.cc
@@ -682,29 +682,13 @@ java_impl_ = impl; } -void TabImpl::OnAutofillProviderChanged( - JNIEnv* env, - const JavaParamRef<jobject>& autofill_provider) { +void TabImpl::InitializeAutofillIfNecessary(JNIEnv* env) { if (g_system_autofill_disabled_for_testing) return; - - if (!autofill_provider_) { - // The first invocation should be when instantiating the autofill - // infrastructure, at which point the Java-side object should not be null. - DCHECK(autofill_provider); - - // Initialize the native side of the autofill infrastructure. - autofill_provider_ = std::make_unique<autofill::AutofillProviderAndroid>( - autofill_provider, web_contents_.get()); - InitializeAutofill(); - return; + if (!autofill::ContentAutofillDriverFactory::FromWebContents( + web_contents_.get())) { + InitializeAutofillDriver(); } - - // The AutofillProvider Java object has been changed; inform - // |autofill_provider_|. - auto* provider = - static_cast<autofill::AutofillProviderAndroid*>(autofill_provider_.get()); - provider->OnJavaAutofillProviderChanged(env, autofill_provider); } void TabImpl::UpdateBrowserControlsConstraint(JNIEnv* env, @@ -1376,20 +1360,15 @@ } #endif -void TabImpl::InitializeAutofillForTests( - std::unique_ptr<autofill::AutofillProvider> provider) { - DCHECK(!autofill_provider_); - - autofill_provider_ = std::move(provider); - InitializeAutofill(); +void TabImpl::InitializeAutofillForTests() { + InitializeAutofillDriver(); } -void TabImpl::InitializeAutofill() { - DCHECK(autofill_provider_); - +void TabImpl::InitializeAutofillDriver() { content::WebContents* web_contents = web_contents_.get(); DCHECK( !autofill::ContentAutofillDriverFactory::FromWebContents(web_contents)); + DCHECK(autofill::AutofillProvider::FromWebContents(web_contents)); AutofillClientImpl::CreateForWebContents(web_contents); @@ -1409,10 +1388,7 @@ autofill::ContentAutofillDriverFactory::CreateForWebContentsAndDelegate( web_contents, AutofillClientImpl::FromWebContents(web_contents), i18n::GetApplicationLocale(), enable_autofill_download_manager, - autofill_provider_ - ? base::BindRepeating(&autofill::AndroidAutofillManager::Create, - autofill_provider_.get()) - : autofill::AutofillManager::AutofillManagerFactoryCallback()); + base::BindRepeating(&autofill::AndroidAutofillManager::Create)); } find_in_page::FindTabHelper* TabImpl::GetFindTabHelper() {
diff --git a/weblayer/browser/tab_impl.h b/weblayer/browser/tab_impl.h index f4df4fc..077e8a5 100644 --- a/weblayer/browser/tab_impl.h +++ b/weblayer/browser/tab_impl.h
@@ -160,14 +160,10 @@ void SetJavaImpl(JNIEnv* env, const base::android::JavaParamRef<jobject>& impl); - // Invoked every time that the Java-side AutofillProvider instance is - // changed (set to null or to a new object). On first invocation with a non- - // null object initializes the native Autofill infrastructure. On - // subsequent invocations updates the association of that native - // infrastructure with its Java counterpart. - void OnAutofillProviderChanged( - JNIEnv* env, - const base::android::JavaParamRef<jobject>& autofill_provider); + // Invoked every time that the Java-side AutofillProvider instance is created, + // the native side autofill might have been initialized in the case that + // Android context is switched. + void InitializeAutofillIfNecessary(JNIEnv* env); void UpdateBrowserControlsConstraint(JNIEnv* env, jint constraint, jboolean animate); @@ -243,9 +239,8 @@ // Executes |script| with a user gesture. void ExecuteScriptWithUserGestureForTests(const std::u16string& script); - // Initializes the autofill system with |provider| for tests. - void InitializeAutofillForTests( - std::unique_ptr<autofill::AutofillProvider> provider); + // Initializes the autofill system for tests. + void InitializeAutofillForTests(); private: // content::WebContentsDelegate: @@ -347,7 +342,7 @@ void UpdateRendererPrefs(bool should_sync_prefs); - void InitializeAutofill(); + void InitializeAutofillDriver(); // Returns the FindTabHelper for the page, or null if none exists. find_in_page::FindTabHelper* GetFindTabHelper(); @@ -402,8 +397,6 @@ // If true, the fullscreen delegate is called when the tab gains active. bool enter_fullscreen_on_gained_active_ = false; - std::unique_ptr<autofill::AutofillProvider> autofill_provider_; - const std::string guid_; std::map<std::string, std::string> data_;
diff --git a/weblayer/test/stub_autofill_provider.cc b/weblayer/test/stub_autofill_provider.cc index c284781b..57cbc92a 100644 --- a/weblayer/test/stub_autofill_provider.cc +++ b/weblayer/test/stub_autofill_provider.cc
@@ -7,9 +7,11 @@ namespace weblayer { StubAutofillProvider::StubAutofillProvider( + content::WebContents* web_contents, const base::RepeatingCallback<void(const autofill::FormData&)>& on_received_form_data) - : on_received_form_data_(on_received_form_data) {} + : autofill::TestAutofillProvider(web_contents), + on_received_form_data_(on_received_form_data) {} StubAutofillProvider::~StubAutofillProvider() = default;
diff --git a/weblayer/test/stub_autofill_provider.h b/weblayer/test/stub_autofill_provider.h index c33498b39..e3cfd2f 100644 --- a/weblayer/test/stub_autofill_provider.h +++ b/weblayer/test/stub_autofill_provider.h
@@ -7,6 +7,7 @@ #include "base/callback_forward.h" #include "components/android_autofill/browser/test_autofill_provider.h" +#include "content/public/browser/web_contents.h" namespace weblayer { @@ -15,7 +16,9 @@ // the browser. class StubAutofillProvider : public autofill::TestAutofillProvider { public: + // WebContents takes the ownership of StubAutofillProvider. explicit StubAutofillProvider( + content::WebContents* web_contents, const base::RepeatingCallback<void(const autofill::FormData&)>& on_received_form_data); ~StubAutofillProvider() override;
diff --git a/weblayer/test/weblayer_browser_test_utils.cc b/weblayer/test/weblayer_browser_test_utils.cc index 8774984..742107d4 100644 --- a/weblayer/test/weblayer_browser_test_utils.cc +++ b/weblayer/test/weblayer_browser_test_utils.cc
@@ -94,9 +94,8 @@ const base::RepeatingCallback<void(const autofill::FormData&)>& on_received_form_data) { TabImpl* tab_impl = static_cast<TabImpl*>(shell->tab()); - - tab_impl->InitializeAutofillForTests( - std::make_unique<StubAutofillProvider>(on_received_form_data)); + new StubAutofillProvider(tab_impl->web_contents(), on_received_form_data); + tab_impl->InitializeAutofillForTests(); } void ActivateSubresourceFilterInWebContentsForURL(