diff --git a/DEPS b/DEPS index 36ad85b..fcfd92e 100644 --- a/DEPS +++ b/DEPS
@@ -144,11 +144,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': '96d2ee0fd0bb09d1505a89987341557bbdf2fcff', + 'skia_revision': 'eb24735ec5879effa97ff24f8340fd63f74665c1', # 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': 'ffee6baaeee1bcaa8d1bba5e981377d30b37bd88', + 'v8_revision': '56efa9f0db8682763a5ef51549a66b191e031eec', # 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. @@ -156,15 +156,15 @@ # 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': 'ec9ff8ce3909ec618842d1922aacf6c6cd961b2e', + 'angle_revision': 'f92fc916887e53f862ffefaabf07786813f8c9e1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. - 'swiftshader_revision': '6448bd6606392e3fec18b2b7fb7fb43da5a2996e', + 'swiftshader_revision': '763b77946e17811b1fed2617434e8886f8a41b42', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': '22923602f40e0fe3cdad7d3ce8828497e5e2a7fb', + 'pdfium_revision': '68fb145dca2b0d41acb00e9c16fc5032a1a980e0', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling BoringSSL # and whatever else without interference from each other. @@ -207,7 +207,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '60b615536f54726c34d2137494bd447728465db0', + 'catapult_revision': '96450caa691a82a9c66a1bb8eeab89f1b11b31a0', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -215,7 +215,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-node-modules # and whatever else without interference from each other. - 'devtools_node_modules_revision': '5f7cd2497d7a643125c3b6eb910d99ba28be6899', + 'devtools_node_modules_revision': '08f835aae2a552cd8b449ec1be9d292cbacbfb8b', # 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. @@ -275,15 +275,15 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'shaderc_revision': '72988e40a45ea46bfd615420b060c0b923a7a866', + 'shaderc_revision': 'ef2b7a6d5aedd2dec30e77d8c97499ce5ab0564c', # 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': '4af9808400d993f58977ed7d320b1f912e92573f', + 'dawn_revision': 'd6f13c645b19ce965d3064c98b5f4a566fd386f6', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'quiche_revision': '600a045286553a6484b45452be8d985cb3c7e031', + 'quiche_revision': 'd57d3f905ac470ad0b31352907668c22ffb0c0b4', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ios_webkit # and whatever else without interference from each other. @@ -833,7 +833,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '0fb33b26eb533a6f6184cab75ad50c229ee5c130', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '9217ff8b2c57fc7f5f706fef741a2c48efe7c885', 'src/third_party/devtools-node-modules': Var('chromium_git') + '/external/github.com/ChromeDevTools/devtools-node-modules' + '@' + Var('devtools_node_modules_revision'), @@ -1194,7 +1194,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '3d5856c03a84d75057ce46e168e055811f8f9611', + Var('android_git') + '/platform/external/perfetto.git' + '@' + 'a7fc7a353fbd5c863363e5e5a34d41dea8e43b4f', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1362,7 +1362,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '6453c2f5604ec8bca15e9e1edc64e979da8f1083', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '08da49d0a488aaf915f90c33b1f9bdbfecbe4367', + Var('webrtc_git') + '/src.git' + '@' + 'b4b52ec4b45cd6b6be4a6a881b26874e03a89be3', 'src/third_party/xdg-utils': { 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d', @@ -1403,7 +1403,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@ded8bf94b4c3b28429000446e038f3e252c17072', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@5176e2acfc0ef7bec2bca5c8e181a70cad0de87d', 'condition': 'checkout_src_internal', },
diff --git a/android_webview/browser/aw_content_browser_client.cc b/android_webview/browser/aw_content_browser_client.cc index f6b017bb..c0271b7 100644 --- a/android_webview/browser/aw_content_browser_client.cc +++ b/android_webview/browser/aw_content_browser_client.cc
@@ -816,17 +816,13 @@ if (base::FeatureList::IsEnabled(network::features::kNetworkService) || base::FeatureList::IsEnabled(safe_browsing::kCheckByURLLoaderThrottle)) { - auto* delegate = GetSafeBrowsingUrlCheckerDelegate(); - if (delegate && !delegate->ShouldSkipRequestCheck( - resource_context, request.url, frame_tree_node_id, - -1 /* render_process_id */, -1 /* render_frame_id */, - request.originated_from_service_worker)) { - auto safe_browsing_throttle = - safe_browsing::BrowserURLLoaderThrottle::MaybeCreate(delegate, - wc_getter); - if (safe_browsing_throttle) - result.push_back(std::move(safe_browsing_throttle)); - } + result.push_back(safe_browsing::BrowserURLLoaderThrottle::Create( + base::BindOnce( + [](AwContentBrowserClient* client, content::ResourceContext*) { + return client->GetSafeBrowsingUrlCheckerDelegate(); + }, + base::Unretained(this)), + wc_getter, frame_tree_node_id, resource_context)); } if (request.resource_type == @@ -858,6 +854,14 @@ std::vector<std::unique_ptr<content::URLLoaderThrottle>> result; + result.push_back(safe_browsing::BrowserURLLoaderThrottle::Create( + base::BindOnce( + [](AwContentBrowserClient* client, content::ResourceContext*) { + return client->GetSafeBrowsingUrlCheckerDelegate(); + }, + base::Unretained(this)), + wc_getter, frame_tree_node_id, browser_context->GetResourceContext())); + if (request.resource_type == static_cast<int>(content::ResourceType::kMainFrame)) { const bool is_load_url = @@ -877,7 +881,7 @@ return result; } -safe_browsing::UrlCheckerDelegate* +scoped_refptr<safe_browsing::UrlCheckerDelegate> AwContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate() { DCHECK_CURRENTLY_ON(BrowserThread::IO); @@ -888,7 +892,7 @@ AwBrowserProcess::GetInstance()->GetSafeBrowsingWhitelistManager()); } - return safe_browsing_url_checker_delegate_.get(); + return safe_browsing_url_checker_delegate_; } void AwContentBrowserClient::ExposeInterfacesToMediaService(
diff --git a/android_webview/browser/aw_content_browser_client.h b/android_webview/browser/aw_content_browser_client.h index bfcc7ac..05e1ebdd 100644 --- a/android_webview/browser/aw_content_browser_client.h +++ b/android_webview/browser/aw_content_browser_client.h
@@ -268,7 +268,8 @@ static void DisableCreatingThreadPool(); private: - safe_browsing::UrlCheckerDelegate* GetSafeBrowsingUrlCheckerDelegate(); + scoped_refptr<safe_browsing::UrlCheckerDelegate> + GetSafeBrowsingUrlCheckerDelegate(); // TODO(eroman): Remove once WebView has switched over to NetworkService. std::unique_ptr<net::NetLog> non_network_service_net_log_;
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java index 885e4e7..a39c51a 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java
@@ -47,6 +47,7 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; +import org.chromium.base.test.util.FlakyTest; import org.chromium.base.test.util.InMemorySharedPreferences; import org.chromium.components.safe_browsing.SafeBrowsingApiBridge; import org.chromium.components.safe_browsing.SafeBrowsingApiHandler; @@ -630,6 +631,7 @@ } @Test + @FlakyTest(message = "crbug.com/984705") @SmallTest @Feature({"AndroidWebView"}) public void testSafeBrowsingProceedThroughInterstitialForSubresource() throws Throwable {
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 6edfa6db..ab697bd2 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -190,6 +190,10 @@ "assistant/assistant_interaction_controller.h", "assistant/assistant_notification_controller.cc", "assistant/assistant_notification_controller.h", + "assistant/assistant_notification_expiry_monitor.cc", + "assistant/assistant_notification_expiry_monitor.h", + "assistant/assistant_prefs_controller.cc", + "assistant/assistant_prefs_controller.h", "assistant/assistant_screen_context_controller.cc", "assistant/assistant_screen_context_controller.h", "assistant/assistant_settings.cc", @@ -1348,6 +1352,7 @@ # TODO(https://crbug.com/644355): Remove Shill dependencies. "//chromeos/network", "//chromeos/services/assistant/public:feature_flags", + "//chromeos/services/assistant/public/cpp:prefs", "//chromeos/services/assistant/public/mojom", "//chromeos/services/multidevice_setup/public/mojom", "//chromeos/services/network_config/public/cpp", @@ -1445,6 +1450,7 @@ ] allow_circular_includes_from = [ + "//ash/assistant/ui", "//components/exo", "//components/exo/wayland", ] @@ -1603,6 +1609,8 @@ "app_menu/notification_menu_view_unittest.cc", "app_menu/notification_overflow_view_unittest.cc", "assistant/assistant_controller_unittest.cc", + "assistant/assistant_notification_controller_unittest.cc", + "assistant/assistant_prefs_controller_unittest.cc", "assistant/assistant_screen_context_controller_unittest.cc", "assistant/model/assistant_query_history_unittest.cc", "assistant/ui/assistant_container_view_unittest.cc",
diff --git a/ash/app_list/app_list_controller_impl_unittest.cc b/ash/app_list/app_list_controller_impl_unittest.cc index 1137eb6..5f4f28fc 100644 --- a/ash/app_list/app_list_controller_impl_unittest.cc +++ b/ash/app_list/app_list_controller_impl_unittest.cc
@@ -15,6 +15,7 @@ #include "ash/ime/ime_controller.h" #include "ash/ime/test_ime_controller_client.h" #include "ash/keyboard/keyboard_controller_impl.h" +#include "ash/public/cpp/app_list/app_list_config.h" #include "ash/public/cpp/presentation_time_recorder.h" #include "ash/public/cpp/shelf_types.h" #include "ash/shelf/shelf.h" @@ -182,7 +183,8 @@ EXPECT_EQ(0, app_list_screen_bounds.y()); EXPECT_EQ(ash::AppListViewState::kHalf, GetAppListView()->app_list_state()); gfx::Transform expected_transform; - expected_transform.Translate(0, -app_list::kAppListBackgroundRadius); + expected_transform.Translate( + 0, -app_list::AppListConfig::instance().background_radius()); EXPECT_EQ( expected_transform, GetAppListView()->GetAppListBackgroundShieldForTest()->GetTransform()); @@ -232,7 +234,8 @@ // AppListBackgroundShield is translated to hide the rounded corners. gfx::Transform expected_transform; - expected_transform.Translate(0, -app_list::kAppListBackgroundRadius); + expected_transform.Translate( + 0, -app_list::AppListConfig::instance().background_radius()); EXPECT_EQ( expected_transform, GetAppListView()->GetAppListBackgroundShieldForTest()->GetTransform());
diff --git a/ash/app_list/views/app_list_view.cc b/ash/app_list/views/app_list_view.cc index 153ce7f..25e5f41f 100644 --- a/ash/app_list/views/app_list_view.cc +++ b/ash/app_list/views/app_list_view.cc
@@ -392,7 +392,8 @@ layer()->SetBackgroundBlur(AppListConfig::instance().blur_radius()); layer()->SetBackdropFilterQuality(kAppListBlurQuality); layer()->SetRoundedCornerRadius( - {kAppListBackgroundRadius, kAppListBackgroundRadius, 0, 0}); + {AppListConfig::instance().background_radius(), + AppListConfig::instance().background_radius(), 0, 0}); } else { layer()->SetBackgroundBlur(0); } @@ -410,12 +411,13 @@ } void UpdateBounds(const gfx::Rect& bounds) { - // Inset bottom by 2 * |kAppListBackgroundRadius| to account for the rounded - // corners on the top and bottom of the |app_list_background_shield_|. - // Only add the inset to the bottom to keep padding at the top of the - // AppList the same. + // Inset bottom by 2 * the background radius to account for the rounded + // corners on the top and bottom of the |app_list_background_shield_|. Only + // add the inset to the bottom to keep padding at the top of the AppList the + // same. gfx::Rect new_bounds = bounds; - new_bounds.Inset(0, 0, 0, -kAppListBackgroundRadius * 2); + new_bounds.Inset(0, 0, 0, + -AppListConfig::instance().background_radius() * 2); SetBoundsRect(new_bounds); } @@ -424,7 +426,8 @@ cc::PaintFlags flags; flags.setStyle(cc::PaintFlags::kFill_Style); flags.setColor(color_); - canvas->DrawRoundRect(GetContentsBounds(), kAppListBackgroundRadius, flags); + canvas->DrawRoundRect(GetContentsBounds(), + AppListConfig::instance().background_radius(), flags); } SkColor GetColorForTest() const { return color_; } @@ -1849,7 +1852,7 @@ gfx::Transform transform; if (ShouldHideRoundedCorners(new_bounds)) - transform.Translate(0, -kAppListBackgroundRadius); + transform.Translate(0, -AppListConfig::instance().background_radius()); app_list_background_shield_->SetTransform(transform); app_list_background_shield_->SchedulePaint(); @@ -2091,17 +2094,16 @@ float app_list_transition_progress = GetAppListTransitionProgress(); if (app_list_transition_progress >= 1 && app_list_transition_progress <= 2) { - // Translate background shield so that it ends drag at y position - // -|kAppListBackgroundRadius| when dragging between peeking and - // fullscreen. - transform.Translate( - 0, -kAppListBackgroundRadius * (app_list_transition_progress - 1)); + // Translate background shield so that it ends drag at a y position + // according to the background radius in peeking and fullscreen. + transform.Translate(0, -AppListConfig::instance().background_radius() * + (app_list_transition_progress - 1)); } } else if (is_fullscreen() || ShouldHideRoundedCorners(GetBoundsInScreen())) { // AppListView::Layout may be called after OnWindowBoundsChanged. It may // reset the transform of |app_list_background_shield_|. So hide the rounded // corners here when ShouldHideRoundedCorners returns true. - transform.Translate(0, -kAppListBackgroundRadius); + transform.Translate(0, -AppListConfig::instance().background_radius()); } app_list_background_shield_->SetTransform(transform); }
diff --git a/ash/app_list/views/app_list_view.h b/ash/app_list/views/app_list_view.h index bf623820..e1071e7 100644 --- a/ash/app_list/views/app_list_view.h +++ b/ash/app_list/views/app_list_view.h
@@ -59,9 +59,6 @@ namespace { -// The background corner radius in peeking and fullscreen state. -constexpr int kAppListBackgroundRadius = 28; - // The fraction of app list height that the app list must be released at in // order to transition to the next state. constexpr int kAppListThresholdDenominator = 3; @@ -319,10 +316,6 @@ onscreen_keyboard_shown_ = onscreen_keyboard_shown; } - int get_background_radius_for_test() const { - return kAppListBackgroundRadius; - } - views::View* GetAppListBackgroundShieldForTest(); SkColor GetAppListBackgroundShieldColorForTest();
diff --git a/ash/app_list/views/search_result_tile_item_list_view.cc b/ash/app_list/views/search_result_tile_item_list_view.cc index 04c794b..6be15a75 100644 --- a/ash/app_list/views/search_result_tile_item_list_view.cc +++ b/ash/app_list/views/search_result_tile_item_list_view.cc
@@ -301,8 +301,7 @@ }); for (auto* result : policy_tiles_results) { - // if the app is requesting to be placed in an index out of bounds - if (result->display_index() + 1 > display_results.size()) { + if (result->display_index() > display_results.size() - 1) { display_results.emplace_back(result); } else { display_results.emplace(display_results.begin() + result->display_index(),
diff --git a/ash/ash_prefs.cc b/ash/ash_prefs.cc index 68236c18..48d756b 100644 --- a/ash/ash_prefs.cc +++ b/ash/ash_prefs.cc
@@ -25,6 +25,7 @@ #include "ash/system/session/logout_button_tray.h" #include "ash/touch/touch_devices_controller.h" #include "ash/wallpaper/wallpaper_controller_impl.h" +#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" namespace ash { @@ -49,6 +50,7 @@ ShelfController::RegisterProfilePrefs(registry); TouchDevicesController::RegisterProfilePrefs(registry); tray::VPNListView::RegisterProfilePrefs(registry); + chromeos::assistant::prefs::RegisterProfilePrefsForeign(registry, for_test); } } // namespace
diff --git a/ash/assistant/assistant_controller.cc b/ash/assistant/assistant_controller.cc index 4dcd40d8..6debb90 100644 --- a/ash/assistant/assistant_controller.cc +++ b/ash/assistant/assistant_controller.cc
@@ -18,6 +18,7 @@ #include "ash/utility/screenshot_controller.h" #include "base/bind.h" #include "base/memory/scoped_refptr.h" +#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" #include "components/prefs/pref_registry_simple.h" #include "services/content/public/mojom/constants.mojom.h" #include "services/service_manager/public/cpp/connector.h" @@ -37,6 +38,7 @@ assistant_cache_controller_(this), assistant_interaction_controller_(this), assistant_notification_controller_(this), + assistant_prefs_controller_(), assistant_screen_context_controller_(this), assistant_setup_controller_(this), assistant_ui_controller_(this), @@ -117,10 +119,9 @@ } void AssistantController::StartSpeakerIdEnrollmentFlow() { - mojom::ConsentStatus consent_status = - VoiceInteractionController::Get()->consent_status().value_or( - mojom::ConsentStatus::kUnknown); - if (consent_status == mojom::ConsentStatus::kActivityControlAccepted) { + if (prefs_controller()->prefs()->GetInteger( + chromeos::assistant::prefs::kAssistantConsentStatus) == + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted) { // If activity control has been accepted, launch the enrollment flow. setup_controller()->StartOnboarding(false /* relaunch */, FlowType::kSpeakerIdEnrollment);
diff --git a/ash/assistant/assistant_controller.h b/ash/assistant/assistant_controller.h index 7a87655..89ef054d 100644 --- a/ash/assistant/assistant_controller.h +++ b/ash/assistant/assistant_controller.h
@@ -17,6 +17,7 @@ #include "ash/assistant/assistant_controller_observer.h" #include "ash/assistant/assistant_interaction_controller.h" #include "ash/assistant/assistant_notification_controller.h" +#include "ash/assistant/assistant_prefs_controller.h" #include "ash/assistant/assistant_screen_context_controller.h" #include "ash/assistant/assistant_setup_controller.h" #include "ash/assistant/assistant_ui_controller.h" @@ -32,6 +33,7 @@ #include "base/observer_list.h" #include "chromeos/audio/cras_audio_handler.h" #include "chromeos/services/assistant/public/mojom/assistant.mojom.h" +#include "components/prefs/pref_service.h" #include "mojo/public/cpp/bindings/binding_set.h" #include "mojo/public/cpp/bindings/interface_ptr_set.h" #include "mojo/public/cpp/bindings/pending_receiver.h" @@ -45,6 +47,7 @@ class AssistantCacheController; class AssistantInteractionController; class AssistantNotificationController; +class AssistantPrefsController; class AssistantScreenContextController; class AssistantSetupController; class AssistantUiController; @@ -128,6 +131,10 @@ return &assistant_notification_controller_; } + AssistantPrefsController* prefs_controller() { + return &assistant_prefs_controller_; + } + AssistantScreenContextController* screen_context_controller() { return &assistant_screen_context_controller_; } @@ -173,6 +180,7 @@ AssistantCacheController assistant_cache_controller_; AssistantInteractionController assistant_interaction_controller_; AssistantNotificationController assistant_notification_controller_; + AssistantPrefsController assistant_prefs_controller_; AssistantScreenContextController assistant_screen_context_controller_; AssistantSetupController assistant_setup_controller_; AssistantUiController assistant_ui_controller_;
diff --git a/ash/assistant/assistant_notification_controller.cc b/ash/assistant/assistant_notification_controller.cc index 6328039..1e32def2 100644 --- a/ash/assistant/assistant_notification_controller.cc +++ b/ash/assistant/assistant_notification_controller.cc
@@ -8,6 +8,7 @@ #include <utility> #include "ash/assistant/assistant_controller.h" +#include "ash/assistant/assistant_notification_expiry_monitor.h" #include "ash/assistant/util/deep_link_util.h" #include "ash/public/cpp/notification_utils.h" #include "ash/public/cpp/vector_icons/vector_icons.h" @@ -81,6 +82,7 @@ AssistantController* assistant_controller) : assistant_controller_(assistant_controller), binding_(this), + expiry_monitor_(this), notifier_id_(GetNotifierId()) { AddModelObserver(this); assistant_controller_->AddObserver(this);
diff --git a/ash/assistant/assistant_notification_controller.h b/ash/assistant/assistant_notification_controller.h index bd1655b..6a7e63e0 100644 --- a/ash/assistant/assistant_notification_controller.h +++ b/ash/assistant/assistant_notification_controller.h
@@ -9,6 +9,7 @@ #include "ash/ash_export.h" #include "ash/assistant/assistant_controller_observer.h" +#include "ash/assistant/assistant_notification_expiry_monitor.h" #include "ash/assistant/model/assistant_notification_model.h" #include "ash/assistant/model/assistant_notification_model_observer.h" #include "ash/assistant/model/assistant_ui_model_observer.h" @@ -97,6 +98,7 @@ mojo::Binding<mojom::AssistantNotificationController> binding_; AssistantNotificationModel model_; + AssistantNotificationExpiryMonitor expiry_monitor_; // Owned by AssistantController. chromeos::assistant::mojom::Assistant* assistant_ = nullptr;
diff --git a/ash/assistant/assistant_notification_controller_unittest.cc b/ash/assistant/assistant_notification_controller_unittest.cc new file mode 100644 index 0000000..e72e2df --- /dev/null +++ b/ash/assistant/assistant_notification_controller_unittest.cc
@@ -0,0 +1,291 @@ +// 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 "ash/assistant/assistant_notification_controller.h" + +#include "ash/assistant/assistant_controller.h" +#include "ash/assistant/model/assistant_notification_model_observer.h" +#include "ash/shell.h" +#include "ash/test/ash_test_base.h" +#include "base/test/scoped_task_environment.h" +#include "chromeos/services/assistant/public/mojom/assistant.mojom.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace ash { + +using chromeos::assistant::mojom::AssistantNotificationPtr; +using testing::_; +using testing::Eq; +using testing::Field; +using testing::StrictMock; + +constexpr bool kAnyBool = false; + +class AssistantNotificationModelObserverMock + : public AssistantNotificationModelObserver { + public: + AssistantNotificationModelObserverMock() = default; + ~AssistantNotificationModelObserverMock() override = default; + + MOCK_METHOD1(OnNotificationAdded, + void(const AssistantNotification* notification)); + MOCK_METHOD1(OnNotificationUpdated, + void(const AssistantNotification* notification)); + MOCK_METHOD2(OnNotificationRemoved, + void(const AssistantNotification* notification, + bool from_server)); + MOCK_METHOD1(OnAllNotificationsRemoved, void(bool from_server)); + + private: + DISALLOW_COPY_AND_ASSIGN(AssistantNotificationModelObserverMock); +}; + +MATCHER_P(IdIs, expected_id, "") { + if (arg->client_id != expected_id) { + *result_listener << "Received notification with a wrong id.\n" + << "Expected:\n '" << expected_id << "'\n" + << "Actual:\n '" << arg->client_id << "'\n"; + return false; + } + return true; +} + +class AssistantNotificationControllerTest : public AshTestBase { + protected: + AssistantNotificationControllerTest() { + DestroyScopedTaskEnvironment(); + scoped_task_environment_ = + std::make_unique<base::test::ScopedTaskEnvironment>( + base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME_AND_NOW, + base::test::ScopedTaskEnvironment::MainThreadType::UI); + } + ~AssistantNotificationControllerTest() override = default; + + void SetUp() override { + ASSERT_TRUE(chromeos::switches::IsAssistantEnabled()); + + AshTestBase::SetUp(); + + controller_ = + Shell::Get()->assistant_controller()->notification_controller(); + DCHECK(controller_); + } + + AssistantNotificationController& controller() { return *controller_; } + + AssistantNotificationModelObserverMock& AddStrictObserverMock() { + observer_ = + std::make_unique<StrictMock<AssistantNotificationModelObserverMock>>(); + controller().AddModelObserver(observer_.get()); + return *observer_; + } + + AssistantNotificationPtr CreateNotification(const std::string& id) { + auto notification = + chromeos::assistant::mojom::AssistantNotification::New(); + notification->client_id = id; + return notification; + } + + AssistantNotificationPtr CreateNotification(const std::string& id, + int timeout_ms) { + auto result = CreateNotification(id); + result->expiry_time = + base::Time::Now() + base::TimeDelta::FromMilliseconds(timeout_ms); + return result; + } + + void AddNotification(const std::string& id, int timeout_ms) { + controller().AddOrUpdateNotification(CreateNotification(id, timeout_ms)); + } + + void AddNotification(const std::string& id) { + controller().AddOrUpdateNotification(CreateNotification(id)); + } + + void UpdateNotification(const std::string& id, int timeout_ms) { + controller().AddOrUpdateNotification(CreateNotification(id, timeout_ms)); + } + + void UpdateNotification(const std::string& id) { + controller().AddOrUpdateNotification(CreateNotification(id)); + } + + void RemoveNotification(const std::string& id) { + controller().RemoveNotificationById(id, kAnyBool); + } + + void ForwardTimeInMs(int time_in_ms) { + scoped_task_environment_->FastForwardBy( + base::TimeDelta::FromMilliseconds(time_in_ms)); + } + + private: + AssistantNotificationController* controller_; + std::unique_ptr<AssistantNotificationModelObserverMock> observer_; + std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment_; + + DISALLOW_COPY_AND_ASSIGN(AssistantNotificationControllerTest); +}; + +TEST_F(AssistantNotificationControllerTest, + ShouldInformObserverOfNewNotifications) { + auto& observer = AddStrictObserverMock(); + + EXPECT_CALL(observer, OnNotificationAdded(IdIs("id"))); + + controller().AddOrUpdateNotification(CreateNotification("id")); +} + +TEST_F(AssistantNotificationControllerTest, + ShouldInformObserverOfUpdatedNotifications) { + const auto notification = CreateNotification("id"); + controller().AddOrUpdateNotification(notification.Clone()); + auto& observer = AddStrictObserverMock(); + + EXPECT_CALL(observer, OnNotificationUpdated(IdIs("id"))); + + controller().AddOrUpdateNotification(notification.Clone()); +} + +TEST_F(AssistantNotificationControllerTest, + ShouldInformObserverOfRemovedNotifications) { + const auto notification = CreateNotification("id"); + controller().AddOrUpdateNotification(notification.Clone()); + constexpr bool from_server = kAnyBool; + auto& observer = AddStrictObserverMock(); + + EXPECT_CALL(observer, OnNotificationRemoved(IdIs("id"), Eq(from_server))); + + controller().RemoveNotificationById(notification->client_id, from_server); +} + +TEST_F(AssistantNotificationControllerTest, + ShouldInformObserverOfRemoveAllNotifications) { + const auto notification = CreateNotification("id"); + controller().AddOrUpdateNotification(notification.Clone()); + constexpr bool from_server = !kAnyBool; + auto& observer = AddStrictObserverMock(); + + EXPECT_CALL(observer, OnAllNotificationsRemoved(Eq(from_server))); + + controller().RemoveAllNotifications(from_server); +} + +TEST_F(AssistantNotificationControllerTest, + ShouldRemoveNotificationWhenItExpires) { + constexpr int timeout_ms = 1000; + AddNotification("id", timeout_ms); + auto& observer = AddStrictObserverMock(); + + EXPECT_CALL(observer, OnNotificationRemoved(IdIs("id"), _)); + + ForwardTimeInMs(timeout_ms); +} + +TEST_F(AssistantNotificationControllerTest, + ShouldNotRemoveNotificationsTooSoon) { + constexpr int timeout_ms = 1000; + AddNotification("id", timeout_ms); + auto& observer = AddStrictObserverMock(); + + EXPECT_CALL(observer, OnNotificationRemoved).Times(0); + ForwardTimeInMs(timeout_ms - 1); +} + +TEST_F(AssistantNotificationControllerTest, + ShouldUseFromServerFalseWhenNotificationExpires) { + constexpr int timeout_ms = 1000; + AddNotification("id", timeout_ms); + auto& observer = AddStrictObserverMock(); + + EXPECT_CALL(observer, OnNotificationRemoved(_, Eq(false))); + + ForwardTimeInMs(timeout_ms); +} + +TEST_F(AssistantNotificationControllerTest, + ShouldRemoveEachNotificationAsItExpires) { + constexpr int first_timeout_ms = 1000; + constexpr int second_timeout_ms = 1500; + + AddNotification("first", first_timeout_ms); + AddNotification("second", second_timeout_ms); + + auto& observer = AddStrictObserverMock(); + + EXPECT_CALL(observer, OnNotificationRemoved(IdIs("first"), _)); + ForwardTimeInMs(first_timeout_ms); + + EXPECT_CALL(observer, OnNotificationRemoved(IdIs("second"), _)); + int delta_between_notifications = second_timeout_ms - first_timeout_ms; + ForwardTimeInMs(delta_between_notifications); +} + +TEST_F(AssistantNotificationControllerTest, + ShouldSupport2NotificationsThatExpireAtTheSameTime) { + constexpr int timeout_ms = 1000; + + AddNotification("first", timeout_ms); + AddNotification("at-same-time", timeout_ms); + + auto& observer = AddStrictObserverMock(); + + EXPECT_CALL(observer, OnNotificationRemoved(IdIs("first"), _)); + EXPECT_CALL(observer, OnNotificationRemoved(IdIs("at-same-time"), _)); + ForwardTimeInMs(timeout_ms); +} + +TEST_F(AssistantNotificationControllerTest, + ShouldImmediateRemoveNotificationsThatAlreadyExpired) { + constexpr int negative_timeout = -1000; + + AddNotification("expired", negative_timeout); + + auto& observer = AddStrictObserverMock(); + + EXPECT_CALL(observer, OnNotificationRemoved(IdIs("expired"), _)); +} + +TEST_F(AssistantNotificationControllerTest, + ShouldNotRemoveNotificationsThatWereManuallyRemoved) { + constexpr int timeout = 1000; + + AddNotification("id", timeout); + RemoveNotification("id"); + + auto& observer = AddStrictObserverMock(); + + EXPECT_CALL(observer, OnNotificationRemoved).Times(0); + ForwardTimeInMs(timeout); +} + +TEST_F(AssistantNotificationControllerTest, + ShouldSupportExpiryTimeSetInUpdate) { + constexpr int timeout = 1000; + + AddNotification("id"); + UpdateNotification("id", timeout); + + auto& observer = AddStrictObserverMock(); + + EXPECT_CALL(observer, OnNotificationRemoved); + ForwardTimeInMs(timeout); +} + +TEST_F(AssistantNotificationControllerTest, + ShouldNotRemoveNotificationIfExpiryTimeIsClearedInUpdate) { + constexpr int timeout = 1000; + + AddNotification("id", timeout); + UpdateNotification("id"); + + auto& observer = AddStrictObserverMock(); + + EXPECT_CALL(observer, OnNotificationRemoved).Times(0); + ForwardTimeInMs(timeout); +} + +} // namespace ash
diff --git a/ash/assistant/assistant_notification_expiry_monitor.cc b/ash/assistant/assistant_notification_expiry_monitor.cc new file mode 100644 index 0000000..ad153820 --- /dev/null +++ b/ash/assistant/assistant_notification_expiry_monitor.cc
@@ -0,0 +1,130 @@ +// 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 "ash/assistant/assistant_notification_expiry_monitor.h" + +#include "ash/assistant/assistant_notification_controller.h" +#include "ash/assistant/model/assistant_notification_model.h" +#include "ash/assistant/model/assistant_notification_model_observer.h" +#include "base/bind.h" +#include "chromeos/services/assistant/public/mojom/assistant.mojom.h" + +namespace ash { + +namespace { + +bool HasExpired(const AssistantNotificationExpiryMonitor::AssistantNotification* + notification) { + return notification->expiry_time.has_value() && + (notification->expiry_time.value() <= base::Time::Now()); +} + +// Returns the minimum of the base::Time instances that actually have a value. +base::Optional<base::Time> Min(base::Optional<base::Time> left, + base::Optional<base::Time> right) { + if (!left.has_value()) + return right; + + if (!right.has_value()) + return left; + + return std::min(left.value(), right.value()); +} + +} // namespace + +class AssistantNotificationExpiryMonitor::Observer + : public AssistantNotificationModelObserver { + public: + Observer(AssistantNotificationExpiryMonitor* monitor) : monitor_(monitor) {} + ~Observer() override = default; + + void OnNotificationAdded(const AssistantNotification* notification) override { + monitor_->UpdateTimer(); + } + + void OnNotificationUpdated( + const AssistantNotification* notification) override { + monitor_->UpdateTimer(); + } + + void OnNotificationRemoved(const AssistantNotification* notification, + bool from_server) override { + monitor_->UpdateTimer(); + } + + void OnAllNotificationsRemoved(bool from_server) override { + monitor_->UpdateTimer(); + } + + private: + AssistantNotificationExpiryMonitor* const monitor_; + + DISALLOW_COPY_AND_ASSIGN(Observer); +}; + +AssistantNotificationExpiryMonitor::AssistantNotificationExpiryMonitor( + AssistantNotificationController* controller) + : controller_(controller), observer_(std::make_unique<Observer>(this)) { + DCHECK(controller_); + controller_->AddModelObserver(observer_.get()); +} + +AssistantNotificationExpiryMonitor::~AssistantNotificationExpiryMonitor() = + default; + +void AssistantNotificationExpiryMonitor::UpdateTimer() { + base::Optional<base::TimeDelta> timeout = GetTimerTimeout(); + if (timeout) { + timer_.Start( + FROM_HERE, timeout.value(), + base::BindOnce( + &AssistantNotificationExpiryMonitor::RemoveExpiredNotifications, + base::Unretained(this))); + } else { + timer_.Stop(); + } +} + +base::Optional<base::TimeDelta> +AssistantNotificationExpiryMonitor::GetTimerTimeout() const { + base::Optional<base::Time> endtime = GetTimerEndTime(); + if (endtime) + return endtime.value() - base::Time::Now(); + return base::nullopt; +} + +base::Optional<base::Time> AssistantNotificationExpiryMonitor::GetTimerEndTime() + const { + base::Optional<base::Time> result = base::nullopt; + for (const AssistantNotification* notification : GetNotifications()) + result = Min(result, notification->expiry_time); + return result; +} + +void AssistantNotificationExpiryMonitor::RemoveExpiredNotifications() { + for (const NotificationId& id : GetExpiredNotifications()) { + VLOG(1) << "Removing expired notification '" << id << "'"; + controller_->RemoveNotificationById(id, /*from_server=*/false); + } + + UpdateTimer(); +} + +std::vector<AssistantNotificationExpiryMonitor::NotificationId> +AssistantNotificationExpiryMonitor::GetExpiredNotifications() const { + std::vector<NotificationId> result; + for (const AssistantNotification* notification : GetNotifications()) { + if (HasExpired(notification)) + result.push_back(notification->client_id); + } + return result; +} + +std::vector<const AssistantNotificationExpiryMonitor::AssistantNotification*> +AssistantNotificationExpiryMonitor::GetNotifications() const { + return controller_->model()->GetNotifications(); +} + +} // namespace ash
diff --git a/ash/assistant/assistant_notification_expiry_monitor.h b/ash/assistant/assistant_notification_expiry_monitor.h new file mode 100644 index 0000000..ba99e5a1 --- /dev/null +++ b/ash/assistant/assistant_notification_expiry_monitor.h
@@ -0,0 +1,56 @@ +// 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 ASH_ASSISTANT_ASSISTANT_NOTIFICATION_EXPIRY_MONITOR_H_ +#define ASH_ASSISTANT_ASSISTANT_NOTIFICATION_EXPIRY_MONITOR_H_ + +#include <memory> +#include <vector> + +#include "ash/assistant/model/assistant_notification_model_observer.h" +#include "base/optional.h" +#include "base/timer/timer.h" + +namespace ash { + +class AssistantNotificationController; + +// Will track all Assistant notifications by subscribing to the given +// |controller| and will call +// |AssistantNotificationController::RemoveNotificationById| when the +// notification expires (i.e. when the current time passes the value in the +// expiry_time| field). +class AssistantNotificationExpiryMonitor { + public: + using AssistantNotification = + chromeos::assistant::mojom::AssistantNotification; + + explicit AssistantNotificationExpiryMonitor( + AssistantNotificationController* controller); + ~AssistantNotificationExpiryMonitor(); + + private: + using NotificationId = std::string; + class Observer; + + // Start/stop the timer waiting for the next expiry time. + // If the timer is already running this will start a new timer with the + // (new) expiry time that will expire first. + void UpdateTimer(); + + base::Optional<base::TimeDelta> GetTimerTimeout() const; + base::Optional<base::Time> GetTimerEndTime() const; + void RemoveExpiredNotifications(); + std::vector<NotificationId> GetExpiredNotifications() const; + std::vector<const AssistantNotification*> GetNotifications() const; + + base::OneShotTimer timer_; + AssistantNotificationController* const controller_; + std::unique_ptr<Observer> observer_; + + DISALLOW_COPY_AND_ASSIGN(AssistantNotificationExpiryMonitor); +}; + +} // namespace ash +#endif // ASH_ASSISTANT_ASSISTANT_NOTIFICATION_EXPIRY_MONITOR_H_
diff --git a/ash/assistant/assistant_prefs_controller.cc b/ash/assistant/assistant_prefs_controller.cc new file mode 100644 index 0000000..4fc95b5 --- /dev/null +++ b/ash/assistant/assistant_prefs_controller.cc
@@ -0,0 +1,82 @@ +// 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 "ash/assistant/assistant_prefs_controller.h" + +#include "ash/session/session_controller_impl.h" +#include "ash/shell.h" +#include "components/prefs/pref_change_registrar.h" +#include "components/prefs/pref_registry_simple.h" + +namespace ash { + +AssistantPrefsController::AssistantPrefsController() + : session_observer_(this) {} + +AssistantPrefsController::~AssistantPrefsController() = default; + +void AssistantPrefsController::AddObserver(AssistantPrefsObserver* observer) { + InitObserver(observer); + observers_.AddObserver(observer); +} + +void AssistantPrefsController::RemoveObserver( + AssistantPrefsObserver* observer) { + observers_.RemoveObserver(observer); +} + +void AssistantPrefsController::InitObserver(AssistantPrefsObserver* observer) { + PrefService* primary_user_prefs = + Shell::Get()->session_controller()->GetPrimaryUserPrefService(); + PrefService* active_prefs = + Shell::Get()->session_controller()->GetActivePrefService(); + + if (primary_user_prefs && primary_user_prefs == active_prefs) { + observer->OnAssistantConsentStatusUpdated(active_prefs->GetInteger( + chromeos::assistant::prefs::kAssistantConsentStatus)); + } +} + +PrefService* AssistantPrefsController::prefs() { + PrefService* primary_user_prefs = + Shell::Get()->session_controller()->GetPrimaryUserPrefService(); + PrefService* active_prefs = + Shell::Get()->session_controller()->GetActivePrefService(); + + DCHECK_EQ(primary_user_prefs, active_prefs); + return primary_user_prefs; +} + +void AssistantPrefsController::OnActiveUserPrefServiceChanged( + PrefService* pref_service) { + pref_change_registrar_.reset(); + + // If primary user is active, register pref change listeners. + PrefService* primary_user_prefs = + Shell::Get()->session_controller()->GetPrimaryUserPrefService(); + if (primary_user_prefs && primary_user_prefs == pref_service) { + for (auto& observer : observers_) + InitObserver(&observer); + + pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); + pref_change_registrar_->Init(pref_service); + + pref_change_registrar_->Add( + chromeos::assistant::prefs::kAssistantConsentStatus, + base::BindRepeating(&AssistantPrefsController::NotifyConsentStatus, + base::Unretained(this))); + } +} + +void AssistantPrefsController::NotifyConsentStatus() { + for (auto& observer : observers_) { + observer.OnAssistantConsentStatusUpdated( + Shell::Get() + ->session_controller() + ->GetPrimaryUserPrefService() + ->GetInteger(chromeos::assistant::prefs::kAssistantConsentStatus)); + } +} + +} // namespace ash
diff --git a/ash/assistant/assistant_prefs_controller.h b/ash/assistant/assistant_prefs_controller.h new file mode 100644 index 0000000..55a0c73 --- /dev/null +++ b/ash/assistant/assistant_prefs_controller.h
@@ -0,0 +1,59 @@ +// 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 ASH_ASSISTANT_ASSISTANT_PREFS_CONTROLLER_H_ +#define ASH_ASSISTANT_ASSISTANT_PREFS_CONTROLLER_H_ + +#include "ash/ash_export.h" +#include "ash/session/session_observer.h" +#include "base/macros.h" +#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" + +class PrefChangeRegistrar; + +namespace ash { + +// A checked observer which receives Assistant prefs change. +class ASH_EXPORT AssistantPrefsObserver : public base::CheckedObserver { + public: + AssistantPrefsObserver() = default; + ~AssistantPrefsObserver() override = default; + + virtual void OnAssistantConsentStatusUpdated(int consent_status) {} + + private: + DISALLOW_COPY_AND_ASSIGN(AssistantPrefsObserver); +}; + +class ASH_EXPORT AssistantPrefsController : public SessionObserver { + public: + AssistantPrefsController(); + ~AssistantPrefsController() override; + + void AddObserver(AssistantPrefsObserver* observer); + void RemoveObserver(AssistantPrefsObserver* observer); + void InitObserver(AssistantPrefsObserver* observer); + + PrefService* prefs(); + + private: + // SessionObserver: + void OnActiveUserPrefServiceChanged(PrefService* pref_service) override; + + // Called when the consent status is obtained from the pref service. + void NotifyConsentStatus(); + + // Observes user profile prefs for the Assistant. + std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; + + ScopedSessionObserver session_observer_; + + base::ObserverList<AssistantPrefsObserver> observers_; + + DISALLOW_COPY_AND_ASSIGN(AssistantPrefsController); +}; + +} // namespace ash + +#endif // ASH_ASSISTANT_ASSISTANT_PREFS_CONTROLLER_H_
diff --git a/ash/assistant/assistant_prefs_controller_unittest.cc b/ash/assistant/assistant_prefs_controller_unittest.cc new file mode 100644 index 0000000..0c1fbdf --- /dev/null +++ b/ash/assistant/assistant_prefs_controller_unittest.cc
@@ -0,0 +1,97 @@ +// 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 "ash/assistant/assistant_prefs_controller.h" + +#include <memory> + +#include "ash/assistant/assistant_controller.h" +#include "ash/shell.h" +#include "ash/test/ash_test_base.h" +#include "base/macros.h" +#include "base/test/scoped_feature_list.h" +#include "chromeos/constants/chromeos_switches.h" +#include "components/prefs/pref_service.h" + +namespace ash { + +class TestAssistantPrefsObserver : public AssistantPrefsObserver { + public: + TestAssistantPrefsObserver() = default; + ~TestAssistantPrefsObserver() override = default; + + // AssistantPrefsObserver: + void OnAssistantConsentStatusUpdated(int consent_status) override { + consent_status_ = consent_status; + } + + int consent_status() { return consent_status_; } + + private: + int consent_status_ = chromeos::assistant::prefs::ConsentStatus::kUnknown; + + DISALLOW_COPY_AND_ASSIGN(TestAssistantPrefsObserver); +}; + +class AssistantPrefsControllerTest : public AshTestBase { + protected: + AssistantPrefsControllerTest() = default; + ~AssistantPrefsControllerTest() override = default; + + void SetUp() override { + scoped_feature_list_.InitAndEnableFeature( + chromeos::switches::kAssistantFeature); + ASSERT_TRUE(chromeos::switches::IsAssistantEnabled()); + + AshTestBase::SetUp(); + + prefs_ = Shell::Get()->assistant_controller()->prefs_controller()->prefs(); + DCHECK(prefs_); + + observer_ = std::make_unique<TestAssistantPrefsObserver>(); + } + + PrefService* prefs() { return prefs_; } + + TestAssistantPrefsObserver* observer() { return observer_.get(); } + + private: + base::test::ScopedFeatureList scoped_feature_list_; + + PrefService* prefs_ = nullptr; + std::unique_ptr<TestAssistantPrefsObserver> observer_; + + DISALLOW_COPY_AND_ASSIGN(AssistantPrefsControllerTest); +}; + +TEST_F(AssistantPrefsControllerTest, InitObserver) { + prefs()->SetInteger( + chromeos::assistant::prefs::kAssistantConsentStatus, + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted); + + // The observer class should get an instant notification about the current + // pref value. + Shell::Get()->assistant_controller()->prefs_controller()->AddObserver( + observer()); + EXPECT_EQ(chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted, + observer()->consent_status()); +} + +TEST_F(AssistantPrefsControllerTest, NotifyConsentStatus) { + Shell::Get()->assistant_controller()->prefs_controller()->AddObserver( + observer()); + + prefs()->SetInteger(chromeos::assistant::prefs::kAssistantConsentStatus, + chromeos::assistant::prefs::ConsentStatus::kUnauthorized); + EXPECT_EQ(chromeos::assistant::prefs::ConsentStatus::kUnauthorized, + observer()->consent_status()); + + prefs()->SetInteger( + chromeos::assistant::prefs::kAssistantConsentStatus, + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted); + EXPECT_EQ(chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted, + observer()->consent_status()); +} + +} // namespace ash
diff --git a/ash/assistant/assistant_setup_controller.cc b/ash/assistant/assistant_setup_controller.cc index 2d5caf0..e0217fdc 100644 --- a/ash/assistant/assistant_setup_controller.cc +++ b/ash/assistant/assistant_setup_controller.cc
@@ -13,6 +13,7 @@ #include "ash/shell.h" #include "base/bind.h" #include "base/bind_helpers.h" +#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" #include "chromeos/services/assistant/public/features.h" namespace { @@ -57,11 +58,9 @@ } void AssistantSetupController::OnOptInButtonPressed() { - mojom::ConsentStatus consent_status = - VoiceInteractionController::Get()->consent_status().value_or( - mojom::ConsentStatus::kUnknown); - - if (consent_status == mojom::ConsentStatus::kUnauthorized) { + if (assistant_controller_->prefs_controller()->prefs()->GetInteger( + chromeos::assistant::prefs::kAssistantConsentStatus) == + chromeos::assistant::prefs::ConsentStatus::kUnauthorized) { assistant_controller_->OpenUrl(assistant::util::CreateLocalizedGURL( kGSuiteAdministratorInstructionsUrl)); } else {
diff --git a/ash/assistant/assistant_view_delegate_impl.cc b/ash/assistant/assistant_view_delegate_impl.cc index 7d21ef5..79163e2a 100644 --- a/ash/assistant/assistant_view_delegate_impl.cc +++ b/ash/assistant/assistant_view_delegate_impl.cc
@@ -9,6 +9,7 @@ #include "ash/assistant/assistant_controller_observer.h" #include "ash/assistant/assistant_interaction_controller.h" #include "ash/assistant/assistant_notification_controller.h" +#include "ash/assistant/assistant_prefs_controller.h" #include "ash/public/cpp/voice_interaction_controller.h" #include "ash/shell.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" @@ -91,14 +92,14 @@ assistant_controller_->ui_controller()->RemoveModelObserver(observer); } -void AssistantViewDelegateImpl::AddVoiceInteractionControllerObserver( - DefaultVoiceInteractionObserver* observer) { - VoiceInteractionController::Get()->AddLocalObserver(observer); +void AssistantViewDelegateImpl::AddAssistantPrefsObserver( + AssistantPrefsObserver* observer) { + assistant_controller_->prefs_controller()->AddObserver(observer); } -void AssistantViewDelegateImpl::RemoveVoiceInteractionControllerObserver( - DefaultVoiceInteractionObserver* observer) { - VoiceInteractionController::Get()->RemoveLocalObserver(observer); +void AssistantViewDelegateImpl::RemoveAssistantPrefsObserver( + AssistantPrefsObserver* observer) { + assistant_controller_->prefs_controller()->RemoveObserver(observer); } CaptionBarDelegate* AssistantViewDelegateImpl::GetCaptionBarDelegate() { @@ -111,9 +112,9 @@ assistant_controller_->DownloadImage(url, std::move(callback)); } -mojom::ConsentStatus AssistantViewDelegateImpl::GetConsentStatus() const { - return VoiceInteractionController::Get()->consent_status().value_or( - mojom::ConsentStatus::kUnknown); +int AssistantViewDelegateImpl::GetConsentStatus() const { + return assistant_controller_->prefs_controller()->prefs()->GetInteger( + chromeos::assistant::prefs::kAssistantConsentStatus); } ::wm::CursorManager* AssistantViewDelegateImpl::GetCursorManager() {
diff --git a/ash/assistant/assistant_view_delegate_impl.h b/ash/assistant/assistant_view_delegate_impl.h index 5564004..e7db110 100644 --- a/ash/assistant/assistant_view_delegate_impl.h +++ b/ash/assistant/assistant_view_delegate_impl.h
@@ -41,15 +41,13 @@ AssistantNotificationModelObserver* observer) override; void AddUiModelObserver(AssistantUiModelObserver* observer) override; void RemoveUiModelObserver(AssistantUiModelObserver* observer) override; - void AddVoiceInteractionControllerObserver( - DefaultVoiceInteractionObserver* observer) override; - void RemoveVoiceInteractionControllerObserver( - DefaultVoiceInteractionObserver* observer) override; + void AddAssistantPrefsObserver(AssistantPrefsObserver* observer) override; + void RemoveAssistantPrefsObserver(AssistantPrefsObserver* observer) override; CaptionBarDelegate* GetCaptionBarDelegate() override; void DownloadImage( const GURL& url, AssistantImageDownloader::DownloadCallback callback) override; - mojom::ConsentStatus GetConsentStatus() const override; + int GetConsentStatus() const override; ::wm::CursorManager* GetCursorManager() override; void GetNavigableContentsFactoryForView( mojo::PendingReceiver<content::mojom::NavigableContentsFactory> receiver)
diff --git a/ash/assistant/model/assistant_notification_model.cc b/ash/assistant/model/assistant_notification_model.cc index 875396f..af725f1 100644 --- a/ash/assistant/model/assistant_notification_model.cc +++ b/ash/assistant/model/assistant_notification_model.cc
@@ -79,11 +79,16 @@ } std::vector<const chromeos::assistant::mojom::AssistantNotification*> +AssistantNotificationModel::GetNotifications() const { + return GetNotificationsByType(base::nullopt); +} + +std::vector<const chromeos::assistant::mojom::AssistantNotification*> AssistantNotificationModel::GetNotificationsByType( - AssistantNotificationType type) const { + base::Optional<AssistantNotificationType> type) const { std::vector<const AssistantNotification*> notifications; for (const auto& notification : notifications_) { - if (notification.second->type == type) + if (!type || notification.second->type == type.value()) notifications.push_back(notification.second.get()); } return notifications;
diff --git a/ash/assistant/model/assistant_notification_model.h b/ash/assistant/model/assistant_notification_model.h index 22c8dbf..a203f99 100644 --- a/ash/assistant/model/assistant_notification_model.h +++ b/ash/assistant/model/assistant_notification_model.h
@@ -58,8 +58,12 @@ const AssistantNotification* GetNotificationById(const std::string& id) const; // Returns all notifications matching the specified |type|. + // Use base::nullopt to return all notifications independent of their type. std::vector<const AssistantNotification*> GetNotificationsByType( - AssistantNotificationType type) const; + base::Optional<AssistantNotificationType> type) const; + + // Returns all notifications (that have not been removed). + std::vector<const AssistantNotification*> GetNotifications() const; // Returns true if the model contains a notification uniquely identified by // |id|, otherwise false.
diff --git a/ash/assistant/ui/DEPS b/ash/assistant/ui/DEPS index bea464e..3db41ee 100644 --- a/ash/assistant/ui/DEPS +++ b/ash/assistant/ui/DEPS
@@ -1,6 +1,7 @@ noparent = True include_rules = [ + "+ash/assistant/assistant_prefs_controller.h", "+ash/assistant/model", "+ash/assistant/ui", "+ash/assistant/util",
diff --git a/ash/assistant/ui/assistant_view_delegate.h b/ash/assistant/ui/assistant_view_delegate.h index a27ec73..ab3155e 100644 --- a/ash/assistant/ui/assistant_view_delegate.h +++ b/ash/assistant/ui/assistant_view_delegate.h
@@ -8,6 +8,7 @@ #include <map> #include <string> +#include "ash/assistant/assistant_prefs_controller.h" #include "ash/assistant/model/assistant_cache_model.h" #include "ash/assistant/model/assistant_cache_model_observer.h" #include "ash/assistant/model/assistant_interaction_model.h" @@ -112,12 +113,11 @@ virtual void AddUiModelObserver(AssistantUiModelObserver* observer) = 0; virtual void RemoveUiModelObserver(AssistantUiModelObserver* observer) = 0; - // Adds/removes the voice interaction controller observer associated with the - // view delegate. - virtual void AddVoiceInteractionControllerObserver( - DefaultVoiceInteractionObserver* observer) = 0; - virtual void RemoveVoiceInteractionControllerObserver( - DefaultVoiceInteractionObserver* observer) = 0; + // Adds/removes the Assistant prefs observer associated with the view + // delegate. + virtual void AddAssistantPrefsObserver(AssistantPrefsObserver* observer) = 0; + virtual void RemoveAssistantPrefsObserver( + AssistantPrefsObserver* observer) = 0; // Gets the caption bar delegate associated with the view delegate. virtual CaptionBarDelegate* GetCaptionBarDelegate() = 0; @@ -130,7 +130,7 @@ AssistantImageDownloader::DownloadCallback callback) = 0; // Returns the status of the user's consent. - virtual mojom::ConsentStatus GetConsentStatus() const = 0; + virtual int GetConsentStatus() const = 0; // Returns the cursor_manager. virtual ::wm::CursorManager* GetCursorManager() = 0;
diff --git a/ash/assistant/ui/main_stage/assistant_footer_view.cc b/ash/assistant/ui/main_stage/assistant_footer_view.cc index c3aba0f6..e0d3d5f 100644 --- a/ash/assistant/ui/main_stage/assistant_footer_view.cc +++ b/ash/assistant/ui/main_stage/assistant_footer_view.cc
@@ -45,11 +45,11 @@ &AssistantFooterView::OnAnimationEnded, base::Unretained(this)))) { InitLayout(); - delegate_->AddVoiceInteractionControllerObserver(this); + delegate_->AddAssistantPrefsObserver(this); } AssistantFooterView::~AssistantFooterView() { - delegate_->RemoveVoiceInteractionControllerObserver(this); + delegate_->RemoveAssistantPrefsObserver(this); } const char* AssistantFooterView::GetClassName() const { @@ -68,8 +68,9 @@ SetLayoutManager(std::make_unique<views::FillLayout>()); // Initial view state is based on user consent state. - const bool consent_given = delegate_->GetConsentStatus() == - mojom::ConsentStatus::kActivityControlAccepted; + const bool consent_given = + delegate_->GetConsentStatus() == + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted; // Suggestion container. suggestion_container_ = new SuggestionContainerView(delegate_); @@ -96,14 +97,14 @@ AddChildView(opt_in_view_); } -void AssistantFooterView::OnVoiceInteractionConsentStatusUpdated( - mojom::ConsentStatus consent_status) { +void AssistantFooterView::OnAssistantConsentStatusUpdated(int consent_status) { using assistant::util::CreateLayerAnimationSequence; using assistant::util::CreateOpacityElement; using assistant::util::StartLayerAnimationSequence; const bool consent_given = - consent_status == mojom::ConsentStatus::kActivityControlAccepted; + consent_status == + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted; // When the consent state changes, we need to hide/show the appropriate views. views::View* hide_view = @@ -150,8 +151,9 @@ bool AssistantFooterView::OnAnimationEnded( const ui::CallbackLayerAnimationObserver& observer) { - const bool consent_given = delegate_->GetConsentStatus() == - mojom::ConsentStatus::kActivityControlAccepted; + const bool consent_given = + delegate_->GetConsentStatus() == + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted; // Only the view relevant to our consent state should process events. suggestion_container_->set_can_process_events_within_subtree(consent_given);
diff --git a/ash/assistant/ui/main_stage/assistant_footer_view.h b/ash/assistant/ui/main_stage/assistant_footer_view.h index 29d174d..33274fc 100644 --- a/ash/assistant/ui/main_stage/assistant_footer_view.h +++ b/ash/assistant/ui/main_stage/assistant_footer_view.h
@@ -8,8 +8,7 @@ #include <memory> #include <string> -#include "ash/public/cpp/assistant/default_voice_interaction_observer.h" -#include "ash/public/interfaces/voice_interaction_controller.mojom.h" +#include "ash/assistant/assistant_prefs_controller.h" #include "base/component_export.h" #include "base/macros.h" #include "ui/views/view.h" @@ -26,7 +25,7 @@ class COMPONENT_EXPORT(ASSISTANT_UI) AssistantFooterView : public views::View, - DefaultVoiceInteractionObserver { + public AssistantPrefsObserver { public: explicit AssistantFooterView(AssistantViewDelegate* delegate); ~AssistantFooterView() override; @@ -36,9 +35,8 @@ gfx::Size CalculatePreferredSize() const override; int GetHeightForWidth(int width) const override; - // mojom::VoiceInteractionObserver: - void OnVoiceInteractionConsentStatusUpdated( - mojom::ConsentStatus consent_status) override; + // AssistantPrefsObserver: + void OnAssistantConsentStatusUpdated(int consent_status) override; private: void InitLayout();
diff --git a/ash/assistant/ui/main_stage/assistant_opt_in_view.cc b/ash/assistant/ui/main_stage/assistant_opt_in_view.cc index e767cfc..858c5ab 100644 --- a/ash/assistant/ui/main_stage/assistant_opt_in_view.cc +++ b/ash/assistant/ui/main_stage/assistant_opt_in_view.cc
@@ -36,8 +36,9 @@ return style; } -base::string16 GetAction(mojom::ConsentStatus consent_status) { - return consent_status == mojom::ConsentStatus::kUnauthorized +base::string16 GetAction(int consent_status) { + return consent_status == + chromeos::assistant::prefs::ConsentStatus::kUnauthorized ? l10n_util::GetStringUTF16( IDS_ASH_ASSISTANT_OPT_IN_ASK_ADMINISTRATOR) : l10n_util::GetStringUTF16(IDS_ASH_ASSISTANT_OPT_IN_GET_STARTED); @@ -89,11 +90,11 @@ AssistantOptInView::AssistantOptInView(AssistantViewDelegate* delegate) : delegate_(delegate) { InitLayout(); - delegate_->AddVoiceInteractionControllerObserver(this); + delegate_->AddAssistantPrefsObserver(this); } AssistantOptInView::~AssistantOptInView() { - delegate_->RemoveVoiceInteractionControllerObserver(this); + delegate_->RemoveAssistantPrefsObserver(this); } const char* AssistantOptInView::GetClassName() const { @@ -113,8 +114,7 @@ delegate_->OnOptInButtonPressed(); } -void AssistantOptInView::OnVoiceInteractionConsentStatusUpdated( - mojom::ConsentStatus consent_status) { +void AssistantOptInView::OnAssistantConsentStatusUpdated(int consent_status) { UpdateLabel(consent_status); } @@ -155,7 +155,7 @@ UpdateLabel(delegate_->GetConsentStatus()); } -void AssistantOptInView::UpdateLabel(mojom::ConsentStatus consent_status) { +void AssistantOptInView::UpdateLabel(int consent_status) { // First substitution string: "Unlock more Assistant features." const base::string16 unlock_features = l10n_util::GetStringUTF16(IDS_ASH_ASSISTANT_OPT_IN_UNLOCK_MORE_FEATURES);
diff --git a/ash/assistant/ui/main_stage/assistant_opt_in_view.h b/ash/assistant/ui/main_stage/assistant_opt_in_view.h index 69ba51f..1f60521 100644 --- a/ash/assistant/ui/main_stage/assistant_opt_in_view.h +++ b/ash/assistant/ui/main_stage/assistant_opt_in_view.h
@@ -5,8 +5,7 @@ #ifndef ASH_ASSISTANT_UI_MAIN_STAGE_ASSISTANT_OPT_IN_VIEW_H_ #define ASH_ASSISTANT_UI_MAIN_STAGE_ASSISTANT_OPT_IN_VIEW_H_ -#include "ash/public/cpp/assistant/default_voice_interaction_observer.h" -#include "ash/public/interfaces/voice_interaction_controller.mojom.h" +#include "ash/assistant/assistant_prefs_controller.h" #include "base/component_export.h" #include "base/macros.h" #include "ui/views/controls/button/button.h" @@ -24,7 +23,7 @@ class COMPONENT_EXPORT(ASSISTANT_UI) AssistantOptInView : public views::View, public views::ButtonListener, - public DefaultVoiceInteractionObserver { + public AssistantPrefsObserver { public: explicit AssistantOptInView(AssistantViewDelegate* delegate_); ~AssistantOptInView() override; @@ -37,13 +36,12 @@ // views::ButtonListener: void ButtonPressed(views::Button* sender, const ui::Event& event) override; - // DefaultVoiceInteractionObserver: - void OnVoiceInteractionConsentStatusUpdated( - mojom::ConsentStatus consent_status) override; + // AssistantPrefsObserver: + void OnAssistantConsentStatusUpdated(int consent_status) override; private: void InitLayout(); - void UpdateLabel(mojom::ConsentStatus consent_status); + void UpdateLabel(int consent_status); views::StyledLabel* label_; // Owned by view hierarchy.
diff --git a/ash/public/cpp/app_list/app_list_config.cc b/ash/public/cpp/app_list/app_list_config.cc index 890c9ae..610bf4e3 100644 --- a/ash/public/cpp/app_list/app_list_config.cc +++ b/ash/public/cpp/app_list/app_list_config.cc
@@ -60,6 +60,7 @@ // TODO(manucornet): Share the value with ShelfConstants and use // 48 when the new shelf UI is turned off. shelf_height_(56), + background_radius_(shelf_height_ / 2), blur_radius_(30), contents_background_color_(SkColorSetRGB(0xF2, 0xF2, 0xF2)), grid_selected_color_(gfx::kGoogleBlue300),
diff --git a/ash/public/cpp/app_list/app_list_config.h b/ash/public/cpp/app_list/app_list_config.h index 18d873d..2b5a8230 100644 --- a/ash/public/cpp/app_list/app_list_config.h +++ b/ash/public/cpp/app_list/app_list_config.h
@@ -95,6 +95,7 @@ return grid_tile_spacing_in_folder_; } int shelf_height() const { return shelf_height_; } + int background_radius() const { return background_radius_; } int blur_radius() const { return blur_radius_; } SkColor contents_background_color() const { return contents_background_color_; @@ -304,6 +305,9 @@ // The height/width of the shelf from the bottom/side of the screen. const int shelf_height_; + // The background corner radius used for the app list. + const int background_radius_; + // The blur radius used in the app list. const int blur_radius_;
diff --git a/ash/public/cpp/assistant/assistant_state_base.h b/ash/public/cpp/assistant/assistant_state_base.h index d781681..d53ba422 100644 --- a/ash/public/cpp/assistant/assistant_state_base.h +++ b/ash/public/cpp/assistant/assistant_state_base.h
@@ -31,10 +31,6 @@ return settings_enabled_; } - const base::Optional<mojom::ConsentStatus>& consent_status() const { - return consent_status_; - } - const base::Optional<bool>& context_enabled() const { return context_enabled_; } @@ -68,9 +64,6 @@ // data is not available yet. base::Optional<bool> settings_enabled_; - // The status of the user's consent. nullopt if the data is not available yet. - base::Optional<mojom::ConsentStatus> consent_status_; - // Whether screen context is enabled. nullopt if the data is not available // yet. base::Optional<bool> context_enabled_;
diff --git a/ash/public/cpp/assistant/assistant_state_proxy.cc b/ash/public/cpp/assistant/assistant_state_proxy.cc index 0e40434..eeaf166 100644 --- a/ash/public/cpp/assistant/assistant_state_proxy.cc +++ b/ash/public/cpp/assistant/assistant_state_proxy.cc
@@ -35,8 +35,6 @@ observer->OnVoiceInteractionContextEnabled(context_enabled_.value()); if (hotword_enabled_.has_value()) observer->OnVoiceInteractionHotwordEnabled(hotword_enabled_.value()); - if (consent_status_.has_value()) - observer->OnVoiceInteractionConsentStatusUpdated(consent_status_.value()); if (hotword_always_on_.has_value()) observer->OnVoiceInteractionHotwordAlwaysOn(hotword_always_on_.value()); if (allowed_state_.has_value()) @@ -79,13 +77,6 @@ observer.OnVoiceInteractionHotwordEnabled(hotword_enabled_.value()); } -void AssistantStateProxy::OnVoiceInteractionConsentStatusUpdated( - mojom::ConsentStatus consent_status) { - consent_status_ = consent_status; - for (auto& observer : observers_) - observer.OnVoiceInteractionConsentStatusUpdated(consent_status_.value()); -} - void AssistantStateProxy::OnVoiceInteractionHotwordAlwaysOn(bool always_on) { hotword_always_on_ = always_on; for (auto& observer : observers_)
diff --git a/ash/public/cpp/assistant/assistant_state_proxy.h b/ash/public/cpp/assistant/assistant_state_proxy.h index c9ce46a..4bcda23 100644 --- a/ash/public/cpp/assistant/assistant_state_proxy.h +++ b/ash/public/cpp/assistant/assistant_state_proxy.h
@@ -44,8 +44,6 @@ void OnVoiceInteractionSettingsEnabled(bool enabled) override; void OnVoiceInteractionContextEnabled(bool enabled) override; void OnVoiceInteractionHotwordEnabled(bool enabled) override; - void OnVoiceInteractionConsentStatusUpdated( - mojom::ConsentStatus consent_status) override; void OnVoiceInteractionHotwordAlwaysOn(bool always_on) override; void OnAssistantFeatureAllowedChanged( mojom::AssistantAllowedState state) override;
diff --git a/ash/public/cpp/assistant/default_voice_interaction_observer.h b/ash/public/cpp/assistant/default_voice_interaction_observer.h index 951afd19..83eedb9 100644 --- a/ash/public/cpp/assistant/default_voice_interaction_observer.h +++ b/ash/public/cpp/assistant/default_voice_interaction_observer.h
@@ -28,8 +28,6 @@ void OnVoiceInteractionSettingsEnabled(bool enabled) override {} void OnVoiceInteractionContextEnabled(bool enabled) override {} void OnVoiceInteractionHotwordEnabled(bool enabled) override {} - void OnVoiceInteractionConsentStatusUpdated( - ash::mojom::ConsentStatus consent_status) override {} void OnVoiceInteractionHotwordAlwaysOn(bool always_on) override {} void OnAssistantFeatureAllowedChanged( ash::mojom::AssistantAllowedState state) override {}
diff --git a/ash/public/cpp/voice_interaction_controller.cc b/ash/public/cpp/voice_interaction_controller.cc index 2f12873..a924a8b 100644 --- a/ash/public/cpp/voice_interaction_controller.cc +++ b/ash/public/cpp/voice_interaction_controller.cc
@@ -96,19 +96,6 @@ observer.OnVoiceInteractionHotwordAlwaysOn(always_on); } -void VoiceInteractionController::NotifyConsentStatus( - mojom::ConsentStatus consent_status) { - if (consent_status_.has_value() && consent_status_.value() == consent_status) - return; - - consent_status_ = consent_status; - observers_.ForAllPtrs([consent_status](auto* observer) { - observer->OnVoiceInteractionConsentStatusUpdated(consent_status); - }); - for (auto& observer : local_observers_) - observer.OnVoiceInteractionConsentStatusUpdated(consent_status); -} - void VoiceInteractionController::NotifyFeatureAllowed( mojom::AssistantAllowedState state) { if (allowed_state_ == state) @@ -198,8 +185,6 @@ observer->OnVoiceInteractionContextEnabled(context_enabled_.value()); if (hotword_enabled_.has_value()) observer->OnVoiceInteractionHotwordEnabled(hotword_enabled_.value()); - if (consent_status_.has_value()) - observer->OnVoiceInteractionConsentStatusUpdated(consent_status_.value()); if (hotword_always_on_.has_value()) observer->OnVoiceInteractionHotwordAlwaysOn(hotword_always_on_.value()); if (allowed_state_.has_value())
diff --git a/ash/public/cpp/voice_interaction_controller.h b/ash/public/cpp/voice_interaction_controller.h index bc87a0cf..e66b479 100644 --- a/ash/public/cpp/voice_interaction_controller.h +++ b/ash/public/cpp/voice_interaction_controller.h
@@ -45,9 +45,6 @@ // Called when the hotword is set to always on/only with power source. virtual void NotifyHotwordAlwaysOn(bool always_on); - // Called when the consent status is obtained from the server. - virtual void NotifyConsentStatus(mojom::ConsentStatus consent_status); - // Notify if voice interaction feature is allowed or not. e.g. not allowed // if disabled by policy. virtual void NotifyFeatureAllowed(mojom::AssistantAllowedState state);
diff --git a/ash/public/cpp/voice_interaction_controller_unittest.cc b/ash/public/cpp/voice_interaction_controller_unittest.cc index 261fcd4..dbb6d345 100644 --- a/ash/public/cpp/voice_interaction_controller_unittest.cc +++ b/ash/public/cpp/voice_interaction_controller_unittest.cc
@@ -38,10 +38,6 @@ void OnVoiceInteractionHotwordEnabled(bool enabled) override { hotword_enabled_ = enabled; } - void OnVoiceInteractionConsentStatusUpdated( - mojom::ConsentStatus consent_status) override { - consent_status_ = consent_status; - } void OnAssistantFeatureAllowedChanged( mojom::AssistantAllowedState state) override {} void OnLocaleChanged(const std::string& locale) override {} @@ -58,7 +54,6 @@ bool hotword_always_on() const { return hotword_always_on_; } bool hotword_enabled() const { return hotword_enabled_; } bool arc_play_store_enabled() const { return arc_play_store_enabled_; } - mojom::ConsentStatus consent_status() const { return consent_status_; } void SetVoiceInteractionController(VoiceInteractionController* controller) { mojom::VoiceInteractionObserverPtr ptr; @@ -73,7 +68,6 @@ bool hotword_always_on_ = false; bool hotword_enabled_ = false; bool arc_play_store_enabled_ = false; - mojom::ConsentStatus consent_status_ = mojom::ConsentStatus::kUnknown; mojo::Binding<mojom::VoiceInteractionObserver> voice_interaction_binding_; @@ -152,18 +146,6 @@ EXPECT_TRUE(observer()->hotword_enabled()); } -TEST_F(VoiceInteractionControllerTest, NotifyConsentStatus) { - controller()->NotifyConsentStatus( - mojom::ConsentStatus::kActivityControlAccepted); - controller()->FlushForTesting(); - // The cached state should be updated. - EXPECT_TRUE(controller()->consent_status() == - mojom::ConsentStatus::kActivityControlAccepted); - // The observers should be notified. - EXPECT_TRUE(observer()->consent_status() == - mojom::ConsentStatus::kActivityControlAccepted); -} - TEST_F(VoiceInteractionControllerTest, NotifyArcPlayStoreEnabledChanged) { controller()->NotifyArcPlayStoreEnabledChanged(true); controller()->FlushForTesting();
diff --git a/ash/public/interfaces/voice_interaction_controller.mojom b/ash/public/interfaces/voice_interaction_controller.mojom index 21b618f..e3be921 100644 --- a/ash/public/interfaces/voice_interaction_controller.mojom +++ b/ash/public/interfaces/voice_interaction_controller.mojom
@@ -65,9 +65,6 @@ // Called when hotword is set to always on/only with power source. OnVoiceInteractionHotwordAlwaysOn(bool always_on); - // Called when consent status is updated. - OnVoiceInteractionConsentStatusUpdated(ConsentStatus consent_status); - // Called when assistant feature allowed state has changed. OnAssistantFeatureAllowedChanged(AssistantAllowedState state); @@ -89,20 +86,3 @@ // Add an observer. AddObserver(VoiceInteractionObserver observer); }; - -// The status of the user's consent. The enum values cannot be changed because -// they are persisted on disk. -enum ConsentStatus { - // The status is unknown. - kUnknown = 0, - - // The user accepted activity control access. - kActivityControlAccepted = 1, - - // The user is not authorized to give consent. - kUnauthorized = 2, - - // The user's consent information is not found. This is typically the case - // when consent from the user has never been requested. - kNotFound = 3, -};
diff --git a/ash/system/message_center/OWNERS b/ash/system/message_center/OWNERS index 577bbabd6..a8cc478a 100644 --- a/ash/system/message_center/OWNERS +++ b/ash/system/message_center/OWNERS
@@ -1 +1,2 @@ file://ui/message_center/OWNERS +# COMPONENT: UI>Shell>Notifications
diff --git a/ash/system/network/OWNERS b/ash/system/network/OWNERS index 85991f46..504282d 100644 --- a/ash/system/network/OWNERS +++ b/ash/system/network/OWNERS
@@ -2,3 +2,4 @@ stevenjb@chromium.org tbarzic@chromium.org tonydeluna@chromium.org +# COMPONENT: OS>Systems>Network
diff --git a/ash/wm/desks/desks_unittests.cc b/ash/wm/desks/desks_unittests.cc index 8a563af6..0c80ae6 100644 --- a/ash/wm/desks/desks_unittests.cc +++ b/ash/wm/desks/desks_unittests.cc
@@ -1054,8 +1054,8 @@ EXPECT_EQ(target_bounds_before_drag, overview_item->target_bounds()); EXPECT_TRUE(DoesActiveDeskContainWindow(win1.get())); - // Now drag it to desk_2's mini_view. The overview grid should now show the - // "no-windows" widget, and the window should move to desk_2. + // Now drag it to desk_2's mini_view. The overview grid should now have only + // `win2`, and `win1` should move to desk_2. auto* desk_2_mini_view = desks_bar_view->mini_views()[1].get(); EXPECT_EQ(desk_2, desk_2_mini_view->desk()); DragItemToPoint(overview_item,
diff --git a/ash/wm/overview/overview_grid.cc b/ash/wm/overview/overview_grid.cc index eaef353..bcdd4ac 100644 --- a/ash/wm/overview/overview_grid.cc +++ b/ash/wm/overview/overview_grid.cc
@@ -1190,14 +1190,17 @@ return effective_bounds; } -bool OverviewGrid::UpdateDesksBarDragDetails(const gfx::Point& screen_location, - bool for_drop) { +bool OverviewGrid::IntersectsWithDesksBar(const gfx::Point& screen_location, + bool update_desks_bar_drag_details, + bool for_drop) { DCHECK(desks_util::ShouldDesksBarBeCreated()); const bool dragged_item_over_bar = desks_widget_->GetWindowBoundsInScreen().Contains(screen_location); - desks_bar_view_->SetDragDetails(screen_location, - !for_drop && dragged_item_over_bar); + if (update_desks_bar_drag_details) { + desks_bar_view_->SetDragDetails(screen_location, + !for_drop && dragged_item_over_bar); + } return dragged_item_over_bar; } @@ -1207,8 +1210,11 @@ DCHECK(desks_util::ShouldDesksBarBeCreated()); // End the drag for the DesksBarView. - if (!UpdateDesksBarDragDetails(screen_location, /*for_drop=*/true)) + if (!IntersectsWithDesksBar(screen_location, + /*update_desks_bar_drag_details=*/true, + /*for_drop=*/true)) { return false; + } auto* desks_controller = DesksController::Get(); for (auto& mini_view : desks_bar_view_->mini_views()) {
diff --git a/ash/wm/overview/overview_grid.h b/ash/wm/overview/overview_grid.h index e01ce6a..d927cd5 100644 --- a/ash/wm/overview/overview_grid.h +++ b/ash/wm/overview/overview_grid.h
@@ -248,13 +248,15 @@ // positioned, taking into account the availability of the Desks bar). gfx::Rect GetGridEffectiveBounds() const; - // Called when a window is being dragged in Overview Mode to update the drag - // details (screen_location, and whether that location intersects with the - // desks bar widget. |for_drop| should be set to true if this is called when - // the item is being dropped when the drag is complete + // Called when a window is being dragged in Overview Mode. If + // |update_desks_bar_drag_details| is true, it will update the drag details + // (screen_location, and whether that location intersects with the + // desks bar widget). |for_drop| should be set to true if this is called when + // the item is being dropped when the drag is complete. // Returns true if |screen_location| does intersect with the DesksBarView. - bool UpdateDesksBarDragDetails(const gfx::Point& screen_location, - bool for_drop); + bool IntersectsWithDesksBar(const gfx::Point& screen_location, + bool update_desks_bar_drag_details, + bool for_drop); // Updates the drag details for DesksBarView to end the drag and move the // window of |drag_item| to another desk if it was dropped on a mini_view of
diff --git a/ash/wm/overview/overview_window_drag_controller.cc b/ash/wm/overview/overview_window_drag_controller.cc index b5698e2..a2f2f04 100644 --- a/ash/wm/overview/overview_window_drag_controller.cc +++ b/ash/wm/overview/overview_window_drag_controller.cc
@@ -298,6 +298,18 @@ const gfx::PointF centerpoint = location_in_screen - (initial_event_location_ - initial_centerpoint_); + // If the drag location intersects with the desk bar, then we should cancel + // the drag-to-close mode and start the normal drag mode. + if (virtual_desks_bar_enabled_ && + item_->overview_grid()->IntersectsWithDesksBar( + gfx::ToRoundedPoint(location_in_screen), + /*update_desks_bar_drag_details=*/false, /*for_drop=*/false)) { + item_->SetOpacity(original_opacity_); + StartNormalDragMode(location_in_screen); + ContinueNormalDrag(location_in_screen); + return; + } + // Update |item_|'s opacity based on its distance. |item_|'s x coordinate // should not change while in drag to close state. float val = std::abs(location_in_screen.y() - initial_event_location_.y()) / @@ -348,8 +360,9 @@ bool allow_original_window_opacity_change = true; if (virtual_desks_bar_enabled_) { - if (item_->overview_grid()->UpdateDesksBarDragDetails( - gfx::ToRoundedPoint(location_in_screen), /*for_drop=*/false)) { + if (item_->overview_grid()->IntersectsWithDesksBar( + gfx::ToRoundedPoint(location_in_screen), + /*update_desks_bar_drag_details=*/true, /*for_drop=*/false)) { // The drag location intersects the bounds of the DesksBarView, in this // case we scale down the item, and center it around the drag location. bounds.set_size(on_desks_bar_item_size_);
diff --git a/ash/wm/overview/overview_window_drag_controller_unittest.cc b/ash/wm/overview/overview_window_drag_controller_unittest.cc index ab30437f..7584bb4 100644 --- a/ash/wm/overview/overview_window_drag_controller_unittest.cc +++ b/ash/wm/overview/overview_window_drag_controller_unittest.cc
@@ -7,6 +7,9 @@ #include "ash/public/cpp/ash_features.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" +#include "ash/wm/desks/desk.h" +#include "ash/wm/desks/desk_mini_view.h" +#include "ash/wm/desks/desks_bar_view.h" #include "ash/wm/mru_window_tracker.h" #include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_grid.h" @@ -198,4 +201,80 @@ EXPECT_EQ(target_bounds_before_drag, overview_item->target_bounds()); } +class OverviewWindowDragControllerWithDesksTest : public AshTestBase { + public: + OverviewWindowDragControllerWithDesksTest() = default; + ~OverviewWindowDragControllerWithDesksTest() override = default; + + // AshTestBase: + void SetUp() override { + scoped_feature_list_.InitAndEnableFeature(features::kVirtualDesks); + + AshTestBase::SetUp(); + } + + private: + base::test::ScopedFeatureList scoped_feature_list_; + + DISALLOW_COPY_AND_ASSIGN(OverviewWindowDragControllerWithDesksTest); +}; + +TEST_F(OverviewWindowDragControllerWithDesksTest, + SwitchDragToCloseToNormalDragWhendraggedToDesk) { + UpdateDisplay("600x800"); + auto* controller = DesksController::Get(); + controller->NewDesk(); + ASSERT_EQ(2u, controller->desks().size()); + + auto window = CreateTestWindow(gfx::Rect(0, 0, 250, 100)); + wm::ActivateWindow(window.get()); + EXPECT_EQ(window.get(), wm::GetActiveWindow()); + + auto* overview_controller = Shell::Get()->overview_controller(); + overview_controller->StartOverview(); + EXPECT_TRUE(overview_controller->InOverviewSession()); + auto* overview_session = overview_controller->overview_session(); + const auto* overview_grid = + overview_session->GetGridWithRootWindow(Shell::GetPrimaryRootWindow()); + ASSERT_TRUE(overview_grid); + const auto* desks_bar_view = overview_grid->desks_bar_view(); + ASSERT_TRUE(desks_bar_view); + auto* overview_item = + overview_session->GetOverviewItemForWindow(window.get()); + ASSERT_TRUE(overview_item); + const gfx::RectF target_bounds_before_drag = overview_item->target_bounds(); + + // Drag with touch gesture only vertically without intersecting with the desk + // bar, which should trigger the drag-to-close mode. + const int item_center_to_desks_bar_bottom = + gfx::ToRoundedPoint(target_bounds_before_drag.CenterPoint()).y() - + desks_bar_view->GetBoundsInScreen().bottom(); + EXPECT_GT(item_center_to_desks_bar_bottom, 0); + const int space_to_leave = 20; + auto* event_generator = GetEventGenerator(); + StartDraggingItemBy(overview_item, 0, + -(item_center_to_desks_bar_bottom - space_to_leave), + /*by_touch_gestures=*/true, event_generator); + OverviewWindowDragController* drag_controller = + overview_session->window_drag_controller(); + EXPECT_EQ(OverviewWindowDragController::DragBehavior::kDragToClose, + drag_controller->current_drag_behavior()); + // Continue dragging vertically up such that the drag location intersects with + // the desks bar. Expect that normal drag is now triggered. + event_generator->MoveTouchBy(0, -(space_to_leave + 10)); + EXPECT_EQ(OverviewWindowDragController::DragBehavior::kNormalDrag, + drag_controller->current_drag_behavior()); + // Now it's possible to drop it on desk_2's mini_view. + auto* desk_2_mini_view = desks_bar_view->mini_views()[1].get(); + ASSERT_TRUE(desk_2_mini_view); + event_generator->MoveTouch( + desk_2_mini_view->GetBoundsInScreen().CenterPoint()); + event_generator->ReleaseTouch(); + EXPECT_TRUE(overview_controller->InOverviewSession()); + EXPECT_TRUE(overview_grid->empty()); + const Desk* desk_2 = controller->desks()[1].get(); + EXPECT_TRUE(base::Contains(desk_2->windows(), window.get())); + EXPECT_TRUE(overview_session->no_windows_widget_for_testing()); +} + } // namespace ash
diff --git a/base/bind.h b/base/bind.h index 6554485..7a400af 100644 --- a/base/bind.h +++ b/base/bind.h
@@ -293,7 +293,7 @@ return closure; } -// Unretained() allows Bind() to bind a non-refcounted class, and to disable +// Unretained() allows binding a non-refcounted class, and to disable // refcounting on arguments that are refcounted objects. // // EXAMPLE OF Unretained(): @@ -305,9 +305,9 @@ // // // In some function somewhere. // Foo foo; -// Closure foo_callback = -// Bind(&Foo::func, Unretained(&foo)); -// foo_callback.Run(); // Prints "Foo:f". +// OnceClosure foo_callback = +// BindOnce(&Foo::func, Unretained(&foo)); +// std::move(foo_callback).Run(); // Prints "Foo:f". // // Without the Unretained() wrapper on |&foo|, the above call would fail // to compile because Foo does not support the AddRef() and Release() methods. @@ -324,13 +324,13 @@ // void foo(RefCountedBytes* bytes) {} // // scoped_refptr<RefCountedBytes> bytes = ...; -// Closure callback = Bind(&foo, base::RetainedRef(bytes)); -// callback.Run(); +// OnceClosure callback = BindOnce(&foo, base::RetainedRef(bytes)); +// std::move(callback).Run(); // // Without RetainedRef, the scoped_refptr would try to implicitly convert to // a raw pointer and fail compilation: // -// Closure callback = Bind(&foo, bytes); // ERROR! +// OnceClosure callback = BindOnce(&foo, bytes); // ERROR! template <typename T> static inline internal::RetainedRefWrapper<T> RetainedRef(T* o) { return internal::RetainedRefWrapper<T>(o); @@ -340,26 +340,26 @@ return internal::RetainedRefWrapper<T>(std::move(o)); } -// Owned() transfers ownership of an object to the Callback resulting from -// bind; the object will be deleted when the Callback is deleted. +// Owned() transfers ownership of an object to the callback resulting from +// bind; the object will be deleted when the callback is deleted. // // EXAMPLE OF Owned(): // // void foo(int* arg) { cout << *arg << endl } // // int* pn = new int(1); -// Closure foo_callback = Bind(&foo, Owned(pn)); +// RepeatingClosure foo_callback = BindRepeating(&foo, Owned(pn)); // // foo_callback.Run(); // Prints "1" // foo_callback.Run(); // Prints "1" -// *n = 2; +// *pn = 2; // foo_callback.Run(); // Prints "2" // // foo_callback.Reset(); // |pn| is deleted. Also will happen when // // |foo_callback| goes out of scope. // // Without Owned(), someone would have to know to delete |pn| when the last -// reference to the Callback is deleted. +// reference to the callback is deleted. template <typename T> static inline internal::OwnedWrapper<T> Owned(T* o) { return internal::OwnedWrapper<T>(o); @@ -371,9 +371,9 @@ } // Passed() is for transferring movable-but-not-copyable types (eg. unique_ptr) -// through a Callback. Logically, this signifies a destructive transfer of -// the state of the argument into the target function. Invoking -// Callback::Run() twice on a Callback that was created with a Passed() +// through a RepeatingCallback. Logically, this signifies a destructive transfer +// of the state of the argument into the target function. Invoking +// RepeatingCallback::Run() twice on a callback that was created with a Passed() // argument will CHECK() because the first invocation would have already // transferred ownership to the target function. // @@ -390,22 +390,22 @@ // // // |cb| is given ownership of Foo(). |f| is now NULL. // // You can use std::move(f) in place of &f, but it's more verbose. -// Closure cb = Bind(&TakesOwnership, Passed(&f)); +// RepeatingClosure cb = BindRepeating(&TakesOwnership, Passed(&f)); // // // Run was never called so |cb| still owns Foo() and deletes // // it on Reset(). // cb.Reset(); // // // |cb| is given a new Foo created by CreateFoo(). -// cb = Bind(&TakesOwnership, Passed(CreateFoo())); +// cb = BindRepeating(&TakesOwnership, Passed(CreateFoo())); // // // |arg| in TakesOwnership() is given ownership of Foo(). |cb| // // no longer owns Foo() and, if reset, would not delete Foo(). // cb.Run(); // Foo() is now transferred to |arg| and deleted. // cb.Run(); // This CHECK()s since Foo() already been used once. // -// We offer 2 syntaxes for calling Passed(). The first takes an rvalue and -// is best suited for use with the return value of a function or other temporary +// We offer 2 syntaxes for calling Passed(). The first takes an rvalue and is +// best suited for use with the return value of a function or other temporary // rvalues. The second takes a pointer to the scoper and is just syntactic sugar // to avoid having to write Passed(std::move(scoper)). // @@ -421,21 +421,21 @@ return internal::PassedWrapper<T>(std::move(*scoper)); } -// IgnoreResult() is used to adapt a function or Callback with a return type to +// IgnoreResult() is used to adapt a function or callback with a return type to // one with a void return. This is most useful if you have a function with, // say, a pesky ignorable bool return that you want to use with PostTask or -// something else that expect a Callback with a void return. +// something else that expect a callback with a void return. // // EXAMPLE OF IgnoreResult(): // // int DoSomething(int arg) { cout << arg << endl; } // -// // Assign to a Callback with a void return type. -// Callback<void(int)> cb = Bind(IgnoreResult(&DoSomething)); -// cb->Run(1); // Prints "1". +// // Assign to a callback with a void return type. +// OnceCallback<void(int)> cb = BindOnce(IgnoreResult(&DoSomething)); +// std::move(cb).Run(1); // Prints "1". // -// // Prints "1" on |ml|. -// ml->PostTask(FROM_HERE, BindOnce(IgnoreResult(&DoSomething), 1); +// // Prints "2" on |ml|. +// ml->PostTask(FROM_HERE, BindOnce(IgnoreResult(&DoSomething), 2); template <typename T> static inline internal::IgnoreResultHelper<T> IgnoreResult(T data) { return internal::IgnoreResultHelper<T>(std::move(data)); @@ -450,8 +450,9 @@ // EXAMPLE OF RetainBlock(): // // // Wrap the block and bind it to a callback. -// Callback<void(int)> cb = Bind(RetainBlock(^(int n) { NSLog(@"%d", n); })); -// cb.Run(1); // Logs "1". +// OnceCallback<void(int)> cb = +// BindOnce(RetainBlock(^(int n) { NSLog(@"%d", n); })); +// std::move(cb).Run(1); // Logs "1". template <typename R, typename... Args> base::mac::ScopedBlock<R (^)(Args...)> RetainBlock(R (^block)(Args...)) { return base::mac::ScopedBlock<R (^)(Args...)>(block,
diff --git a/base/bind_helpers.h b/base/bind_helpers.h index 15961e6..37065a0 100644 --- a/base/bind_helpers.h +++ b/base/bind_helpers.h
@@ -16,7 +16,7 @@ #include "build/build_config.h" // This defines a set of simple functions and utilities that people want when -// using Callback<> and Bind(). +// using {Once,Repeating}Callback<> and Bind{Once,Repeating}(). namespace base {
diff --git a/base/bind_unittest.cc b/base/bind_unittest.cc index 4dd03e5..9bf85ab 100644 --- a/base/bind_unittest.cc +++ b/base/bind_unittest.cc
@@ -311,7 +311,7 @@ return n; } -void TakesACallback(const Closure& callback) { +void TakesACallback(const RepeatingClosure& callback) { callback.Run(); } @@ -363,31 +363,32 @@ } TEST_F(BindTest, BasicTest) { - Callback<int(int, int, int)> cb = Bind(&Sum, 32, 16, 8); + RepeatingCallback<int(int, int, int)> cb = BindRepeating(&Sum, 32, 16, 8); EXPECT_EQ(92, cb.Run(13, 12, 11)); - Callback<int(int, int, int, int, int, int)> c1 = Bind(&Sum); + RepeatingCallback<int(int, int, int, int, int, int)> c1 = BindRepeating(&Sum); EXPECT_EQ(69, c1.Run(14, 13, 12, 11, 10, 9)); - Callback<int(int, int, int)> c2 = Bind(c1, 32, 16, 8); + RepeatingCallback<int(int, int, int)> c2 = BindRepeating(c1, 32, 16, 8); EXPECT_EQ(86, c2.Run(11, 10, 9)); - Callback<int()> c3 = Bind(c2, 4, 2, 1); + RepeatingCallback<int()> c3 = BindRepeating(c2, 4, 2, 1); EXPECT_EQ(63, c3.Run()); } -// Test that currying the rvalue result of another Bind() works correctly. -// - rvalue should be usable as argument to Bind(). -// - multiple runs of resulting Callback remain valid. +// Test that currying the rvalue result of another BindRepeating() works +// correctly. +// - rvalue should be usable as argument to BindRepeating(). +// - multiple runs of resulting RepeatingCallback remain valid. TEST_F(BindTest, CurryingRvalueResultOfBind) { int n = 0; RepeatingClosure cb = BindRepeating(&TakesACallback, BindRepeating(&PtrArgSet, &n)); - // If we implement Bind() such that the return value has auto_ptr-like - // semantics, the second call here will fail because ownership of - // the internal BindState<> would have been transfered to a *temporary* - // constructon of a Callback object on the first call. + // If we implement BindRepeating() such that the return value has + // auto_ptr-like semantics, the second call here will fail because ownership + // of the internal BindState<> would have been transferred to a *temporary* + // construction of a RepeatingCallback object on the first call. cb.Run(); EXPECT_EQ(2, n); @@ -633,8 +634,8 @@ BindOnce(&NoRef::VoidConstMethod0, const_weak_factory.GetWeakPtr()); OnceClosure const_method_const_ptr_cb = BindOnce(&NoRef::VoidConstMethod0, const_weak_factory.GetWeakPtr()); - Callback<int(int)> normal_func_cb = - Bind(&FunctionWithWeakFirstParam, weak_factory.GetWeakPtr()); + OnceCallback<int(int)> normal_func_cb = + BindOnce(&FunctionWithWeakFirstParam, weak_factory.GetWeakPtr()); weak_factory.InvalidateWeakPtrs(); const_weak_factory.InvalidateWeakPtrs(); @@ -1056,7 +1057,8 @@ int deletes = 0; TypeParam ptr(new DeleteCounter(&deletes)); - Callback<TypeParam()> callback = Bind(&PassThru<TypeParam>, Passed(&ptr)); + RepeatingCallback<TypeParam()> callback = + BindRepeating(&PassThru<TypeParam>, Passed(&ptr)); EXPECT_FALSE(ptr.get()); EXPECT_EQ(0, deletes); @@ -1067,7 +1069,7 @@ TYPED_TEST(BindMoveOnlyTypeTest, PassedWithRvalue) { int deletes = 0; - Callback<TypeParam()> callback = Bind( + RepeatingCallback<TypeParam()> callback = BindRepeating( &PassThru<TypeParam>, Passed(TypeParam(new DeleteCounter(&deletes)))); EXPECT_EQ(0, deletes); @@ -1080,8 +1082,8 @@ TYPED_TEST(BindMoveOnlyTypeTest, ReturnMoveOnlyType) { int deletes = 0; DeleteCounter* counter = new DeleteCounter(&deletes); - Callback<TypeParam()> callback = - Bind(&PassThru<TypeParam>, Passed(TypeParam(counter))); + RepeatingCallback<TypeParam()> callback = + BindRepeating(&PassThru<TypeParam>, Passed(TypeParam(counter))); TypeParam result = callback.Run(); ASSERT_EQ(counter, result.get()); EXPECT_EQ(0, deletes); @@ -1099,7 +1101,8 @@ int deletes = 0; TypeParam ptr(new DeleteCounter(&deletes)); // Test unbound argument forwarding. - Callback<TypeParam(TypeParam)> cb_unbound = Bind(&PassThru<TypeParam>); + RepeatingCallback<TypeParam(TypeParam)> cb_unbound = + BindRepeating(&PassThru<TypeParam>); cb_unbound.Run(std::move(ptr)); EXPECT_EQ(1, deletes); } @@ -1123,14 +1126,14 @@ v.push_back(std::make_unique<int>(12345)); // Early binding should work: - base::Callback<MoveOnlyVector()> bound_cb = - base::Bind(&AcceptAndReturnMoveOnlyVector, Passed(&v)); + base::RepeatingCallback<MoveOnlyVector()> bound_cb = + base::BindRepeating(&AcceptAndReturnMoveOnlyVector, Passed(&v)); MoveOnlyVector intermediate_result = bound_cb.Run(); VerifyVector(intermediate_result); // As should passing it as an argument to Run(): - base::Callback<MoveOnlyVector(MoveOnlyVector)> unbound_cb = - base::Bind(&AcceptAndReturnMoveOnlyVector); + base::RepeatingCallback<MoveOnlyVector(MoveOnlyVector)> unbound_cb = + base::BindRepeating(&AcceptAndReturnMoveOnlyVector); MoveOnlyVector final_result = unbound_cb.Run(std::move(intermediate_result)); VerifyVector(final_result); } @@ -1311,8 +1314,8 @@ EXPECT_EQ(42, Bind([](int i) { return i * 7; }, 6).Run()); int x = 1; - base::Callback<void(int)> cb = - Bind([](int* x, int i) { *x *= i; }, Unretained(&x)); + base::RepeatingCallback<void(int)> cb = + BindRepeating([](int* x, int i) { *x *= i; }, Unretained(&x)); cb.Run(6); EXPECT_EQ(6, x); cb.Run(7); @@ -1496,10 +1499,10 @@ // - Can bind a __fastcall function. // - Can bind a __stdcall function. TEST_F(BindTest, WindowsCallingConventions) { - Callback<int()> fastcall_cb = Bind(&FastCallFunc, 1); + RepeatingCallback<int()> fastcall_cb = BindRepeating(&FastCallFunc, 1); EXPECT_EQ(1, fastcall_cb.Run()); - Callback<int()> stdcall_cb = Bind(&StdCallFunc, 2); + RepeatingCallback<int()> stdcall_cb = BindRepeating(&StdCallFunc, 2); EXPECT_EQ(2, stdcall_cb.Run()); } #endif @@ -1565,9 +1568,9 @@ // Test null callbacks cause a DCHECK. TEST(BindDeathTest, NullCallback) { - base::Callback<void(int)> null_cb; + base::RepeatingCallback<void(int)> null_cb; ASSERT_TRUE(null_cb.is_null()); - EXPECT_DCHECK_DEATH(base::Bind(null_cb, 42)); + EXPECT_DCHECK_DEATH(base::BindRepeating(null_cb, 42)); } TEST(BindDeathTest, BanFirstOwnerOfRefCountedType) {
diff --git a/base/bind_unittest.nc b/base/bind_unittest.nc index 349d38b..77a9a9c 100644 --- a/base/bind_unittest.nc +++ b/base/bind_unittest.nc
@@ -86,8 +86,8 @@ void WontCompile() { HasRef has_ref; const HasRef* const_has_ref_ptr_ = &has_ref; - Callback<void()> method_to_const_cb = - Bind(&HasRef::VoidMethod0, const_has_ref_ptr_); + RepeatingCallback<void()> method_to_const_cb = + BindRepeating(&HasRef::VoidMethod0, const_has_ref_ptr_); method_to_const_cb.Run(); } @@ -99,8 +99,8 @@ // We require refcounts unless you have Unretained(). void WontCompile() { NoRef no_ref; - Callback<void()> no_ref_cb = - Bind(&NoRef::VoidMethod0, &no_ref); + RepeatingCallback<void()> no_ref_cb = + BindRepeating(&NoRef::VoidMethod0, &no_ref); no_ref_cb.Run(); } @@ -111,8 +111,8 @@ // We require refcounts unless you have Unretained(). void WontCompile() { NoRef no_ref; - Callback<void()> no_ref_const_cb = - Bind(&NoRef::VoidConstMethod0, &no_ref); + RepeatingCallback<void()> no_ref_const_cb = + BindRepeating(&NoRef::VoidConstMethod0, &no_ref); no_ref_const_cb.Run(); } @@ -123,8 +123,8 @@ // This is just a const-correctness check. void WontCompile() { const NoRef* const_no_ref_ptr; - Callback<NoRef*()> pointer_same_cb = - Bind(&PolymorphicIdentity<NoRef*>, const_no_ref_ptr); + RepeatingCallback<NoRef*()> pointer_same_cb = + BindRepeating(&PolymorphicIdentity<NoRef*>, const_no_ref_ptr); pointer_same_cb.Run(); } @@ -135,8 +135,8 @@ // This is just a const-correctness check. void WontCompile() { const NoRefChild* const_child_ptr; - Callback<NoRefParent*()> pointer_super_cb = - Bind(&PolymorphicIdentity<NoRefParent*>, const_child_ptr); + RepeatingCallback<NoRefParent*()> pointer_super_cb = + BindRepeating(&PolymorphicIdentity<NoRefParent*>, const_child_ptr); pointer_super_cb.Run(); } @@ -153,7 +153,7 @@ // accidentally have the function be modifying a temporary, or a copy. void WontCompile() { Parent p; - Callback<int(Parent&)> ref_arg_cb = Bind(&UnwrapParentRef); + RepeatingCallback<int(Parent&)> ref_arg_cb = BindRepeating(&UnwrapParentRef); ref_arg_cb.Run(p); } @@ -164,7 +164,7 @@ // See comment in NCTEST_DISALLOW_NON_CONST_REF_PARAM void WontCompile() { Parent p; - Callback<int()> ref_cb = Bind(&UnwrapParentRef, p); + RepeatingCallback<int()> ref_cb = BindRepeating(&UnwrapParentRef, p); ref_cb.Run(); } @@ -177,8 +177,8 @@ // implicitly convert an array type to a pointer type. void WontCompile() { HasRef p[10]; - Callback<void()> method_bound_to_array_cb = - Bind(&HasRef::VoidMethod0, p); + RepeatingCallback<void()> method_bound_to_array_cb = + BindRepeating(&HasRef::VoidMethod0, p); method_bound_to_array_cb.Run(); } @@ -188,10 +188,10 @@ void WontCompile() { HasRef for_raw_ptr; int a; - Callback<void()> ref_count_as_raw_ptr_a = - Bind(&VoidPolymorphic1<int*>, &a); - Callback<void()> ref_count_as_raw_ptr = - Bind(&VoidPolymorphic1<HasRef*>, &for_raw_ptr); + RepeatingCallback<void()> ref_count_as_raw_ptr_a = + BindRepeating(&VoidPolymorphic1<int*>, &a); + RepeatingCallback<void()> ref_count_as_raw_ptr = + BindRepeating(&VoidPolymorphic1<HasRef*>, &for_raw_ptr); } #elif defined(NCTEST_NO_LVALUE_RAW_PTR_FOR_REFCOUNTED_TYPES) // [r"fatal error: static_assert failed due to requirement '!HasRefCountedTypeAsRawPtr<base::HasRef \*>::value' \"A parameter is a refcounted type and needs scoped_refptr.\""] @@ -199,8 +199,8 @@ // Refcounted types should not be bound as a raw pointer. void WontCompile() { HasRef* for_raw_ptr = nullptr; - Callback<void()> ref_count_as_raw_ptr = - Bind(&VoidPolymorphic1<HasRef*>, for_raw_ptr); + RepeatingCallback<void()> ref_count_as_raw_ptr = + BindRepeating(&VoidPolymorphic1<HasRef*>, for_raw_ptr); } #elif defined(NCTEST_NO_RVALUE_CONST_RAW_PTR_FOR_REFCOUNTED_TYPES) // [r"fatal error: static_assert failed due to requirement '!HasRefCountedTypeAsRawPtr<const base::HasRef \*>::value' \"A parameter is a refcounted type and needs scoped_refptr.\""] @@ -208,8 +208,8 @@ // Refcounted types should not be bound as a raw pointer. void WontCompile() { const HasRef for_raw_ptr; - Callback<void()> ref_count_as_raw_ptr = - Bind(&VoidPolymorphic1<const HasRef*>, &for_raw_ptr); + RepeatingCallback<void()> ref_count_as_raw_ptr = + BindRepeating(&VoidPolymorphic1<const HasRef*>, &for_raw_ptr); } #elif defined(NCTEST_NO_LVALUE_CONST_RAW_PTR_FOR_REFCOUNTED_TYPES) // [r"fatal error: static_assert failed due to requirement '!HasRefCountedTypeAsRawPtr<const base::HasRef \*>::value' \"A parameter is a refcounted type and needs scoped_refptr.\""] @@ -217,8 +217,8 @@ // Refcounted types should not be bound as a raw pointer. void WontCompile() { const HasRef* for_raw_ptr = nullptr; - Callback<void()> ref_count_as_raw_ptr = - Bind(&VoidPolymorphic1<const HasRef*>, for_raw_ptr); + RepeatingCallback<void()> ref_count_as_raw_ptr = + BindRepeating(&VoidPolymorphic1<const HasRef*>, for_raw_ptr); } #elif defined(NCTEST_WEAKPTR_BIND_MUST_RETURN_VOID) // [r"fatal error: static_assert failed due to requirement 'std::is_void<int>::value' \"weak_ptrs can only bind to methods without return values\""] @@ -227,50 +227,51 @@ void WontCompile() { NoRef no_ref; WeakPtrFactory<NoRef> weak_factory(&no_ref); - Callback<int()> weak_ptr_with_non_void_return_type = - Bind(&NoRef::IntMethod0, weak_factory.GetWeakPtr()); + RepeatingCallback<int()> weak_ptr_with_non_void_return_type = + BindRepeating(&NoRef::IntMethod0, weak_factory.GetWeakPtr()); weak_ptr_with_non_void_return_type.Run(); } -#elif defined(NCTEST_DISALLOW_ASSIGN_DIFFERENT_TYPES) // [r"fatal error: no viable conversion from 'Callback<MakeUnboundRunType<void \(\*\)\(int\)>>' to 'Callback<void \(\)>'"] +#elif defined(NCTEST_DISALLOW_ASSIGN_DIFFERENT_TYPES) // [r"fatal error: no viable conversion from 'RepeatingCallback<MakeUnboundRunType<void \(\*\)\(int\)>>' to 'RepeatingCallback<void \(\)>'"] // Bind result cannot be assigned to Callbacks with a mismatching type. void WontCompile() { - Closure callback_mismatches_bind_type = Bind(&VoidPolymorphic1<int>); + RepeatingClosure callback_mismatches_bind_type = + BindRepeating(&VoidPolymorphic1<int>); } #elif defined(NCTEST_DISALLOW_CAPTURING_LAMBDA) // [r"fatal error: implicit instantiation of undefined template 'base::internal::FunctorTraits<\(lambda at (\.\./)+base/bind_unittest.nc:[0-9]+:[0-9]+\), void>'"] void WontCompile() { int i = 0, j = 0; - Bind([i,&j]() {j = i;}); + BindOnce([i,&j]() {j = i;}); } #elif defined(NCTEST_DISALLOW_ONCECALLBACK_RUN_ON_LVALUE) // [r"fatal error: static_assert failed due to requirement '!sizeof \(\*this\)' \"OnceCallback::Run\(\) may only be invoked on a non-const rvalue, i\.e\. std::move\(callback\).Run\(\).\""] void WontCompile() { - OnceClosure cb = Bind([] {}); + OnceClosure cb = BindOnce([] {}); cb.Run(); } #elif defined(NCTEST_DISALLOW_ONCECALLBACK_RUN_ON_CONST_LVALUE) // [r"fatal error: static_assert failed due to requirement '!sizeof \(\*this\)' \"OnceCallback::Run\(\) may only be invoked on a non-const rvalue, i\.e\. std::move\(callback\).Run\(\).\""] void WontCompile() { - const OnceClosure cb = Bind([] {}); + const OnceClosure cb = BindOnce([] {}); cb.Run(); } #elif defined(NCTEST_DISALLOW_ONCECALLBACK_RUN_ON_CONST_RVALUE) // [r"fatal error: static_assert failed due to requirement '!sizeof \(\*this\)' \"OnceCallback::Run\(\) may only be invoked on a non-const rvalue, i\.e\. std::move\(callback\).Run\(\).\""] void WontCompile() { - const OnceClosure cb = Bind([] {}); + const OnceClosure cb = BindOnce([] {}); std::move(cb).Run(); } #elif defined(NCTEST_DISALLOW_BIND_ONCECALLBACK) // [r"fatal error: static_assert failed due to requirement '!base::internal::IsOnceCallback<base::OnceCallback<void \(int\)> >\(\)' \"BindRepeating cannot bind OnceCallback. Use BindOnce with std::move\(\).\""] void WontCompile() { - Bind(BindOnce([](int) {}), 42); + BindRepeating(BindOnce([](int) {}), 42); } #elif defined(NCTEST_DISALLOW_BINDONCE_LVALUE_ONCECALLBACK) // [r"fatal error: static_assert failed due to requirement '!internal::IsOnceCallback<std::decay_t<OnceCallback<void (int)> &> >() || (std::is_rvalue_reference<OnceCallback<void (int)> &>() && !std::is_const<std::remove_reference_t<OnceCallback<void (int)> &> >())' \"BindOnce requires non-const rvalue for OnceCallback binding. I.e.: base::BindOnce(std::move(callback)).\""] @@ -297,20 +298,20 @@ void WontCompile() { std::unique_ptr<int> x; - Bind(&TakesMoveOnly, x); + BindRepeating(&TakesMoveOnly, x); } #elif defined(NCTEST_BIND_MOVEONLY_TYPE_WITH_STDMOVE) // [r"Bound argument \|i\| is move-only but will be forwarded by copy\. Ensure \|Arg\| is bound using base::Passed\(\), not std::move\(\)."] void WontCompile() { std::unique_ptr<int> x; - Bind(&TakesMoveOnly, std::move(x)); + BindRepeating(&TakesMoveOnly, std::move(x)); } #elif defined(NCTEST_BIND_NON_EMPTY_FUNCTOR) // [r"fatal error: implicit instantiation of undefined template 'base::internal::FunctorTraits<base::NonEmptyFunctor, void>'"] void WontCompile() { - Bind(NonEmptyFunctor()); + BindRepeating(NonEmptyFunctor()); } #elif defined(NCTEST_DISALLOW_BINDLAMBDAFORTESTING_LVALUE_MUTABLE_LAMBDA) // [r"BindLambdaForTesting requires non-const rvalue for mutable lambda binding\. I\.e\.: base::BindLambdaForTesting\(std::move\(lambda\)\)."]
diff --git a/base/callback.h b/base/callback.h index 1d3473c..e08f9b8 100644 --- a/base/callback.h +++ b/base/callback.h
@@ -2,8 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// NOTE: Header files that do not require the full definition of Callback or -// Closure should #include "base/callback_forward.h" instead of this file. +// NOTE: Header files that do not require the full definition of +// base::{Once,Repeating}Callback or base::{Once,Repeating}Closure should +// #include "base/callback_forward.h" instead of this file. #ifndef BASE_CALLBACK_H_ #define BASE_CALLBACK_H_
diff --git a/base/callback_helpers_unittest.cc b/base/callback_helpers_unittest.cc index 5a7e2c3..00b2ef5 100644 --- a/base/callback_helpers_unittest.cc +++ b/base/callback_helpers_unittest.cc
@@ -50,7 +50,7 @@ TEST(CallbackHelpersTest, TestScopedClosureRunnerExitScope) { int run_count = 0; { - base::ScopedClosureRunner runner(base::Bind(&Increment, &run_count)); + base::ScopedClosureRunner runner(base::BindOnce(&Increment, &run_count)); EXPECT_EQ(0, run_count); } EXPECT_EQ(1, run_count); @@ -60,7 +60,7 @@ int run_count = 0; base::OnceClosure c; { - base::ScopedClosureRunner runner(base::Bind(&Increment, &run_count)); + base::ScopedClosureRunner runner(base::BindOnce(&Increment, &run_count)); c = runner.Release(); EXPECT_EQ(0, run_count); } @@ -74,8 +74,8 @@ int run_count_2 = 0; { base::ScopedClosureRunner runner; - runner.ReplaceClosure(base::Bind(&Increment, &run_count_1)); - runner.ReplaceClosure(base::Bind(&Increment, &run_count_2)); + runner.ReplaceClosure(base::BindOnce(&Increment, &run_count_1)); + runner.ReplaceClosure(base::BindOnce(&Increment, &run_count_2)); EXPECT_EQ(0, run_count_1); EXPECT_EQ(0, run_count_2); } @@ -86,7 +86,7 @@ TEST(CallbackHelpersTest, TestScopedClosureRunnerRunAndReset) { int run_count_3 = 0; { - base::ScopedClosureRunner runner(base::Bind(&Increment, &run_count_3)); + base::ScopedClosureRunner runner(base::BindOnce(&Increment, &run_count_3)); EXPECT_EQ(0, run_count_3); runner.RunAndReset(); EXPECT_EQ(1, run_count_3); @@ -98,7 +98,7 @@ int run_count = 0; { std::unique_ptr<base::ScopedClosureRunner> runner( - new base::ScopedClosureRunner(base::Bind(&Increment, &run_count))); + new base::ScopedClosureRunner(base::BindOnce(&Increment, &run_count))); base::ScopedClosureRunner runner2(std::move(*runner)); runner.reset(); EXPECT_EQ(0, run_count); @@ -110,9 +110,10 @@ int run_count_1 = 0; int run_count_2 = 0; { - base::ScopedClosureRunner runner(base::Bind(&Increment, &run_count_1)); + base::ScopedClosureRunner runner(base::BindOnce(&Increment, &run_count_1)); { - base::ScopedClosureRunner runner2(base::Bind(&Increment, &run_count_2)); + base::ScopedClosureRunner runner2( + base::BindOnce(&Increment, &run_count_2)); runner = std::move(runner2); EXPECT_EQ(0, run_count_1); EXPECT_EQ(0, run_count_2);
diff --git a/base/callback_unittest.nc b/base/callback_unittest.nc index cdc48af..df68184 100644 --- a/base/callback_unittest.nc +++ b/base/callback_unittest.nc
@@ -15,36 +15,37 @@ class Child : Parent { }; -#if defined(NCTEST_EQUALS_REQUIRES_SAMETYPE) // [r"fatal error: invalid operands to binary expression \('Callback<void \(\)>' \(aka 'RepeatingCallback<void \(\)>'\) and 'Callback<int \(\)>' \(aka 'RepeatingCallback<int \(\)>'\)\)"] +#if defined(NCTEST_EQUALS_REQUIRES_SAMETYPE) // [r"fatal error: invalid operands to binary expression \('RepeatingCallback<void \(\)>' and 'RepeatingCallback<int \(\)>'\)"] // Attempting to call comparison function on two callbacks of different type. // // This should be a compile time failure because each callback type should be // considered distinct. void WontCompile() { - Callback<void()> c1; - Callback<int()> c2; + RepeatingCallback<void()> c1; + RepeatingCallback<int()> c2; c1 == c2; } -#elif defined(NCTEST_CONSTRUCTION_FROM_SUBTYPE) // [r"fatal error: no viable conversion from 'Callback<base::Parent \(\)>' to 'Callback<base::Child \(\)>'"] +#elif defined(NCTEST_CONSTRUCTION_FROM_SUBTYPE) // [r"fatal error: no viable conversion from 'RepeatingCallback<base::Parent \(\)>' to 'RepeatingCallback<base::Child \(\)>'"] -// Construction of Callback<A> from Callback<B> if A is supertype of B. +// Construction of RepeatingCallback<A> from RepeatingCallback<B> if A is +// supertype of B. // // While this is technically safe, most people aren't used to it when coding // C++ so if this is happening, it is almost certainly an error. void WontCompile() { - Callback<Parent()> cb_a; - Callback<Child()> cb_b = cb_a; + RepeatingCallback<Parent()> cb_a; + RepeatingCallback<Child()> cb_b = cb_a; } #elif defined(NCTEST_ASSIGNMENT_FROM_SUBTYPE) // [r"fatal error: no viable overloaded '='"] -// Assignment of Callback<A> from Callback<B> if A is supertype of B. -// See explanation for NCTEST_CONSTRUCTION_FROM_SUBTYPE +// Assignment of RepeatingCallback<A> from RepeatingCallback<B> if A is +// supertype of B. See explanation for NCTEST_CONSTRUCTION_FROM_SUBTYPE. void WontCompile() { - Callback<Parent()> cb_a; - Callback<Child()> cb_b; + RepeatingCallback<Parent()> cb_a; + RepeatingCallback<Child()> cb_b; cb_a = cb_b; }
diff --git a/base/cancelable_callback.h b/base/cancelable_callback.h index 5069853..b4c40b1 100644 --- a/base/cancelable_callback.h +++ b/base/cancelable_callback.h
@@ -33,7 +33,8 @@ // run_loop.QuitWhenIdle(); // } // -// CancelableClosure timeout(base::Bind(&TimeoutCallback, "Test timed out.")); +// CancelableOnceClosure timeout( +// base::BindOnce(&TimeoutCallback, "Test timed out.")); // ThreadTaskRunnerHandle::Get()->PostDelayedTask(FROM_HERE, timeout.callback(), // TimeDelta::FromSeconds(4)); // RunIntensiveTest(); @@ -145,7 +146,7 @@ template <typename Signature> using CancelableRepeatingCallback = internal::CancelableCallbackImpl<RepeatingCallback<Signature>>; -using CancelableRepeatingClosure = CancelableOnceCallback<void()>; +using CancelableRepeatingClosure = CancelableRepeatingCallback<void()>; template <typename Signature> using CancelableCallback = CancelableRepeatingCallback<Signature>;
diff --git a/base/cancelable_callback_unittest.cc b/base/cancelable_callback_unittest.cc index da1a957c..da6c7bb 100644 --- a/base/cancelable_callback_unittest.cc +++ b/base/cancelable_callback_unittest.cc
@@ -38,10 +38,10 @@ // - After Cancel(), Run() completes but has no effect. TEST(CancelableCallbackTest, Cancel) { int count = 0; - CancelableClosure cancelable( - base::Bind(&Increment, base::Unretained(&count))); + CancelableRepeatingClosure cancelable( + base::BindRepeating(&Increment, base::Unretained(&count))); - base::Closure callback = cancelable.callback(); + base::RepeatingClosure callback = cancelable.callback(); callback.Run(); EXPECT_EQ(1, count); @@ -59,11 +59,11 @@ // - After Cancel(), callback() returns a null callback. TEST(CancelableCallbackTest, MultipleCancel) { int count = 0; - CancelableClosure cancelable( - base::Bind(&Increment, base::Unretained(&count))); + CancelableRepeatingClosure cancelable( + base::BindRepeating(&Increment, base::Unretained(&count))); - base::Closure callback1 = cancelable.callback(); - base::Closure callback2 = cancelable.callback(); + base::RepeatingClosure callback1 = cancelable.callback(); + base::RepeatingClosure callback2 = cancelable.callback(); cancelable.Cancel(); callback1.Run(); @@ -76,7 +76,7 @@ cancelable.Cancel(); // callback() of a cancelled callback is null. - base::Closure callback3 = cancelable.callback(); + base::RepeatingClosure callback3 = cancelable.callback(); EXPECT_TRUE(callback3.is_null()); } @@ -84,11 +84,11 @@ // - Destruction of CancelableCallback cancels outstanding callbacks. TEST(CancelableCallbackTest, CallbackCanceledOnDestruction) { int count = 0; - base::Closure callback; + base::RepeatingClosure callback; { - CancelableClosure cancelable( - base::Bind(&Increment, base::Unretained(&count))); + CancelableRepeatingClosure cancelable( + base::BindRepeating(&Increment, base::Unretained(&count))); callback = cancelable.callback(); callback.Run(); @@ -105,7 +105,8 @@ scoped_refptr<TestRefCounted> ref_counted = new TestRefCounted; EXPECT_TRUE(ref_counted->HasOneRef()); - CancelableClosure cancelable(base::Bind(RefCountedParam, ref_counted)); + CancelableOnceClosure cancelable( + base::BindOnce(RefCountedParam, ref_counted)); EXPECT_FALSE(cancelable.IsCancelled()); EXPECT_TRUE(ref_counted.get()); EXPECT_FALSE(ref_counted->HasOneRef()); @@ -122,10 +123,10 @@ // - Reset() deactivates outstanding callbacks. TEST(CancelableCallbackTest, Reset) { int count = 0; - CancelableClosure cancelable( - base::Bind(&Increment, base::Unretained(&count))); + CancelableRepeatingClosure cancelable( + base::BindRepeating(&Increment, base::Unretained(&count))); - base::Closure callback = cancelable.callback(); + base::RepeatingClosure callback = cancelable.callback(); callback.Run(); EXPECT_EQ(1, count); @@ -133,7 +134,7 @@ EXPECT_EQ(2, count); cancelable.Reset( - base::Bind(&IncrementBy, base::Unretained(&count), 3)); + base::BindRepeating(&IncrementBy, base::Unretained(&count), 3)); EXPECT_FALSE(cancelable.IsCancelled()); // The stale copy of the cancelable callback is non-null. @@ -143,7 +144,7 @@ callback.Run(); EXPECT_EQ(2, count); - base::Closure callback2 = cancelable.callback(); + base::RepeatingClosure callback2 = cancelable.callback(); ASSERT_FALSE(callback2.is_null()); callback2.Run(); @@ -153,12 +154,11 @@ // IsCanceled(). // - Cancel() transforms the CancelableCallback into a cancelled state. TEST(CancelableCallbackTest, IsNull) { - CancelableClosure cancelable; + CancelableOnceClosure cancelable; EXPECT_TRUE(cancelable.IsCancelled()); int count = 0; - cancelable.Reset(base::Bind(&Increment, - base::Unretained(&count))); + cancelable.Reset(base::BindOnce(&Increment, base::Unretained(&count))); EXPECT_FALSE(cancelable.IsCancelled()); cancelable.Cancel(); @@ -171,8 +171,8 @@ test::ScopedTaskEnvironment scoped_task_environment; int count = 0; - CancelableClosure cancelable(base::Bind(&Increment, - base::Unretained(&count))); + CancelableRepeatingClosure cancelable( + base::BindRepeating(&Increment, base::Unretained(&count))); ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, cancelable.callback()); RunLoop().RunUntilIdle(); @@ -194,8 +194,8 @@ const int kExpectedResult = 42; int result = 0; - CancelableCallback<void(std::unique_ptr<int>)> cb( - base::Bind(&OnMoveOnlyReceived, base::Unretained(&result))); + CancelableRepeatingCallback<void(std::unique_ptr<int>)> cb( + base::BindRepeating(&OnMoveOnlyReceived, base::Unretained(&result))); cb.callback().Run(std::make_unique<int>(kExpectedResult)); EXPECT_EQ(kExpectedResult, result);
diff --git a/base/immediate_crash.h b/base/immediate_crash.h index 94ee14f..935fb00 100644 --- a/base/immediate_crash.h +++ b/base/immediate_crash.h
@@ -33,32 +33,33 @@ // Note: this last bullet point may no longer be true, and may be removed in // the future. -// Note: TRAP_SEQUENCE Is currently split into two macro helpers due to the fact -// that clang emits an actual instruction for __builtin_unreachable() on certain -// platforms (see https://crbug.com/958675). In addition, the int3/bkpt/brk will -// be removed in followups, so splitting it up like this now makes it easy to -// land the followups. +// TODO(https://crbug.com/958675): TRAP_SEQUENCE_() was previously split into +// two macro helpers to make it easier to simplify it to one instruction in +// followups. TRAP_SEQUENCE2_() will be renamed and collapsed into +// TRAP_SEQUENCE_() assuming nothing goes wrong... #if defined(COMPILER_GCC) #if defined(OS_NACL) // Crash report accuracy is not guaranteed on NaCl. -#define TRAP_SEQUENCE1_() __builtin_trap() -#define TRAP_SEQUENCE2_() asm volatile("") +#define TRAP_SEQUENCE2_() __builtin_trap() #elif defined(ARCH_CPU_X86_FAMILY) -// TODO(https://crbug.com/958675): In theory, it should be possible to use just -// int3. However, there are a number of crashes with SIGILL as the exception -// code, so it seems likely that there's a signal handler that allows execution -// to continue after SIGTRAP. -#define TRAP_SEQUENCE1_() asm volatile("int3") +// In theory, it should be possible to use just int3. However, there are a +// number of crashes with SIGILL as the exception code, so it seems likely that +// there's a signal handler that allows execution to continue after SIGTRAP. #if defined(OS_MACOSX) // Intentionally empty: __builtin_unreachable() is always part of the sequence // (see IMMEDIATE_CRASH below) and already emits a ud2 on Mac. #define TRAP_SEQUENCE2_() asm volatile("") +#elif defined(OS_LINUX) +// TODO(dcheng): Remove int3 on Linux as well. Removing it is preventing +// IMMEDIATE_CRASH() from being detected as abnormal program termination on +// Linux. +#define TRAP_SEQUENCE2_() asm volatile("int3;ud2") #else #define TRAP_SEQUENCE2_() asm volatile("ud2") #endif // defined(OS_MACOSX) @@ -69,23 +70,22 @@ // as a 32 bit userspace app on arm64. There doesn't seem to be any way to // cause a SIGTRAP from userspace without using a syscall (which would be a // problem for sandboxing). -// TODO(https://crbug.com/958675): Remove bkpt from this sequence. -#define TRAP_SEQUENCE1_() asm volatile("bkpt #0") +// TODO(dcheng): This likely will no longer generate a SIGTRAP, update this +// comment to what it does generate? #define TRAP_SEQUENCE2_() asm volatile("udf #0") #elif defined(ARCH_CPU_ARM64) // This will always generate a SIGTRAP on arm64. -// TODO(https://crbug.com/958675): Remove brk from this sequence. -#define TRAP_SEQUENCE1_() asm volatile("brk #0") +// TODO(dcheng): This likely will no longer generate a SIGTRAP, update this +// comment to what it does generate? #define TRAP_SEQUENCE2_() asm volatile("hlt #0") #else // Crash report accuracy will not be guaranteed on other architectures, but at // least this will crash as expected. -#define TRAP_SEQUENCE1_() __builtin_trap() -#define TRAP_SEQUENCE2_() asm volatile("") +#define TRAP_SEQUENCE2_() __builtin_trap() #endif // ARCH_CPU_* @@ -94,20 +94,16 @@ #if !defined(__clang__) // MSVC x64 doesn't support inline asm, so use the MSVC intrinsic. -#define TRAP_SEQUENCE1_() __debugbreak() -#define TRAP_SEQUENCE2_() +#define TRAP_SEQUENCE2_() __debugbreak() #elif defined(ARCH_CPU_ARM64) -#define TRAP_SEQUENCE1_() __asm volatile("brk #0\n") // Intentionally empty: __builtin_unreachable() is always part of the sequence // (see IMMEDIATE_CRASH below) and already emits a ud2 on Win64 #define TRAP_SEQUENCE2_() __asm volatile("") #else -#define TRAP_SEQUENCE1_() asm volatile("int3") - #if defined(ARCH_CPU_64_BITS) // Intentionally empty: __builtin_unreachable() is always part of the sequence // (see IMMEDIATE_CRASH below) and already emits a ud2 on Win64 @@ -126,7 +122,6 @@ #define TRAP_SEQUENCE_() \ do { \ - TRAP_SEQUENCE1_(); \ TRAP_SEQUENCE2_(); \ } while (false)
diff --git a/base/immediate_crash_unittest.cc b/base/immediate_crash_unittest.cc index 8fc9d38..1b538aeb 100644 --- a/base/immediate_crash_unittest.cc +++ b/base/immediate_crash_unittest.cc
@@ -38,14 +38,19 @@ NativeLibraryLoadError load_error; FilePath helper_library_path; #if !defined(OS_ANDROID) && !defined(OS_FUCHSIA) - // On Android M, DIR_EXE == /system/bin when running base_unittests. - // On Fuchsia, NativeLibrary understands the native convention that libraries - // are not colocated with the binary. + // Appending the library name to DIR_EXE isn't necessary on all platforms (and + // can even break in some places): + // - on Android M, DIR_EXE == /system/bin when running base_unittests. + // - on Fuchsia, NativeLibrary knows where to look already, since it + // understands the platform convention that libraries are not colocated with + // the binary. ASSERT_TRUE(PathService::Get(DIR_EXE, &helper_library_path)); #endif helper_library_path = helper_library_path.AppendASCII( GetNativeLibraryName("immediate_crash_test_helper")); #if defined(OS_ANDROID) && defined(COMPONENT_BUILD) + // Android component builds use a unique shared library suffix to avoid naming + // collisions. helper_library_path = helper_library_path.ReplaceExtension(".cr.so"); #endif // TODO(dcheng): Shouldn't GetNativeLibraryName just return a FilePath? @@ -86,8 +91,10 @@ // Look for two IMMEDIATE_CRASH() opcode sequences. for (int i = 0; i < 2; ++i) { - // INT 3 +#if defined(OS_LINUX) + // INT3 EXPECT_EQ(0xCC, *++it); +#endif // defined(OS_LINUX) // UD2 EXPECT_EQ(0x0F, *++it); EXPECT_EQ(0x0B, *++it); @@ -120,8 +127,6 @@ // Look for two IMMEDIATE_CRASH() opcode sequences. for (int i = 0; i < 2; ++i) { - // BKPT #0 - EXPECT_EQ(0xBE00, *++it); // UDF #0 EXPECT_EQ(0xDE00, *++it); } @@ -143,8 +148,6 @@ // Look for two IMMEDIATE_CRASH() opcode sequences. for (int i = 0; i < 2; ++i) { - // BRK #0 - EXPECT_EQ(0XD4200000, *++it); // HLT #0 EXPECT_EQ(0xD4400000, *++it); }
diff --git a/base/logging.cc b/base/logging.cc index 7a474ca..eaf5662 100644 --- a/base/logging.cc +++ b/base/logging.cc
@@ -482,21 +482,13 @@ if (severity < g_min_log_level) return false; - // Return true here unless we know ~LogMessage won't do anything. + // Return true here unless we know ~LogMessage won't do anything. Note that + // ~LogMessage writes to stderr if severity_ >= kAlwaysPrintErrorLevel, even + // when g_logging_destination is LOG_NONE. return g_logging_destination != LOG_NONE || log_message_handler || severity >= kAlwaysPrintErrorLevel; } -// Returns true when logging destination LOG_TO_STDERR flag is set. Also when -// configured to only LOG_TO_FILE, continue to log higher-severity messages to -// stderr as well to better detect and diagnose problems with unit tests, -// especially on the buildbots. -bool ShouldLogToStderr(int severity) { - return ((g_logging_destination & LOG_TO_STDERR) != 0) || - (severity >= kAlwaysPrintErrorLevel && - g_logging_destination == LOG_TO_FILE); -} - int GetVlogVerbosity() { return std::max(-1, LOG_INFO - GetMinLogLevel()); } @@ -858,7 +850,11 @@ #endif // OS_FUCHSIA } - if (ShouldLogToStderr(severity_)) { + if ((g_logging_destination & LOG_TO_STDERR) != 0 || + severity_ >= kAlwaysPrintErrorLevel) { + // Write logs with destination LOG_TO_STDERR to stderr. Also output to + // stderr for logs above a certain log level to better detect and diagnose + // problems with unit tests, especially on the buildbots. ignore_result(fwrite(str_newline.data(), str_newline.size(), 1, stderr)); fflush(stderr); }
diff --git a/base/logging_unittest.cc b/base/logging_unittest.cc index 5ab6975..dbabc6d1 100644 --- a/base/logging_unittest.cc +++ b/base/logging_unittest.cc
@@ -8,8 +8,6 @@ #include "base/bind.h" #include "base/callback.h" #include "base/compiler_specific.h" -#include "base/files/file_util.h" -#include "base/files/scoped_temp_dir.h" #include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" @@ -238,60 +236,6 @@ LOG(INFO) << mock_log_source_stderr.Log(); } -// Check that when logging to file and message severity is -// kAlwaysPrintErrorLevel or higher that the message is also written to stderr. -// When severity is lower, make sure the message is only written to file. -// Relies on POSIX specific APIs. Though this feature is cross-platform, testing -// on POSIX platforms is sufficient. -#if defined(OS_POSIX) || defined(OS_FUCHSIA) -TEST_F(LoggingTest, LogToFileAndStderr) { - const char kInfoLogMessage[] = "This is an INFO level message"; - const char kErrorLogMessage[] = "Here we have a message of level ERROR"; - base::ScopedTempDir temp_dir; - ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - - // Set up logging to log to a file. - base::FilePath file_logs_path = temp_dir.GetPath().Append("file.log"); - LoggingSettings settings; - settings.logging_dest = LOG_TO_FILE; - settings.log_file = file_logs_path.value().c_str(); - InitLogging(settings); - - // Create a file and change stderr to write to that file, to easily check - // contents. - base::FilePath stderr_logs_path = temp_dir.GetPath().Append("stderr.log"); - base::File stderr_logs = base::File( - stderr_logs_path, - base::File::FLAG_CREATE | base::File::FLAG_WRITE | base::File::FLAG_READ); - base::ScopedFD stderr_backup = base::ScopedFD(dup(STDERR_FILENO)); - int dup_result = dup2(stderr_logs.GetPlatformFile(), STDERR_FILENO); - ASSERT_GE(dup_result, 0); - - LOG(INFO) << kInfoLogMessage; - LOG(ERROR) << kErrorLogMessage; - - // Restore the original stderr logging destination. - dup_result = dup2(stderr_backup.get(), STDERR_FILENO); - ASSERT_EQ(dup_result, STDERR_FILENO); - - // Check that both log messages are written to "file.log". - std::string written_file_logs; - ASSERT_TRUE(base::ReadFileToString(file_logs_path, &written_file_logs)); - std::size_t found_info_log = written_file_logs.find(kInfoLogMessage); - EXPECT_FALSE(found_info_log == std::string::npos); - std::size_t found_error_log = written_file_logs.find(kErrorLogMessage); - EXPECT_FALSE(found_error_log == std::string::npos); - - // Check that the kErrorLogMessage is written to |stderr.log| and - // kInfoLogMessage is not. - ASSERT_TRUE(base::ReadFileToString(stderr_logs_path, &written_file_logs)); - found_info_log = written_file_logs.find(kInfoLogMessage); - EXPECT_TRUE(found_info_log == std::string::npos); - found_error_log = written_file_logs.find(kErrorLogMessage); - EXPECT_FALSE(found_error_log == std::string::npos); -} -#endif - // Official builds have CHECKs directly call BreakDebugger. #if !defined(OFFICIAL_BUILD)
diff --git a/base/metrics/histogram_functions.cc b/base/metrics/histogram_functions.cc index 687f235..cc2828f 100644 --- a/base/metrics/histogram_functions.cc +++ b/base/metrics/histogram_functions.cc
@@ -170,7 +170,7 @@ TimeDelta min, TimeDelta max, int buckets) { - HistogramBase* histogram = Histogram::FactoryTimeGet( + HistogramBase* histogram = Histogram::FactoryMicrosecondsTimeGet( name, min, max, buckets, HistogramBase::kUmaTargetedHistogramFlag); histogram->AddTimeMicrosecondsGranularity(sample); } @@ -180,7 +180,7 @@ TimeDelta min, TimeDelta max, int buckets) { - HistogramBase* histogram = Histogram::FactoryTimeGet( + HistogramBase* histogram = Histogram::FactoryMicrosecondsTimeGet( name, min, max, buckets, HistogramBase::kUmaTargetedHistogramFlag); histogram->AddTimeMicrosecondsGranularity(sample); } @@ -197,6 +197,24 @@ TimeDelta::FromSeconds(10), 50); } +// TODO(crbug.com/983261) Remove this method after moving to +// UmaHistogramMicrosecondsTimes. +void UmaHistogramMicrosecondsTimesUnderTenMilliseconds(const std::string& name, + TimeDelta sample) { + UmaHistogramCustomMicrosecondsTimes(name, sample, + TimeDelta::FromMicroseconds(1), + TimeDelta::FromMilliseconds(10), 50); +} + +// TODO(crbug.com/983261) Remove this method after moving to +// UmaHistogramMicrosecondsTimes. +void UmaHistogramMicrosecondsTimesUnderTenMilliseconds(const char* name, + TimeDelta sample) { + UmaHistogramCustomMicrosecondsTimes(name, sample, + TimeDelta::FromMicroseconds(1), + TimeDelta::FromMilliseconds(10), 50); +} + void UmaHistogramMemoryKB(const std::string& name, int sample) { UmaHistogramCustomCounts(name, sample, 1000, 500000, 50); }
diff --git a/base/metrics/histogram_functions.h b/base/metrics/histogram_functions.h index 55b7513..0ecfae3 100644 --- a/base/metrics/histogram_functions.h +++ b/base/metrics/histogram_functions.h
@@ -195,6 +195,16 @@ BASE_EXPORT void UmaHistogramMicrosecondsTimes(const char* name, TimeDelta sample); +// For microseconds timings from 1 microsecond up to 10 ms (50 buckets). +// TODO(crbug.com/983261) Remove this method after moving to +// UmaHistogramMicrosecondsTimes. +BASE_EXPORT void UmaHistogramMicrosecondsTimesUnderTenMilliseconds( + const std::string& name, + TimeDelta sample); +BASE_EXPORT void UmaHistogramMicrosecondsTimesUnderTenMilliseconds( + const char* name, + TimeDelta sample); + // For recording memory related histograms. // Used to measure common KB-granularity memory stats. Range is up to 500M. BASE_EXPORT void UmaHistogramMemoryKB(const std::string& name, int sample);
diff --git a/base/run_loop.cc b/base/run_loop.cc index 43685971..f350a429 100644 --- a/base/run_loop.cc +++ b/base/run_loop.cc
@@ -200,26 +200,28 @@ quit_when_idle_received_ = true; } -Closure RunLoop::QuitClosure() { +RepeatingClosure RunLoop::QuitClosure() { // Obtaining the QuitClosure() is not thread-safe; either post the // QuitClosure() from the run thread or invoke Quit() directly (which is // thread-safe). DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); allow_quit_current_deprecated_ = false; - return Bind(&ProxyToTaskRunner, origin_task_runner_, - Bind(&RunLoop::Quit, weak_factory_.GetWeakPtr())); + return BindRepeating( + &ProxyToTaskRunner, origin_task_runner_, + BindRepeating(&RunLoop::Quit, weak_factory_.GetWeakPtr())); } -Closure RunLoop::QuitWhenIdleClosure() { +RepeatingClosure RunLoop::QuitWhenIdleClosure() { // Obtaining the QuitWhenIdleClosure() is not thread-safe; either post the // QuitWhenIdleClosure() from the run thread or invoke QuitWhenIdle() directly // (which is thread-safe). DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); allow_quit_current_deprecated_ = false; - return Bind(&ProxyToTaskRunner, origin_task_runner_, - Bind(&RunLoop::QuitWhenIdle, weak_factory_.GetWeakPtr())); + return BindRepeating( + &ProxyToTaskRunner, origin_task_runner_, + BindRepeating(&RunLoop::QuitWhenIdle, weak_factory_.GetWeakPtr())); } // static @@ -268,13 +270,13 @@ } // static -Closure RunLoop::QuitCurrentWhenIdleClosureDeprecated() { +RepeatingClosure RunLoop::QuitCurrentWhenIdleClosureDeprecated() { // TODO(844016): Fix callsites and enable this check, or remove the API. // Delegate* delegate = GetTlsDelegate().Get(); // DCHECK(delegate->active_run_loops_.top()->allow_quit_current_deprecated_) // << "Please migrate off QuitCurrentWhenIdleClosureDeprecated(), e.g to " // "QuitWhenIdleClosure()."; - return Bind(&RunLoop::QuitCurrentWhenIdleDeprecated); + return BindRepeating(&RunLoop::QuitCurrentWhenIdleDeprecated); } #if DCHECK_IS_ON()
diff --git a/base/run_loop.h b/base/run_loop.h index 69ab4e3..539e588 100644 --- a/base/run_loop.h +++ b/base/run_loop.h
@@ -118,13 +118,13 @@ void Quit(); void QuitWhenIdle(); - // Returns a Closure that safely calls Quit() or QuitWhenIdle() (has no effect - // if the RunLoop instance is gone). + // Returns a RepeatingClosure that safely calls Quit() or QuitWhenIdle() (has + // no effect if the RunLoop instance is gone). // // These methods must be called from the thread on which the RunLoop was // created. // - // Returned Closures may be safely: + // Returned closures may be safely: // * Passed to other threads. // * Run() from other threads, though this will quit the RunLoop // asynchronously. @@ -141,8 +141,8 @@ // Note that Quit() itself is thread-safe and may be invoked directly if you // have access to the RunLoop reference from another thread (e.g. from a // capturing lambda or test observer). - Closure QuitClosure(); - Closure QuitWhenIdleClosure(); + RepeatingClosure QuitClosure(); + RepeatingClosure QuitWhenIdleClosure(); // Returns true if there is an active RunLoop on this thread. // Safe to call before RegisterDelegateForCurrentThread(). @@ -249,7 +249,7 @@ // instance and increase readability. static void QuitCurrentDeprecated(); static void QuitCurrentWhenIdleDeprecated(); - static Closure QuitCurrentWhenIdleClosureDeprecated(); + static RepeatingClosure QuitCurrentWhenIdleClosureDeprecated(); // Configures all RunLoop::Run() calls on the current thread to run the // supplied |on_timeout| callback if they run for longer than |timeout|.
diff --git a/base/run_loop_unittest.cc b/base/run_loop_unittest.cc index 03c20d46..edea4b151 100644 --- a/base/run_loop_unittest.cc +++ b/base/run_loop_unittest.cc
@@ -403,7 +403,7 @@ // Verify that the QuitWhenIdleClosure() can run after the RunLoop has been // deleted. It should have no effect. TEST_P(RunLoopTest, QuitWhenIdleClosureAfterRunLoopScope) { - Closure quit_when_idle_closure; + RepeatingClosure quit_when_idle_closure; { RunLoop run_loop; quit_when_idle_closure = run_loop.QuitWhenIdleClosure();
diff --git a/base/task/sequence_manager/sequence_manager_impl_unittest.cc b/base/task/sequence_manager/sequence_manager_impl_unittest.cc index d257d85..d288514 100644 --- a/base/task/sequence_manager/sequence_manager_impl_unittest.cc +++ b/base/task/sequence_manager/sequence_manager_impl_unittest.cc
@@ -3874,7 +3874,7 @@ base::OnceClosure RunOnDestruction(base::OnceClosure task) { return base::BindOnce( [](std::unique_ptr<RunOnDestructionHelper>) {}, - base::Passed(std::make_unique<RunOnDestructionHelper>(std::move(task)))); + std::make_unique<RunOnDestructionHelper>(std::move(task))); } base::OnceClosure PostOnDestruction(scoped_refptr<TestTaskQueue> task_queue,
diff --git a/build/android/pylib/dex/dex_parser.py b/build/android/pylib/dex/dex_parser.py old mode 100644 new mode 100755 index 4242a906..5ddd6e2 --- a/build/android/pylib/dex/dex_parser.py +++ b/build/android/pylib/dex/dex_parser.py
@@ -1,3 +1,4 @@ +#!/usr/bin/env python # 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. @@ -13,7 +14,12 @@ import argparse import collections +import errno +import os +import re import struct +import sys +import zipfile # https://source.android.com/devices/tech/dalvik/dex-format#header-item _DEX_HEADER_FMT = ( @@ -53,10 +59,10 @@ 'type_idx,proto_idx,name_idx') _TypeItem = collections.namedtuple('TypeItem', 'type_idx') _StringDataItem = collections.namedtuple('StringItem', 'utf16_size,data') - -DexMethodFullSignature = collections.namedtuple( - 'DexMethodFullSignature', - 'class_type,return_type,method_name,parameter_types') +_ClassDefItem = collections.namedtuple( + 'ClassDefItem', + 'class_idx,access_flags,superclass_idx,interfaces_off,source_file_idx,' + 'annotations_off,class_data_off,static_values_off') class _MemoryItemList(object): @@ -169,6 +175,18 @@ super(_TypeListItemList, self).__init__(reader, offset, size, _TypeListItem) +class _ClassDefItemList(_MemoryItemList): + + def __init__(self, reader, offset, size): + reader.Seek(offset) + + def factory(x): + return _ClassDefItem(*(x.ReadUInt() + for _ in xrange(len(_ClassDefItem._fields)))) + + super(_ClassDefItemList, self).__init__(reader, offset, size, factory) + + class _DexMapItem(object): def __init__(self, reader): @@ -336,7 +354,20 @@ referenced by index in other sections. type_list_item_list: _TypeListItemList containing _TypeListItems. _TypeListItems are referenced by their offsets from other dex items. + class_def_item_list: _ClassDefItemList containing _ClassDefItems. """ + _CLASS_ACCESS_FLAGS = { + 0x1: 'public', + 0x2: 'private', + 0x4: 'protected', + 0x8: 'static', + 0x10: 'final', + 0x200: 'interface', + 0x400: 'abstract', + 0x1000: 'synthetic', + 0x2000: 'annotation', + 0x4000: 'enum', + } def __init__(self, data): """Decodes dex file memory sections. @@ -355,6 +386,8 @@ self.reader, self.header.method_ids_off, self.header.method_ids_size) self.string_item_list = _StringItemList( self.reader, self.header.string_ids_off, self.header.string_ids_size) + self.class_def_item_list = _ClassDefItemList( + self.reader, self.header.class_defs_off, self.header.class_defs_size) type_list_key = _DexMapList.TYPE_TYPE_LIST if type_list_key in self.map_list: @@ -363,6 +396,10 @@ self.reader, map_list_item.offset, map_list_item.size) else: self.type_list_item_list = _TypeListItemList(self.reader, 0, 0) + self._type_lists_by_offset = { + type_list.offset: type_list + for type_list in self.type_list_item_list + } def GetString(self, string_item_idx): string_item = self.string_item_list[string_item_idx] @@ -372,6 +409,19 @@ type_item = self.type_item_list[type_item_idx] return self.GetString(type_item.descriptor_idx) + def GetTypeListStringsByOffset(self, offset): + if not offset: + return () + type_list = self._type_lists_by_offset[offset] + return tuple(self.GetTypeString(item.type_idx) for item in type_list) + + @staticmethod + def ResolveClassAccessFlags(access_flags): + return tuple( + flag_string + for flag, flag_string in DexFile._CLASS_ACCESS_FLAGS.iteritems() + if flag & access_flags) + def __repr__(self): items = [ self.header, @@ -380,61 +430,141 @@ self.proto_item_list, self.method_item_list, self.string_item_list, + self.type_list_item_list, + self.class_def_item_list, ] return '\n'.join(str(item) for item in items) -def _MethodSignaturesFromDexFile(dexfile): - methods = [] - type_lists_by_offset = { - type_list.offset: type_list - for type_list in dexfile.type_list_item_list - } +def _MethodSignaturePartsFromDexFile(dexfile): + """Yields the string components of dex methods in a dex file. + Args: + dexfile: The input dex file. + + Yields: + Tuples that look like: + (class name, return type, method name, (parameter type, ...)). + """ for method_item in dexfile.method_item_list: class_name_string = dexfile.GetTypeString(method_item.type_idx) method_name_string = dexfile.GetString(method_item.name_idx) - proto_item = dexfile.proto_item_list[method_item.proto_idx] return_type_string = dexfile.GetTypeString(proto_item.return_type_idx) - parameter_types = () - if proto_item.parameters_off: - type_list = type_lists_by_offset[proto_item.parameters_off] - parameter_types = tuple( - dexfile.GetTypeString(item.type_idx) for item in type_list) - - methods.append( - DexMethodFullSignature(class_name_string, return_type_string, - method_name_string, parameter_types)) - - return methods + parameter_types = dexfile.GetTypeListStringsByOffset( + proto_item.parameters_off) + yield (class_name_string, return_type_string, method_name_string, + parameter_types) def CountUniqueDexMethods(dexfiles): """Returns the number of unique methods given an iterable of dex files. - For method counts, most tools count the total number of defined dex methods. - In the multi-dex case, some method items are duplicated across dex files. - This function dedupes method definitions by converting dex method items into - string representations of the full method signatures. + For method counts, most tools count the total number of dex methods referred + to by a dex file. In the multi-dex case, some method items are referred to by + multiple dex files, which means some methods are double counted. This method + returns a count of the number of unique methods referred to across all given + dex files. Args: dexfiles: Iterable of DexFile objects to count unique methods for. """ unique_methods = set() for dexfile in dexfiles: - unique_methods.update(_MethodSignaturesFromDexFile(dexfile)) + unique_methods.update(_MethodSignaturePartsFromDexFile(dexfile)) return len(unique_methods) +class _DumpCommand(object): + + def __init__(self, dexfile): + self._dexfile = dexfile + + def Run(self): + raise NotImplementedError() + + +class _DumpMethods(_DumpCommand): + + def Run(self): + for parts in _MethodSignaturePartsFromDexFile(self._dexfile): + class_type, return_type, method_name, parameter_types = parts + print('{} {} (return type={}, parameters={})'.format( + class_type, method_name, return_type, parameter_types)) + + +class _DumpStrings(_DumpCommand): + + def Run(self): + for string_item in self._dexfile.string_item_list: + # Some strings are likely to be non-ascii (vs. methods/classes). + print(string_item.data.encode('utf-8')) + + +class _DumpClasses(_DumpCommand): + + def Run(self): + for class_item in self._dexfile.class_def_item_list: + class_string = self._dexfile.GetTypeString(class_item.class_idx) + superclass_string = self._dexfile.GetTypeString(class_item.superclass_idx) + interfaces = self._dexfile.GetTypeListStringsByOffset( + class_item.interfaces_off) + access_flags = DexFile.ResolveClassAccessFlags(class_item.access_flags) + print('{} (superclass={}, interfaces={}, access_flags={})'.format( + class_string, superclass_string, interfaces, access_flags)) + + +class _DumpSummary(_DumpCommand): + + def Run(self): + print(self._dexfile) + + +def _DumpDexItems(dexfile_data, name, item): + dexfile = DexFile(bytearray(dexfile_data)) + print('dex_parser: Dumping {} for {}'.format(item, name)) + cmds = { + 'summary': _DumpSummary, + 'methods': _DumpMethods, + 'strings': _DumpStrings, + 'classes': _DumpClasses, + } + try: + cmds[item](dexfile).Run() + except IOError as e: + if e.errno == errno.EPIPE: + # Assume we're piping to "less", do nothing. + pass + + def main(): parser = argparse.ArgumentParser(description='Dump dex contents to stdout.') - parser.add_argument('dexfile', help='Input dex file path.') + parser.add_argument( + 'input', help='Input (.dex, .jar, .zip, .aab, .apk) file path.') + parser.add_argument( + 'item', + choices=('methods', 'strings', 'classes', 'summary'), + help='Item to dump', + nargs='?', + default='summary') args = parser.parse_args() - with open(args.dexfile) as f: - dexfile = DexFile(bytearray(f.read())) - print('{} contents:\n\n{}'.format(args.dexfile, dexfile)) + if os.path.splitext(args.input)[1] in ('.apk', '.jar', '.zip', '.aab'): + with zipfile.ZipFile(args.input) as z: + dex_file_paths = [ + f for f in z.namelist() if re.match(r'.*classes[0-9]*\.dex$', f) + ] + if not dex_file_paths: + print('Error: {} does not contain any classes.dex files'.format( + args.input)) + sys.exit(1) + + for path in dex_file_paths: + _DumpDexItems(z.read(path), path, args.item) + + else: + with open(args.input) as f: + _DumpDexItems(f.read(), args.input, args.item) if __name__ == '__main__':
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 1709b0f0..711f6e2 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -8907772007199750624 \ No newline at end of file +8907741888668098576 \ No newline at end of file
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 0c1901f..28f0cfb 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -8907771311287432384 \ No newline at end of file +8907743014151154800 \ No newline at end of file
diff --git a/cc/animation/keyframe_effect.cc b/cc/animation/keyframe_effect.cc index d1d55431..221cf0b 100644 --- a/cc/animation/keyframe_effect.cc +++ b/cc/animation/keyframe_effect.cc
@@ -276,7 +276,7 @@ bool keyframe_model_removed = false; // Since we want to use the KeyframeModels that we're going to remove, we - // need to use a stable_parition here instead of remove_if. Remove_if leaves + // need to use a stable_partition here instead of remove_if. remove_if leaves // the removed items in an unspecified state. auto keyframe_models_to_remove = std::stable_partition( keyframe_models_.begin(), keyframe_models_.end(),
diff --git a/chrome/VERSION b/chrome/VERSION index af8be39e..9c9a584 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=77 MINOR=0 -BUILD=3855 +BUILD=3856 PATCH=0
diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/GridTabSwitcherMediator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/GridTabSwitcherMediator.java index 88a5b86..c366963 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/GridTabSwitcherMediator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/GridTabSwitcherMediator.java
@@ -67,6 +67,10 @@ private static final int DEFAULT_TOP_PADDING = 0; + // Count histograms for tab counts when showing switcher. + static final String TAB_COUNT_HISTOGRAM = "Tabs.TabCountInSwitcher"; + static final String TAB_ENTRIES_HISTOGRAM = "Tabs.IndependentTabCountInSwitcher"; + /** Field trial parameter for the {@link TabListRecyclerView} cleanup delay. */ private static final String SOFT_CLEANUP_DELAY_PARAM = "soft-cleanup-delay"; private static final int DEFAULT_SOFT_CLEANUP_DELAY_MS = 3_000; @@ -393,6 +397,8 @@ mModelIndexWhenShown = mTabModelSelector.getCurrentModelIndex(); mTabIdwhenShown = mTabModelSelector.getCurrentTabId(); mContainerViewModel.set(ANIMATE_VISIBILITY_CHANGES, true); + + recordTabCounts(); } @Override @@ -523,4 +529,15 @@ .getCurrentTabModelFilter() .getRelatedTabList(tabId); } + + private void recordTabCounts() { + final TabModel model = mTabModelSelector.getCurrentModel(); + if (model == null) return; + RecordHistogram.recordCountHistogram(TAB_COUNT_HISTOGRAM, model.getCount()); + + final TabModelFilter filter = + mTabModelSelector.getTabModelFilterProvider().getCurrentTabModelFilter(); + if (filter == null) return; + RecordHistogram.recordCountHistogram(TAB_ENTRIES_HISTOGRAM, filter.getCount()); + } }
diff --git a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/GridTabSwitcherMediatorUnitTest.java b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/GridTabSwitcherMediatorUnitTest.java index 28dab23..20624a4 100644 --- a/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/GridTabSwitcherMediatorUnitTest.java +++ b/chrome/android/features/tab_ui/junit/src/org/chromium/chrome/browser/tasks/tab_management/GridTabSwitcherMediatorUnitTest.java
@@ -40,6 +40,7 @@ import org.chromium.base.UserDataHost; import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordUserAction; +import org.chromium.base.metrics.test.ShadowRecordHistogram; import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.compositor.CompositorViewHolder; @@ -69,7 +70,7 @@ * Tests for {@link GridTabSwitcherMediatorUnitTest}. */ @RunWith(BaseRobolectricTestRunner.class) -@Config(manifest = Config.NONE) +@Config(manifest = Config.NONE, shadows = {ShadowRecordHistogram.class}) @DisableFeatures(ChromeFeatureList.TAB_SWITCHER_ON_RETURN) @EnableFeatures(ChromeFeatureList.TAB_TO_GTS_ANIMATION) public class GridTabSwitcherMediatorUnitTest { @@ -128,6 +129,7 @@ @Before public void setUp() { + ShadowRecordHistogram.reset(); RecordUserAction.setDisabledForTests(true); RecordHistogram.setDisabledForTests(true); FeatureUtilities.setGridTabSwitcherEnabledForTesting(true); @@ -219,6 +221,41 @@ mModel.get(TabListContainerProperties.ANIMATE_VISIBILITY_CHANGES), equalTo(true)); assertThat(mModel.get(TabListContainerProperties.IS_VISIBLE), equalTo(true)); assertThat(mMediator.overviewVisible(), equalTo(true)); + + assertThat(ShadowRecordHistogram.getHistogramValueCountForTesting( + GridTabSwitcherMediator.TAB_COUNT_HISTOGRAM, 3), + equalTo(1)); + assertThat(ShadowRecordHistogram.getHistogramValueCountForTesting( + GridTabSwitcherMediator.TAB_ENTRIES_HISTOGRAM, 3), + equalTo(1)); + } + + @Test + public void showsWithoutAnimation_withTabGroups() { + doReturn(2).when(mTabModelFilter).getCount(); + + initAndAssertAllProperties(); + mMediator.showOverview(false); + + InOrder inOrder = inOrder(mPropertyObserver, mPropertyObserver); + inOrder.verify(mPropertyObserver) + .onPropertyChanged(mModel, TabListContainerProperties.ANIMATE_VISIBILITY_CHANGES); + inOrder.verify(mPropertyObserver) + .onPropertyChanged(mModel, TabListContainerProperties.IS_VISIBLE); + inOrder.verify(mPropertyObserver) + .onPropertyChanged(mModel, TabListContainerProperties.ANIMATE_VISIBILITY_CHANGES); + + assertThat( + mModel.get(TabListContainerProperties.ANIMATE_VISIBILITY_CHANGES), equalTo(true)); + assertThat(mModel.get(TabListContainerProperties.IS_VISIBLE), equalTo(true)); + assertThat(mMediator.overviewVisible(), equalTo(true)); + + assertThat(ShadowRecordHistogram.getHistogramValueCountForTesting( + GridTabSwitcherMediator.TAB_COUNT_HISTOGRAM, 3), + equalTo(1)); + assertThat(ShadowRecordHistogram.getHistogramValueCountForTesting( + GridTabSwitcherMediator.TAB_ENTRIES_HISTOGRAM, 2), + equalTo(1)); } @Test
diff --git a/chrome/android/features/vr/java/AndroidManifest.xml b/chrome/android/features/vr/java/AndroidManifest.xml index 388353f7..4a2c233 100644 --- a/chrome/android/features/vr/java/AndroidManifest.xml +++ b/chrome/android/features/vr/java/AndroidManifest.xml
@@ -8,17 +8,9 @@ featureSplit="vr"> <dist:module - dist:instant="false" - dist:title="@string/vr_module_title"> - <dist:fusing dist:include="false" /> - <dist:delivery> - <dist:install-time> - <dist:conditions> - <dist:device-feature dist:name="android.hardware.vr.high_performance" /> - </dist:conditions> - </dist:install-time> - <dist:on-demand /> - </dist:delivery> + dist:onDemand="true" + dist:title="@string/vr_module_title"> + <dist:fusing dist:include="false" /> </dist:module> <application>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java index 9fe3d479..a168b08 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -245,6 +245,9 @@ "Android.MainActivity.UndispatchedExplicitMainViewIntentSource", IntentHandler.ExternalAppId.NUM_ENTRIES); + // Count histogram used to track number of tabs when we show the Overview on Return to Chrome. + private static final String TAB_COUNT_ON_RETURN = "Tabs.TabCountOnStartScreenShown"; + private final ActivityStopMetrics mActivityStopMetrics; private final MainIntentBehaviorMetrics mMainIntentMetrics; private final @Nullable MultiInstanceManager mMultiInstanceManager; @@ -1040,6 +1043,10 @@ long lastBackgroundedTimeMillis = mInactivityTracker.getLastBackgroundedTimeMs(); if (ReturnToChromeExperimentsUtil.shouldShowTabSwitcher(lastBackgroundedTimeMillis) && isMainIntentFromLauncher(getIntent()) && !isOverviewVisible) { + if (getCurrentTabModel() != null) { + RecordHistogram.recordCountHistogram( + TAB_COUNT_ON_RETURN, getCurrentTabModel().getCount()); + } toggleOverview(); return; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/content/TabContentManager.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/content/TabContentManager.java index eb96176a..ed5d0967 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/content/TabContentManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/content/TabContentManager.java
@@ -11,6 +11,7 @@ import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; +import android.support.annotation.IntDef; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.View; @@ -22,6 +23,7 @@ import org.chromium.base.VisibleForTesting; import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; +import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.task.AsyncTask; import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeSwitches; @@ -35,6 +37,8 @@ import org.chromium.ui.display.DisplayAndroid; import java.io.File; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.List; @@ -44,6 +48,20 @@ */ @JNINamespace("android") public class TabContentManager { + // These are used for UMA logging, so append only. Please update the + // GridTabSwitcherThumbnailFetchingResult enum in enums.xml if these change. + @IntDef({ThumbnailFetchingResult.GOT_JPEG, ThumbnailFetchingResult.GOT_ETC1, + ThumbnailFetchingResult.GOT_NOTHING}) + @Retention(RetentionPolicy.SOURCE) + public @interface ThumbnailFetchingResult { + int GOT_JPEG = 0; + int GOT_ETC1 = 1; + int GOT_NOTHING = 2; + int NUM_ENTRIES = 3; + } + private static final String UMA_THUMBNAIL_FETCHING_RESULT = + "GridTabSwitcher.ThumbnailFetchingResult"; + private final float mThumbnailScale; private final int mFullResThumbnailsMaxSize; private final ContentOffsetProvider mContentOffsetProvider; @@ -329,13 +347,26 @@ } @Override - public void onPostExecute(Bitmap bitmap) { - if (bitmap != null) { - callback.onResult(bitmap); + public void onPostExecute(Bitmap jpeg) { + if (jpeg != null) { + RecordHistogram.recordEnumeratedHistogram(UMA_THUMBNAIL_FETCHING_RESULT, + ThumbnailFetchingResult.GOT_JPEG, ThumbnailFetchingResult.NUM_ENTRIES); + callback.onResult(jpeg); return; } if (mNativeTabContentManager == 0 || !mSnapshotsEnabled) return; - nativeGetEtc1TabThumbnail(mNativeTabContentManager, tab.getId(), callback); + nativeGetEtc1TabThumbnail(mNativeTabContentManager, tab.getId(), (etc1) -> { + if (etc1 != null) { + RecordHistogram.recordEnumeratedHistogram(UMA_THUMBNAIL_FETCHING_RESULT, + ThumbnailFetchingResult.GOT_ETC1, + ThumbnailFetchingResult.NUM_ENTRIES); + } else { + RecordHistogram.recordEnumeratedHistogram(UMA_THUMBNAIL_FETCHING_RESULT, + ThumbnailFetchingResult.GOT_NOTHING, + ThumbnailFetchingResult.NUM_ENTRIES); + } + callback.onResult(etc1); + }); } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManager.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManager.java index eb78f54..5477e77 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManager.java
@@ -11,7 +11,6 @@ import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; -import android.os.Build; import android.os.Handler; import android.os.IBinder; import android.support.annotation.Nullable; @@ -23,10 +22,8 @@ import org.chromium.base.VisibleForTesting; import org.chromium.chrome.browser.download.DownloadNotificationService.DownloadStatus; -import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; -import java.util.List; import java.util.Map; /** @@ -53,9 +50,6 @@ // Delay to ensure start/stop foreground doesn't happen too quickly (b/74236718). private static final int WAIT_TIME_MS = 200; - // Used to track existing notifications for UMA stats. - private final List<Integer> mExistingNotifications = new ArrayList<>(); - // Variables used to ensure start/stop foreground doesn't happen too quickly (b/74236718). private final Handler mHandler = new Handler(); private final Runnable mMaybeStopServiceRunnable = new Runnable() { @@ -92,15 +86,6 @@ mDownloadUpdateQueue.put(notificationId, new DownloadUpdate(notificationId, notification, downloadStatus, context)); processDownloadUpdateQueue(false /* not isProcessingPending */); - - // Record instance where notification is being launched for the first time. - if (!mExistingNotifications.contains(notificationId)) { - mExistingNotifications.add(notificationId); - if (Build.VERSION.SDK_INT < 24) { - DownloadNotificationUmaHelper.recordNotificationFlickerCountHistogram( - DownloadNotificationUmaHelper.LaunchType.LAUNCH); - } - } } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java index 7c9fcf8d..d5a3696 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
@@ -512,10 +512,6 @@ ? NotificationUmaTracker.SystemNotificationType.DOWNLOAD_PAGES : NotificationUmaTracker.SystemNotificationType.DOWNLOAD_FILES, notification); - - // Record the number of other notifications when there's a new notification. - DownloadNotificationUmaHelper.recordExistingNotificationsCountHistogram( - mDownloadSharedPreferenceHelper.getEntries().size(), true /* withForeground */); } private static boolean canResumeDownload(Context context, DownloadSharedPreferenceEntry entry) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationUmaHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationUmaHelper.java index 5e26bab..0945cd7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationUmaHelper.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationUmaHelper.java
@@ -150,35 +150,6 @@ } /** - * Record the number of existing notifications when a new notification is being launched (more - * specifically the number of existing shared preference entries when a new shared preference - * entry is being recorded). - * @param count The number of existing notifications. - * @param withForeground Whether this is with foreground enabled or not. - */ - static void recordExistingNotificationsCountHistogram(int count, boolean withForeground) { - if (!LibraryLoader.getInstance().isInitialized()) return; - if (withForeground) { - RecordHistogram.recordCountHistogram( - "Android.DownloadManager.NotificationsCount.ForegroundEnabled", count); - } else { - RecordHistogram.recordCountHistogram( - "Android.DownloadManager.NotificationsCount.ForegroundDisabled", count); - } - } - - /** - * Record an instance when a notification is being launched for the first time or relaunched due - * to the need to dissociate the notification from the foreground (only on API < 24). - * @param launchType Whether it is a launch or a relaunch ({@link LaunchType}). - */ - static void recordNotificationFlickerCountHistogram(@LaunchType int launchType) { - if (!LibraryLoader.getInstance().isInitialized()) return; - RecordHistogram.recordEnumeratedHistogram( - "Android.DownloadManager.NotificationLaunch", launchType, LaunchType.NUM_ENTRIES); - } - - /** * Records the state of a request at user-initiated cancel. * @param isDownload True if the request is a download, false if it is an offline page. * @param state State of a request when cancelled (e.g. downloading, paused).
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkTest.java index 13159fe..56c15ea 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkTest.java
@@ -15,14 +15,18 @@ import android.widget.TextView; import org.junit.After; +import org.junit.AfterClass; import org.junit.Assert; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.chromium.base.ActivityState; import org.chromium.base.ApplicationStatus; +import org.chromium.base.test.params.ParameterAnnotations; +import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisableIf; @@ -34,11 +38,12 @@ import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.bookmarks.BookmarkBridge.BookmarkItem; +import org.chromium.chrome.browser.night_mode.NightModeTestUtils; import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksShim; import org.chromium.chrome.browser.util.UrlConstants; import org.chromium.chrome.browser.widget.selection.SelectableListToolbar; import org.chromium.chrome.test.ChromeActivityTestRule; -import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; import org.chromium.chrome.test.util.ActivityUtils; import org.chromium.chrome.test.util.BookmarkTestUtil; import org.chromium.chrome.test.util.ChromeTabUtils; @@ -58,7 +63,8 @@ /** * Tests for the bookmark manager. */ -@RunWith(ChromeJUnit4ClassRunner.class) +@RunWith(ParameterizedRunner.class) +@ParameterAnnotations.UseRunnerDelegate(ChromeJUnit4RunnerDelegate.class) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) @RetryOnFailure public class BookmarkTest { @@ -84,6 +90,17 @@ private EmbeddedTestServer mTestServer; private @Nullable BookmarkActivity mBookmarkActivity; + @BeforeClass + public static void setUpBeforeActivityLaunched() { + NightModeTestUtils.setUpNightModeBeforeChromeActivityLaunched(); + } + + @ParameterAnnotations.UseMethodParameterBefore(NightModeTestUtils.NightModeParams.class) + public void setupNightMode(boolean nightModeEnabled) { + NightModeTestUtils.setUpNightModeForChromeActivity(nightModeEnabled); + mRenderTestRule.setNightModeEnabled(nightModeEnabled); + } + @Before public void setUp() throws Exception { mActivityTestRule.startMainActivityFromLauncher(); @@ -108,6 +125,11 @@ mTestServer.stopAndDestroyServer(); } + @AfterClass + public static void tearDownAfterActivityDestroyed() { + NightModeTestUtils.tearDownNightModeAfterChromeActivityDestroyed(); + } + private void openBookmarkManager() throws InterruptedException { if (mActivityTestRule.getActivity().isTablet()) { mActivityTestRule.loadUrl(UrlConstants.BOOKMARKS_URL); @@ -381,7 +403,8 @@ @Test @MediumTest @Feature({"RenderTest"}) - public void testBookmarkFolderIcon() throws Exception { + @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class) + public void testBookmarkFolderIcon(boolean nightModeEnabled) throws Exception { BookmarkPromoHeader.forcePromoStateForTests(BookmarkPromoHeader.PromoState.PROMO_NONE); addFolder(TEST_FOLDER_TITLE); openBookmarkManager();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesPageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesPageTest.java index 6e59f703..ef2515e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesPageTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/explore_sites/ExploreSitesPageTest.java
@@ -19,13 +19,17 @@ import android.view.View; import org.junit.After; +import org.junit.AfterClass; import org.junit.Assert; import org.junit.Assume; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import org.chromium.base.test.params.ParameterAnnotations; +import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; @@ -33,11 +37,12 @@ import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.ChromeSwitches; +import org.chromium.chrome.browser.night_mode.NightModeTestUtils; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.util.FeatureUtilities; import org.chromium.chrome.browser.util.UrlConstants; import org.chromium.chrome.test.ChromeActivityTestRule; -import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; import org.chromium.chrome.test.util.RenderTestRule; import org.chromium.chrome.test.util.browser.Features; import org.chromium.content_public.browser.test.util.Criteria; @@ -51,7 +56,8 @@ */ // TODO(https://crbug.com/894334): Remove format suppression once formatting bug is fixed. // clang-format off -@RunWith(ChromeJUnit4ClassRunner.class) +@RunWith(ParameterizedRunner.class) +@ParameterAnnotations.UseRunnerDelegate(ChromeJUnit4RunnerDelegate.class) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ExploreSitesPageTest { // clang-format on @@ -87,6 +93,17 @@ private RecyclerView mRecyclerView; private ExploreSitesPage mEsp; + @BeforeClass + public static void setUpBeforeActivityLaunched() { + NightModeTestUtils.setUpNightModeBeforeChromeActivityLaunched(); + } + + @ParameterAnnotations.UseMethodParameterBefore(NightModeTestUtils.NightModeParams.class) + public void setupNightMode(boolean nightModeEnabled) { + NightModeTestUtils.setUpNightModeForChromeActivity(nightModeEnabled); + mRenderTestRule.setNightModeEnabled(nightModeEnabled); + } + @Before public void setUp() throws Exception { ExploreSitesBridge.setCatalogForTesting(getTestingCatalog()); @@ -106,6 +123,11 @@ ExploreSitesBridge.setCatalogForTesting(null); } + @AfterClass + public static void tearDownAfterActivityDestroyed() { + NightModeTestUtils.tearDownNightModeAfterChromeActivityDestroyed(); + } + private int getFirstVisiblePosition() { return ((LinearLayoutManager) mRecyclerView.getLayoutManager()) .findFirstCompletelyVisibleItemPosition(); @@ -136,7 +158,8 @@ @SmallTest @Feature({"ExploreSites", "RenderTest"}) @Features.EnableFeatures(ChromeFeatureList.EXPLORE_SITES) - public void testInitialLayout() throws Exception { + @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class) + public void testInitialLayout(boolean nightModeEnabled) throws Exception { onView(instanceOf(RecyclerView.class)).perform(RecyclerViewActions.scrollToPosition(0)); mRenderTestRule.render(mRecyclerView, "initial_layout"); } @@ -147,8 +170,8 @@ Add({"enable-features=ExploreSites<FakeStudyName", "force-fieldtrials=FakeStudyName/Enabled", "force-fieldtrial-params=FakeStudyName.Enabled:variation/mostLikelyTile"}) @Feature({"ExploreSites", "RenderTest"}) - public void - testInitialLayout_MostLikely() throws Exception { + @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class) + public void testInitialLayout_MostLikely(boolean nightModeEnabled) throws Exception { mRenderTestRule.render(mRecyclerView, "initial_layout"); Assert.assertEquals(0, getFirstVisiblePosition()); } @@ -187,7 +210,8 @@ @SmallTest @Feature({"ExploreSites", "RenderTest"}) @Features.EnableFeatures(ChromeFeatureList.EXPLORE_SITES) - public void testScrollingFromNTP() throws Exception { + @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class) + public void testScrollingFromNTP(boolean nightModeEnabled) throws Exception { mActivityTestRule.loadUrl("about:blank"); ExploreSitesCategory category = getTestingCatalog().get(2); mActivityTestRule.loadUrl(category.getUrl()); @@ -205,7 +229,8 @@ @SmallTest @Feature({"ExploreSites", "RenderTest"}) @Features.EnableFeatures(ChromeFeatureList.EXPLORE_SITES) - public void testFocusRetention_WithBack() throws Exception { + @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class) + public void testFocusRetention_WithBack(boolean nightModeEnabled) throws Exception { Assume.assumeTrue(FeatureUtilities.isNoTouchModeEnabled()); InstrumentationRegistry.getInstrumentation().setInTouchMode(false);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFreeShippingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFreeShippingTest.java index c22e1a8..2739fb65 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFreeShippingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestFreeShippingTest.java
@@ -6,13 +6,18 @@ import android.support.test.filters.MediumTest; +import org.junit.AfterClass; import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.chromium.base.metrics.RecordHistogram; +import org.chromium.base.test.params.ParameterAnnotations; +import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.FlakyTest; @@ -22,8 +27,9 @@ import org.chromium.chrome.browser.autofill.CardType; import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; +import org.chromium.chrome.browser.night_mode.NightModeTestUtils; import org.chromium.chrome.browser.payments.PaymentRequestTestRule.MainActivityStartCallback; -import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; import org.chromium.chrome.test.ui.DisableAnimationsTestRule; import org.chromium.chrome.test.util.RenderTestRule; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -34,7 +40,8 @@ /** * A payment integration test for a merchant that provides free shipping regardless of address. */ -@RunWith(ChromeJUnit4ClassRunner.class) +@RunWith(ParameterizedRunner.class) +@ParameterAnnotations.UseRunnerDelegate(ChromeJUnit4RunnerDelegate.class) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class PaymentRequestFreeShippingTest implements MainActivityStartCallback { // Disable animations to reduce flakiness. @@ -43,12 +50,33 @@ @Rule public PaymentRequestTestRule mPaymentRequestTestRule = - new PaymentRequestTestRule("payment_request_free_shipping_test.html", this); + new PaymentRequestTestRule("payment_request_free_shipping_test.html", this, true); @Rule public RenderTestRule mRenderTestRule = new RenderTestRule("components/test/data/payments/render_tests"); + @BeforeClass + public static void setUpBeforeActivityLaunched() { + NightModeTestUtils.setUpNightModeBeforeChromeActivityLaunched(); + } + + @ParameterAnnotations.UseMethodParameterBefore(NightModeTestUtils.NightModeParams.class) + public void setupNightMode(boolean nightModeEnabled) { + NightModeTestUtils.setUpNightModeForChromeActivity(nightModeEnabled); + mRenderTestRule.setNightModeEnabled(nightModeEnabled); + } + + @Before + public void setUp() throws Exception { + mPaymentRequestTestRule.startMainActivity(); + } + + @AfterClass + public static void tearDownAfterActivityDestroyed() { + NightModeTestUtils.tearDownNightModeAfterChromeActivityDestroyed(); + } + @Override public void onMainActivityStarted() throws InterruptedException, TimeoutException { AutofillTestHelper helper = new AutofillTestHelper(); @@ -65,7 +93,8 @@ @Test @MediumTest @Feature({"Payments", "RenderTest"}) - public void testPayWithRender() throws Throwable { + @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class) + public void testPayWithRender(boolean nightModeEnabled) throws Throwable { mPaymentRequestTestRule.triggerUIAndWait(mPaymentRequestTestRule.getReadyToPay()); mRenderTestRule.render(mPaymentRequestTestRule.getPaymentRequestView(), "free_shipping"); mPaymentRequestTestRule.clickAndWait(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestRule.java index 722bf26..6be066899 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestRule.java
@@ -120,6 +120,8 @@ PaymentRequestImpl mPaymentRequest; PaymentRequestUI mUI; + private final boolean mDelayStartActivity; + private final AtomicReference<WebContents> mWebContentsRef; private final String mTestFilePath; @@ -129,6 +131,11 @@ private final MainActivityStartCallback mCallback; public PaymentRequestTestRule(String testFileName, MainActivityStartCallback callback) { + this(testFileName, callback, false); + } + + public PaymentRequestTestRule( + String testFileName, MainActivityStartCallback callback, boolean delayStartActivity) { super(); mReadyForInput = new PaymentsCallbackHelper<>(); mReadyToPay = new PaymentsCallbackHelper<>(); @@ -155,6 +162,7 @@ : UrlUtils.getIsolatedTestFilePath( String.format("components/test/data/payments/%s", testFileName)); mCallback = callback; + mDelayStartActivity = delayStartActivity; } public PaymentRequestTestRule(String testFileName) { @@ -1241,7 +1249,7 @@ return super.apply(new Statement() { @Override public void evaluate() throws Throwable { - startMainActivity(); + if (!mDelayStartActivity) startMainActivity(); base.evaluate(); } }, description);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/tile/TileGridLayoutTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/tile/TileGridLayoutTest.java index d1b388fd..9b09e4d 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/tile/TileGridLayoutTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/tile/TileGridLayoutTest.java
@@ -23,11 +23,15 @@ import android.view.ViewGroup; import android.widget.FrameLayout; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.chromium.base.ThreadUtils; +import org.chromium.base.test.params.ParameterAnnotations; +import org.chromium.base.test.params.ParameterizedRunner; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; @@ -38,6 +42,7 @@ import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.GlobalDiscardableReferencePool; +import org.chromium.chrome.browser.night_mode.NightModeTestUtils; import org.chromium.chrome.browser.ntp.NewTabPage; import org.chromium.chrome.browser.ntp.cards.NewTabPageViewHolder.PartialBindCallback; import org.chromium.chrome.browser.offlinepages.OfflinePageItem; @@ -49,7 +54,7 @@ import org.chromium.chrome.browser.util.UrlConstants; import org.chromium.chrome.browser.util.ViewUtils; import org.chromium.chrome.browser.widget.displaystyle.UiConfig; -import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.NewTabPageTestUtils; import org.chromium.chrome.test.util.RenderTestRule; @@ -73,7 +78,8 @@ /** * Instrumentation tests for the {@link TileGridLayout} on the New Tab Page. */ -@RunWith(ChromeJUnit4ClassRunner.class) +@RunWith(ParameterizedRunner.class) +@ParameterAnnotations.UseRunnerDelegate(ChromeJUnit4RunnerDelegate.class) @CommandLineFlags.Add(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE) public class TileGridLayoutTest { @Rule @@ -105,12 +111,29 @@ private final CallbackHelper mLoadCompleteHelper = new CallbackHelper(); + @BeforeClass + public static void setUpBeforeActivityLaunched() { + NightModeTestUtils.setUpNightModeBeforeChromeActivityLaunched(); + } + + @ParameterAnnotations.UseMethodParameterBefore(NightModeTestUtils.NightModeParams.class) + public void setupNightMode(boolean nightModeEnabled) { + NightModeTestUtils.setUpNightModeForChromeActivity(nightModeEnabled); + mRenderTestRule.setNightModeEnabled(nightModeEnabled); + } + + @AfterClass + public static void tearDownAfterActivityDestroyed() { + NightModeTestUtils.tearDownNightModeAfterChromeActivityDestroyed(); + } + @Test @MediumTest @Feature({"NewTabPage", "RenderTest"}) + @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class) // TODO(https://crbug.com/906151): Add new goldens and enable ExploreSites. @DisableFeatures(ChromeFeatureList.EXPLORE_SITES) - public void testTileGridAppearance() throws Exception { + public void testTileGridAppearance(boolean nightModeEnabled) throws Exception { NewTabPage ntp = setUpFakeDataToShowOnNtp(FAKE_MOST_VISITED_URLS.length); mRenderTestRule.render(getTileGridLayout(ntp), "ntp_tile_grid_layout"); } @@ -119,7 +142,8 @@ //@MediumTest @DisabledTest(message = "crbug.com/771648") @Feature({"NewTabPage", "RenderTest"}) - public void testModernTileGridAppearance_Full() throws IOException, InterruptedException { + public void testModernTileGridAppearance_Full() + throws IOException, InterruptedException { View tileGridLayout = renderTiles(makeSuggestions(FAKE_MOST_VISITED_URLS.length)); setOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, mActivityTestRule.getActivity()); @@ -141,7 +165,8 @@ @DisabledTest(message = "crbug.com/771648") @RetryOnFailure @Feature({"NewTabPage", "RenderTest"}) - public void testModernTileGridAppearance_Two() throws IOException, InterruptedException { + public void testModernTileGridAppearance_Two() + throws IOException, InterruptedException { View tileGridLayout = renderTiles(makeSuggestions(2)); setOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, mActivityTestRule.getActivity()); @@ -156,7 +181,8 @@ @Feature({"NewTabPage", "RenderTest"}) // TODO(https://crbug.com/906151): Add new goldens and enable ExploreSites. @DisableFeatures(ChromeFeatureList.EXPLORE_SITES) - public void testTileAppearanceModern() + @ParameterAnnotations.UseMethodParameter(NightModeTestUtils.NightModeParams.class) + public void testTileAppearanceModern(boolean nightModeEnabled) throws IOException, InterruptedException, TimeoutException { List<SiteSuggestion> suggestions = makeSuggestions(2); List<String> offlineAvailableUrls = Collections.singletonList(suggestions.get(0).url);
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 0602b08..0e6093e6 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -628,6 +628,7 @@ "lookalikes/lookalike_url_navigation_throttle.h", "lookalikes/lookalike_url_service.cc", "lookalikes/lookalike_url_service.h", + "lookalikes/safety_tips/safety_tip_ui.h", "mac/bluetooth_utility.h", "mac/bluetooth_utility.mm", "mac/dock.h", @@ -3576,6 +3577,7 @@ "//chrome/services/cups_proxy/public/mojom", "//chromeos/components/account_manager", "//chromeos/services/assistant/public:feature_flags", + "//chromeos/services/assistant/public/cpp:prefs", "//chromeos/services/cellular_setup", "//chromeos/services/device_sync", "//chromeos/services/device_sync/public/mojom",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index f671797..2cc14f8 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -1384,9 +1384,6 @@ {"focus-mode", flag_descriptions::kFocusMode, flag_descriptions::kFocusModeDescription, kOsDesktop, FEATURE_VALUE_TYPE(features::kFocusMode)}, - {"site-settings", flag_descriptions::kSiteSettings, - flag_descriptions::kSiteSettingsDescription, kOsDesktop, - FEATURE_VALUE_TYPE(features::kSiteSettings)}, {"touch-events", flag_descriptions::kTouchEventsName, flag_descriptions::kTouchEventsDescription, kOsDesktop, MULTI_VALUE_TYPE(kTouchEventFeatureDetectionChoices)},
diff --git a/chrome/browser/apps/intent_helper/apps_navigation_throttle.cc b/chrome/browser/apps/intent_helper/apps_navigation_throttle.cc index f0f745c..4b3e8fe 100644 --- a/chrome/browser/apps/intent_helper/apps_navigation_throttle.cc +++ b/chrome/browser/apps/intent_helper/apps_navigation_throttle.cc
@@ -117,8 +117,9 @@ const GURL& url) { std::vector<IntentPickerAppInfo> apps = FindPwaForUrl(web_contents, url, {}); + bool show_persistence_options = ShouldShowPersistenceOptions(apps); ShowIntentPickerBubbleForApps( - web_contents, std::move(apps), ShouldShowRememberSelection(apps), + web_contents, std::move(apps), show_persistence_options, base::BindOnce(&OnIntentPickerClosed, web_contents, ui_auto_display_service, url)); } @@ -194,7 +195,7 @@ void AppsNavigationThrottle::ShowIntentPickerBubbleForApps( content::WebContents* web_contents, std::vector<IntentPickerAppInfo> apps, - bool show_remember_selection, + bool show_persistence_options, IntentPickerResponse callback) { if (apps.empty()) return; @@ -207,7 +208,7 @@ return; browser->window()->ShowIntentPickerBubble(std::move(apps), /*enable_stay_in_chrome=*/true, - show_remember_selection, + show_persistence_options, std::move(callback)); } @@ -284,7 +285,8 @@ return Platform::ARC; case PickerAction::PWA_APP_PRESSED: return Platform::PWA; - case PickerAction::PICKER_ERROR: + case PickerAction::ERROR_BEFORE_PICKER: + case PickerAction::ERROR_AFTER_PICKER: case PickerAction::DIALOG_DEACTIVATED: case PickerAction::CHROME_PRESSED: case PickerAction::CHROME_PREFERRED_PRESSED: @@ -343,7 +345,7 @@ } // static -bool AppsNavigationThrottle::ShouldShowRememberSelection( +bool AppsNavigationThrottle::ShouldShowPersistenceOptions( std::vector<apps::IntentPickerAppInfo>& apps) { // There is no support persistence for PWA so the selection should be hidden // if only PWAs are present. @@ -378,11 +380,13 @@ ui_displayed_ = false; IntentPickerTabHelper::SetShouldShowIcon(web_contents, true); break; - case PickerShowState::kPopOut: + case PickerShowState::kPopOut: { + bool show_persistence_options = ShouldShowPersistenceOptions(apps); ShowIntentPickerBubbleForApps(web_contents, std::move(apps), - ShouldShowRememberSelection(apps), + show_persistence_options, std::move(callback)); break; + } default: NOTREACHED(); } @@ -414,8 +418,10 @@ IntentPickerCloseReason close_reason, bool should_persist) { switch (close_reason) { - case IntentPickerCloseReason::PICKER_ERROR: - return PickerAction::PICKER_ERROR; + case IntentPickerCloseReason::ERROR_BEFORE_PICKER: + return PickerAction::ERROR_BEFORE_PICKER; + case IntentPickerCloseReason::ERROR_AFTER_PICKER: + return PickerAction::ERROR_AFTER_PICKER; case IntentPickerCloseReason::DIALOG_DEACTIVATED: return PickerAction::DIALOG_DEACTIVATED; case IntentPickerCloseReason::PREFERRED_APP_FOUND:
diff --git a/chrome/browser/apps/intent_helper/apps_navigation_throttle.h b/chrome/browser/apps/intent_helper/apps_navigation_throttle.h index 49aacf8..4734945 100644 --- a/chrome/browser/apps/intent_helper/apps_navigation_throttle.h +++ b/chrome/browser/apps/intent_helper/apps_navigation_throttle.h
@@ -82,7 +82,7 @@ static void ShowIntentPickerBubbleForApps( content::WebContents* web_contents, std::vector<IntentPickerAppInfo> apps, - bool show_remember_selection, + bool show_persistence_options, IntentPickerResponse callback); explicit AppsNavigationThrottle(content::NavigationHandle* navigation_handle); @@ -104,7 +104,8 @@ // and need to be synced with histograms.xml. This enum class should also be // treated as append-only. enum class PickerAction : int { - PICKER_ERROR = 0, + // Picker errors occurring after the picker is shown. + ERROR_AFTER_PICKER = 0, // DIALOG_DEACTIVATED keeps track of the user dismissing the UI via clicking // the close button or clicking outside of the IntentPickerBubbleView // surface. As with CHROME_PRESSED, the user stays in Chrome, however we @@ -124,7 +125,9 @@ ARC_APP_PRESSED = 7, ARC_APP_PREFERRED_PRESSED = 8, PWA_APP_PRESSED = 9, - INVALID = 10, + // Picker errors occurring before the picker is shown. + ERROR_BEFORE_PICKER = 10, + INVALID = 11, kMaxValue = INVALID, }; @@ -169,7 +172,7 @@ static bool ContainsOnlyPwas( const std::vector<apps::IntentPickerAppInfo>& apps); - static bool ShouldShowRememberSelection( + static bool ShouldShowPersistenceOptions( std::vector<apps::IntentPickerAppInfo>& apps); // Overridden for Chrome OS to allow arc handling.
diff --git a/chrome/browser/apps/intent_helper/apps_navigation_throttle_unittest.cc b/chrome/browser/apps/intent_helper/apps_navigation_throttle_unittest.cc index 6465caff3..9433cc3 100644 --- a/chrome/browser/apps/intent_helper/apps_navigation_throttle_unittest.cc +++ b/chrome/browser/apps/intent_helper/apps_navigation_throttle_unittest.cc
@@ -104,30 +104,53 @@ } TEST(AppsNavigationThrottleTest, TestGetPickerAction) { - // Expect PickerAction::PICKER_ERROR if the close_reason is ERROR. - EXPECT_EQ( - AppsNavigationThrottle::PickerAction::PICKER_ERROR, - AppsNavigationThrottle::GetPickerAction( - apps::mojom::AppType::kUnknown, IntentPickerCloseReason::PICKER_ERROR, - /*should_persist=*/true)); + EXPECT_EQ(AppsNavigationThrottle::PickerAction::ERROR_BEFORE_PICKER, + AppsNavigationThrottle::GetPickerAction( + apps::mojom::AppType::kUnknown, + IntentPickerCloseReason::ERROR_BEFORE_PICKER, + /*should_persist=*/true)); - EXPECT_EQ( - AppsNavigationThrottle::PickerAction::PICKER_ERROR, - AppsNavigationThrottle::GetPickerAction( - apps::mojom::AppType::kArc, IntentPickerCloseReason::PICKER_ERROR, - /*should_persist=*/true)); + EXPECT_EQ(AppsNavigationThrottle::PickerAction::ERROR_BEFORE_PICKER, + AppsNavigationThrottle::GetPickerAction( + apps::mojom::AppType::kArc, + IntentPickerCloseReason::ERROR_BEFORE_PICKER, + /*should_persist=*/true)); - EXPECT_EQ( - AppsNavigationThrottle::PickerAction::PICKER_ERROR, - AppsNavigationThrottle::GetPickerAction( - apps::mojom::AppType::kUnknown, IntentPickerCloseReason::PICKER_ERROR, - /*should_persist=*/false)); + EXPECT_EQ(AppsNavigationThrottle::PickerAction::ERROR_BEFORE_PICKER, + AppsNavigationThrottle::GetPickerAction( + apps::mojom::AppType::kUnknown, + IntentPickerCloseReason::ERROR_BEFORE_PICKER, + /*should_persist=*/false)); - EXPECT_EQ( - AppsNavigationThrottle::PickerAction::PICKER_ERROR, - AppsNavigationThrottle::GetPickerAction( - apps::mojom::AppType::kArc, IntentPickerCloseReason::PICKER_ERROR, - /*should_persist=*/false)); + EXPECT_EQ(AppsNavigationThrottle::PickerAction::ERROR_BEFORE_PICKER, + AppsNavigationThrottle::GetPickerAction( + apps::mojom::AppType::kArc, + IntentPickerCloseReason::ERROR_BEFORE_PICKER, + /*should_persist=*/false)); + + EXPECT_EQ(AppsNavigationThrottle::PickerAction::ERROR_AFTER_PICKER, + AppsNavigationThrottle::GetPickerAction( + apps::mojom::AppType::kUnknown, + IntentPickerCloseReason::ERROR_AFTER_PICKER, + /*should_persist=*/true)); + + EXPECT_EQ(AppsNavigationThrottle::PickerAction::ERROR_AFTER_PICKER, + AppsNavigationThrottle::GetPickerAction( + apps::mojom::AppType::kArc, + IntentPickerCloseReason::ERROR_AFTER_PICKER, + /*should_persist=*/true)); + + EXPECT_EQ(AppsNavigationThrottle::PickerAction::ERROR_AFTER_PICKER, + AppsNavigationThrottle::GetPickerAction( + apps::mojom::AppType::kUnknown, + IntentPickerCloseReason::ERROR_AFTER_PICKER, + /*should_persist=*/false)); + + EXPECT_EQ(AppsNavigationThrottle::PickerAction::ERROR_AFTER_PICKER, + AppsNavigationThrottle::GetPickerAction( + apps::mojom::AppType::kArc, + IntentPickerCloseReason::ERROR_AFTER_PICKER, + /*should_persist=*/false)); // Expect PickerAction::DIALOG_DEACTIVATED if the close_reason is // DIALOG_DEACTIVATED. @@ -237,12 +260,22 @@ // When the PickerAction is either ERROR or DIALOG_DEACTIVATED we MUST stay in // Chrome not taking into account the selected_app_package. - EXPECT_EQ(AppsNavigationThrottle::Platform::CHROME, - AppsNavigationThrottle::GetDestinationPlatform( - app_id, AppsNavigationThrottle::PickerAction::PICKER_ERROR)); - EXPECT_EQ(AppsNavigationThrottle::Platform::CHROME, - AppsNavigationThrottle::GetDestinationPlatform( - app_id, AppsNavigationThrottle::PickerAction::PICKER_ERROR)); + EXPECT_EQ( + AppsNavigationThrottle::Platform::CHROME, + AppsNavigationThrottle::GetDestinationPlatform( + app_id, AppsNavigationThrottle::PickerAction::ERROR_BEFORE_PICKER)); + EXPECT_EQ( + AppsNavigationThrottle::Platform::CHROME, + AppsNavigationThrottle::GetDestinationPlatform( + app_id, AppsNavigationThrottle::PickerAction::ERROR_BEFORE_PICKER)); + EXPECT_EQ( + AppsNavigationThrottle::Platform::CHROME, + AppsNavigationThrottle::GetDestinationPlatform( + app_id, AppsNavigationThrottle::PickerAction::ERROR_AFTER_PICKER)); + EXPECT_EQ( + AppsNavigationThrottle::Platform::CHROME, + AppsNavigationThrottle::GetDestinationPlatform( + app_id, AppsNavigationThrottle::PickerAction::ERROR_AFTER_PICKER)); EXPECT_EQ( AppsNavigationThrottle::Platform::CHROME, AppsNavigationThrottle::GetDestinationPlatform(
diff --git a/chrome/browser/apps/intent_helper/apps_navigation_types.h b/chrome/browser/apps/intent_helper/apps_navigation_types.h index a6faa72e..3b7cd4f 100644 --- a/chrome/browser/apps/intent_helper/apps_navigation_types.h +++ b/chrome/browser/apps/intent_helper/apps_navigation_types.h
@@ -17,8 +17,11 @@ // Describes the possible ways for the intent picker to be closed. enum class IntentPickerCloseReason { - // There was an error in showing the intent picker. - PICKER_ERROR, + // An error occurred in the intent picker before it could be displayed. + ERROR_BEFORE_PICKER, + + // An error occurred in the intent picker after it was displayed. + ERROR_AFTER_PICKER, // The user dismissed the picker without making a choice. DIALOG_DEACTIVATED,
diff --git a/chrome/browser/assist_ranker/OWNERS b/chrome/browser/assist_ranker/OWNERS index cebf50d8..c63059f5 100644 --- a/chrome/browser/assist_ranker/OWNERS +++ b/chrome/browser/assist_ranker/OWNERS
@@ -1 +1,2 @@ file://components/assist_ranker/OWNERS +# COMPONENT: UI>Browser>Search>ContextualSearch
diff --git a/chrome/browser/banners/app_banner_manager_desktop.cc b/chrome/browser/banners/app_banner_manager_desktop.cc index 494bbcc..affc058 100644 --- a/chrome/browser/banners/app_banner_manager_desktop.cc +++ b/chrome/browser/banners/app_banner_manager_desktop.cc
@@ -159,8 +159,9 @@ Profile::FromBrowserContext(web_contents()->GetBrowserContext()); auto* provider = web_app::WebAppProviderBase::GetProviderBase(profile); DCHECK(provider); - web_app::AppId app_id = provider->registrar().FindAppIdForUrl(validated_url_); - if (!app_id.empty() && app_id == installed_app_id) + base::Optional<web_app::AppId> app_id = + provider->registrar().FindAppWithUrlInScope(validated_url_); + if (app_id.has_value() && *app_id == installed_app_id) OnInstall(blink::kWebDisplayModeStandalone); }
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index da97e83d..de37af59 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -4721,17 +4721,11 @@ bool matches_enterprise_whitelist = safe_browsing::IsURLWhitelistedByPolicy( request.url, io_data->safe_browsing_whitelist_domains()); if (!matches_enterprise_whitelist) { - auto* delegate = GetSafeBrowsingUrlCheckerDelegate(resource_context); - if (delegate && !delegate->ShouldSkipRequestCheck( - resource_context, request.url, frame_tree_node_id, - -1 /* render_process_id */, -1 /* render_frame_id */, - request.originated_from_service_worker)) { - auto safe_browsing_throttle = - safe_browsing::BrowserURLLoaderThrottle::MaybeCreate(delegate, - wc_getter); - if (safe_browsing_throttle) - result.push_back(std::move(safe_browsing_throttle)); - } + result.push_back(safe_browsing::BrowserURLLoaderThrottle::Create( + base::BindOnce( + &ChromeContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate, + base::Unretained(this)), + wc_getter, frame_tree_node_id, resource_context)); } } #endif // defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) @@ -4823,6 +4817,18 @@ headers, data_reduction_proxy_throttle_manager_.get())); } +#if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) + bool matches_enterprise_whitelist = safe_browsing::IsURLWhitelistedByPolicy( + request.url, *profile->GetPrefs()); + if (!matches_enterprise_whitelist) { + result.push_back(safe_browsing::BrowserURLLoaderThrottle::Create( + base::BindOnce( + &ChromeContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate, + base::Unretained(this)), + wc_getter, frame_tree_node_id, profile->GetResourceContext())); + } +#endif // defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) + if (chrome_navigation_ui_data && chrome_navigation_ui_data->prerender_mode() != prerender::NO_PRERENDER) { result.push_back(std::make_unique<prerender::PrerenderURLLoaderThrottle>( @@ -5491,7 +5497,7 @@ g_default_quota_settings = settings; } -safe_browsing::UrlCheckerDelegate* +scoped_refptr<safe_browsing::UrlCheckerDelegate> ChromeContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate( content::ResourceContext* resource_context) { DCHECK_CURRENTLY_ON(BrowserThread::IO); @@ -5508,7 +5514,7 @@ safe_browsing_service_->ui_manager()); } - return safe_browsing_url_checker_delegate_.get(); + return safe_browsing_url_checker_delegate_; } base::Optional<std::string>
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index 09412248..af05161b 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h
@@ -694,8 +694,8 @@ static void SetDefaultQuotaSettingsForTesting( const storage::QuotaSettings *settings); - safe_browsing::UrlCheckerDelegate* GetSafeBrowsingUrlCheckerDelegate( - content::ResourceContext* resource_context); + scoped_refptr<safe_browsing::UrlCheckerDelegate> + GetSafeBrowsingUrlCheckerDelegate(content::ResourceContext* resource_context); #if BUILDFLAG(ENABLE_PLUGINS) // Set of origins that can use TCP/UDP private APIs from NaCl.
diff --git a/chrome/browser/chromeos/apps/intent_helper/chromeos_apps_navigation_throttle.cc b/chrome/browser/chromeos/apps/intent_helper/chromeos_apps_navigation_throttle.cc index 13e3e27f..de730a5 100644 --- a/chrome/browser/chromeos/apps/intent_helper/chromeos_apps_navigation_throttle.cc +++ b/chrome/browser/chromeos/apps/intent_helper/chromeos_apps_navigation_throttle.cc
@@ -74,7 +74,7 @@ url, launch_name, should_launch_app, should_persist)) { CloseOrGoBack(web_contents); } else { - close_reason = apps::IntentPickerCloseReason::PICKER_ERROR; + close_reason = apps::IntentPickerCloseReason::ERROR_AFTER_PICKER; } return; case apps::mojom::AppType::kUnknown: @@ -133,9 +133,9 @@ std::vector<apps::IntentPickerAppInfo> apps) { std::vector<apps::IntentPickerAppInfo> apps_for_picker = FindPwaForUrl(web_contents, url, std::move(apps)); + bool show_persistence_options = ShouldShowPersistenceOptions(apps_for_picker); apps::AppsNavigationThrottle::ShowIntentPickerBubbleForApps( - web_contents, std::move(apps_for_picker), - ShouldShowRememberSelection(apps_for_picker), + web_contents, std::move(apps_for_picker), show_persistence_options, base::BindOnce(&OnIntentPickerClosed, web_contents, ui_auto_display_service, url)); } @@ -154,7 +154,8 @@ case PickerAction::ARC_APP_PRESSED: case PickerAction::ARC_APP_PREFERRED_PRESSED: case PickerAction::PWA_APP_PRESSED: - case PickerAction::PICKER_ERROR: + case PickerAction::ERROR_BEFORE_PICKER: + case PickerAction::ERROR_AFTER_PICKER: case PickerAction::DIALOG_DEACTIVATED: case PickerAction::CHROME_PRESSED: case PickerAction::CHROME_PREFERRED_PRESSED:
diff --git a/chrome/browser/chromeos/apps/intent_helper/chromeos_apps_navigation_throttle_unittest.cc b/chrome/browser/chromeos/apps/intent_helper/chromeos_apps_navigation_throttle_unittest.cc index 2d5e806..fc316cb 100644 --- a/chrome/browser/chromeos/apps/intent_helper/chromeos_apps_navigation_throttle_unittest.cc +++ b/chrome/browser/chromeos/apps/intent_helper/chromeos_apps_navigation_throttle_unittest.cc
@@ -17,14 +17,26 @@ // When the PickerAction is either ERROR or DIALOG_DEACTIVATED we MUST stay in // Chrome not taking into account the selected_app_package. - EXPECT_EQ(apps::AppsNavigationThrottle::Platform::CHROME, - ChromeOsAppsNavigationThrottle::GetDestinationPlatform( - chrome_launch_name, - apps::AppsNavigationThrottle::PickerAction::PICKER_ERROR)); - EXPECT_EQ(apps::AppsNavigationThrottle::Platform::CHROME, - ChromeOsAppsNavigationThrottle::GetDestinationPlatform( - app_launch_name, - apps::AppsNavigationThrottle::PickerAction::PICKER_ERROR)); + EXPECT_EQ( + apps::AppsNavigationThrottle::Platform::CHROME, + ChromeOsAppsNavigationThrottle::GetDestinationPlatform( + chrome_launch_name, + apps::AppsNavigationThrottle::PickerAction::ERROR_BEFORE_PICKER)); + EXPECT_EQ( + apps::AppsNavigationThrottle::Platform::CHROME, + ChromeOsAppsNavigationThrottle::GetDestinationPlatform( + app_launch_name, + apps::AppsNavigationThrottle::PickerAction::ERROR_BEFORE_PICKER)); + EXPECT_EQ( + apps::AppsNavigationThrottle::Platform::CHROME, + ChromeOsAppsNavigationThrottle::GetDestinationPlatform( + chrome_launch_name, + apps::AppsNavigationThrottle::PickerAction::ERROR_AFTER_PICKER)); + EXPECT_EQ( + apps::AppsNavigationThrottle::Platform::CHROME, + ChromeOsAppsNavigationThrottle::GetDestinationPlatform( + app_launch_name, + apps::AppsNavigationThrottle::PickerAction::ERROR_AFTER_PICKER)); EXPECT_EQ( apps::AppsNavigationThrottle::Platform::CHROME, ChromeOsAppsNavigationThrottle::GetDestinationPlatform(
diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc b/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc index 7c13350..16c9708 100644 --- a/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc +++ b/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc
@@ -386,12 +386,13 @@ } if (!instance) - reason = apps::IntentPickerCloseReason::PICKER_ERROR; + reason = apps::IntentPickerCloseReason::ERROR_AFTER_PICKER; if (reason == apps::IntentPickerCloseReason::OPEN_APP || reason == apps::IntentPickerCloseReason::STAY_IN_CHROME) { if (selected_app_index == handlers.size()) { - reason = apps::IntentPickerCloseReason::PICKER_ERROR; + // Selected app does not exist. + reason = apps::IntentPickerCloseReason::ERROR_AFTER_PICKER; } } @@ -423,7 +424,11 @@ LOG(ERROR) << "Chrome is not a valid option for external protocol URLs"; NOTREACHED(); return; // no UMA recording. - case apps::IntentPickerCloseReason::PICKER_ERROR: + case apps::IntentPickerCloseReason::ERROR_BEFORE_PICKER: + // This can happen since an error could occur right before invoking + // Show() on the bubble's UI code. + FALLTHROUGH; + case apps::IntentPickerCloseReason::ERROR_AFTER_PICKER: LOG(ERROR) << "IntentPickerBubbleView returned CloseReason::ERROR: " << "instance=" << instance << ", selected_app_index=" << selected_app_index @@ -474,7 +479,7 @@ const bool stay_in_chrome = IsChromeAnAppCandidate(handlers); IntentPickerTabHelper::SetShouldShowIcon(web_contents, true); browser->window()->ShowIntentPickerBubble( - std::move(app_info), stay_in_chrome, /*show_remember_selection=*/true, + std::move(app_info), stay_in_chrome, /*show_persistence_options=*/true, base::BindOnce(OnIntentPickerClosed, render_process_host_id, routing_id, url, safe_to_bypass_ui, std::move(handlers))); }
diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_intent_picker_app_fetcher.cc b/chrome/browser/chromeos/arc/intent_helper/arc_intent_picker_app_fetcher.cc index dd9ad2e..1083143 100644 --- a/chrome/browser/chromeos/arc/intent_helper/arc_intent_picker_app_fetcher.cc +++ b/chrome/browser/chromeos/arc/intent_helper/arc_intent_picker_app_fetcher.cc
@@ -236,7 +236,7 @@ DVLOG(1) << "There are no app candidates for this URL: " << url; chromeos::ChromeOsAppsNavigationThrottle::RecordUma( /*selected_app_package=*/std::string(), apps::mojom::AppType::kUnknown, - apps::IntentPickerCloseReason::PICKER_ERROR, + apps::IntentPickerCloseReason::ERROR_BEFORE_PICKER, /*should_persist=*/false); std::move(callback).Run(apps::AppsNavigationAction::RESUME, {}); return; @@ -310,7 +310,7 @@ } if (!instance) { - close_reason = apps::IntentPickerCloseReason::PICKER_ERROR; + close_reason = apps::IntentPickerCloseReason::ERROR_BEFORE_PICKER; } else if (ArcIntentHelperBridge::IsIntentHelperPackage(package_name)) { IntentPickerTabHelper::SetShouldShowIcon(web_contents(), true); preferred_platform = apps::PreferredPlatform::NATIVE_CHROME; @@ -339,7 +339,7 @@ LOG(ERROR) << "Cannot get an instance of ArcIntentHelperBridge"; chromeos::ChromeOsAppsNavigationThrottle::RecordUma( /*selected_app_package=*/std::string(), apps::mojom::AppType::kUnknown, - apps::IntentPickerCloseReason::PICKER_ERROR, + apps::IntentPickerCloseReason::ERROR_BEFORE_PICKER, /*should_persist=*/false); std::move(callback).Run({}); return;
diff --git a/chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client.cc b/chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client.cc index f1f0f2a..0a940ba6 100644 --- a/chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client.cc +++ b/chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client.cc
@@ -15,7 +15,6 @@ #include "chrome/browser/chromeos/assistant/assistant_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" -#include "chrome/browser/ui/ash/assistant/assistant_pref_util.h" #include "chromeos/constants/chromeos_switches.h" #include "components/arc/arc_prefs.h" #include "components/arc/arc_util.h" @@ -116,13 +115,6 @@ ash::VoiceInteractionController::Get()->NotifyHotwordAlwaysOn(always_on); } -void VoiceInteractionControllerClient::NotifyConsentStatus() { - DCHECK(profile_); - PrefService* prefs = profile_->GetPrefs(); - ash::VoiceInteractionController::Get()->NotifyConsentStatus( - assistant::prefs::GetConsentStatus(prefs)); -} - void VoiceInteractionControllerClient::NotifyFeatureAllowed() { DCHECK(profile_); ash::mojom::AssistantAllowedState state = @@ -182,11 +174,6 @@ pref_change_registrar_->Init(prefs); pref_change_registrar_->Add( - assistant::prefs::kAssistantConsentStatus, - base::BindRepeating( - &VoiceInteractionControllerClient::NotifyConsentStatus, - base::Unretained(this))); - pref_change_registrar_->Add( language::prefs::kApplicationLocale, base::BindRepeating( &VoiceInteractionControllerClient::NotifyLocaleChanged, @@ -222,7 +209,6 @@ &VoiceInteractionControllerClient::NotifyLaunchWithMicOpen, base::Unretained(this))); - NotifyConsentStatus(); NotifySettingsEnabled(); NotifyContextEnabled(); NotifyLocaleChanged();
diff --git a/chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client.h b/chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client.h index d0dd3ab4..72360dd 100644 --- a/chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client.h +++ b/chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client.h
@@ -54,7 +54,6 @@ void NotifyContextEnabled(); void NotifyHotwordEnabled(); void NotifyHotwordAlwaysOn(); - void NotifyConsentStatus(); void NotifyFeatureAllowed(); void NotifyNotificationEnabled(); void NotifyLocaleChanged();
diff --git a/chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client_unittest.cc b/chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client_unittest.cc index 02ea954..dbc1d0c2 100644 --- a/chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client_unittest.cc +++ b/chrome/browser/chromeos/arc/voice_interaction/voice_interaction_controller_client_unittest.cc
@@ -112,17 +112,6 @@ EXPECT_EQ(false, ash::VoiceInteractionController::Get()->notification_enabled()); - ASSERT_EQ(static_cast<int>(ash::mojom::ConsentStatus::kUnknown), - prefs->GetInteger(assistant::prefs::kAssistantConsentStatus)); - prefs->SetInteger( - assistant::prefs::kAssistantConsentStatus, - static_cast<int>(ash::mojom::ConsentStatus::kActivityControlAccepted)); - ASSERT_EQ( - static_cast<int>(ash::mojom::ConsentStatus::kActivityControlAccepted), - prefs->GetInteger(assistant::prefs::kAssistantConsentStatus)); - EXPECT_EQ(ash::mojom::ConsentStatus::kActivityControlAccepted, - ash::VoiceInteractionController::Get()->consent_status()); - ASSERT_EQ("", prefs->GetString(language::prefs::kApplicationLocale)); prefs->SetString(language::prefs::kApplicationLocale, "en-CA"); ASSERT_EQ("en-CA", prefs->GetString(language::prefs::kApplicationLocale));
diff --git a/chrome/browser/chromeos/drive/fileapi/drivefs_async_file_util.cc b/chrome/browser/chromeos/drive/fileapi/drivefs_async_file_util.cc index 81fa3a41..f10b96d 100644 --- a/chrome/browser/chromeos/drive/fileapi/drivefs_async_file_util.cc +++ b/chrome/browser/chromeos/drive/fileapi/drivefs_async_file_util.cc
@@ -7,6 +7,7 @@ #include <utility> #include "base/bind.h" +#include "base/files/file_enumerator.h" #include "base/files/file_util.h" #include "base/task/post_task.h" #include "chrome/browser/chromeos/drive/drive_integration_service.h" @@ -19,6 +20,7 @@ #include "storage/browser/fileapi/file_system_operation_context.h" #include "storage/browser/fileapi/file_system_url.h" #include "storage/browser/fileapi/local_file_util.h" +#include "storage/browser/fileapi/native_file_util.h" #include "storage/common/fileapi/file_system_util.h" namespace drive { @@ -27,6 +29,21 @@ constexpr char kTrashDirectoryName[] = ".Trash"; +class DriveFsFileUtil : public storage::LocalFileUtil { + public: + DriveFsFileUtil() = default; + ~DriveFsFileUtil() override = default; + + protected: + bool IsHiddenItem(const base::FilePath& local_file_path) const override { + // DriveFS is a trusted filesystem, allow symlinks. + return false; + } + + private: + DISALLOW_COPY_AND_ASSIGN(DriveFsFileUtil); +}; + class CopyOperation { public: CopyOperation( @@ -188,7 +205,7 @@ } // namespace DriveFsAsyncFileUtil::DriveFsAsyncFileUtil(Profile* profile) - : AsyncFileUtilAdapter(new storage::LocalFileUtil), + : AsyncFileUtilAdapter(new DriveFsFileUtil), profile_(profile), weak_factory_(this) {}
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc index c993288b..054ad69d 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
@@ -597,6 +597,12 @@ TestCase("dirRenameToExisting"), TestCase("dirRenameToExisting").InGuestMode(), TestCase("dirRenameToExisting").EnableDriveFs(), + TestCase("dirRenameRemovableWithKeyboard"), + TestCase("dirRenameRemovableWithKeyboard").InGuestMode(), + TestCase("dirRenameRemovableWithKeyboard").EnableDriveFs(), + TestCase("dirRenameRemovableWithContentMenu"), + TestCase("dirRenameRemovableWithContentMenu").InGuestMode(), + TestCase("dirRenameRemovableWithContentMenu").EnableDriveFs(), TestCase("dirCreateWithContextMenu"), TestCase("dirCreateWithContextMenu").EnableMyFilesVolume(), TestCase("dirCreateWithKeyboard"), @@ -649,7 +655,10 @@ TestCase("driveBackupPhotos").EnableDriveFs(), TestCase("driveAvailableOfflineGearMenu").DisableDriveFs(), TestCase("driveAvailableOfflineGearMenu").EnableDriveFs(), - TestCase("driveAvailableOfflineDirectoryGearMenu"))); + TestCase("driveAvailableOfflineDirectoryGearMenu"), + TestCase("driveLinkToDirectory").EnableDriveFs(), + TestCase("driveLinkOpenFileThroughLinkedDirectory").EnableDriveFs(), + TestCase("driveLinkOpenFileThroughTransitiveLink").EnableDriveFs())); WRAPPED_INSTANTIATE_TEST_SUITE_P( Transfer, /* transfer.js */
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc index 661c64d9..2601683b 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc
@@ -177,7 +177,7 @@ }; // Represents the different types of entries (e.g. file, folder). - enum EntryType { FILE, DIRECTORY, TEAM_DRIVE, COMPUTER }; + enum EntryType { FILE, DIRECTORY, LINK, TEAM_DRIVE, COMPUTER }; // Represents whether an entry appears in 'Share with Me' or not. enum SharedOption { NONE, SHARED, SHARED_WITH_ME, NESTED_SHARED_WITH_ME }; @@ -409,6 +409,8 @@ *type = FILE; else if (value == "directory") *type = DIRECTORY; + else if (value == "link") + *type = LINK; else if (value == "team_drive") *type = TEAM_DRIVE; else if (value == "Computer") @@ -702,6 +704,11 @@ ASSERT_TRUE(base::CreateDirectory(target_path)) << "Failed to create a directory: " << target_path.value(); break; + case AddEntriesMessage::LINK: + ASSERT_TRUE(base::CreateSymbolicLink( + base::FilePath(entry.source_file_name), target_path)) + << "Failed to create a symlink: " << target_path.value(); + break; case AddEntriesMessage::TEAM_DRIVE: NOTREACHED() << "Can't create a team drive in a local volume: " << target_path.value(); @@ -1040,12 +1047,17 @@ entry.shared_option == AddEntriesMessage::SHARED_WITH_ME, file_capabilities); break; + case AddEntriesMessage::LINK: + NOTREACHED() << "Can't create a link in a drive test volume: " + << entry.computer_name; + break; case AddEntriesMessage::TEAM_DRIVE: CreateTeamDrive(entry.team_drive_name, team_drive_capabilities); break; case AddEntriesMessage::COMPUTER: NOTREACHED() << "Can't create a computer in a drive test volume: " << entry.computer_name; + break; } // Any file or directory created above, will only appear in Drive after @@ -1228,6 +1240,12 @@ ASSERT_TRUE(base::CreateDirectory(target_path)) << "Failed to create a directory: " << target_path.value(); break; + case AddEntriesMessage::LINK: + ASSERT_TRUE(base::CreateSymbolicLink( + base::FilePath(entry.source_file_name), target_path)) + << "Failed to create a symlink from " << entry.source_file_name + << " to " << target_path.value(); + break; case AddEntriesMessage::TEAM_DRIVE: ASSERT_TRUE(base::CreateDirectory(target_path)) << "Failed to create a team drive: " << target_path.value();
diff --git a/chrome/browser/chromeos/logging.cc b/chrome/browser/chromeos/logging.cc index 736ad3e..4732f58 100644 --- a/chrome/browser/chromeos/logging.cc +++ b/chrome/browser/chromeos/logging.cc
@@ -13,6 +13,9 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/logging_chrome.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/network_service_instance.h" +#include "content/public/common/network_service_util.h" +#include "services/network/public/mojom/network_service.mojom.h" namespace logging { @@ -37,8 +40,17 @@ base::PostTaskWithTraits( FROM_HERE, {base::MayBlock()}, base::BindOnce(&RemoveSymlinkAndLog, log_path, target_path)); - } else { - chrome_logging_redirected_ = true; + return; + } + chrome_logging_redirected_ = true; + + // Redirect the Network Service's logs as well if it's running out of process. + if (content::IsOutOfProcessNetworkService()) { + auto logging_settings = network::mojom::LoggingSettings::New(); + logging_settings->logging_dest = settings.logging_dest; + logging_settings->log_file = log_path; + content::GetNetworkService()->ReinitializeLogging( + std::move(logging_settings)); } }
diff --git a/chrome/browser/chromeos/login/screens/assistant_optin_flow_screen_browsertest.cc b/chrome/browser/chromeos/login/screens/assistant_optin_flow_screen_browsertest.cc index efcc4c8..4f2889f 100644 --- a/chrome/browser/chromeos/login/screens/assistant_optin_flow_screen_browsertest.cc +++ b/chrome/browser/chromeos/login/screens/assistant_optin_flow_screen_browsertest.cc
@@ -29,6 +29,7 @@ #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" #include "chrome/common/chrome_paths.h" #include "chromeos/constants/chromeos_switches.h" +#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" #include "chromeos/services/assistant/public/features.h" #include "chromeos/services/assistant/public/mojom/constants.mojom.h" #include "chromeos/services/assistant/public/mojom/settings.mojom.h" @@ -516,8 +517,9 @@ ExpectCollectedOptIns({}); PrefService* const prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); - EXPECT_EQ(ash::mojom::ConsentStatus::kUnknown, - ::assistant::prefs::GetConsentStatus(prefs)); + EXPECT_EQ( + chromeos::assistant::prefs::ConsentStatus::kUnknown, + prefs->GetInteger(chromeos::assistant::prefs::kAssistantConsentStatus)); EXPECT_FALSE(prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled)); EXPECT_FALSE(prefs->GetBoolean(arc::prefs::kVoiceInteractionContextEnabled)); } @@ -552,8 +554,9 @@ ExpectCollectedOptIns({FakeAssistantSettings::OptIn::ACTIVITY_CONTROL}); PrefService* const prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); - EXPECT_EQ(ash::mojom::ConsentStatus::kActivityControlAccepted, - ::assistant::prefs::GetConsentStatus(prefs)); + EXPECT_EQ( + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted, + prefs->GetInteger(chromeos::assistant::prefs::kAssistantConsentStatus)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionContextEnabled)); } @@ -592,8 +595,9 @@ ExpectCollectedOptIns({FakeAssistantSettings::OptIn::ACTIVITY_CONTROL}); PrefService* const prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); - EXPECT_EQ(ash::mojom::ConsentStatus::kActivityControlAccepted, - ::assistant::prefs::GetConsentStatus(prefs)); + EXPECT_EQ( + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted, + prefs->GetInteger(chromeos::assistant::prefs::kAssistantConsentStatus)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled)); EXPECT_FALSE(prefs->GetBoolean(arc::prefs::kVoiceInteractionContextEnabled)); } @@ -632,8 +636,9 @@ ExpectCollectedOptIns({FakeAssistantSettings::OptIn::ACTIVITY_CONTROL}); PrefService* const prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); - EXPECT_EQ(ash::mojom::ConsentStatus::kActivityControlAccepted, - ::assistant::prefs::GetConsentStatus(prefs)); + EXPECT_EQ( + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted, + prefs->GetInteger(chromeos::assistant::prefs::kAssistantConsentStatus)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionContextEnabled)); } @@ -672,8 +677,9 @@ ExpectCollectedOptIns({FakeAssistantSettings::OptIn::ACTIVITY_CONTROL}); PrefService* const prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); - EXPECT_EQ(ash::mojom::ConsentStatus::kActivityControlAccepted, - ::assistant::prefs::GetConsentStatus(prefs)); + EXPECT_EQ( + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted, + prefs->GetInteger(chromeos::assistant::prefs::kAssistantConsentStatus)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionContextEnabled)); } @@ -696,8 +702,9 @@ ExpectCollectedOptIns({}); PrefService* const prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); - EXPECT_EQ(ash::mojom::ConsentStatus::kUnknown, - ::assistant::prefs::GetConsentStatus(prefs)); + EXPECT_EQ( + chromeos::assistant::prefs::ConsentStatus::kUnknown, + prefs->GetInteger(chromeos::assistant::prefs::kAssistantConsentStatus)); EXPECT_FALSE(prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled)); EXPECT_FALSE(prefs->GetBoolean(arc::prefs::kVoiceInteractionContextEnabled)); } @@ -737,8 +744,9 @@ ExpectCollectedOptIns({FakeAssistantSettings::OptIn::ACTIVITY_CONTROL}); PrefService* const prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); - EXPECT_EQ(ash::mojom::ConsentStatus::kActivityControlAccepted, - ::assistant::prefs::GetConsentStatus(prefs)); + EXPECT_EQ( + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted, + prefs->GetInteger(chromeos::assistant::prefs::kAssistantConsentStatus)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionContextEnabled)); } @@ -781,8 +789,9 @@ ExpectCollectedOptIns({FakeAssistantSettings::OptIn::ACTIVITY_CONTROL, FakeAssistantSettings::OptIn::EMAIL}); PrefService* const prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); - EXPECT_EQ(ash::mojom::ConsentStatus::kActivityControlAccepted, - ::assistant::prefs::GetConsentStatus(prefs)); + EXPECT_EQ( + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted, + prefs->GetInteger(chromeos::assistant::prefs::kAssistantConsentStatus)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionContextEnabled)); } @@ -814,8 +823,9 @@ ExpectCollectedOptIns({}); PrefService* const prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); - EXPECT_EQ(ash::mojom::ConsentStatus::kActivityControlAccepted, - ::assistant::prefs::GetConsentStatus(prefs)); + EXPECT_EQ( + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted, + prefs->GetInteger(chromeos::assistant::prefs::kAssistantConsentStatus)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionContextEnabled)); } @@ -846,8 +856,9 @@ ExpectCollectedOptIns({}); PrefService* const prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); - EXPECT_EQ(ash::mojom::ConsentStatus::kActivityControlAccepted, - ::assistant::prefs::GetConsentStatus(prefs)); + EXPECT_EQ( + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted, + prefs->GetInteger(chromeos::assistant::prefs::kAssistantConsentStatus)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionContextEnabled)); } @@ -935,8 +946,9 @@ ExpectCollectedOptIns({}); PrefService* const prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); - EXPECT_EQ(ash::mojom::ConsentStatus::kActivityControlAccepted, - ::assistant::prefs::GetConsentStatus(prefs)); + EXPECT_EQ( + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted, + prefs->GetInteger(chromeos::assistant::prefs::kAssistantConsentStatus)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionContextEnabled)); } @@ -987,8 +999,9 @@ ExpectCollectedOptIns({}); PrefService* const prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); - EXPECT_EQ(ash::mojom::ConsentStatus::kActivityControlAccepted, - ::assistant::prefs::GetConsentStatus(prefs)); + EXPECT_EQ( + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted, + prefs->GetInteger(chromeos::assistant::prefs::kAssistantConsentStatus)); EXPECT_FALSE(prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionContextEnabled)); } @@ -1043,8 +1056,9 @@ ExpectCollectedOptIns({}); PrefService* const prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); - EXPECT_EQ(ash::mojom::ConsentStatus::kActivityControlAccepted, - ::assistant::prefs::GetConsentStatus(prefs)); + EXPECT_EQ( + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted, + prefs->GetInteger(chromeos::assistant::prefs::kAssistantConsentStatus)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionHotwordEnabled)); EXPECT_TRUE(prefs->GetBoolean(arc::prefs::kVoiceInteractionContextEnabled)); }
diff --git a/chrome/browser/chromeos/usb/cros_usb_detector.cc b/chrome/browser/chromeos/usb/cros_usb_detector.cc index 0357d18..d8b81ea8 100644 --- a/chrome/browser/chromeos/usb/cros_usb_detector.cc +++ b/chrome/browser/chromeos/usb/cros_usb_detector.cc
@@ -9,6 +9,7 @@ #include "ash/public/cpp/notification_utils.h" #include "base/metrics/histogram_macros.h" +#include "base/stl_util.h" #include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_util.h" @@ -198,14 +199,13 @@ } // namespace -SharedUsbDeviceInfo::SharedUsbDeviceInfo() = default; -SharedUsbDeviceInfo::SharedUsbDeviceInfo(const SharedUsbDeviceInfo&) = default; -SharedUsbDeviceInfo::~SharedUsbDeviceInfo() = default; +CrosUsbDeviceInfo::CrosUsbDeviceInfo() = default; +CrosUsbDeviceInfo::CrosUsbDeviceInfo(const CrosUsbDeviceInfo&) = default; +CrosUsbDeviceInfo::~CrosUsbDeviceInfo() = default; -SharedUsbDeviceInfo::VmSharingInfo::VmSharingInfo() = default; -SharedUsbDeviceInfo::VmSharingInfo::VmSharingInfo(const VmSharingInfo&) = - default; -SharedUsbDeviceInfo::VmSharingInfo::~VmSharingInfo() = default; +CrosUsbDeviceInfo::VmSharingInfo::VmSharingInfo() = default; +CrosUsbDeviceInfo::VmSharingInfo::VmSharingInfo(const VmSharingInfo&) = default; +CrosUsbDeviceInfo::VmSharingInfo::~VmSharingInfo() = default; std::string CrosUsbDetector::MakeNotificationId(const std::string& guid) { return "cros:" + guid; @@ -265,24 +265,32 @@ device_manager_ = std::move(device_manager); } -void CrosUsbDetector::AddSharedUsbDeviceObserver( - SharedUsbDeviceObserver* observer) { - shared_usb_device_observers_.AddObserver(observer); +void CrosUsbDetector::AddUsbDeviceObserver(CrosUsbDeviceObserver* observer) { + usb_device_observers_.AddObserver(observer); } -void CrosUsbDetector::RemoveSharedUsbDeviceObserver( - SharedUsbDeviceObserver* observer) { - shared_usb_device_observers_.RemoveObserver(observer); +void CrosUsbDetector::RemoveUsbDeviceObserver(CrosUsbDeviceObserver* observer) { + usb_device_observers_.RemoveObserver(observer); } -void CrosUsbDetector::SignalSharedUsbDeviceObservers() { - for (auto& observer : shared_usb_device_observers_) { - observer.OnSharedUsbDevicesChanged(shared_usb_devices_); +void CrosUsbDetector::SignalUsbDeviceObservers() { + for (auto& observer : usb_device_observers_) { + observer.OnUsbDevicesChanged(); } } -std::vector<SharedUsbDeviceInfo> CrosUsbDetector::GetSharedUsbDevices() { - return shared_usb_devices_; +const std::vector<CrosUsbDeviceInfo>& CrosUsbDetector::GetConnectedDevices() + const { + return usb_devices_; +} + +std::vector<CrosUsbDeviceInfo> CrosUsbDetector::GetDevicesSharableWithCrostini() + const { + auto devices = usb_devices_; + base::EraseIf(devices, [](const CrosUsbDeviceInfo& device) { + return !device.sharable_with_crostini; + }); + return devices; } void CrosUsbDetector::ConnectToDeviceManager() { @@ -319,17 +327,6 @@ device_info); } -bool CrosUsbDetector::IsDeviceSharable( - const device::mojom::UsbDeviceInfo& device_info) { - if (device::UsbDeviceFilterMatches(*adb_device_filter_, device_info) || - device::UsbDeviceFilterMatches(*fastboot_device_filter_, device_info)) { - return true; - } - return base::FeatureList::IsEnabled(features::kCrostiniUsbAllowUnsupported) && - !device::UsbDeviceFilterMatchesAny(guest_os_classes_blocked_, - device_info); -} - void CrosUsbDetector::OnDeviceChecked( device::mojom::UsbDeviceInfoPtr device_info, bool hide_notification, @@ -340,22 +337,34 @@ << " vendor:" << device_info->vendor_id; return; } - - SharedUsbDeviceInfo new_device; + CrosUsbDeviceInfo new_device; new_device.guid = device_info->guid; new_device.label = ProductLabelFromDevice(device_info); - shared_usb_devices_.push_back(new_device); - available_device_info_.emplace(device_info->guid, device_info.Clone()); - SignalSharedUsbDeviceObservers(); + const bool has_supported_interface = + device::UsbDeviceFilterMatches(*adb_device_filter_, *device_info) || + device::UsbDeviceFilterMatches(*fastboot_device_filter_, *device_info); + const bool has_blocked_interface = device::UsbDeviceFilterMatchesAny( + guest_os_classes_blocked_, *device_info); + new_device.sharable_with_crostini = + has_supported_interface || + (!has_blocked_interface && + base::FeatureList::IsEnabled(features::kCrostiniUsbAllowUnsupported)); - // USB devices not claimed by Chrome OS get automatically attached to the - // default VM. Note that this relies on the underlying VM (ARCVM) having its - // own permission model to restrict access to the device. - AttachUsbDeviceToVm(kDefaultVmName, new_device.guid, base::DoNothing()); + usb_devices_.push_back(new_device); + available_device_info_.emplace(device_info->guid, device_info.Clone()); + SignalUsbDeviceObservers(); + + if (has_supported_interface || !has_blocked_interface) { + // USB devices not claimed by Chrome OS get automatically attached to the + // default VM. Note that this relies on the underlying VM (ARCVM) having its + // own permission model to restrict access to the device. + AttachUsbDeviceToVm(kDefaultVmName, new_device.guid, base::DoNothing()); + } // Some devices should not trigger the notification. - if (hide_notification || !ShouldShowNotification(*device_info)) { + if (!new_device.sharable_with_crostini || hide_notification || + !ShouldShowNotification(*device_info)) { return; } ShowNotificationForDevice(std::move(device_info)); @@ -367,9 +376,6 @@ void CrosUsbDetector::OnDeviceAdded(device::mojom::UsbDeviceInfoPtr device_info, bool hide_notification) { - if (!IsDeviceSharable(*device_info)) { - return; // Guest OS does not handle this kind of device. - } device_manager_->CheckAccess( device_info->guid, base::BindOnce(&CrosUsbDetector::OnDeviceChecked, @@ -383,7 +389,7 @@ CrosUsbDetector::MakeNotificationId(device_info->guid)); std::string guid = device_info->guid; - for (const auto& device : shared_usb_devices_) { + for (const auto& device : usb_devices_) { if (device.guid == guid) { for (const auto& sharing_info_pair : device.vm_sharing_info) { DetachUsbDeviceFromVmInternal(sharing_info_pair.first, guid, @@ -391,16 +397,14 @@ } } } - const auto& start = - std::remove_if(shared_usb_devices_.begin(), shared_usb_devices_.end(), - [guid](const SharedUsbDeviceInfo& device) { - return device.guid == guid; - }); - if (start != shared_usb_devices_.end()) { - shared_usb_devices_.erase(start, shared_usb_devices_.end()); + const auto& start = std::remove_if( + usb_devices_.begin(), usb_devices_.end(), + [guid](const CrosUsbDeviceInfo& device) { return device.guid == guid; }); + if (start != usb_devices_.end()) { + usb_devices_.erase(start, usb_devices_.end()); } available_device_info_.erase(guid); - SignalSharedUsbDeviceObservers(); + SignalUsbDeviceObservers(); } void CrosUsbDetector::OnDeviceManagerConnectionError() { @@ -411,7 +415,7 @@ void CrosUsbDetector::ConnectSharedDevicesOnVmStartup() { // Reattach shared devices when the VM becomes available. - for (auto& device : shared_usb_devices_) { + for (auto& device : usb_devices_) { bool attached_device = false; for (const auto& sharing_pair : device.vm_sharing_info) { if (sharing_pair.second.shared) { @@ -429,7 +433,7 @@ const std::string& vm_name, const std::string& guid, base::OnceCallback<void(bool success)> callback) { - for (auto& device : shared_usb_devices_) { + for (auto& device : usb_devices_) { if (device.guid == guid) { // Mark the USB device shared so that we know to reattach it on VM // restart. @@ -503,7 +507,7 @@ const auto& device_info = it->second; base::Optional<uint8_t> guest_port; - for (const auto& device : shared_usb_devices_) { + for (const auto& device : usb_devices_) { if (device.guid == guid) { const auto it = device.vm_sharing_info.find(vm_name); if (it != device.vm_sharing_info.end()) { @@ -547,7 +551,7 @@ std::move(callback).Run(/*success=*/false); return; } - for (const auto& device : shared_usb_devices_) { + for (const auto& device : usb_devices_) { if (device.guid == device_info->guid) { const auto it = device.vm_sharing_info.find(vm_name); if (it != device.vm_sharing_info.end() && it->second.guest_port) { @@ -576,7 +580,7 @@ bool success, uint8_t guest_port) { if (success) { - for (auto& device : shared_usb_devices_) { + for (auto& device : usb_devices_) { if (device.guid == guid) { auto& vm_sharing_info = device.vm_sharing_info[vm_name]; vm_sharing_info.shared = true; @@ -585,7 +589,7 @@ } } } - SignalSharedUsbDeviceObservers(); + SignalUsbDeviceObservers(); std::move(callback).Run(success); } @@ -594,13 +598,13 @@ const std::string& guid, base::OnceCallback<void(bool success)> callback, bool success) { - for (auto& device : shared_usb_devices_) { + for (auto& device : usb_devices_) { if (device.guid == guid) { device.vm_sharing_info.erase(vm_name); break; } } - SignalSharedUsbDeviceObservers(); + SignalUsbDeviceObservers(); std::move(callback).Run(success); }
diff --git a/chrome/browser/chromeos/usb/cros_usb_detector.h b/chrome/browser/chromeos/usb/cros_usb_detector.h index 25cf73c..2fe8829 100644 --- a/chrome/browser/chromeos/usb/cros_usb_detector.h +++ b/chrome/browser/chromeos/usb/cros_usb_detector.h
@@ -40,10 +40,12 @@ kMaxValue = kConnectToLinux }; -struct SharedUsbDeviceInfo { - SharedUsbDeviceInfo(); - SharedUsbDeviceInfo(const SharedUsbDeviceInfo&); - ~SharedUsbDeviceInfo(); +// Represents a USB device tracked by a CrosUsbDetector instance. The device may +// or may not be sharable with a particular type of VM (e.g. Crostini). +struct CrosUsbDeviceInfo { + CrosUsbDeviceInfo(); + CrosUsbDeviceInfo(const CrosUsbDeviceInfo&); + ~CrosUsbDeviceInfo(); struct VmSharingInfo { VmSharingInfo(); @@ -62,14 +64,15 @@ base::flat_map<std::string, VmSharingInfo> vm_sharing_info; std::string guid; base::string16 label; + // Whether the device can be shared with Crostini. + bool sharable_with_crostini = false; // TODO(nverne): Add current state and errors etc. }; -class SharedUsbDeviceObserver : public base::CheckedObserver { +class CrosUsbDeviceObserver : public base::CheckedObserver { public: // Called when the available USB devices change. - virtual void OnSharedUsbDevicesChanged( - std::vector<SharedUsbDeviceInfo> usb_devices) = 0; + virtual void OnUsbDevicesChanged() = 0; }; // Detects USB Devices for Chrome OS and manages UI for controlling their use @@ -115,11 +118,18 @@ const std::string& guid, base::OnceCallback<void(bool success)> callback); - void AddSharedUsbDeviceObserver(SharedUsbDeviceObserver* observer); - void RemoveSharedUsbDeviceObserver(SharedUsbDeviceObserver* observer); - void SignalSharedUsbDeviceObservers(); + void AddUsbDeviceObserver(CrosUsbDeviceObserver* observer); + void RemoveUsbDeviceObserver(CrosUsbDeviceObserver* observer); + void SignalUsbDeviceObservers(); - std::vector<SharedUsbDeviceInfo> GetSharedUsbDevices(); + // Returns all the USB devices tracked by this instance. This may not contain + // all physically connected devices and may also contain devices that are + // sharable with e.g. ARCVM but not with Crostini. + const std::vector<CrosUsbDeviceInfo>& GetConnectedDevices() const; + + // Returns all the USB devices that are sharable with Crostini. This may not + // include all connected devices. + std::vector<CrosUsbDeviceInfo> GetDevicesSharableWithCrostini() const; private: void AttachUsbDeviceToVmInternal( @@ -168,8 +178,6 @@ // Returns true when a device should show a notification when attached. bool ShouldShowNotification(const device::mojom::UsbDeviceInfo& device_info); - // Returns true when a device can be shared. - bool IsDeviceSharable(const device::mojom::UsbDeviceInfo& device_info); device::mojom::UsbDeviceManagerPtr device_manager_; mojo::AssociatedBinding<device::mojom::UsbDeviceManagerClient> @@ -184,9 +192,9 @@ // A mapping from GUID -> UsbDeviceInfo for each attached USB device std::map<std::string, device::mojom::UsbDeviceInfoPtr> available_device_info_; - std::vector<SharedUsbDeviceInfo> shared_usb_devices_; + std::vector<CrosUsbDeviceInfo> usb_devices_; - base::ObserverList<SharedUsbDeviceObserver> shared_usb_device_observers_; + base::ObserverList<CrosUsbDeviceObserver> usb_device_observers_; // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed.
diff --git a/chrome/browser/chromeos/usb/cros_usb_detector_unittest.cc b/chrome/browser/chromeos/usb/cros_usb_detector_unittest.cc index fb45a380..6dabf8a 100644 --- a/chrome/browser/chromeos/usb/cros_usb_detector_unittest.cc +++ b/chrome/browser/chromeos/usb/cros_usb_detector_unittest.cc
@@ -101,20 +101,14 @@ {InterfaceCodes(device_class, 0xff, 0xff)}); } -class TestSharedUsbDeviceObserver : public chromeos::SharedUsbDeviceObserver { +class TestCrosUsbDeviceObserver : public chromeos::CrosUsbDeviceObserver { public: - void OnSharedUsbDevicesChanged( - std::vector<chromeos::SharedUsbDeviceInfo> shared_devices) override { - std::move(shared_devices.begin(), shared_devices.end(), - std::back_inserter(shared_devices_)); - } + void OnUsbDevicesChanged() override { ++notify_count_; } - const std::vector<chromeos::SharedUsbDeviceInfo>& shared_devices() const { - return shared_devices_; - } + int notify_count() const { return notify_count_; } private: - std::vector<chromeos::SharedUsbDeviceInfo> shared_devices_; + int notify_count_ = 0; }; } // namespace @@ -177,6 +171,23 @@ base::RunLoop().RunUntilIdle(); } + chromeos::CrosUsbDeviceInfo GetSingleDeviceInfo() const { + auto devices = cros_usb_detector_->GetConnectedDevices(); + EXPECT_EQ(1U, devices.size()); + return devices.size() == 1 ? devices.front() + : chromeos::CrosUsbDeviceInfo(); + } + + chromeos::CrosUsbDeviceInfo GetSingleDeviceSharableWithCrostini() const { + auto devices = cros_usb_detector_->GetDevicesSharableWithCrostini(); + EXPECT_EQ(1U, devices.size()); + if (devices.empty()) { + return chromeos::CrosUsbDeviceInfo(); + } + EXPECT_TRUE(devices.front().sharable_with_crostini); + return devices.front(); + } + protected: base::string16 connection_message(const char* product_name) { return base::ASCIIToUTF16(base::StringPrintf( @@ -194,7 +205,7 @@ chromeos::FakeCiceroneClient* fake_cicerone_client_; chromeos::FakeConciergeClient* fake_concierge_client_; - TestSharedUsbDeviceObserver shared_usb_device_observer_; + TestCrosUsbDeviceObserver usb_device_observer_; std::unique_ptr<chromeos::CrosUsbDetector> cros_usb_detector_; base::test::ScopedFeatureList scoped_feature_list_; @@ -268,8 +279,7 @@ std::string notification_id = chromeos::CrosUsbDetector::MakeNotificationId(device->guid()); ASSERT_FALSE(display_service_->GetNotification(notification_id)); - - // TODO(jopra): Check that the device is not available for sharing. + EXPECT_EQ(0U, cros_usb_detector_->GetDevicesSharableWithCrostini().size()); } TEST_F(CrosUsbDetectorTest, UsbDeviceClassAdbAdded) { @@ -291,6 +301,8 @@ std::string notification_id = chromeos::CrosUsbDetector::MakeNotificationId(device->guid()); ASSERT_TRUE(display_service_->GetNotification(notification_id)); + // ADB interface wins. + EXPECT_EQ(1U, cros_usb_detector_->GetDevicesSharableWithCrostini().size()); } TEST_F(CrosUsbDetectorTest, UsbDeviceClassWithoutNotificationAdded) { @@ -306,8 +318,7 @@ std::string notification_id = chromeos::CrosUsbDetector::MakeNotificationId(device->guid()); ASSERT_FALSE(display_service_->GetNotification(notification_id)); - - // TODO(jopra): Check that the device is available for sharing. + EXPECT_EQ(1U, cros_usb_detector_->GetDevicesSharableWithCrostini().size()); } TEST_F(CrosUsbDetectorTest, UsbDeviceWithoutProductNameAddedAndRemoved) { @@ -666,24 +677,22 @@ 0, 1, kManufacturerName, kProductName_1, "002"); device_manager_.AddDevice(device_1); base::RunLoop().RunUntilIdle(); - auto devices = cros_usb_detector_->GetSharedUsbDevices(); - ASSERT_EQ(1U, devices.size()); + auto device_info = GetSingleDeviceInfo(); - AttachDeviceToVm(crostini::kCrostiniDefaultVmName, devices[0].guid); + AttachDeviceToVm(crostini::kCrostiniDefaultVmName, device_info.guid); EXPECT_FALSE( - chromeos::SharedUsbDeviceInfo::VmSharingInfo().guest_port.has_value()); - devices = cros_usb_detector_->GetSharedUsbDevices(); - ASSERT_EQ(1U, devices.size()); - EXPECT_EQ(1U, devices[0].vm_sharing_info.size()); + chromeos::CrosUsbDeviceInfo::VmSharingInfo().guest_port.has_value()); + device_info = GetSingleDeviceSharableWithCrostini(); + EXPECT_EQ(1U, device_info.vm_sharing_info.size()); auto crostini_info = - devices[0].vm_sharing_info[crostini::kCrostiniDefaultVmName]; + device_info.vm_sharing_info[crostini::kCrostiniDefaultVmName]; EXPECT_TRUE(crostini_info.shared); EXPECT_TRUE(crostini_info.guest_port.has_value()); EXPECT_EQ(0U, *crostini_info.guest_port); } TEST_F(CrosUsbDetectorTest, DeviceGetsAutoAttachedToArcVmOnConnect) { - cros_usb_detector_->AddSharedUsbDeviceObserver(&shared_usb_device_observer_); + cros_usb_detector_->AddUsbDeviceObserver(&usb_device_observer_); ConnectToDeviceManager(); base::RunLoop().RunUntilIdle(); @@ -691,14 +700,8 @@ 0, 1, kManufacturerName, kProductName_1, "002"); device_manager_.AddDevice(device_1); base::RunLoop().RunUntilIdle(); - auto notifications = shared_usb_device_observer_.shared_devices(); - ASSERT_EQ(2U, notifications.size()); - EXPECT_EQ(0U, notifications[0].vm_sharing_info.size()); - EXPECT_TRUE(notifications[1].vm_sharing_info[arc::kArcVmName].shared); - - auto devices = cros_usb_detector_->GetSharedUsbDevices(); - ASSERT_EQ(1U, devices.size()); - EXPECT_TRUE(devices[0].vm_sharing_info[arc::kArcVmName].shared); + EXPECT_EQ(2, usb_device_observer_.notify_count()); + EXPECT_TRUE(GetSingleDeviceInfo().vm_sharing_info[arc::kArcVmName].shared); } TEST_F(CrosUsbDetectorTest, AttachingDeviceToCrostiniDetachesItFromArcVm) { @@ -710,24 +713,17 @@ device_manager_.AddDevice(device_1); base::RunLoop().RunUntilIdle(); - auto devices = cros_usb_detector_->GetSharedUsbDevices(); - ASSERT_EQ(1U, devices.size()); - EXPECT_TRUE(devices[0].vm_sharing_info[arc::kArcVmName].shared); + auto device_info = GetSingleDeviceInfo(); + EXPECT_TRUE(device_info.vm_sharing_info[arc::kArcVmName].shared); - cros_usb_detector_->AddSharedUsbDeviceObserver(&shared_usb_device_observer_); - AttachDeviceToVm(crostini::kCrostiniDefaultVmName, devices[0].guid); - auto notifications = shared_usb_device_observer_.shared_devices(); - ASSERT_EQ(2U, notifications.size()); - EXPECT_EQ(1U, notifications[0].vm_sharing_info.size()); - EXPECT_TRUE(notifications[1] - .vm_sharing_info[crostini::kCrostiniDefaultVmName] - .shared); + cros_usb_detector_->AddUsbDeviceObserver(&usb_device_observer_); + AttachDeviceToVm(crostini::kCrostiniDefaultVmName, device_info.guid); + EXPECT_EQ(2, usb_device_observer_.notify_count()); - devices = cros_usb_detector_->GetSharedUsbDevices(); - ASSERT_EQ(1U, devices.size()); - EXPECT_EQ(1U, devices[0].vm_sharing_info.size()); + device_info = GetSingleDeviceInfo(); + EXPECT_EQ(1U, device_info.vm_sharing_info.size()); EXPECT_TRUE( - devices[0].vm_sharing_info[crostini::kCrostiniDefaultVmName].shared); + device_info.vm_sharing_info[crostini::kCrostiniDefaultVmName].shared); } TEST_F(CrosUsbDetectorTest, DetachingDeviceFromCrostiniAttachesItToArcVm) { @@ -739,25 +735,18 @@ device_manager_.AddDevice(device_1); base::RunLoop().RunUntilIdle(); - auto devices = cros_usb_detector_->GetSharedUsbDevices(); - ASSERT_EQ(1U, devices.size()); - AttachDeviceToVm(crostini::kCrostiniDefaultVmName, devices[0].guid); - cros_usb_detector_->AddSharedUsbDeviceObserver(&shared_usb_device_observer_); + auto device_info = GetSingleDeviceInfo(); + AttachDeviceToVm(crostini::kCrostiniDefaultVmName, device_info.guid); + cros_usb_detector_->AddUsbDeviceObserver(&usb_device_observer_); cros_usb_detector_->DetachUsbDeviceFromVm( - crostini::kCrostiniDefaultVmName, devices[0].guid, + crostini::kCrostiniDefaultVmName, device_info.guid, base::Bind([](bool result) { EXPECT_TRUE(result); })); base::RunLoop().RunUntilIdle(); - auto notifications = shared_usb_device_observer_.shared_devices(); - ASSERT_EQ(2U, notifications.size()); - auto sharing_info = notifications[0].vm_sharing_info; - EXPECT_EQ(0U, sharing_info.count(crostini::kCrostiniDefaultVmName)); - EXPECT_TRUE(notifications[1].vm_sharing_info[arc::kArcVmName].shared); - - devices = cros_usb_detector_->GetSharedUsbDevices(); - ASSERT_EQ(1U, devices.size()); - EXPECT_EQ(1U, devices[0].vm_sharing_info.size()); - EXPECT_TRUE(devices[0].vm_sharing_info[arc::kArcVmName].shared); + EXPECT_EQ(2, usb_device_observer_.notify_count()); + device_info = GetSingleDeviceInfo(); + EXPECT_EQ(1U, device_info.vm_sharing_info.size()); + EXPECT_TRUE(device_info.vm_sharing_info[arc::kArcVmName].shared); } TEST_F(CrosUsbDetectorTest, AttachingAlreadyAttachedDeviceIsANoOp) { @@ -769,18 +758,28 @@ device_manager_.AddDevice(device_1); base::RunLoop().RunUntilIdle(); - auto devices = cros_usb_detector_->GetSharedUsbDevices(); - ASSERT_EQ(1U, devices.size()); - EXPECT_TRUE(devices[0].vm_sharing_info[arc::kArcVmName].shared); + auto device_info = GetSingleDeviceInfo(); + EXPECT_TRUE(device_info.vm_sharing_info[arc::kArcVmName].shared); - AttachDeviceToVm(crostini::kCrostiniDefaultVmName, devices[0].guid); - cros_usb_detector_->AddSharedUsbDeviceObserver(&shared_usb_device_observer_); - AttachDeviceToVm(crostini::kCrostiniDefaultVmName, devices[0].guid); - auto notifications = shared_usb_device_observer_.shared_devices(); - EXPECT_EQ(0U, notifications.size()); - devices = cros_usb_detector_->GetSharedUsbDevices(); - ASSERT_EQ(1U, devices.size()); - EXPECT_EQ(1U, devices[0].vm_sharing_info.size()); + AttachDeviceToVm(crostini::kCrostiniDefaultVmName, device_info.guid); + cros_usb_detector_->AddUsbDeviceObserver(&usb_device_observer_); + AttachDeviceToVm(crostini::kCrostiniDefaultVmName, device_info.guid); + EXPECT_EQ(0, usb_device_observer_.notify_count()); + device_info = GetSingleDeviceInfo(); + EXPECT_EQ(1U, device_info.vm_sharing_info.size()); EXPECT_TRUE( - devices[0].vm_sharing_info[crostini::kCrostiniDefaultVmName].shared); + device_info.vm_sharing_info[crostini::kCrostiniDefaultVmName].shared); +} + +TEST_F(CrosUsbDetectorTest, DeviceCanBeAttachedToArcVmWhenCrostiniIsDisabled) { + scoped_feature_list_.Reset(); // Clears Crostini flags. + ConnectToDeviceManager(); + base::RunLoop().RunUntilIdle(); + + auto device_1 = base::MakeRefCounted<device::FakeUsbDeviceInfo>( + 0, 1, kManufacturerName, kProductName_1, "002"); + device_manager_.AddDevice(device_1); + base::RunLoop().RunUntilIdle(); + + EXPECT_TRUE(GetSingleDeviceInfo().vm_sharing_info[arc::kArcVmName].shared); }
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index 9d9c053..6a1ec3cb 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -1189,6 +1189,9 @@ is_pending_scanning = true; danger_type = download::DOWNLOAD_DANGER_TYPE_ASYNC_SCANNING; break; + case safe_browsing::DownloadCheckResult::BLOCKED_PASSWORD_PROTECTED: + danger_type = download::DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED; + break; } DCHECK_NE(danger_type, download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT);
diff --git a/chrome/browser/download/download_danger_prompt.cc b/chrome/browser/download/download_danger_prompt.cc index ab62e13..e14981d 100644 --- a/chrome/browser/download/download_danger_prompt.cc +++ b/chrome/browser/download/download_danger_prompt.cc
@@ -39,6 +39,8 @@ return "PotentiallyUnwanted"; case download::DOWNLOAD_DANGER_TYPE_ASYNC_SCANNING: return "AsyncScanning"; + case download::DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED: + return "BlockedPasswordProtected"; case download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: case download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT: case download::DOWNLOAD_DANGER_TYPE_USER_VALIDATED:
diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc index 142fe86..1e449a6b 100644 --- a/chrome/browser/download/download_item_model.cc +++ b/chrome/browser/download/download_item_model.cc
@@ -224,6 +224,7 @@ case download::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: case download::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED: case download::DOWNLOAD_DANGER_TYPE_ASYNC_SCANNING: + case download::DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED: return true; case download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: @@ -264,6 +265,7 @@ FALLTHROUGH; case download::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT: case download::DOWNLOAD_DANGER_TYPE_ASYNC_SCANNING: + case download::DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED: return false; } NOTREACHED();
diff --git a/chrome/browser/download/download_ui_model.cc b/chrome/browser/download/download_ui_model.cc index 7f17091..dc83228f 100644 --- a/chrome/browser/download/download_ui_model.cc +++ b/chrome/browser/download/download_ui_model.cc
@@ -289,6 +289,7 @@ return l10n_util::GetStringFUTF16(IDS_PROMPT_DOWNLOAD_CHANGES_SETTINGS, elided_filename); } + case download::DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED: case download::DOWNLOAD_DANGER_TYPE_ASYNC_SCANNING: case download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: case download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT:
diff --git a/chrome/browser/download/notification/download_item_notification.cc b/chrome/browser/download/notification/download_item_notification.cc index e4a77b1..9c50946 100644 --- a/chrome/browser/download/notification/download_item_notification.cc +++ b/chrome/browser/download/notification/download_item_notification.cc
@@ -723,6 +723,7 @@ return l10n_util::GetStringFUTF16(IDS_PROMPT_DOWNLOAD_CHANGES_SETTINGS, elided_filename); } + case download::DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED: case download::DOWNLOAD_DANGER_TYPE_ASYNC_SCANNING: case download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: case download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT:
diff --git a/chrome/browser/engagement/BUILD.gn b/chrome/browser/engagement/BUILD.gn index 8f5fe2a..1965296 100644 --- a/chrome/browser/engagement/BUILD.gn +++ b/chrome/browser/engagement/BUILD.gn
@@ -12,7 +12,4 @@ public_deps = [ "//url/mojom:url_mojom_gurl", ] - - # TODO(https://crbug.com/968369): Change to use new names. - use_old_js_lite_bindings_names = true }
diff --git a/chrome/browser/enterprise_reporting/policy_info.cc b/chrome/browser/enterprise_reporting/policy_info.cc index 46062d12..5768441 100644 --- a/chrome/browser/enterprise_reporting/policy_info.cc +++ b/chrome/browser/enterprise_reporting/policy_info.cc
@@ -61,23 +61,46 @@ return em::Policy_PolicySource_SOURCE_UNKNOWN; } +void UpdatePolicyInfo(em::Policy* policy_info, + const std::string& policy_name, + const base::Value& policy) { + policy_info->set_name(policy_name); + policy_info->set_level(GetLevel(policy)); + policy_info->set_scope(GetScope(policy)); + policy_info->set_source(GetSource(policy)); + base::JSONWriter::Write(*policy.FindKey("value"), + policy_info->mutable_value()); + const std::string* error = policy.FindStringKey("error"); + if (error) + policy_info->set_error(*error); +} + } // namespace void AppendChromePolicyInfoIntoProfileReport( const base::Value& policies, em::ChromeUserProfileInfo* profile_info) { - for (const auto& item : policies.FindKey("chromePolicies")->DictItems()) { - const base::Value& policy = item.second; - auto* policy_info = profile_info->add_chrome_policies(); - policy_info->set_name(item.first); - policy_info->set_level(GetLevel(policy)); - policy_info->set_scope(GetScope(policy)); - policy_info->set_source(GetSource(policy)); - base::JSONWriter::Write(*policy.FindKey("value"), - policy_info->mutable_value()); - const std::string* error = policy.FindStringKey("error"); - if (error) - policy_info->set_error(*error); + for (const auto& policy_iter : + policies.FindKey("chromePolicies")->DictItems()) { + UpdatePolicyInfo(profile_info->add_chrome_policies(), policy_iter.first, + policy_iter.second); + } +} + +void AppendExtensionPolicyInfoIntoProfileReport( + const base::Value& policies, + em::ChromeUserProfileInfo* profile_info) { + for (const auto& extension_iter : + policies.FindKey("extensionPolicies")->DictItems()) { + const base::Value& policies = extension_iter.second; + if (policies.DictSize() == 0) + continue; + auto* extension = profile_info->add_extension_policies(); + extension->set_extension_id(extension_iter.first); + for (const auto& policy_iter : policies.DictItems()) { + UpdatePolicyInfo(extension->add_policies(), policy_iter.first, + policy_iter.second); + } } }
diff --git a/chrome/browser/enterprise_reporting/policy_info.h b/chrome/browser/enterprise_reporting/policy_info.h index 6a3dfae..c8187a1d 100644 --- a/chrome/browser/enterprise_reporting/policy_info.h +++ b/chrome/browser/enterprise_reporting/policy_info.h
@@ -19,6 +19,10 @@ const base::Value& policies, em::ChromeUserProfileInfo* profile_info); +void AppendExtensionPolicyInfoIntoProfileReport( + const base::Value& policies, + em::ChromeUserProfileInfo* profile_info); + } // namespace enterprise_reporting #endif // CHROME_BROWSER_ENTERPRISE_REPORTING_POLICY_INFO_H_
diff --git a/chrome/browser/enterprise_reporting/policy_info_unittest.cc b/chrome/browser/enterprise_reporting/policy_info_unittest.cc index c95422a..56030eed 100644 --- a/chrome/browser/enterprise_reporting/policy_info_unittest.cc +++ b/chrome/browser/enterprise_reporting/policy_info_unittest.cc
@@ -4,12 +4,16 @@ #include "chrome/browser/enterprise_reporting/policy_info.h" +#include "base/files/file_util.h" #include "chrome/browser/policy/policy_conversions.h" #include "chrome/test/base/testing_profile.h" #include "components/policy/core/common/mock_policy_service.h" #include "components/policy/core/common/policy_map.h" #include "components/policy/proto/device_management_backend.pb.h" #include "content/public/test/test_browser_thread_bundle.h" +#include "extensions/browser/extension_registry.h" +#include "extensions/common/extension_builder.h" +#include "extensions/common/manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" namespace em = enterprise_management; @@ -18,6 +22,9 @@ namespace { constexpr char kPolicyName1[] = "policy_a"; constexpr char kPolicyName2[] = "policy_b"; + +constexpr char kExtensionId1[] = "abcdefghijklmnoabcdefghijklmnoab"; +constexpr char kExtensionId2[] = "abcdefghijklmnoabcdefghijklmnoac"; } // namespace using ::testing::_; @@ -37,18 +44,30 @@ GetPolicies(Eq(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())))) .WillByDefault(::testing::ReturnRef(policy_map_)); + ON_CALL(*policy_service.get(), + GetPolicies(Eq(policy::PolicyNamespace( + policy::POLICY_DOMAIN_EXTENSIONS, kExtensionId1)))) + .WillByDefault(::testing::ReturnRef(extension_policy_map_)); + ON_CALL(*policy_service.get(), + GetPolicies(Eq(policy::PolicyNamespace( + policy::POLICY_DOMAIN_EXTENSIONS, kExtensionId2)))) + .WillByDefault(::testing::ReturnRef(empty_policy_map_)); + policy_service_ = policy_service.get(); return policy_service; } TestingProfile* profile() { return profile_.get(); } policy::PolicyMap* policy_map() { return &policy_map_; } + policy::PolicyMap* extension_policy_map() { return &extension_policy_map_; } policy::MockPolicyService* policy_service() { return policy_service_; } private: content::TestBrowserThreadBundle thread_bundle_; std::unique_ptr<TestingProfile> profile_; policy::PolicyMap policy_map_; + policy::PolicyMap extension_policy_map_; + policy::PolicyMap empty_policy_map_; policy::MockPolicyService* policy_service_; }; @@ -90,4 +109,43 @@ EXPECT_NE("", policy2.error()); } +TEST_F(PolicyInfoTest, ExtensionPolicy) { + EXPECT_CALL(*policy_service(), GetPolicies(_)).Times(3); + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(profile()); + + extension_registry->AddEnabled( + extensions::ExtensionBuilder("extension_name") + .SetID(kExtensionId1) + .SetManifestPath({"storage", "managed_schema"}, "schema.json") + .Build()); + extension_registry->AddEnabled( + extensions::ExtensionBuilder("extension_name") + .SetID(kExtensionId2) + .SetManifestPath({"storage", "managed_schema"}, "schema.json") + .Build()); + + extension_policy_map()->Set(kPolicyName1, policy::POLICY_LEVEL_MANDATORY, + policy::POLICY_SCOPE_MACHINE, + policy::POLICY_SOURCE_PLATFORM, + std::make_unique<base::Value>(3), nullptr); + em::ChromeUserProfileInfo profile_info; + AppendExtensionPolicyInfoIntoProfileReport( + policy::GetAllPolicyValuesAsDictionary(profile(), true, false, false, + false, false), + &profile_info); + // The second extension is not in the report because it has no policy. + EXPECT_EQ(1, profile_info.extension_policies_size()); + EXPECT_EQ(kExtensionId1, profile_info.extension_policies(0).extension_id()); + EXPECT_EQ(1, profile_info.extension_policies(0).policies_size()); + + auto policy1 = profile_info.extension_policies(0).policies(0); + EXPECT_EQ(kPolicyName1, policy1.name()); + EXPECT_EQ("3", policy1.value()); + EXPECT_EQ(em::Policy_PolicyLevel_LEVEL_MANDATORY, policy1.level()); + EXPECT_EQ(em::Policy_PolicyScope_SCOPE_MACHINE, policy1.scope()); + EXPECT_EQ(em::Policy_PolicySource_SOURCE_PLATFORM, policy1.source()); + EXPECT_NE(std::string(), policy1.error()); +} + } // namespace enterprise_reporting
diff --git a/chrome/browser/enterprise_reporting/profile_report_generator.cc b/chrome/browser/enterprise_reporting/profile_report_generator.cc index 5300fa4d..fdfe85a6 100644 --- a/chrome/browser/enterprise_reporting/profile_report_generator.cc +++ b/chrome/browser/enterprise_reporting/profile_report_generator.cc
@@ -63,6 +63,7 @@ /* with_device_data*/ false, /* is_pretty_print */ false, /* convert_types */ false); GetChromePolicyInfo(); + GetExtensionPolicyInfo(); } CheckReportStatusAsync(); @@ -100,6 +101,10 @@ AppendChromePolicyInfoIntoProfileReport(policies_, report_.get()); } +void ProfileReportGenerator::GetExtensionPolicyInfo() { + AppendExtensionPolicyInfoIntoProfileReport(policies_, report_.get()); +} + void ProfileReportGenerator::OnPluginsLoaded( const std::vector<content::WebPluginInfo>& plugins) { for (auto plugin : plugins) {
diff --git a/chrome/browser/enterprise_reporting/profile_report_generator.h b/chrome/browser/enterprise_reporting/profile_report_generator.h index 9d0b9b30..64c0c3cd 100644 --- a/chrome/browser/enterprise_reporting/profile_report_generator.h +++ b/chrome/browser/enterprise_reporting/profile_report_generator.h
@@ -53,7 +53,7 @@ void GetExtensionInfo(); void GetPluginInfo(); void GetChromePolicyInfo(); - // TODO(zmin): void GetExtensionPolicyInfo(); + void GetExtensionPolicyInfo(); // TODO(zmin): void GetPolicyFetchTimestampInfo(); private:
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index f49baf05..e02896ff 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn
@@ -983,6 +983,7 @@ "//chromeos/login/auth", "//chromeos/login/login_state", "//chromeos/network", + "//chromeos/services/assistant/public/cpp:prefs", "//chromeos/services/ime/public/mojom", "//chromeos/services/machine_learning/public/cpp", "//chromeos/services/machine_learning/public/mojom",
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc index 69a76d3..2d635a8 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -149,6 +149,7 @@ const char kDangerUnwanted[] = "unwanted"; const char kDangerWhitelistedByPolicy[] = "whitelistedByPolicy"; const char kDangerAsyncScanning[] = "asyncScanning"; +const char kDangerPasswordProtected[] = "passwordProtected"; const char kDangerUrl[] = "url"; const char kEndTimeKey[] = "endTime"; const char kEndedAfterKey[] = "endedAfter"; @@ -183,12 +184,12 @@ // Note: Any change to the danger type strings, should be accompanied by a // corresponding change to downloads.json. const char* const kDangerStrings[] = { - kDangerSafe, kDangerFile, - kDangerUrl, kDangerContent, - kDangerSafe, kDangerUncommon, - kDangerAccepted, kDangerHost, - kDangerUnwanted, kDangerWhitelistedByPolicy, - kDangerAsyncScanning}; + kDangerSafe, kDangerFile, + kDangerUrl, kDangerContent, + kDangerSafe, kDangerUncommon, + kDangerAccepted, kDangerHost, + kDangerUnwanted, kDangerWhitelistedByPolicy, + kDangerAsyncScanning, kDangerPasswordProtected}; static_assert(base::size(kDangerStrings) == download::DOWNLOAD_DANGER_TYPE_MAX, "kDangerStrings should have DOWNLOAD_DANGER_TYPE_MAX elements");
diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chrome/browser/extensions/api/settings_private/prefs_util.cc index c600c7a..b1c6d774 100644 --- a/chrome/browser/extensions/api/settings_private/prefs_util.cc +++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc
@@ -55,6 +55,7 @@ #include "chrome/browser/extensions/api/settings_private/chromeos_resolve_time_zone_by_geolocation_on_off.h" #include "chrome/browser/ui/ash/assistant/assistant_pref_util.h" #include "chromeos/constants/chromeos_features.h" +#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" #include "chromeos/settings/cros_settings_names.h" #include "components/arc/arc_prefs.h" #include "ui/chromeos/events/pref_names.h" @@ -417,7 +418,7 @@ settings_api::PrefType::PREF_TYPE_BOOLEAN; // Google Assistant. - (*s_whitelist)[::assistant::prefs::kAssistantConsentStatus] = + (*s_whitelist)[chromeos::assistant::prefs::kAssistantConsentStatus] = settings_api::PrefType::PREF_TYPE_NUMBER; (*s_whitelist)[::assistant::prefs::kAssistantDisabledByPolicy] = settings_api::PrefType::PREF_TYPE_BOOLEAN;
diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc index d32c89c..0203d50 100644 --- a/chrome/browser/file_select_helper.cc +++ b/chrome/browser/file_select_helper.cc
@@ -113,9 +113,10 @@ case Result::POTENTIALLY_UNWANTED: return false; - // Safe Browsing should only return ASYNC_SCANNING results for client - // downloads, not for PPAPI downloads. + // Safe Browsing should only return these results for client downloads, not + // for PPAPI downloads. case Result::ASYNC_SCANNING: + case Result::BLOCKED_PASSWORD_PROTECTED: NOTREACHED(); return true; }
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 61ff6a1c..1d7a37bd 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -1781,10 +1781,6 @@ const char kSiteIsolationOptOutChoiceDefault[] = "Default"; const char kSiteIsolationOptOutChoiceOptOut[] = "Disabled (not recommended)"; -const char kSiteSettings[] = "Site settings"; -const char kSiteSettingsDescription[] = - "Add the All Sites list to Site Settings."; - const char kSmoothScrollingName[] = "Smooth Scrolling"; const char kSmoothScrollingDescription[] = "Animate smoothly when scrolling page content.";
diff --git a/chrome/browser/lookalikes/safety_tips/safety_tip_ui.h b/chrome/browser/lookalikes/safety_tips/safety_tip_ui.h new file mode 100644 index 0000000..6587b0b --- /dev/null +++ b/chrome/browser/lookalikes/safety_tips/safety_tip_ui.h
@@ -0,0 +1,45 @@ +// 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 CHROME_BROWSER_LOOKALIKES_SAFETY_TIPS_SAFETY_TIP_UI_H_ +#define CHROME_BROWSER_LOOKALIKES_SAFETY_TIPS_SAFETY_TIP_UI_H_ + +namespace content { +class WebContents; +} + +class GURL; +class Browser; + +namespace safety_tips { + +// This enum describes the types of warnings shown by the safety tip bubble. +enum class SafetyTipType { + // No safety tip is/should be shown. + kNone, + + // This URL is suspicious according to server- or client-side logic. + kBadReputation, + + // This domain is uncommon or the site is young. + kUncommonDomain, + + // This URL may be trying to trick users by impersonating a trustworthy URL. + kLookalikeUrl, + + kMax = kLookalikeUrl, +}; + +// Shows Safety Tip UI using the specified information. |virtual_url| is the +// virtual url of the page/frame the info applies to. |safe_url| is the URL +// that the "Leave" action redirects to. Implemented in platform-specific files. +void ShowSafetyTipDialog(Browser* browser, + content::WebContents* web_contents, + SafetyTipType type, + const GURL& virtual_url, + const GURL& safe_url); + +} // namespace safety_tips + +#endif // CHROME_BROWSER_LOOKALIKES_SAFETY_TIPS_SAFETY_TIP_UI_H_
diff --git a/chrome/browser/media/router/mojo/media_route_controller.h b/chrome/browser/media/router/mojo/media_route_controller.h index 0535f62..d956875 100644 --- a/chrome/browser/media/router/mojo/media_route_controller.h +++ b/chrome/browser/media/router/mojo/media_route_controller.h
@@ -92,7 +92,8 @@ // The second item is a bound MediaStatusObserverPtr whose binding is owned // by |this|. using InitMojoResult = - std::pair<mojom::MediaControllerRequest, mojom::MediaStatusObserverPtr>; + std::pair<mojo::PendingReceiver<mojom::MediaController>, + mojom::MediaStatusObserverPtr>; // Constructs a MediaRouteController that forwards media commands to // |mojo_media_controller_|. |media_router_| will be notified when the
diff --git a/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.cc b/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.cc index b6f6b70..4e83fca 100644 --- a/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.cc +++ b/chrome/browser/media/router/providers/wired_display/wired_display_media_route_provider.cc
@@ -344,11 +344,11 @@ } void WiredDisplayMediaRouteProvider::Presentation::SetMojoConnections( - mojom::MediaControllerRequest media_controller, + mojo::PendingReceiver<mojom::MediaController> media_controller, mojom::MediaStatusObserverPtr observer) { // This provider does not support media controls, so we do not bind // |media_controller| to a controller implementation. - media_controller_request_ = std::move(media_controller); + media_controller_receiver_ = std::move(media_controller); media_status_observer_ = std::move(observer); media_status_observer_->OnMediaStatusUpdated(status_); @@ -358,7 +358,7 @@ } void WiredDisplayMediaRouteProvider::Presentation::ResetMojoConnections() { - media_controller_request_ = nullptr; + media_controller_receiver_.reset(); media_status_observer_ = nullptr; }
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 d52ffbb7..a85e187 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
@@ -122,8 +122,9 @@ // observers if the title changed. void UpdatePresentationTitle(const std::string& title); - void SetMojoConnections(mojom::MediaControllerRequest media_controller, - mojom::MediaStatusObserverPtr observer); + void SetMojoConnections( + mojo::PendingReceiver<mojom::MediaController> media_controller, + mojom::MediaStatusObserverPtr observer); // Resets the Mojo connections to media controller and status observer. void ResetMojoConnections(); @@ -145,7 +146,7 @@ MediaStatus status_; // |media_controller_request| is retained but not used. - mojom::MediaControllerRequest media_controller_request_; + mojo::PendingReceiver<mojom::MediaController> media_controller_receiver_; // |media_status_observer|, when set, gets notified whenever |status| // changes.
diff --git a/chrome/browser/ntp_tiles/OWNERS b/chrome/browser/ntp_tiles/OWNERS index af1328d..e96321a 100644 --- a/chrome/browser/ntp_tiles/OWNERS +++ b/chrome/browser/ntp_tiles/OWNERS
@@ -1 +1,2 @@ file://components/ntp_tiles/OWNERS +# COMPONENT: UI>Browser>ContentSuggestions>History
diff --git a/chrome/browser/picture_in_picture/OWNERS b/chrome/browser/picture_in_picture/OWNERS index ed74af2..0a33a0e8 100644 --- a/chrome/browser/picture_in_picture/OWNERS +++ b/chrome/browser/picture_in_picture/OWNERS
@@ -1 +1,3 @@ file://third_party/blink/renderer/modules/picture_in_picture/OWNERS +# COMPONENT: Blink>Media>PictureInPicture +# TEAM: media-dev@chromium.org
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 8499d3e..1b19c582 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -314,6 +314,7 @@ #if BUILDFLAG(ENABLE_CROS_ASSISTANT) #include "chrome/browser/ui/ash/assistant/assistant_pref_util.h" +#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" #endif #else @@ -396,10 +397,6 @@ const char kNextUpdateCheck[] = "extensions.autoupdate.next_check"; const char kLastUpdateCheck[] = "extensions.autoupdate.last_check"; -// Deprecated 2/2019. -const char kVoiceInteractionActivityControlAcceptedDeprecated[] = - "settings.voice_interaction.activity_control.accepted"; - // Deprecated 3/2019. const char kCurrentThemeImages[] = "extensions.theme.images"; const char kCurrentThemeColors[] = "extensions.theme.colors"; @@ -487,9 +484,6 @@ registry->RegisterIntegerPref(kLastUpdateCheck, 0); registry->RegisterIntegerPref(kNextUpdateCheck, 0); - registry->RegisterBooleanPref( - kVoiceInteractionActivityControlAcceptedDeprecated, false); - registry->RegisterDictionaryPref(kCurrentThemeImages); registry->RegisterDictionaryPref(kCurrentThemeColors); registry->RegisterDictionaryPref(kCurrentThemeTints); @@ -877,7 +871,10 @@ ::onc::RegisterProfilePrefs(registry); #if BUILDFLAG(ENABLE_CROS_ASSISTANT) + // TODO(b/110211045): Merge these two methods after migrating other Assistant + // related prefs. assistant::prefs::RegisterProfilePrefs(registry); + chromeos::assistant::prefs::RegisterProfilePrefsForBrowser(registry); #endif #endif @@ -965,28 +962,6 @@ ash::RegisterSigninProfilePrefs(registry); } -#if BUILDFLAG(ENABLE_CROS_ASSISTANT) - -bool MigrateVoiceInteractionActivityControlAccepted( - PrefService* profile_prefs) { - const base::Value* activity_control_accepted = - profile_prefs->GetUserPrefValue( - kVoiceInteractionActivityControlAcceptedDeprecated); - - if (!activity_control_accepted) - return false; - - ash::mojom::ConsentStatus consent_status = - activity_control_accepted->GetBool() - ? ash::mojom::ConsentStatus::kActivityControlAccepted - : ash::mojom::ConsentStatus::kUnknown; - - assistant::prefs::SetConsentStatus(profile_prefs, consent_status); - return true; -} - -#endif - #endif // This method should be periodically pruned of year+ old migrations. @@ -1048,14 +1023,6 @@ // Added 12/2018. profile_prefs->ClearPref(prefs::kDataSaverPromptsShown); -#if BUILDFLAG(ENABLE_CROS_ASSISTANT) - // Added 2/2019. - if (MigrateVoiceInteractionActivityControlAccepted(profile_prefs)) { - profile_prefs->ClearPref( - kVoiceInteractionActivityControlAcceptedDeprecated); - } -#endif - // Added 4/2019 guest_os::GuestOsSharePath::MigratePersistedPathsToMultiVM(profile_prefs); #endif
diff --git a/chrome/browser/push_messaging/OWNERS b/chrome/browser/push_messaging/OWNERS index 4898e44..b948d98 100644 --- a/chrome/browser/push_messaging/OWNERS +++ b/chrome/browser/push_messaging/OWNERS
@@ -1,4 +1,4 @@ file://content/browser/push_messaging/OWNERS -# TEAM: platform-capabilities@chromium.org +# TEAM: platform-capabilities@chromium.org # COMPONENT: Blink>PushAPI
diff --git a/chrome/browser/resources/chromeos/switch_access/BUILD.gn b/chrome/browser/resources/chromeos/switch_access/BUILD.gn index 34438a3..2888359 100644 --- a/chrome/browser/resources/chromeos/switch_access/BUILD.gn +++ b/chrome/browser/resources/chromeos/switch_access/BUILD.gn
@@ -56,6 +56,8 @@ "icons/scrollUpOrBackward.svg", "icons/select.svg", "icons/showContextMenu.svg", + "icons/textSelectionEnd.svg", + "icons/textSelectionStart.svg", "key_event_handler.js", "menu_manager.js", "menu_panel.css",
diff --git a/chrome/browser/resources/chromeos/switch_access/icons/textSelectionEnd.svg b/chrome/browser/resources/chromeos/switch_access/icons/textSelectionEnd.svg new file mode 100644 index 0000000..bfb803e5 --- /dev/null +++ b/chrome/browser/resources/chromeos/switch_access/icons/textSelectionEnd.svg
@@ -0,0 +1,4 @@ +<!-- 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. --> +<svg height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="m13 5h-2v-2h6v2h-2v10h2v2h-6v-2h2zm-4-2v2h-2v-2zm-4 0v2h-2v-2zm0 4v2h-2v-2zm0 4v2h-2v-2zm0 4v2h-2v-2zm4 0v2h-2v-2z" fill="#E8EAED" fill-rule="evenodd"/></svg>
diff --git a/chrome/browser/resources/chromeos/switch_access/icons/textSelectionStart.svg b/chrome/browser/resources/chromeos/switch_access/icons/textSelectionStart.svg new file mode 100644 index 0000000..3ef03df1 --- /dev/null +++ b/chrome/browser/resources/chromeos/switch_access/icons/textSelectionStart.svg
@@ -0,0 +1,4 @@ +<!-- 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. --> +<svg height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="m7 5v10h2v2h-6v-2h2v-10h-2v-2h6v2zm4-2h2v2h-2zm4 0h2v2h-2zm0 4h2v2h-2zm0 4h2v2h-2zm0 4h2v2h-2zm-4 0h2v2h-2z" fill="#E8EAED" fill-rule="evenodd"/></svg>
diff --git a/chrome/browser/resources/chromeos/switch_access/menu_manager.js b/chrome/browser/resources/chromeos/switch_access/menu_manager.js index fec0e2cb..eaf1a27e 100644 --- a/chrome/browser/resources/chromeos/switch_access/menu_manager.js +++ b/chrome/browser/resources/chromeos/switch_access/menu_manager.js
@@ -284,6 +284,8 @@ actions.push(SAConstants.MenuAction.MOVE_FORWARD_ONE_CHAR_OF_TEXT); actions.push(SAConstants.MenuAction.MOVE_FORWARD_ONE_WORD_OF_TEXT); actions.push(SAConstants.MenuAction.MOVE_UP_ONE_LINE_OF_TEXT); + actions.push(SAConstants.MenuAction.SELECT_START); + actions.push(SAConstants.MenuAction.SELECT_END); } } else if (actions.length > 0) { actions.push(SAConstants.MenuAction.SELECT); @@ -372,6 +374,12 @@ this.navigationManager_.moveUpOneLineOfText(); exitAfterAction = false; break; + case SAConstants.MenuAction.SELECT_START: + this.navigationManager_.textInputManager().setSelectStart(); + break; + case SAConstants.MenuAction.SELECT_END: + this.navigationManager_.textInputManager().setSelectEnd(); + break; default: this.navigationManager_.performActionOnCurrentNode(action); }
diff --git a/chrome/browser/resources/chromeos/switch_access/menu_panel.html b/chrome/browser/resources/chromeos/switch_access/menu_panel.html index 0de8669d..f5221e2 100644 --- a/chrome/browser/resources/chromeos/switch_access/menu_panel.html +++ b/chrome/browser/resources/chromeos/switch_access/menu_panel.html
@@ -85,6 +85,13 @@ <button class="action" id="moveUpOneLineOfText"> <img src="icons/moveUpOneLineOfText.svg"> <p class="i18n" msgid="move_up_one_line_of_text"></p> + <button class="action" id="selectStart"> + <img src="icons/textSelectionStart.svg"> + <p class="i18n" msgid="selection_start"></p> + </button> + <button class="action" id="selectEnd"> + <img src="icons/textSelectionEnd.svg"> + <p class="i18n" msgid="selection_end"></p> </button> <button class="action" id="dictation"> <img src="icons/dictation.svg">
diff --git a/chrome/browser/resources/chromeos/switch_access/navigation_manager.js b/chrome/browser/resources/chromeos/switch_access/navigation_manager.js index 62a0f51..1a37415 100644 --- a/chrome/browser/resources/chromeos/switch_access/navigation_manager.js +++ b/chrome/browser/resources/chromeos/switch_access/navigation_manager.js
@@ -104,6 +104,21 @@ } /** + * Get the currently highlighted node. + */ + currentNode() { + return this.node_; + } + + /** + * TODO(rosalindag): get rid of this after moving text selection to new file + * Get the text_input_manager. + */ + textInputManager() { + return this.textInputManager_; + } + + /** * Open the Switch Access menu for the currently highlighted node. */ enterMenu() {
diff --git a/chrome/browser/resources/chromeos/switch_access/strings/switch_access_strings.grd b/chrome/browser/resources/chromeos/switch_access/strings/switch_access_strings.grd index b69f750..637e823 100644 --- a/chrome/browser/resources/chromeos/switch_access/strings/switch_access_strings.grd +++ b/chrome/browser/resources/chromeos/switch_access/strings/switch_access_strings.grd
@@ -186,8 +186,12 @@ <message desc="The Switch Access action for moving the text caret up one line." name="IDS_SWITCH_ACCESS_MOVE_UP_ONE_LINE_OF_TEXT"> Move up one line </message> + <message desc="The Switch Access action to set the beginning of a text selection area." name="IDS_SWITCH_ACCESS_SELECTION_START"> + Selection start + </message> + <message desc="The Switch Access action to set the end of a text selection area." name="IDS_SWITCH_ACCESS_SELECTION_END"> + Selection end + </message> </messages> </release> </grit> - -
diff --git a/chrome/browser/resources/chromeos/switch_access/strings/switch_access_strings_grd/IDS_SWITCH_ACCESS_SELECTION_END.png.sha1 b/chrome/browser/resources/chromeos/switch_access/strings/switch_access_strings_grd/IDS_SWITCH_ACCESS_SELECTION_END.png.sha1 new file mode 100644 index 0000000..2fd05da8 --- /dev/null +++ b/chrome/browser/resources/chromeos/switch_access/strings/switch_access_strings_grd/IDS_SWITCH_ACCESS_SELECTION_END.png.sha1
@@ -0,0 +1 @@ +00a4102e86dd815cc71a8a07f4143237be7a0a14 \ No newline at end of file
diff --git a/chrome/browser/resources/chromeos/switch_access/strings/switch_access_strings_grd/IDS_SWITCH_ACCESS_SELECTION_START.png.sha1 b/chrome/browser/resources/chromeos/switch_access/strings/switch_access_strings_grd/IDS_SWITCH_ACCESS_SELECTION_START.png.sha1 new file mode 100644 index 0000000..2fd05da8 --- /dev/null +++ b/chrome/browser/resources/chromeos/switch_access/strings/switch_access_strings_grd/IDS_SWITCH_ACCESS_SELECTION_START.png.sha1
@@ -0,0 +1 @@ +00a4102e86dd815cc71a8a07f4143237be7a0a14 \ No newline at end of file
diff --git a/chrome/browser/resources/chromeos/switch_access/switch_access_constants.js b/chrome/browser/resources/chromeos/switch_access/switch_access_constants.js index 4c9fd05..b694a4b 100644 --- a/chrome/browser/resources/chromeos/switch_access/switch_access_constants.js +++ b/chrome/browser/resources/chromeos/switch_access/switch_access_constants.js
@@ -173,7 +173,11 @@ // Either perform the default action or enter a new scope, as applicable. SELECT: 'select', // Show the system context menu for the current element. - SHOW_CONTEXT_MENU: chrome.automation.ActionType.SHOW_CONTEXT_MENU + SHOW_CONTEXT_MENU: chrome.automation.ActionType.SHOW_CONTEXT_MENU, + // Set the end of a text selection. + SELECT_END: 'selectEnd', + // Set the beginning of a text selection. + SELECT_START: 'selectStart' }; /**
diff --git a/chrome/browser/resources/chromeos/switch_access/text_input_manager.js b/chrome/browser/resources/chromeos/switch_access/text_input_manager.js index 31ef4fca..6202879 100644 --- a/chrome/browser/resources/chromeos/switch_access/text_input_manager.js +++ b/chrome/browser/resources/chromeos/switch_access/text_input_manager.js
@@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// Constant to indicate selection index is not set. +const NO_SELECTION = -1; + /** * Class to handle text input for improved accuracy and efficiency. */ @@ -23,6 +26,12 @@ color: SAConstants.Focus.PRIMARY_COLOR, secondaryColor: SAConstants.Focus.SECONDARY_COLOR }; + + /** @private {number} */ + this.selectionStart_ = NO_SELECTION; + + /** @private {number} */ + this.selectionEnd_ = NO_SELECTION; } /** @@ -131,4 +140,52 @@ this.textInputFocusRing_.rects = []; chrome.accessibilityPrivate.setFocusRings([this.textInputFocusRing_]); } + + /** + * IN PROGRESS TEXT SELECTION BELOW + * TODO(rosalindag): Move this into the text navigation file when + * creation of that file is merged + */ + + + /** + * TODO(rosalindag): Check for value is -1 for selectionStart and + * selectionEnd and handle error. + * + * TODO(rosalindag): Add variables to pass into anchorObject and focusObject. + * + * Sets the selection using the selectionStart and selectionEnd + * as the offset input for setDocumentSelection and the parameter + * textNode as the object input for setDocumentSelection. + * @param {!chrome.automation.AutomationNode} textNode + * @private + */ + setSelection_(textNode) { + chrome.automation.setDocumentSelection({ + anchorObject: textNode, + anchorOffset: this.selectionStart_, + focusObject: textNode, + focusOffset: this.selectionEnd_ + }); + } + + /** + * Sets the selectionStart variable based on the selection of the current + * node. + * @public + */ + setSelectStart() { + var textNode = this.navigationManager_.currentNode(); + this.selectionStart_ = textNode.textSelStart; + } + + /** + * Sets the selectionEnd variable based on the selection of the current node. + * @public + */ + setSelectEnd() { + var textNode = this.navigationManager_.currentNode(); + this.selectionEnd_ = textNode.textSelEnd; + this.setSelection_(textNode); + } }
diff --git a/chrome/browser/resources/engagement/site_engagement.js b/chrome/browser/resources/engagement/site_engagement.js index f8f0824..39454c3 100644 --- a/chrome/browser/resources/engagement/site_engagement.js +++ b/chrome/browser/resources/engagement/site_engagement.js
@@ -11,8 +11,8 @@ /** @type {function()} */ let disableAutoupdateForTests; -/** @type {mojom.SiteEngagementDetailsProviderProxy} */ -let uiHandler; +/** @type {mojom.SiteEngagementDetailsProviderRemote} */ +let engagementDetailsProvider; (function() { let resolvePageIsPopulated = null; @@ -25,7 +25,7 @@ }; function initialize() { - uiHandler = mojom.SiteEngagementDetailsProvider.getProxy(); + engagementDetailsProvider = mojom.SiteEngagementDetailsProvider.getRemote(); /** @type {?HTMLElement} */ const engagementTableBody = $('engagement-table-body'); @@ -132,7 +132,8 @@ */ function handleBaseScoreChange(origin, e) { const baseScoreInput = e.target; - uiHandler.setSiteEngagementBaseScoreForUrl(origin, baseScoreInput.value); + engagementDetailsProvider.setSiteEngagementBaseScoreForUrl( + origin, baseScoreInput.value); baseScoreInput.barCellRef.style.width = (baseScoreInput.value * 4) + 'px'; baseScoreInput.blur(); enableAutoupdate(); @@ -207,13 +208,11 @@ /** * Retrieve site engagement info and render the engagement table. */ - function updateEngagementTable() { + async function updateEngagementTable() { // Populate engagement table. - uiHandler.getSiteEngagementDetails().then((response) => { - info = response.info; - renderTable(); - resolvePageIsPopulated(); - }); + ({info} = await engagementDetailsProvider.getSiteEngagementDetails()); + renderTable(); + resolvePageIsPopulated(); } updateEngagementTable();
diff --git a/chrome/browser/resources/extensions/item.html b/chrome/browser/resources/extensions/item.html index e52cbce9..4dd4b1c 100644 --- a/chrome/browser/resources/extensions/item.html +++ b/chrome/browser/resources/extensions/item.html
@@ -91,7 +91,7 @@ } #name-and-version { - @apply --cr-primary-text; + color: var(--cr-primary-text-color); margin-bottom: 4px; }
diff --git a/chrome/browser/resources/extensions/keyboard_shortcuts.html b/chrome/browser/resources/extensions/keyboard_shortcuts.html index 540f2be4..399ccfb 100644 --- a/chrome/browser/resources/extensions/keyboard_shortcuts.html +++ b/chrome/browser/resources/extensions/keyboard_shortcuts.html
@@ -17,10 +17,10 @@ } .shortcut-card { - @apply --cr-primary-text; @apply --cr-card-elevation; background-color: var(--cr-card-background-color); border-radius: var(--cr-card-border-radius); + color: var(--cr-primary-text-color); margin: 0 auto 16px auto; padding-bottom: 8px; width: var(--cr-toolbar-field-width);
diff --git a/chrome/browser/resources/local_ntp/customize.js b/chrome/browser/resources/local_ntp/customize.js index 6fbf87d..00e4bc5 100644 --- a/chrome/browser/resources/local_ntp/customize.js +++ b/chrome/browser/resources/local_ntp/customize.js
@@ -933,6 +933,7 @@ return; } customize.selectedOptions.background = null; + customize.selectedOptions.backgroundId = null; customize.richerPicker_removeSelectedState(tile); customize.richerPicker_maybeToggleDone(); customize.richerPicker_unpreviewImage(); @@ -1419,8 +1420,11 @@ // Selecting a local image for the background should close the picker. if (configData.richerPicker) { - ntpApiHandle.onlocalbackgroundselected = - customize.richerPicker_applyCustomization; + ntpApiHandle.onlocalbackgroundselected = () => { + customize.richerPicker_deselectBackgroundTile( + customize.selectedOptions.background); + customize.richerPicker_applyCustomization(); + }; } // Edit gear icon interaction events.
diff --git a/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.html b/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.html index 3e432f90..52e133a 100644 --- a/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.html +++ b/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.html
@@ -229,9 +229,7 @@ </settings-checkbox> <settings-checkbox pref="{{prefs.browser.clear_data.site_settings}}" - label="[[siteSettingsLabel_( - '$i18nPolymer{siteSettings}', - '$i18nPolymer{contentSettings}')]]" + label="$i18nPolymer{siteSettings}" sub-label="[[counters_.site_settings]]" disabled="[[clearingInProgress_]]"> </settings-checkbox>
diff --git a/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.js b/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.js index fc53faa..d64aa86e 100644 --- a/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.js +++ b/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.js
@@ -294,19 +294,6 @@ return cookiesSummary; }, - - /** - * Choose a content/site settings label. - * @param {string} siteSettings - * @param {string} contentSettings - * @return {string} - * @private - */ - siteSettingsLabel_: function(siteSettings, contentSettings) { - return loadTimeData.getBoolean('enableSiteSettings') ? siteSettings : - contentSettings; - }, - /** * Updates the text of a browsing data counter corresponding to the given * preference.
diff --git a/chrome/browser/resources/settings/languages_page/manage_input_methods_page.js b/chrome/browser/resources/settings/languages_page/manage_input_methods_page.js index 015878b..b2b71758 100644 --- a/chrome/browser/resources/settings/languages_page/manage_input_methods_page.js +++ b/chrome/browser/resources/settings/languages_page/manage_input_methods_page.js
@@ -7,9 +7,6 @@ * and disabling input methods. Input methods are grouped by base languages to * avoid showing duplicate or ambiguous input methods. * - * @group Chrome Settings Elements - * @element settings-manage-input-methods-page - * * TODO(hsuregan): Move to OS settings. */ Polymer({
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chrome/browser/resources/settings/privacy_page/privacy_page.html index 5715752..ddf709f 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_page.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_page.html
@@ -156,7 +156,7 @@ </template> <cr-link-row id="site-settings-subpage-trigger" class="hr" - label="[[siteSettingsPageTitle_()]]" + label="$i18n{siteSettings}" sub-label="$i18n{siteSettingsDescription}" on-click="onSiteSettingsTap_"></cr-link-row> <cr-link-row id="clearBrowsingData"
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.js b/chrome/browser/resources/settings/privacy_page/privacy_page.js index 14bf4725..49ea7f9 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_page.js +++ b/chrome/browser/resources/settings/privacy_page/privacy_page.js
@@ -389,17 +389,6 @@ settings.navigateTo(settings.routes.SECURITY_KEYS); }, - /** - * The sub-page title for the site or content settings. - * @return {string} - * @private - */ - siteSettingsPageTitle_: function() { - return loadTimeData.getBoolean('enableSiteSettings') ? - loadTimeData.getString('siteSettings') : - loadTimeData.getString('contentSettings'); - }, - /** @private */ getProtectedContentLabel_: function(value) { return value ? this.i18n('siteSettingsProtectedContentEnable') :
diff --git a/chrome/browser/resources/settings/route.js b/chrome/browser/resources/settings/route.js index e065adc..799611c 100644 --- a/chrome/browser/resources/settings/route.js +++ b/chrome/browser/resources/settings/route.js
@@ -368,16 +368,9 @@ } } - if (loadTimeData.getBoolean('enableSiteSettings')) { - r.SITE_SETTINGS_ALL = r.SITE_SETTINGS.createChild('all'); - r.SITE_SETTINGS_SITE_DETAILS = - r.SITE_SETTINGS_ALL.createChild('/content/siteDetails'); - } else { - // When there is no "All Sites", pressing 'back' from "Site Details" - // should return to "Content Settings". - r.SITE_SETTINGS_SITE_DETAILS = - r.SITE_SETTINGS.createChild('/content/siteDetails'); - } + r.SITE_SETTINGS_ALL = r.SITE_SETTINGS.createChild('all'); + r.SITE_SETTINGS_SITE_DETAILS = + r.SITE_SETTINGS_ALL.createChild('/content/siteDetails'); r.SITE_SETTINGS_HANDLERS = r.SITE_SETTINGS.createChild('/handlers');
diff --git a/chrome/browser/resources/settings/site_settings/site_details.html b/chrome/browser/resources/settings/site_settings/site_details.html index d9e9115..5b373ff 100644 --- a/chrome/browser/resources/settings/site_settings/site_details.html +++ b/chrome/browser/resources/settings/site_settings/site_details.html
@@ -33,13 +33,6 @@ #storageText { display: flex; } - /* When 'Usage' is omitted, subheadings are removed. Reduce the start - * padding allowed for lists without headings and add back vertical space - * that would normally be provided by the subheading. */ - .list-frame.without-heading { - margin-top: 12px; - padding-inline-start: var(--cr-section-padding); - } #resetSettingsButton { margin-top: 24px; @@ -80,44 +73,42 @@ </div> </cr-dialog> - <template is="dom-if" if="[[enableSiteSettings_]]"> - <div id="usage"> - <div class="settings-box first line-only"> - <h2 class="first">$i18n{siteSettingsUsage}</h2> + <div id="usage"> + <div class="settings-box first line-only"> + <h2 class="first">$i18n{siteSettingsUsage}</h2> + </div> + <div class="list-frame"> + <div class="list-item" id="noStorage" + hidden$="[[hasUsage_(storedData_, numCookies_)]]"> + <div class="start">$i18n{siteSettingsUsageNone}</div> </div> - <div class="list-frame"> - <div class="list-item" id="noStorage" - hidden$="[[hasUsage_(storedData_, numCookies_)]]"> - <div class="start">$i18n{siteSettingsUsageNone}</div> - </div> - <div class="list-item" id="storage" - hidden$="[[!hasUsage_(storedData_, numCookies_)]]"> - <div class="start" id="storageText"> - <div hidden$="[[!storedData_]]">[[storedData_]]</div> - <div hidden$="[[!hasDataAndCookies_(storedData_, numCookies_)]]"> - · - </div> - <div hidden$="[[!numCookies_]]">[[numCookies_]]</div> + <div class="list-item" id="storage" + hidden$="[[!hasUsage_(storedData_, numCookies_)]]"> + <div class="start" id="storageText"> + <div hidden$="[[!storedData_]]">[[storedData_]]</div> + <div hidden$="[[!hasDataAndCookies_(storedData_, numCookies_)]]"> + · </div> - <cr-button id="clearStorage" role="button" aria-disabled="false" - on-click="onConfirmClearStorage_" - aria-label="$i18n{siteSettingsDelete}"> - $i18n{siteSettingsDelete} - </cr-button> + <div hidden$="[[!numCookies_]]">[[numCookies_]]</div> </div> + <cr-button id="clearStorage" role="button" aria-disabled="false" + on-click="onConfirmClearStorage_" + aria-label="$i18n{siteSettingsDelete}"> + $i18n{siteSettingsDelete} + </cr-button> </div> </div> + </div> - <div class="settings-box first"> - <h2 class="start">$i18n{siteSettingsPermissions}</h2> - <cr-button id="resetSettingsButton" class="header-aligned-button" - role="button" aria-disabled="false" - on-click="onConfirmClearSettings_"> - $i18n{siteSettingsReset} - </cr-button> - </div> - </template> - <div class$="list-frame [[permissionListClass_(enableSiteSettings_)]]"> + <div class="settings-box first"> + <h2 class="start">$i18n{siteSettingsPermissions}</h2> + <cr-button id="resetSettingsButton" class="header-aligned-button" + role="button" aria-disabled="false" + on-click="onConfirmClearSettings_"> + $i18n{siteSettingsReset} + </cr-button> + </div> + <div class="list-frame"> <site-details-permission category="{{ContentSettingsTypes.GEOLOCATION}}" icon="cr:location-on" id="geolocation" label="$i18n{siteSettingsLocation}"> @@ -218,14 +209,6 @@ </template> </div> - <template is="dom-if" if="[[!enableSiteSettings_]]"> - <cr-link-row - class="hr" - id="resetSettingsButton" - label="$i18n{siteSettingsReset}" - on-click="onConfirmClearSettings_"> - </cr-link-row> - </template> <website-usage-private-api id="usageApi" website-data-usage="{{storedData_}}" website-cookie-usage="{{numCookies_}}">
diff --git a/chrome/browser/resources/settings/site_settings/site_details.js b/chrome/browser/resources/settings/site_settings/site_details.js index 98b4cf5..da034ee5 100644 --- a/chrome/browser/resources/settings/site_settings/site_details.js +++ b/chrome/browser/resources/settings/site_settings/site_details.js
@@ -69,14 +69,6 @@ return loadTimeData.getBoolean('enableBluetoothScanningContentSetting'); } }, - - /** @private */ - enableSiteSettings_: { - type: Boolean, - value: function() { - return loadTimeData.getBoolean('enableSiteSettings'); - }, - }, }, listeners: { @@ -121,10 +113,7 @@ if (!valid) { settings.navigateToPreviousRoute(); } else { - if (this.enableSiteSettings_) { - this.$.usageApi.fetchUsageTotal(this.toUrl(this.origin_).hostname); - } - + this.$.usageApi.fetchUsageTotal(this.toUrl(this.origin_).hostname); this.updatePermissions_(this.getCategoryList()); } }); @@ -242,10 +231,7 @@ * @private */ onClearStorage_: function(e) { - // Since usage is only shown when "Site Settings" is enabled, don't - // clear it when it's not shown. - if (this.enableSiteSettings_ && - this.hasUsage_(this.storedData_, this.numCookies_)) { + if (this.hasUsage_(this.storedData_, this.numCookies_)) { this.$.usageApi.clearUsage(this.toUrl(this.origin_).href); } @@ -266,16 +252,6 @@ }, /** - * Checks whether the permission list is standalone or has a heading. - * @return {string} CSS class applied when the permission list has no - * heading. - * @private - */ - permissionListClass_: function(hasHeading) { - return hasHeading ? '' : 'without-heading'; - }, - - /** * Checks whether this site has any usage information to show. * @return {boolean} Whether there is any usage information to show (e.g. * disk or battery).
diff --git a/chrome/browser/resources/settings/site_settings/site_list_entry.js b/chrome/browser/resources/settings/site_settings/site_list_entry.js index d6d662e..fda7071a 100644 --- a/chrome/browser/resources/settings/site_settings/site_list_entry.js +++ b/chrome/browser/resources/settings/site_settings/site_list_entry.js
@@ -15,14 +15,6 @@ ], properties: { - /** @private */ - enableSiteSettings_: { - type: Boolean, - value: function() { - return loadTimeData.getBoolean('enableSiteSettings'); - }, - }, - /** * Some content types (like Location) do not allow the user to manually * edit the exception list from within Settings. @@ -209,7 +201,7 @@ return; } this.browserProxy.isOriginValid(this.model.origin).then((valid) => { - this.allowNavigateToSiteDetail_ = valid && this.enableSiteSettings_; + this.allowNavigateToSiteDetail_ = valid; }); } });
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page.html b/chrome/browser/resources/settings/site_settings_page/site_settings_page.html index 6351c14..f2b5e48 100644 --- a/chrome/browser/resources/settings/site_settings_page/site_settings_page.html +++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page.html
@@ -23,17 +23,15 @@ --cr-section-min-height: var(--cr-section-two-line-min-height); } </style> - <template is="dom-if" if="[[enableSiteSettings_]]"> - <div class="settings-box first line-only"> - <h2 class="first">$i18n{siteSettingsAllSites}</h2> - </div> - <cr-link-row data-route="SITE_SETTINGS_ALL" id="all-sites" - label="$i18n{siteSettingsAllSitesDescription}" - on-click="onTapNavigate_"></cr-link-row> - <div class="settings-box first line-only"> - <h2>$i18n{siteSettingsPermissions}</h2> - </div> - </template> + <div class="settings-box first line-only"> + <h2 class="first">$i18n{siteSettingsAllSites}</h2> + </div> + <cr-link-row data-route="SITE_SETTINGS_ALL" id="all-sites" + label="$i18n{siteSettingsAllSitesDescription}" + on-click="onTapNavigate_"></cr-link-row> + <div class="settings-box first line-only"> + <h2>$i18n{siteSettingsPermissions}</h2> + </div> <cr-link-row class="two-line" data-route="SITE_SETTINGS_COOKIES" id="cookies" label="$i18n{siteSettingsCookies}"
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page.js b/chrome/browser/resources/settings/site_settings_page/site_settings_page.js index 8eb6db6..85c0349 100644 --- a/chrome/browser/resources/settings/site_settings_page/site_settings_page.js +++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page.js
@@ -28,14 +28,6 @@ }, /** @private */ - enableSiteSettings_: { - type: Boolean, - value: function() { - return loadTimeData.getBoolean('enableSiteSettings'); - }, - }, - - /** @private */ isGuest_: { type: Boolean, value: function() {
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 4dbd6c1..4727e30 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
@@ -4,6 +4,7 @@ #include "chrome/browser/safe_browsing/download_protection/check_client_download_request.h" +#include <algorithm> #include <memory> #include "base/bind.h" @@ -24,8 +25,10 @@ #include "chrome/common/safe_browsing/archive_analyzer_results.h" #include "chrome/common/safe_browsing/download_type_util.h" #include "chrome/common/safe_browsing/file_type_policies.h" +#include "components/prefs/pref_service.h" #include "components/safe_browsing/common/utils.h" #include "components/safe_browsing/features.h" +#include "components/safe_browsing/proto/csd.pb.h" #include "components/safe_browsing/web_ui/safe_browsing_ui.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_task_traits.h" @@ -413,6 +416,26 @@ return; } + content::BrowserContext* browser_context = + content::DownloadItemUtils::GetBrowserContext(item_); + bool password_protected_allowed = true; + if (browser_context) { + Profile* profile = Profile::FromBrowserContext(browser_context); + password_protected_allowed = + profile->GetPrefs()->GetBoolean(prefs::kPasswordProtectedAllowed); + } + + if (!password_protected_allowed && + std::any_of(results.archived_binaries.begin(), + results.archived_binaries.end(), + [](const ClientDownloadRequest::ArchivedBinary& binary) { + return binary.is_encrypted(); + })) { + FinishRequest(DownloadCheckResult::BLOCKED_PASSWORD_PROTECTED, + REASON_BLOCKED_PASSWORD_PROTECTED); + return; + } + // The content checks cannot determine that we decided to sample this file, so // special case that DownloadType. if (type_ != ClientDownloadRequest::SAMPLED_UNSUPPORTED_FILE)
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 fe2a4ba6..93c1f184 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
@@ -431,6 +431,10 @@ update.Get()->AppendString(domain); } + void SetPasswordProtectedAllowedPref(bool value) { + profile()->GetPrefs()->SetBoolean(prefs::kPasswordProtectedAllowed, value); + } + // Helper function to simulate a user gesture, then a link click. // The usual NavigateAndCommit is unsuitable because it creates // browser-initiated navigations, causing us to drop the referrer. @@ -2723,4 +2727,48 @@ EXPECT_FALSE(HasClientDownloadRequest()); } +TEST_F(DownloadProtectionServiceTest, + PasswordProtectedArchivesBlockedByPreference) { + base::FilePath test_zip; + EXPECT_TRUE(base::PathService::Get(chrome::DIR_TEST_DATA, &test_zip)); + test_zip = test_zip.AppendASCII("safe_browsing") + .AppendASCII("download_protection") + .AppendASCII("encrypted.zip"); + + NiceMockDownloadItem item; + PrepareBasicDownloadItemWithFullPaths( + &item, {"http://www.evil.com/encrypted.zip"}, // url_chain + "http://www.google.com/", // referrer + test_zip, // tmp_path + temp_dir_.GetPath().Append( + FILE_PATH_LITERAL("encrypted.zip"))); // final_path + content::DownloadItemUtils::AttachInfo(&item, profile(), nullptr); + + { + SetPasswordProtectedAllowedPref(false); + + RunLoop run_loop; + download_service_->CheckClientDownload( + &item, base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, + base::Unretained(this), run_loop.QuitClosure())); + run_loop.Run(); + EXPECT_TRUE(IsResult(DownloadCheckResult::BLOCKED_PASSWORD_PROTECTED)); + EXPECT_FALSE(HasClientDownloadRequest()); + } + + { + SetPasswordProtectedAllowedPref(true); + PrepareResponse(ClientDownloadResponse::SAFE, net::HTTP_OK, net::OK); + + RunLoop run_loop; + download_service_->CheckClientDownload( + &item, base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, + base::Unretained(this), run_loop.QuitClosure())); + run_loop.Run(); + EXPECT_TRUE(IsResult(DownloadCheckResult::SAFE)); + EXPECT_TRUE(HasClientDownloadRequest()); + ClearClientDownloadRequest(); + } +} + } // namespace safe_browsing
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 4c01350..1167dbb7 100644 --- a/chrome/browser/safe_browsing/download_protection/download_protection_util.h +++ b/chrome/browser/safe_browsing/download_protection/download_protection_util.h
@@ -23,6 +23,7 @@ POTENTIALLY_UNWANTED, WHITELISTED_BY_POLICY, ASYNC_SCANNING, + BLOCKED_PASSWORD_PROTECTED, }; // Enum to keep track why a particular download verdict was chosen. @@ -57,6 +58,7 @@ REASON_SAMPLED_UNSUPPORTED_FILE = 26, REASON_VERDICT_UNKNOWN = 27, REASON_DOWNLOAD_DESTROYED = 28, + REASON_BLOCKED_PASSWORD_PROTECTED = 29, REASON_MAX // Always add new values before this one. };
diff --git a/chrome/browser/ui/ash/assistant/assistant_pref_util.cc b/chrome/browser/ui/ash/assistant/assistant_pref_util.cc index 38a64a2..49522b3 100644 --- a/chrome/browser/ui/ash/assistant/assistant_pref_util.cc +++ b/chrome/browser/ui/ash/assistant/assistant_pref_util.cc
@@ -12,31 +12,14 @@ namespace assistant { namespace prefs { -// A preference that indicates the user has accepted activity control. -const char kAssistantConsentStatus[] = - "settings.voice_interaction.activity_control.consent_status"; // A preference that indicates the Assistant has been disabled by domain policy. // If true, the Assistant will always been disabled and user cannot enable it. const char kAssistantDisabledByPolicy[] = "settings.assistant.disabled_by_policy"; void RegisterProfilePrefs(PrefRegistrySimple* registry) { - registry->RegisterIntegerPref( - kAssistantConsentStatus, - static_cast<int>(ash::mojom::ConsentStatus::kUnknown)); registry->RegisterBooleanPref(kAssistantDisabledByPolicy, false); } -ash::mojom::ConsentStatus GetConsentStatus(PrefService* pref_service) { - return static_cast<ash::mojom::ConsentStatus>( - pref_service->GetInteger(kAssistantConsentStatus)); -} - -void SetConsentStatus(PrefService* pref_service, - ash::mojom::ConsentStatus consent_status) { - pref_service->SetInteger(kAssistantConsentStatus, - static_cast<int>(consent_status)); -} - } // namespace prefs } // namespace assistant
diff --git a/chrome/browser/ui/ash/assistant/assistant_pref_util.h b/chrome/browser/ui/ash/assistant/assistant_pref_util.h index a95c67a..f54f0a1 100644 --- a/chrome/browser/ui/ash/assistant/assistant_pref_util.h +++ b/chrome/browser/ui/ash/assistant/assistant_pref_util.h
@@ -13,19 +13,11 @@ namespace assistant { namespace prefs { -extern const char kAssistantConsentStatus[]; extern const char kAssistantDisabledByPolicy[]; // Registers Assistant specific profile preferences. void RegisterProfilePrefs(PrefRegistrySimple* registry); -// Gets the user's consent status from the given preference service. -ash::mojom::ConsentStatus GetConsentStatus(PrefService* pref_service); - -// Sets the user's consent status in the given preference service. -void SetConsentStatus(PrefService* pref_service, - ash::mojom::ConsentStatus consent_status); - } // namespace prefs } // namespace assistant
diff --git a/chrome/browser/ui/ash/assistant/assistant_setup.cc b/chrome/browser/ui/ash/assistant/assistant_setup.cc index f62b704..0c38d539 100644 --- a/chrome/browser/ui/ash/assistant/assistant_setup.cc +++ b/chrome/browser/ui/ash/assistant/assistant_setup.cc
@@ -18,11 +18,11 @@ #include "chrome/browser/notifications/notification_display_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" -#include "chrome/browser/ui/ash/assistant/assistant_pref_util.h" #include "chrome/browser/ui/settings_window_manager_chromeos.h" #include "chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.h" #include "chrome/common/webui_url_constants.h" #include "chrome/grit/generated_resources.h" +#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" #include "chromeos/services/assistant/public/mojom/constants.mojom.h" #include "chromeos/services/assistant/public/proto/settings_ui.pb.h" #include "components/arc/arc_prefs.h" @@ -176,25 +176,28 @@ case ConsentFlowUi::ASK_FOR_CONSENT: if (consent_ui.has_activity_control_ui() && consent_ui.activity_control_ui().setting_zippy().size()) { - assistant::prefs::SetConsentStatus( - prefs, ash::mojom::ConsentStatus::kNotFound); + prefs->SetInteger(chromeos::assistant::prefs::kAssistantConsentStatus, + chromeos::assistant::prefs::ConsentStatus::kNotFound); } else { - assistant::prefs::SetConsentStatus( - prefs, ash::mojom::ConsentStatus::kActivityControlAccepted); + prefs->SetInteger(chromeos::assistant::prefs::kAssistantConsentStatus, + chromeos::assistant::prefs::ConsentStatus:: + kActivityControlAccepted); } break; case ConsentFlowUi::ERROR_ACCOUNT: - assistant::prefs::SetConsentStatus( - prefs, ash::mojom::ConsentStatus::kUnauthorized); + prefs->SetInteger( + chromeos::assistant::prefs::kAssistantConsentStatus, + chromeos::assistant::prefs::ConsentStatus::kUnauthorized); break; case ConsentFlowUi::ALREADY_CONSENTED: - assistant::prefs::SetConsentStatus( - prefs, ash::mojom::ConsentStatus::kActivityControlAccepted); + prefs->SetInteger( + chromeos::assistant::prefs::kAssistantConsentStatus, + chromeos::assistant::prefs::ConsentStatus::kActivityControlAccepted); break; case ConsentFlowUi::UNSPECIFIED: case ConsentFlowUi::ERROR: - assistant::prefs::SetConsentStatus(prefs, - ash::mojom::ConsentStatus::kUnknown); + prefs->SetInteger(chromeos::assistant::prefs::kAssistantConsentStatus, + chromeos::assistant::prefs::ConsentStatus::kUnknown); LOG(ERROR) << "Invalid activity control consent status."; } } @@ -203,7 +206,7 @@ auto* pref_service = ProfileManager::GetActiveUserProfile()->GetPrefs(); DCHECK(pref_service); if (!pref_service->GetUserPrefValue( - assistant::prefs::kAssistantConsentStatus)) { + chromeos::assistant::prefs::kAssistantConsentStatus)) { base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&AssistantSetup::StartAssistantOptInFlow,
diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h index 1f4d515b..dcec5b7 100644 --- a/chrome/browser/ui/browser_window.h +++ b/chrome/browser/ui/browser_window.h
@@ -331,15 +331,15 @@ // Shows the intent picker bubble. |app_info| contains the app candidates to // display, |enable_stay_in_chrome| allows to enable or disable 'Stay in - // Chrome' (used for non-http(s) queries), if |show_remember_selection| is - // false, the "remember my choice" checkbox is hidden, and |callback| helps to - // continue the flow back to either AppsNavigationThrottle or - // ArcExternalProtocolDialog capturing the user's decision and storing UMA - // metrics. + // Chrome' (used for non-http(s) queries), if |show_persistence_options| is + // false, the "remember my choice" checkbox is hidden, the "stay in chrome" + // button is hidden, and |callback| helps to continue the flow back to either + // AppsNavigationThrottle or ArcExternalProtocolDialog capturing the user's + // decision and storing UMA metrics. virtual void ShowIntentPickerBubble( std::vector<apps::IntentPickerAppInfo> app_info, bool enable_stay_in_chrome, - bool show_remember_selection, + bool show_persistence_options, IntentPickerResponse callback) = 0; // Shows the Bookmark bubble. |url| is the URL being bookmarked,
diff --git a/chrome/browser/ui/tabs/tab_strip_model.cc b/chrome/browser/ui/tabs/tab_strip_model.cc index 89f36fd..6171b76 100644 --- a/chrome/browser/ui/tabs/tab_strip_model.cc +++ b/chrome/browser/ui/tabs/tab_strip_model.cc
@@ -14,6 +14,8 @@ #include "base/macros.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" +#include "base/numerics/ranges.h" +#include "base/stl_util.h" #include "build/build_config.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" @@ -904,6 +906,17 @@ index = count(); } + // Prevent the tab from being inserted at an index that would make the group + // non-contiguous. Most commonly, the new-tab button always attempts to insert + // at the end of the tab strip. Extensions can insert at an arbitrary index, + // so we have to handle the general case. + if (group.has_value()) { + auto grouped_tabs = ListTabsInGroup(group.value()); + DCHECK(base::STLIsSorted(grouped_tabs)); + index = base::ClampToRange(index, grouped_tabs.front(), + grouped_tabs.back() + 1); + } + if (ui::PageTransitionTypeIncludingQualifiersIs(transition, ui::PAGE_TRANSITION_TYPED) && index == count()) {
diff --git a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc index 1219a037..08ecf36 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
@@ -1644,7 +1644,7 @@ strip.CloseAllTabs(); } -TEST_F(TabStripModelTest, AddWebContents_NewTabAtEndOfStripInheritsOpener) { +TEST_F(TabStripModelTest, NewTabAtEndOfStripInheritsOpener) { TestTabStripModelDelegate delegate; TabStripModel strip(&delegate, profile()); @@ -3312,3 +3312,56 @@ strip.CloseAllTabs(); } +TEST_F(TabStripModelTest, NewTabWithGroup) { + TestTabStripModelDelegate delegate; + TabStripModel strip(&delegate, profile()); + PrepareTabs(&strip, 3); + auto group = strip.AddToNewGroup({1}); + + strip.AddWebContents(CreateWebContentsWithID(3), 2, ui::PAGE_TRANSITION_TYPED, + TabStripModel::ADD_NONE, group); + EXPECT_EQ("0 1 3 2", GetTabStripStateString(strip)); + EXPECT_EQ(group, strip.GetTabGroupForTab(2)); + + strip.CloseAllTabs(); +} + +TEST_F(TabStripModelTest, NewTabWithoutIndexInsertsAtEndOfGroup) { + TestTabStripModelDelegate delegate; + TabStripModel strip(&delegate, profile()); + PrepareTabs(&strip, 3); + auto group = strip.AddToNewGroup({0, 1}); + + strip.AddWebContents(CreateWebContentsWithID(3), -1, + ui::PAGE_TRANSITION_TYPED, TabStripModel::ADD_NONE, + group); + EXPECT_EQ("0 1 3 2", GetTabStripStateString(strip)); + + strip.CloseAllTabs(); +} + +TEST_F(TabStripModelTest, DiscontinuousNewTabIndexTooHigh) { + TestTabStripModelDelegate delegate; + TabStripModel strip(&delegate, profile()); + PrepareTabs(&strip, 3); + auto group = strip.AddToNewGroup({0, 1}); + + strip.AddWebContents(CreateWebContentsWithID(3), 3, ui::PAGE_TRANSITION_TYPED, + TabStripModel::ADD_NONE, group); + EXPECT_EQ("0 1 3 2", GetTabStripStateString(strip)); + + strip.CloseAllTabs(); +} + +TEST_F(TabStripModelTest, DiscontinuousNewTabIndexTooLow) { + TestTabStripModelDelegate delegate; + TabStripModel strip(&delegate, profile()); + PrepareTabs(&strip, 3); + auto group = strip.AddToNewGroup({1, 2}); + + strip.AddWebContents(CreateWebContentsWithID(3), 0, ui::PAGE_TRANSITION_TYPED, + TabStripModel::ADD_NONE, group); + EXPECT_EQ("0 3 1 2", GetTabStripStateString(strip)); + + strip.CloseAllTabs(); +}
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 15a4c218..16c936a 100644 --- a/chrome/browser/ui/views/download/download_danger_prompt_views.cc +++ b/chrome/browser/ui/views/download/download_danger_prompt_views.cc
@@ -252,6 +252,7 @@ IDS_PROMPT_DOWNLOAD_CHANGES_SETTINGS, download_->GetFileNameToReportUser().LossyDisplayName()); } + case download::DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED: case download::DOWNLOAD_DANGER_TYPE_ASYNC_SCANNING: case download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: case download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT:
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc index 69f2f63b..5ee28b3 100644 --- a/chrome/browser/ui/views/download/download_item_view.cc +++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -956,6 +956,7 @@ return gfx::CreateVectorIcon(vector_icons::kWarningIcon, kWarningIconSize, gfx::kGoogleRed700); } + case download::DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED: case download::DOWNLOAD_DANGER_TYPE_ASYNC_SCANNING: case download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: case download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT:
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index b593e422..41e26f3 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -1324,10 +1324,10 @@ void BrowserView::ShowIntentPickerBubble( std::vector<IntentPickerBubbleView::AppInfo> app_info, bool enable_stay_in_chrome, - bool show_remember_selection, + bool show_persistence_options, IntentPickerResponse callback) { toolbar_->ShowIntentPickerBubble(std::move(app_info), enable_stay_in_chrome, - show_remember_selection, + show_persistence_options, std::move(callback)); }
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 2929b99..a7dc6e3 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -364,7 +364,7 @@ void ShowIntentPickerBubble( std::vector<IntentPickerBubbleView::AppInfo> app_info, bool enable_stay_in_chrome, - bool show_remember_selection, + bool show_persistence_options, IntentPickerResponse callback) override; void ShowBookmarkBubble(const GURL& url, bool already_bookmarked) override; autofill::SaveCardBubbleView* ShowSaveCreditCardBubble(
diff --git a/chrome/browser/ui/views/intent_picker_bubble_view.cc b/chrome/browser/ui/views/intent_picker_bubble_view.cc index eb4198b..d0aa8a9 100644 --- a/chrome/browser/ui/views/intent_picker_bubble_view.cc +++ b/chrome/browser/ui/views/intent_picker_bubble_view.cc
@@ -121,10 +121,10 @@ content::WebContents* web_contents, std::vector<AppInfo> app_info, bool enable_stay_in_chrome, - bool show_remember_selection, + bool show_persistence_options, IntentPickerResponse intent_picker_cb) { if (intent_picker_bubble_) { - intent_picker_bubble_->Initialize(show_remember_selection); + intent_picker_bubble_->Initialize(); views::Widget* widget = views::BubbleDialogDelegateView::CreateBubble(intent_picker_bubble_); widget->Show(); @@ -134,13 +134,13 @@ if (!browser || !BrowserView::GetBrowserViewForBrowser(browser)) { std::move(intent_picker_cb) .Run(kInvalidLaunchName, apps::mojom::AppType::kUnknown, - apps::IntentPickerCloseReason::PICKER_ERROR, false); + apps::IntentPickerCloseReason::ERROR_BEFORE_PICKER, false); return nullptr; } BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); intent_picker_bubble_ = new IntentPickerBubbleView( std::move(app_info), std::move(intent_picker_cb), web_contents, - enable_stay_in_chrome); + enable_stay_in_chrome, show_persistence_options); intent_picker_bubble_->set_margins(gfx::Insets()); if (anchor_view) { @@ -159,7 +159,7 @@ browser_view->GetTopContainerBoundsInScreen().height() - kTopContainerMerge)); } - intent_picker_bubble_->Initialize(show_remember_selection); + intent_picker_bubble_->Initialize(); views::Widget* widget = views::BubbleDialogDelegateView::CreateBubble(intent_picker_bubble_); intent_picker_bubble_->GetDialogClientView()->Layout(); @@ -185,13 +185,13 @@ std::unique_ptr<IntentPickerBubbleView> IntentPickerBubbleView::CreateBubbleView(std::vector<AppInfo> app_info, bool enable_stay_in_chrome, - bool show_remember_selection, + bool show_persistence_options, IntentPickerResponse intent_picker_cb, content::WebContents* web_contents) { std::unique_ptr<IntentPickerBubbleView> bubble(new IntentPickerBubbleView( std::move(app_info), std::move(intent_picker_cb), web_contents, - enable_stay_in_chrome)); - bubble->Initialize(show_remember_selection); + enable_stay_in_chrome, show_persistence_options)); + bubble->Initialize(); return bubble; } @@ -241,6 +241,12 @@ return true; } +int IntentPickerBubbleView::GetDialogButtons() const { + if (show_persistence_options_) + return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; + return ui::DIALOG_BUTTON_OK; +} + base::string16 IntentPickerBubbleView::GetWindowTitle() const { return l10n_util::GetStringUTF16(IDS_INTENT_PICKER_BUBBLE_VIEW_OPEN_WITH); } @@ -264,14 +270,16 @@ std::vector<AppInfo> app_info, IntentPickerResponse intent_picker_cb, content::WebContents* web_contents, - bool enable_stay_in_chrome) + bool enable_stay_in_chrome, + bool show_persistence_options) : LocationBarBubbleDelegateView(nullptr /* anchor_view */, gfx::Point(), web_contents), intent_picker_cb_(std::move(intent_picker_cb)), selected_app_tag_(0), app_info_(std::move(app_info)), - enable_stay_in_chrome_(enable_stay_in_chrome) { + enable_stay_in_chrome_(enable_stay_in_chrome), + show_persistence_options_(show_persistence_options) { chrome::RecordDialogCreation(chrome::DialogIdentifier::INTENT_PICKER); } @@ -325,7 +333,7 @@ View::OnKeyEvent(event); } -void IntentPickerBubbleView::Initialize(bool show_remember_selection) { +void IntentPickerBubbleView::Initialize() { views::GridLayout* layout = SetLayoutManager(std::make_unique<views::GridLayout>()); @@ -380,7 +388,8 @@ scroll_view_ = layout->AddView(std::move(scroll_view)); layout->StartRow(views::GridLayout::kFixedSize, kColumnSetId, 0); - if (show_remember_selection) { + // Add Show remember selection checkbox if there are apps besides pwas present + if (show_persistence_options_) { layout->AddView(CreateHorizontalSeparator()); // This second ColumnSet has a padding column in order to manipulate the
diff --git a/chrome/browser/ui/views/intent_picker_bubble_view.h b/chrome/browser/ui/views/intent_picker_bubble_view.h index aed5a2f2..6aae126 100644 --- a/chrome/browser/ui/views/intent_picker_bubble_view.h +++ b/chrome/browser/ui/views/intent_picker_bubble_view.h
@@ -65,12 +65,12 @@ content::WebContents* web_contents, std::vector<AppInfo> app_info, bool enable_stay_in_chrome, - bool show_remember_selection, + bool show_persistence_options, IntentPickerResponse intent_picker_cb); static std::unique_ptr<IntentPickerBubbleView> CreateBubbleView( std::vector<AppInfo> app_info, bool enable_stay_in_chrome, - bool show_remember_selection, + bool show_persistence_options, IntentPickerResponse intent_picker_cb, content::WebContents* web_contents); static IntentPickerBubbleView* intent_picker_bubble() { @@ -85,6 +85,7 @@ bool Cancel() override; bool Close() override; bool ShouldShowCloseButton() const override; + int GetDialogButtons() const override; protected: // LocationBarBubbleDelegateView overrides: @@ -107,7 +108,8 @@ IntentPickerBubbleView(std::vector<AppInfo> app_info, IntentPickerResponse intent_picker_cb, content::WebContents* web_contents, - bool enable_stay_in_chrome); + bool enable_stay_in_chrome, + bool show_persistence_options); // views::BubbleDialogDelegateView overrides: void OnWidgetDestroying(views::Widget* widget) override; @@ -122,7 +124,7 @@ // ui::EventHandler overrides: void OnKeyEvent(ui::KeyEvent* event) override; - void Initialize(bool show_remember_selection); + void Initialize(); // Retrieves the IntentPickerLabelButton* contained at position |index| from // the internal ScrollView. @@ -175,6 +177,10 @@ // Tells whether or not 'Stay in Chrome' should be enabled as an option. const bool enable_stay_in_chrome_; + // Whether 'Remember selection' checkbox and "Stay in chrome" button should be + // shown or hidden. + const bool show_persistence_options_; + DISALLOW_COPY_AND_ASSIGN(IntentPickerBubbleView); };
diff --git a/chrome/browser/ui/views/intent_picker_bubble_view_unittest.cc b/chrome/browser/ui/views/intent_picker_bubble_view_unittest.cc index acaee9b..9389e367 100644 --- a/chrome/browser/ui/views/intent_picker_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/intent_picker_bubble_view_unittest.cc
@@ -74,7 +74,7 @@ bubble_ = IntentPickerBubbleView::CreateBubbleView( std::move(app_info), enable_stay_in_chrome, - /*show_remember_selection=*/true, + /*show_persistence_options=*/true, base::Bind(&IntentPickerBubbleViewTest::OnBubbleClosed, base::Unretained(this)), web_contents);
diff --git a/chrome/browser/ui/views/page_info/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info/page_info_bubble_view.cc index 2b43fc0..4dd4af4 100644 --- a/chrome/browser/ui/views/page_info/page_info_bubble_view.cc +++ b/chrome/browser/ui/views/page_info/page_info_bubble_view.cc
@@ -87,6 +87,7 @@ using bubble_anchor_util::GetPageInfoAnchorConfiguration; using bubble_anchor_util::GetPageInfoAnchorRect; using password_manager::metrics_util::PasswordType; +using safety_tips::SafetyTipType; namespace { @@ -114,7 +115,7 @@ std::unique_ptr<views::View> CreateSiteSettingsLink( const int side_margin, - PageInfoBubbleView* listener) { + views::ButtonListener* listener) { const base::string16& tooltip = l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_SETTINGS_TOOLTIP); return std::make_unique<PageInfoHoverButton>( @@ -124,6 +125,43 @@ tooltip, base::string16()); } +// Navigate to the given URL, replacing the current page in the process. +void ReplaceURL(content::WebContents* web_contents, const GURL& url) { + content::OpenURLParams params(url, content::Referrer(), + WindowOpenDisposition::CURRENT_TAB, + ui::PAGE_TRANSITION_LINK, false); + params.should_replace_current_entry = true; + web_contents->OpenURL(params); +} + +int GetSafetyTipTitleId(SafetyTipType warning_type) { + switch (warning_type) { + case SafetyTipType::kBadReputation: + return IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE; + // These don't have strings yet, so they're just an error: + case SafetyTipType::kUncommonDomain: + case SafetyTipType::kLookalikeUrl: + case SafetyTipType::kNone: + NOTREACHED(); + } + NOTREACHED(); + return 0; +} + +int GetSafetyTipDescriptionId(SafetyTipType warning_type) { + switch (warning_type) { + case SafetyTipType::kBadReputation: + return IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_DESCRIPTION; + // These don't have strings yet, so they're just an error: + case SafetyTipType::kUncommonDomain: + case SafetyTipType::kLookalikeUrl: + case SafetyTipType::kNone: + NOTREACHED(); + } + NOTREACHED(); + return 0; +} + } // namespace // |BubbleHeaderView| is the UI element (view) that represents the header of the @@ -196,6 +234,31 @@ DISALLOW_COPY_AND_ASSIGN(InternalPageInfoBubbleView); }; +// When Chrome displays a safety tip, we create a stripped-down bubble view +// without all of the details. Safety tip info is still displayed in the usual +// PageInfoBubbleView, just less prominently. +class SafetyTipPageInfoBubbleView : public PageInfoBubbleViewBase, + public views::ButtonListener { + public: + // If |anchor_view| is nullptr, or has no Widget, |parent_window| may be + // provided to ensure this bubble is closed when the parent closes. + SafetyTipPageInfoBubbleView(views::View* anchor_view, + const gfx::Rect& anchor_rect, + gfx::NativeView parent_window, + content::WebContents* web_contents, + SafetyTipType type, + const GURL& url, + const GURL& safe_url); + ~SafetyTipPageInfoBubbleView() override; + + // views::ButtonListener: + void ButtonPressed(views::Button* button, const ui::Event& event) override; + + private: + const GURL safe_url_; + DISALLOW_COPY_AND_ASSIGN(SafetyTipPageInfoBubbleView); +}; + //////////////////////////////////////////////////////////////////////////////// // Bubble Header //////////////////////////////////////////////////////////////////////////////// @@ -401,6 +464,107 @@ InternalPageInfoBubbleView::~InternalPageInfoBubbleView() {} //////////////////////////////////////////////////////////////////////////////// +// SafetyTipPageInfoBubbleView +//////////////////////////////////////////////////////////////////////////////// + +SafetyTipPageInfoBubbleView::SafetyTipPageInfoBubbleView( + views::View* anchor_view, + const gfx::Rect& anchor_rect, + gfx::NativeView parent_window, + content::WebContents* web_contents, + SafetyTipType type, + const GURL& url, + const GURL& safe_url) + : PageInfoBubbleViewBase(anchor_view, + anchor_rect, + parent_window, + PageInfoBubbleViewBase::BUBBLE_SAFETY_TIP, + web_contents), + safe_url_(safe_url) { + // Keep the bubble open until explicitly closed (or we navigate away, a tab is + // created over it, etc). + set_close_on_deactivate(false); + + size_t offset; + const base::string16 safety_tip_name = + l10n_util::GetStringUTF16(IDS_PAGE_INFO_SAFETY_TIP_NAME); + const base::string16 title_text = l10n_util::GetStringFUTF16( + GetSafetyTipTitleId(type), safety_tip_name, &offset); + set_window_title(title_text); + + views::BubbleDialogDelegateView::CreateBubble(this); + + // Replace the original title view with our formatted title. + views::Label* original_title = + static_cast<views::Label*>(GetBubbleFrameView()->title()); + views::StyledLabel::RangeStyleInfo name_style; + const auto kSizeDeltaInPixels = 3; + name_style.custom_font = original_title->GetDefaultFontList().Derive( + kSizeDeltaInPixels, gfx::Font::FontStyle::NORMAL, + gfx::Font::Weight::BOLD); + views::StyledLabel::RangeStyleInfo base_style; + base_style.custom_font = original_title->GetDefaultFontList().Derive( + kSizeDeltaInPixels, gfx::Font::FontStyle::NORMAL, + gfx::Font::Weight::NORMAL); + + auto new_title = std::make_unique<views::StyledLabel>(title_text, nullptr); + new_title->AddStyleRange( + gfx::Range(offset, offset + safety_tip_name.length()), name_style); + new_title->AddStyleRange(gfx::Range(0, title_text.length()), base_style); + GetBubbleFrameView()->SetTitleView(std::move(new_title)); + + ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get(); + + // Configure layout. + views::GridLayout* layout = + SetLayoutManager(std::make_unique<views::GridLayout>()); + constexpr int kColumnId = 0; + views::ColumnSet* label_col_set = layout->AddColumnSet(kColumnId); + label_col_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, + 1.0, views::GridLayout::USE_PREF, 0, 0); + + // Add text description. + layout->StartRow(views::GridLayout::kFixedSize, kColumnId); + auto text_label = std::make_unique<views::Label>( + l10n_util::GetStringUTF16(GetSafetyTipDescriptionId(type))); + text_label->SetMultiLine(true); + text_label->SetLineHeight(20); + text_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); + text_label->SizeToFit( + layout_provider->GetDistanceMetric(DISTANCE_BUBBLE_PREFERRED_WIDTH)); + layout->AddView(std::move(text_label)); + + // Add leave site button. + const int hover_list_spacing = layout_provider->GetDistanceMetric( + DISTANCE_RELATED_CONTROL_VERTICAL_SMALL); + layout->StartRowWithPadding(views::GridLayout::kFixedSize, kColumnId, + views::GridLayout::kFixedSize, + hover_list_spacing); + std::unique_ptr<views::Button> button( + views::MdTextButton::CreateSecondaryUiBlueButton( + this, + l10n_util::GetStringUTF16(IDS_PAGE_INFO_SAFETY_TIP_LEAVE_BUTTON))); + button->SetID(PageInfoBubbleView::VIEW_ID_PAGE_INFO_BUTTON_LEAVE_SITE); + layout->AddView(std::move(button), 1, 1, views::GridLayout::TRAILING, + views::GridLayout::LEADING); + + Layout(); + SizeToContents(); +} + +SafetyTipPageInfoBubbleView::~SafetyTipPageInfoBubbleView() {} + +void SafetyTipPageInfoBubbleView::ButtonPressed(views::Button* button, + const ui::Event& event) { + switch (button->GetID()) { + case PageInfoBubbleView::VIEW_ID_PAGE_INFO_BUTTON_LEAVE_SITE: + ReplaceURL(web_contents(), safe_url_); + break; + } + NOTREACHED(); +} + +//////////////////////////////////////////////////////////////////////////////// // PageInfoBubbleView //////////////////////////////////////////////////////////////////////////////// @@ -1029,3 +1193,39 @@ bubble->SetArrow(configuration.bubble_arrow); bubble->GetWidget()->Show(); } + +namespace safety_tips { + +void ShowSafetyTipDialog(Browser* browser, + content::WebContents* web_contents, + SafetyTipType type, + const GURL& virtual_url, + const GURL& safe_url) { + AnchorConfiguration configuration = + GetPageInfoAnchorConfiguration(browser, bubble_anchor_util::kLocationBar); + gfx::Rect anchor_rect = + configuration.anchor_view ? gfx::Rect() : GetPageInfoAnchorRect(browser); + gfx::NativeWindow parent_window = browser->window()->GetNativeWindow(); + gfx::NativeView parent_view = platform_util::GetViewForWindow(parent_window); + + views::BubbleDialogDelegateView* bubble = new SafetyTipPageInfoBubbleView( + configuration.anchor_view, anchor_rect, parent_view, web_contents, type, + virtual_url, safe_url); + + bubble->SetHighlightedButton(configuration.highlighted_button); + bubble->SetArrow(configuration.bubble_arrow); + bubble->GetWidget()->Show(); +} + +} // namespace safety_tips + +PageInfoBubbleViewBase* CreateSafetyTipBubbleForTesting( + gfx::NativeView parent_view, + content::WebContents* web_contents, + safety_tips::SafetyTipType type, + const GURL& virtual_url, + const GURL& safe_url) { + return new SafetyTipPageInfoBubbleView(nullptr, gfx::Rect(), parent_view, + web_contents, type, virtual_url, + safe_url); +}
diff --git a/chrome/browser/ui/views/page_info/page_info_bubble_view.h b/chrome/browser/ui/views/page_info/page_info_bubble_view.h index 1b90a9e3..b49f20c 100644 --- a/chrome/browser/ui/views/page_info/page_info_bubble_view.h +++ b/chrome/browser/ui/views/page_info/page_info_bubble_view.h
@@ -12,6 +12,7 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" +#include "chrome/browser/lookalikes/safety_tips/safety_tip_ui.h" #include "chrome/browser/ui/page_info/page_info_dialog.h" #include "chrome/browser/ui/page_info/page_info_ui.h" #include "chrome/browser/ui/views/bubble_anchor_util_views.h" @@ -84,6 +85,7 @@ VIEW_ID_PAGE_INFO_LINK_OR_BUTTON_CERTIFICATE_VIEWER, VIEW_ID_PAGE_INFO_BUTTON_END_VR, VIEW_ID_PAGE_INFO_HOVER_BUTTON_VR_PRESENTATION, + VIEW_ID_PAGE_INFO_BUTTON_LEAVE_SITE, }; // Creates the appropriate page info bubble for the given |url|. @@ -210,4 +212,12 @@ DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleView); }; +// Creates and returns a safety tip bubble. Used in unit tests. +PageInfoBubbleViewBase* CreateSafetyTipBubbleForTesting( + gfx::NativeView parent_view, + content::WebContents* web_contents, + safety_tips::SafetyTipType type, + const GURL& virtual_url, + const GURL& safe_url); + #endif // CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_BUBBLE_VIEW_H_
diff --git a/chrome/browser/ui/views/page_info/page_info_bubble_view_base.h b/chrome/browser/ui/views/page_info/page_info_bubble_view_base.h index 3478010..52d6e98 100644 --- a/chrome/browser/ui/views/page_info/page_info_bubble_view_base.h +++ b/chrome/browser/ui/views/page_info/page_info_bubble_view_base.h
@@ -32,7 +32,9 @@ // Usual page info bubble for websites. BUBBLE_PAGE_INFO, // Custom bubble for internal pages like chrome:// and chrome-extensions://. - BUBBLE_INTERNAL_PAGE + BUBBLE_INTERNAL_PAGE, + // Custom bubble for displaying safety tips. + BUBBLE_SAFETY_TIP }; // Returns the type of the bubble being shown. For testing only.
diff --git a/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc b/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc index e79ce0f..8c84372 100644 --- a/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc
@@ -10,6 +10,7 @@ #include "build/build_config.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/history/history_service_factory.h" +#include "chrome/browser/lookalikes/safety_tips/safety_tip_ui.h" #include "chrome/browser/permissions/permission_uma_util.h" #include "chrome/browser/ssl/security_state_tab_helper.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" @@ -209,6 +210,41 @@ DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleViewTest); }; +class SafetyTipPageInfoBubbleViewTest : public testing::Test { + public: + SafetyTipPageInfoBubbleViewTest() {} + + // testing::Test: + void SetUp() override { + views_helper_.test_views_delegate()->set_layout_provider( + ChromeLayoutProvider::CreateLayoutProvider()); + views::Widget::InitParams parent_params; + parent_params.context = views_helper_.GetContext(); + parent_window_ = new views::Widget(); + parent_window_->Init(parent_params); + + content::WebContents* web_contents = web_contents_helper_.web_contents(); + TabSpecificContentSettings::CreateForWebContents(web_contents); + + bubble_ = CreateSafetyTipBubbleForTesting( + parent_window_->GetNativeView(), web_contents, + safety_tips::SafetyTipType::kBadReputation, + GURL("https://www.fakegoogle.tld"), GURL("https://www.google.com")); + } + + void TearDown() override { parent_window_->CloseNow(); } + + protected: + ScopedWebContentsTestHelper web_contents_helper_; + views::ScopedViewsTestHelper views_helper_; + + PageInfoBubbleViewBase* bubble_ = nullptr; + views::Widget* parent_window_ = nullptr; // Weak. Owned by the NativeWidget. + + private: + DISALLOW_COPY_AND_ASSIGN(SafetyTipPageInfoBubbleViewTest); +}; + #if BUILDFLAG(ENABLE_PLUGINS) // Waits until a change is observed in content settings. class FlashContentSettingsChangeWaiter : public content_settings::Observer { @@ -708,3 +744,7 @@ EXPECT_EQ(views::Widget::ClosedReason::kCloseButtonClicked, api_->closed_reason()); } + +TEST_F(SafetyTipPageInfoBubbleViewTest, OpenAndClose) { + // This test just opens and closes the bubble. +}
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc index c9f9184..53845f7 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -402,7 +402,7 @@ void ToolbarView::ShowIntentPickerBubble( std::vector<IntentPickerBubbleView::AppInfo> app_info, bool enable_stay_in_chrome, - bool show_remember_selection, + bool show_persistence_options, IntentPickerResponse callback) { PageActionIconView* intent_picker_view = location_bar() @@ -413,7 +413,7 @@ IntentPickerTabHelper::SetShouldShowIcon(GetWebContents(), true); IntentPickerBubbleView::ShowBubble( intent_picker_view, GetWebContents(), std::move(app_info), - enable_stay_in_chrome, show_remember_selection, std::move(callback)); + enable_stay_in_chrome, show_persistence_options, std::move(callback)); } }
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.h b/chrome/browser/ui/views/toolbar/toolbar_view.h index 787a07d..ed67a74 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_view.h +++ b/chrome/browser/ui/views/toolbar/toolbar_view.h
@@ -118,7 +118,7 @@ void ShowIntentPickerBubble( std::vector<IntentPickerBubbleView::AppInfo> app_info, bool enable_stay_in_chrome, - bool show_remember_selection, + bool show_persistence_options, IntentPickerResponse callback); // Shows a bookmark bubble and anchors it appropriately.
diff --git a/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.cc b/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.cc index de99715..f296b04 100644 --- a/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.cc +++ b/chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.cc
@@ -20,6 +20,7 @@ #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" #include "chrome/common/url_constants.h" #include "chrome/grit/browser_resources.h" +#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" #include "components/arc/arc_prefs.h" #include "components/prefs/pref_service.h" #include "content/public/browser/host_zoom_map.h" @@ -166,8 +167,8 @@ PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); const bool completed = prefs->GetBoolean(arc::prefs::kVoiceInteractionEnabled) && - (::assistant::prefs::GetConsentStatus(prefs) == - ash::mojom::ConsentStatus::kActivityControlAccepted); + (prefs->GetInteger(assistant::prefs::kAssistantConsentStatus) == + assistant::prefs::ConsentStatus::kActivityControlAccepted); std::move(callback_).Run(completed); SystemWebDialogDelegate::OnDialogClosed(json_retval); }
diff --git a/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc index 0d7a779..f34a16c 100644 --- a/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/assistant_optin_flow_screen_handler.cc
@@ -18,6 +18,7 @@ #include "chrome/browser/ui/ash/assistant/assistant_pref_util.h" #include "chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_utils.h" #include "chrome/grit/generated_resources.h" +#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" #include "chromeos/services/assistant/public/features.h" #include "chromeos/services/assistant/public/mojom/constants.mojom.h" #include "chromeos/services/assistant/public/proto/settings_ui.pb.h" @@ -241,8 +242,8 @@ weak_factory_.GetWeakPtr())); } else { RecordAssistantOptInStatus(ACTIVITY_CONTROL_SKIPPED); - ::assistant::prefs::SetConsentStatus(profile->GetPrefs(), - ash::mojom::ConsentStatus::kUnknown); + profile->GetPrefs()->SetInteger(assistant::prefs::kAssistantConsentStatus, + assistant::prefs::ConsentStatus::kUnknown); HandleFlowFinished(); } } @@ -375,9 +376,10 @@ settings_ui.consent_flow_ui().consent_status() == assistant::ConsentFlowUi_ConsentStatus_ASK_FOR_CONSENT; - ::assistant::prefs::SetConsentStatus( - prefs, consented ? ash::mojom::ConsentStatus::kActivityControlAccepted - : ash::mojom::ConsentStatus::kUnknown); + prefs->SetInteger( + assistant::prefs::kAssistantConsentStatus, + consented ? assistant::prefs::ConsentStatus::kActivityControlAccepted + : assistant::prefs::ConsentStatus::kUnknown); } else { AddSettingZippy("settings", CreateZippyData(activity_control_ui.setting_zippy())); @@ -453,8 +455,9 @@ } else if (activity_control_needed_) { activity_control_needed_ = false; PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); - ::assistant::prefs::SetConsentStatus( - prefs, ash::mojom::ConsentStatus::kActivityControlAccepted); + prefs->SetInteger( + assistant::prefs::kAssistantConsentStatus, + assistant::prefs::ConsentStatus::kActivityControlAccepted); } } @@ -554,12 +557,13 @@ void AssistantOptInFlowScreenHandler::HandleFlowFinished() { auto* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); - if (!prefs->GetUserPrefValue(::assistant::prefs::kAssistantConsentStatus)) { + if (!prefs->GetUserPrefValue(assistant::prefs::kAssistantConsentStatus)) { // Set consent status to unknown if user consent is needed but not provided. - ::assistant::prefs::SetConsentStatus( - prefs, activity_control_needed_ - ? ash::mojom::ConsentStatus::kUnknown - : ash::mojom::ConsentStatus::kActivityControlAccepted); + prefs->SetInteger( + assistant::prefs::kAssistantConsentStatus, + activity_control_needed_ + ? assistant::prefs::ConsentStatus::kUnknown + : assistant::prefs::ConsentStatus::kActivityControlAccepted); } UMA_HISTOGRAM_EXACT_LINEAR("Assistant.OptInFlow.LoadingTimeoutCount",
diff --git a/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc b/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc index 4748aee5..8b51693 100644 --- a/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc +++ b/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc
@@ -61,6 +61,8 @@ return "POTENTIALLY_UNWANTED"; case download::DOWNLOAD_DANGER_TYPE_ASYNC_SCANNING: return "ASYNC_SCANNING"; + case download::DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED: + return "BLOCKED_PASSWORD_PROTECTED"; case download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: case download::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT: case download::DOWNLOAD_DANGER_TYPE_USER_VALIDATED:
diff --git a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc index c04a9bc..3a2b3bc5b 100644 --- a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc +++ b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
@@ -73,7 +73,7 @@ crostini::CrostiniManager::GetForProfile(profile_) ->AddInstallerViewStatusObserver(this); if (chromeos::CrosUsbDetector::Get()) { - chromeos::CrosUsbDetector::Get()->AddSharedUsbDeviceObserver(this); + chromeos::CrosUsbDetector::Get()->AddUsbDeviceObserver(this); } } @@ -84,7 +84,7 @@ ->RemoveInstallerViewStatusObserver(this); } if (chromeos::CrosUsbDetector::Get()) { - chromeos::CrosUsbDetector::Get()->RemoveSharedUsbDeviceObserver(this); + chromeos::CrosUsbDetector::Get()->RemoveUsbDeviceObserver(this); } } @@ -141,7 +141,7 @@ namespace { base::ListValue UsbDevicesToListValue( - const std::vector<SharedUsbDeviceInfo> shared_usbs) { + const std::vector<CrosUsbDeviceInfo> shared_usbs) { base::ListValue usb_devices_list; for (auto device : shared_usbs) { base::Value device_info(base::Value::Type::DICTIONARY); @@ -171,7 +171,7 @@ ResolveJavascriptCallback( base::Value(callback_id), - UsbDevicesToListValue(detector->GetSharedUsbDevices())); + UsbDevicesToListValue(detector->GetDevicesSharableWithCrostini())); } void CrostiniHandler::HandleSetCrostiniUsbDeviceShared( @@ -194,10 +194,12 @@ base::DoNothing()); } -void CrostiniHandler::OnSharedUsbDevicesChanged( - const std::vector<SharedUsbDeviceInfo> shared_usbs) { - FireWebUIListener("crostini-shared-usb-devices-changed", - UsbDevicesToListValue(shared_usbs)); +void CrostiniHandler::OnUsbDevicesChanged() { + chromeos::CrosUsbDetector* detector = chromeos::CrosUsbDetector::Get(); + DCHECK(detector); // This callback is called by the detector. + FireWebUIListener( + "crostini-shared-usb-devices-changed", + UsbDevicesToListValue(detector->GetDevicesSharableWithCrostini())); } void CrostiniHandler::HandleExportCrostiniContainer(
diff --git a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h index cda03463..97f4605 100644 --- a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h +++ b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.h
@@ -23,7 +23,7 @@ class CrostiniHandler : public ::settings::SettingsPageUIHandler, public crostini::InstallerViewStatusObserver, - public chromeos::SharedUsbDeviceObserver { + public chromeos::CrosUsbDeviceObserver { public: explicit CrostiniHandler(Profile* profile); ~CrostiniHandler() override; @@ -47,8 +47,7 @@ // Set the share state of a USB device. void HandleSetCrostiniUsbDeviceShared(const base::ListValue* args); // chromeos::SharedUsbDeviceObserver. - void OnSharedUsbDevicesChanged( - const std::vector<SharedUsbDeviceInfo> shared_usbs) override; + void OnUsbDevicesChanged() override; // Export the crostini container. void HandleExportCrostiniContainer(const base::ListValue* args); // Import the crostini container.
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 24951498..8bc6437 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -2899,8 +2899,6 @@ AddLocalizedStringsBulk(html_source, kSensorsLocalizedStrings, base::size(kSensorsLocalizedStrings)); - html_source->AddBoolean("enableSiteSettings", base::FeatureList::IsEnabled( - features::kSiteSettings)); html_source->AddBoolean( "enableSafeBrowsingSubresourceFilter", base::FeatureList::IsEnabled(
diff --git a/chrome/browser/vr/test/multi_class_browser_test.h b/chrome/browser/vr/test/multi_class_browser_test.h index 9d4ea83a..8aeb9c6 100644 --- a/chrome/browser/vr/test/multi_class_browser_test.h +++ b/chrome/browser/vr/test/multi_class_browser_test.h
@@ -55,6 +55,13 @@ MULTI_CLASS_RUNNER_NAME_(test_name)::ActuallyRunTestOnMainThread(this); \ } +#define DEFINE_INCOGNITO_BROWSER_TEST_(test_class, test_name) \ + IN_PROC_BROWSER_TEST_F(test_class, test_name##Incognito) { \ + auto* browser = CreateIncognitoBrowser(); \ + SetBrowser(browser); \ + MULTI_CLASS_RUNNER_NAME_(test_name)::ActuallyRunTestOnMainThread(this); \ + } + #define IN_PROC_MULTI_CLASS_BROWSER_TEST_F2(test_class1, test_class2, \ base_class, test_name) \ DEFINE_RUN_TEST_IMPL_(test_name, base_class) \ @@ -63,6 +70,16 @@ void MULTI_CLASS_RUNNER_NAME_(test_name)::ActuallyRunTestOnMainThread( \ base_class* t) +#define IN_PROC_MULTI_CLASS_PLUS_INCOGNITO_BROWSER_TEST_F2( \ + test_class1, test_class2, base_class, test_name) \ + DEFINE_RUN_TEST_IMPL_(test_name, base_class) \ + DEFINE_BROWSER_TEST_(test_class1, test_name) \ + DEFINE_BROWSER_TEST_(test_class2, test_name) \ + DEFINE_INCOGNITO_BROWSER_TEST_(test_class1, test_name) \ + DEFINE_INCOGNITO_BROWSER_TEST_(test_class2, test_name) \ + void MULTI_CLASS_RUNNER_NAME_(test_name)::ActuallyRunTestOnMainThread( \ + base_class* t) + // Helper macro to cut down on duplicate code since most uses of // IN_PROC_MULTI_CLASS_BROWSER_TEST_F2 are passed the same OpenVR and WMR // classes and the same base class @@ -71,4 +88,11 @@ WebXrVrWmrBrowserTest, \ WebXrVrBrowserTestBase, test_name) +// The same as WEBXR_VR_ALL_RUNTIMES_BROWSER_TEST_F, but runs the tests in +// incognito mode as well. +#define WEBXR_VR_ALL_RUNTIMES_PLUS_INCOGNITO_BROWSER_TEST_F(test_name) \ + IN_PROC_MULTI_CLASS_PLUS_INCOGNITO_BROWSER_TEST_F2( \ + WebXrVrOpenVrBrowserTest, WebXrVrWmrBrowserTest, WebXrVrBrowserTestBase, \ + test_name) + #endif // CHROME_BROWSER_VR_TEST_MULTI_CLASS_BROWSER_TEST_H_
diff --git a/chrome/browser/vr/test/xr_browser_test.h b/chrome/browser/vr/test/xr_browser_test.h index 0d3c9aec..5b4b89b 100644 --- a/chrome/browser/vr/test/xr_browser_test.h +++ b/chrome/browser/vr/test/xr_browser_test.h
@@ -164,7 +164,15 @@ // JavaScript errors were encountered. void AssertNoJavaScriptErrors(content::WebContents* web_contents); - Browser* browser() { return InProcessBrowserTest::browser(); } + Browser* browser() { + return browser_ == nullptr ? InProcessBrowserTest::browser() : browser_; + } + + void SetBrowser(Browser* browser) { browser_ = browser; } + + Browser* CreateIncognitoBrowser(Profile* profile = nullptr) { + return InProcessBrowserTest::CreateIncognitoBrowser(profile); + } // Convenience function for running RunJavaScriptOrFail with the return value // of GetCurrentWebContents. @@ -222,6 +230,7 @@ private: void LogJavaScriptFailure(); + Browser* browser_ = nullptr; std::unique_ptr<net::EmbeddedTestServer> server_; base::test::ScopedFeatureList scoped_feature_list_; bool test_skipped_at_startup_ = false;
diff --git a/chrome/browser/vr/test/xr_browser_tests.md b/chrome/browser/vr/test/xr_browser_tests.md index dd10d21..70ffdc6 100644 --- a/chrome/browser/vr/test/xr_browser_tests.md +++ b/chrome/browser/vr/test/xr_browser_tests.md
@@ -98,6 +98,10 @@ `WEBXR_VR_ALL_RUNTIMES_BROWSER_TEST_F` macro, which only needs to take the test name, further cutting down on boilerplate code. +You can also use `WEBXR_VR_ALL_RUNTIMES_PLUS_INCOGNITO_BROWSER_TEST_F` if you +want the same functionality as `WEBXR_VR_ALL_RUNTIMES_BROWSER_TEST_F`, but +also want the test run in Incognito mode in addition to regular Chrome. + [multi class macros]: https://chromium.googlesource.com/chromium/src/+/master/chrome/browser/vr/test/multi_class_browser_test.h ## Test Class Names
diff --git a/chrome/browser/vr/webxr_vr_transition_browser_test.cc b/chrome/browser/vr/webxr_vr_transition_browser_test.cc index bc88d9c..3c593c0 100644 --- a/chrome/browser/vr/webxr_vr_transition_browser_test.cc +++ b/chrome/browser/vr/webxr_vr_transition_browser_test.cc
@@ -82,7 +82,8 @@ IN_PROC_BROWSER_TEST_F(WebVrOpenVrBrowserTest, TestRequestPresentEntersVr) { TestPresentationEntryImpl(this, "generic_webvr_page"); } -WEBXR_VR_ALL_RUNTIMES_BROWSER_TEST_F(TestRequestSessionEntersVr) { +WEBXR_VR_ALL_RUNTIMES_PLUS_INCOGNITO_BROWSER_TEST_F( + TestRequestSessionEntersVr) { TestPresentationEntryImpl(t, "generic_webxr_page"); }
diff --git a/chrome/browser/web_applications/components/app_registrar.h b/chrome/browser/web_applications/components/app_registrar.h index 440b958..6d7e2ed2 100644 --- a/chrome/browser/web_applications/components/app_registrar.h +++ b/chrome/browser/web_applications/components/app_registrar.h
@@ -60,8 +60,10 @@ const AppId& app_id, web_app::InstallSource install_source) const; - // Returns the app id for which the |url| is in scope of, empty if none. - virtual AppId FindAppIdForUrl(const GURL& url) const = 0; + // Searches for the first app id in the registry for which the |url| is in + // scope. + virtual base::Optional<AppId> FindAppWithUrlInScope( + const GURL& url) const = 0; // Count a number of all apps which are installed by user (non-default). // Requires app registry to be in a ready state.
diff --git a/chrome/browser/web_applications/components/web_app_tab_helper_base.cc b/chrome/browser/web_applications/components/web_app_tab_helper_base.cc index 984911f..6bb484b 100644 --- a/chrome/browser/web_applications/components/web_app_tab_helper_base.cc +++ b/chrome/browser/web_applications/components/web_app_tab_helper_base.cc
@@ -32,7 +32,7 @@ // Sync app_id with the initial url from WebContents (used in Tab Restore etc) const GURL init_url = web_contents()->GetSiteInstance()->GetSiteURL(); - SetAppId(FindAppIdInScopeOfUrl(init_url)); + SetAppId(FindAppIdWithUrlInScope(init_url)); } bool WebAppTabHelperBase::HasAssociatedApp() const { @@ -53,7 +53,7 @@ if (!navigation_handle->IsInMainFrame() || !navigation_handle->HasCommitted()) return; - const AppId app_id = FindAppIdInScopeOfUrl(navigation_handle->GetURL()); + const AppId app_id = FindAppIdWithUrlInScope(navigation_handle->GetURL()); SetAppId(app_id); ReinstallPlaceholderAppIfNecessary(navigation_handle->GetURL()); @@ -79,7 +79,7 @@ void WebAppTabHelperBase::OnWebAppInstalled(const AppId& installed_app_id) { // Check if current web_contents url is in scope for the newly installed app. - AppId app_id = FindAppIdInScopeOfUrl(web_contents()->GetURL()); + AppId app_id = FindAppIdWithUrlInScope(web_contents()->GetURL()); if (app_id == installed_app_id) SetAppId(app_id); } @@ -132,11 +132,11 @@ provider->policy_manager()->ReinstallPlaceholderAppIfNecessary(url); } -AppId WebAppTabHelperBase::FindAppIdInScopeOfUrl(const GURL& url) const { +AppId WebAppTabHelperBase::FindAppIdWithUrlInScope(const GURL& url) const { auto* provider = web_app::WebAppProviderBase::GetProviderBase( Profile::FromBrowserContext(web_contents()->GetBrowserContext())); DCHECK(provider); - return provider->registrar().FindAppIdForUrl(url); + return provider->registrar().FindAppWithUrlInScope(url).value_or(AppId()); } } // namespace web_app
diff --git a/chrome/browser/web_applications/components/web_app_tab_helper_base.h b/chrome/browser/web_applications/components/web_app_tab_helper_base.h index 58411cf8..c740c0e 100644 --- a/chrome/browser/web_applications/components/web_app_tab_helper_base.h +++ b/chrome/browser/web_applications/components/web_app_tab_helper_base.h
@@ -95,7 +95,7 @@ // Triggers a reinstall of a placeholder app for |url|. void ReinstallPlaceholderAppIfNecessary(const GURL& url); - AppId FindAppIdInScopeOfUrl(const GURL& url) const; + AppId FindAppIdWithUrlInScope(const GURL& url) const; // WebApp associated with this tab. Empty string if no app associated. AppId app_id_;
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_registrar.cc b/chrome/browser/web_applications/extensions/bookmark_app_registrar.cc index 5ed3232..82d0014 100644 --- a/chrome/browser/web_applications/extensions/bookmark_app_registrar.cc +++ b/chrome/browser/web_applications/extensions/bookmark_app_registrar.cc
@@ -63,13 +63,17 @@ return ExtensionPrefs::Get(profile())->IsExternalExtensionUninstalled(app_id); } -web_app::AppId BookmarkAppRegistrar::FindAppIdForUrl(const GURL& url) const { +base::Optional<web_app::AppId> BookmarkAppRegistrar::FindAppWithUrlInScope( + const GURL& url) const { const Extension* extension = util::GetInstalledPwaForUrl(profile(), url); if (!extension) extension = GetInstalledShortcutForUrl(profile(), url); - return extension ? extension->id() : web_app::AppId(); + if (extension) + return extension->id(); + + return base::nullopt; } int BookmarkAppRegistrar::CountUserInstalledApps() const {
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_registrar.h b/chrome/browser/web_applications/extensions/bookmark_app_registrar.h index 571f91b..b6a7daf 100644 --- a/chrome/browser/web_applications/extensions/bookmark_app_registrar.h +++ b/chrome/browser/web_applications/extensions/bookmark_app_registrar.h
@@ -29,7 +29,8 @@ bool IsInstalled(const web_app::AppId& app_id) const override; bool WasExternalAppUninstalledByUser( const web_app::AppId& app_id) const override; - web_app::AppId FindAppIdForUrl(const GURL& url) const override; + base::Optional<web_app::AppId> FindAppWithUrlInScope( + const GURL& url) const override; int CountUserInstalledApps() const override; std::string GetAppShortName(const web_app::AppId& app_id) const override; std::string GetAppDescription(const web_app::AppId& app_id) const override;
diff --git a/chrome/browser/web_applications/test/test_app_registrar.cc b/chrome/browser/web_applications/test/test_app_registrar.cc index d5598f45..17173f4 100644 --- a/chrome/browser/web_applications/test/test_app_registrar.cc +++ b/chrome/browser/web_applications/test/test_app_registrar.cc
@@ -83,9 +83,10 @@ return it != installed_apps_.end(); } -AppId TestAppRegistrar::FindAppIdForUrl(const GURL& url) const { +base::Optional<AppId> TestAppRegistrar::FindAppWithUrlInScope( + const GURL& url) const { NOTIMPLEMENTED(); - return AppId(); + return base::nullopt; } int TestAppRegistrar::CountUserInstalledApps() const {
diff --git a/chrome/browser/web_applications/test/test_app_registrar.h b/chrome/browser/web_applications/test/test_app_registrar.h index 32f518bc..3f477377 100644 --- a/chrome/browser/web_applications/test/test_app_registrar.h +++ b/chrome/browser/web_applications/test/test_app_registrar.h
@@ -49,7 +49,7 @@ bool HasExternalAppWithInstallSource( const AppId& app_id, InstallSource install_source) const override; - AppId FindAppIdForUrl(const GURL& url) const override; + base::Optional<AppId> FindAppWithUrlInScope(const GURL& url) const override; int CountUserInstalledApps() const override; std::string GetAppShortName(const AppId& app_id) const override; std::string GetAppDescription(const AppId& app_id) const override;
diff --git a/chrome/browser/web_applications/web_app_registrar.cc b/chrome/browser/web_applications/web_app_registrar.cc index 1a88a59..4b437b0 100644 --- a/chrome/browser/web_applications/web_app_registrar.cc +++ b/chrome/browser/web_applications/web_app_registrar.cc
@@ -90,9 +90,10 @@ return false; } -AppId WebAppRegistrar::FindAppIdForUrl(const GURL& url) const { +base::Optional<AppId> WebAppRegistrar::FindAppWithUrlInScope( + const GURL& url) const { NOTIMPLEMENTED(); - return AppId(); + return base::nullopt; } int WebAppRegistrar::CountUserInstalledApps() const {
diff --git a/chrome/browser/web_applications/web_app_registrar.h b/chrome/browser/web_applications/web_app_registrar.h index 9294e18e..7cbab93 100644 --- a/chrome/browser/web_applications/web_app_registrar.h +++ b/chrome/browser/web_applications/web_app_registrar.h
@@ -40,7 +40,7 @@ bool IsInstalled(const GURL& start_url) const override; bool IsInstalled(const AppId& app_id) const override; bool WasExternalAppUninstalledByUser(const AppId& app_id) const override; - AppId FindAppIdForUrl(const GURL& url) const override; + base::Optional<AppId> FindAppWithUrlInScope(const GURL& url) const override; int CountUserInstalledApps() const override; std::string GetAppShortName(const AppId& app_id) const override; std::string GetAppDescription(const AppId& app_id) const override;
diff --git a/chrome/browser/webauthn/OWNERS b/chrome/browser/webauthn/OWNERS index 63f0c6f..99c79f6 100644 --- a/chrome/browser/webauthn/OWNERS +++ b/chrome/browser/webauthn/OWNERS
@@ -1,4 +1,4 @@ file://device/fido/OWNERS # TEAM: identity-dev@chromium.org -# Component: Blink>WebAuthentication +# COMPONENT: Blink>WebAuthentication
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc index a57ab3f88..09c8578 100644 --- a/chrome/common/chrome_features.cc +++ b/chrome/common/chrome_features.cc
@@ -620,10 +620,6 @@ const char kSitePerProcessOnlyForHighMemoryClientsParamName[] = "site-per-process-low-memory-cutoff-mb"; -// The site settings all sites list page in the Chrome settings UI. -const base::Feature kSiteSettings{"SiteSettings", - base::FEATURE_ENABLED_BY_DEFAULT}; - #if defined(OS_CHROMEOS) // Enables or disables automatic setup of USB printers. const base::Feature kStreamlinedUsbPrinterSetup{
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h index c137258..66a3a4e 100644 --- a/chrome/common/chrome_features.h +++ b/chrome/common/chrome_features.h
@@ -386,8 +386,6 @@ extern const base::Feature kShowTrustedPublisherURL; #endif -COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kSiteSettings; - COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kSitePerProcess; COMPONENT_EXPORT(CHROME_FEATURES)
diff --git a/chrome/common/media_galleries/OWNERS b/chrome/common/media_galleries/OWNERS index 7ccf0e0..65216a6b 100644 --- a/chrome/common/media_galleries/OWNERS +++ b/chrome/common/media_galleries/OWNERS
@@ -1 +1,2 @@ file://chrome/browser/media_galleries/OWNERS +# COMPONENT: Platform>Apps>MediaGalleries
diff --git a/chrome/renderer/extensions/OWNERS b/chrome/renderer/extensions/OWNERS index 1c7ec65..60dc5a8 100644 --- a/chrome/renderer/extensions/OWNERS +++ b/chrome/renderer/extensions/OWNERS
@@ -4,3 +4,4 @@ per-file automation_internal_custom_bindings*=file://ui/accessibility/OWNERS # COMPONENT: Platform>Extensions +# TEAM: extensions-reviews@chromium.org
diff --git a/chrome/renderer/printing/OWNERS b/chrome/renderer/printing/OWNERS index 9b08c66..d50bb849 100644 --- a/chrome/renderer/printing/OWNERS +++ b/chrome/renderer/printing/OWNERS
@@ -1 +1,3 @@ file://printing/OWNERS + +# COMPONENT: Internals>Printing
diff --git a/chrome/renderer/safe_browsing/features.cc b/chrome/renderer/safe_browsing/features.cc index c0a6519..a40462c 100644 --- a/chrome/renderer/safe_browsing/features.cc +++ b/chrome/renderer/safe_browsing/features.cc
@@ -4,7 +4,6 @@ #include "chrome/renderer/safe_browsing/features.h" -#include "base/logging.h" #include "base/metrics/histogram_macros.h" namespace safe_browsing { @@ -24,16 +23,12 @@ // too small, or there is a bug causing too many features to be added. // In this case, we'll log to a histogram so we can see that this is // happening, and make phishing classification fail silently. - LOG(ERROR) << "Not adding feature: " << name << " because the " - << "feature map is too large."; UMA_HISTOGRAM_COUNTS_1M("SBClientPhishing.TooManyFeatures", 1); return false; } // We only expect features in the range [0.0, 1.0], so fail if the feature is // outside this range. if (value < 0.0 || value > 1.0) { - LOG(ERROR) << "Not adding feature: " << name << " because the value " - << value << " is not in the range [0.0, 1.0]."; UMA_HISTOGRAM_COUNTS_1M("SBClientPhishing.IllegalFeatureValue", 1); return false; }
diff --git a/chrome/services/file_util/OWNERS b/chrome/services/file_util/OWNERS new file mode 100644 index 0000000..85d233d --- /dev/null +++ b/chrome/services/file_util/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: Services>Safebrowsing
diff --git a/chrome/services/removable_storage_writer/OWNERS b/chrome/services/removable_storage_writer/OWNERS index e69de29..eaf0589 100644 --- a/chrome/services/removable_storage_writer/OWNERS +++ b/chrome/services/removable_storage_writer/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: Internals>Services
diff --git a/chrome/services/wifi_util_win/OWNERS b/chrome/services/wifi_util_win/OWNERS index f1e3d4f..1a31ee9 100644 --- a/chrome/services/wifi_util_win/OWNERS +++ b/chrome/services/wifi_util_win/OWNERS
@@ -1 +1,2 @@ noel@chromium.org +# COMPONENT: Internals>Services>ServiceManager
diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h index 53189f8b..8edcb3e 100644 --- a/chrome/test/base/test_browser_window.h +++ b/chrome/test/base/test_browser_window.h
@@ -125,7 +125,7 @@ #if !defined(OS_ANDROID) void ShowIntentPickerBubble(std::vector<apps::IntentPickerAppInfo> app_info, bool enable_stay_in_chrome, - bool show_remember_selection, + bool show_persistence_options, IntentPickerResponse callback) override {} #endif // !define(OS_ANDROID) autofill::SaveCardBubbleView* ShowSaveCreditCardBubble(
diff --git a/chrome/test/data/android/render_tests/BookmarkTest.bookmark_manager_folder_selected.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/BookmarkTest.NightModeDisabled-bookmark_manager_folder_selected.Nexus_5-19.png.sha1 similarity index 100% rename from chrome/test/data/android/render_tests/BookmarkTest.bookmark_manager_folder_selected.Nexus_5-19.png.sha1 rename to chrome/test/data/android/render_tests/BookmarkTest.NightModeDisabled-bookmark_manager_folder_selected.Nexus_5-19.png.sha1
diff --git a/chrome/test/data/android/render_tests/BookmarkTest.bookmark_manager_one_folder.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/BookmarkTest.NightModeDisabled-bookmark_manager_one_folder.Nexus_5-19.png.sha1 similarity index 100% rename from chrome/test/data/android/render_tests/BookmarkTest.bookmark_manager_one_folder.Nexus_5-19.png.sha1 rename to chrome/test/data/android/render_tests/BookmarkTest.NightModeDisabled-bookmark_manager_one_folder.Nexus_5-19.png.sha1
diff --git a/chrome/test/data/android/render_tests/BookmarkTest.NightModeEnabled-bookmark_manager_folder_selected.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/BookmarkTest.NightModeEnabled-bookmark_manager_folder_selected.Nexus_5-19.png.sha1 new file mode 100644 index 0000000..57b73b6 --- /dev/null +++ b/chrome/test/data/android/render_tests/BookmarkTest.NightModeEnabled-bookmark_manager_folder_selected.Nexus_5-19.png.sha1
@@ -0,0 +1 @@ +51a1396ed8afbef8a0547a3cae356a0b66b28519 \ No newline at end of file
diff --git a/chrome/test/data/android/render_tests/BookmarkTest.NightModeEnabled-bookmark_manager_one_folder.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/BookmarkTest.NightModeEnabled-bookmark_manager_one_folder.Nexus_5-19.png.sha1 new file mode 100644 index 0000000..c9960b56 --- /dev/null +++ b/chrome/test/data/android/render_tests/BookmarkTest.NightModeEnabled-bookmark_manager_one_folder.Nexus_5-19.png.sha1
@@ -0,0 +1 @@ +b2b67ed9e0c888c4076d7fdf5de394743def87f7 \ No newline at end of file
diff --git a/chrome/test/data/android/render_tests/ExploreSitesPageTest.initial_layout.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/ExploreSitesPageTest.NightModeDisabled-initial_layout.Nexus_5-19.png.sha1 similarity index 100% rename from chrome/test/data/android/render_tests/ExploreSitesPageTest.initial_layout.Nexus_5-19.png.sha1 rename to chrome/test/data/android/render_tests/ExploreSitesPageTest.NightModeDisabled-initial_layout.Nexus_5-19.png.sha1
diff --git a/chrome/test/data/android/render_tests/ExploreSitesPageTest.scrolled_to_category_2.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/ExploreSitesPageTest.NightModeDisabled-scrolled_to_category_2.Nexus_5-19.png.sha1 similarity index 100% rename from chrome/test/data/android/render_tests/ExploreSitesPageTest.scrolled_to_category_2.Nexus_5-19.png.sha1 rename to chrome/test/data/android/render_tests/ExploreSitesPageTest.NightModeDisabled-scrolled_to_category_2.Nexus_5-19.png.sha1
diff --git a/chrome/test/data/android/render_tests/ExploreSitesPageTest.NightModeEnabled-initial_layout.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/ExploreSitesPageTest.NightModeEnabled-initial_layout.Nexus_5-19.png.sha1 new file mode 100644 index 0000000..5025e78 --- /dev/null +++ b/chrome/test/data/android/render_tests/ExploreSitesPageTest.NightModeEnabled-initial_layout.Nexus_5-19.png.sha1
@@ -0,0 +1 @@ +9a9d62b59e245167b013b02595bd6eb02ef4bf5a \ No newline at end of file
diff --git a/chrome/test/data/android/render_tests/ExploreSitesPageTest.NightModeEnabled-scrolled_to_category_2.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/ExploreSitesPageTest.NightModeEnabled-scrolled_to_category_2.Nexus_5-19.png.sha1 new file mode 100644 index 0000000..cfdf981d --- /dev/null +++ b/chrome/test/data/android/render_tests/ExploreSitesPageTest.NightModeEnabled-scrolled_to_category_2.Nexus_5-19.png.sha1
@@ -0,0 +1 @@ +4ea1b11ab00d94d5422544c1adf8099cead04195 \ No newline at end of file
diff --git a/chrome/test/data/android/render_tests/TileGridLayoutTest.ntp_tile_grid_layout.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/TileGridLayoutTest.NightModeDisabled-ntp_tile_grid_layout.Nexus_5-19.png.sha1 similarity index 100% rename from chrome/test/data/android/render_tests/TileGridLayoutTest.ntp_tile_grid_layout.Nexus_5-19.png.sha1 rename to chrome/test/data/android/render_tests/TileGridLayoutTest.NightModeDisabled-ntp_tile_grid_layout.Nexus_5-19.png.sha1
diff --git a/chrome/test/data/android/render_tests/TileGridLayoutTest.tile_modern.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/TileGridLayoutTest.NightModeDisabled-tile_modern.Nexus_5-19.png.sha1 similarity index 100% rename from chrome/test/data/android/render_tests/TileGridLayoutTest.tile_modern.Nexus_5-19.png.sha1 rename to chrome/test/data/android/render_tests/TileGridLayoutTest.NightModeDisabled-tile_modern.Nexus_5-19.png.sha1
diff --git a/chrome/test/data/android/render_tests/TileGridLayoutTest.tile_modern_offline.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/TileGridLayoutTest.NightModeDisabled-tile_modern_offline.Nexus_5-19.png.sha1 similarity index 100% rename from chrome/test/data/android/render_tests/TileGridLayoutTest.tile_modern_offline.Nexus_5-19.png.sha1 rename to chrome/test/data/android/render_tests/TileGridLayoutTest.NightModeDisabled-tile_modern_offline.Nexus_5-19.png.sha1
diff --git a/chrome/test/data/android/render_tests/TileGridLayoutTest.NightModeEnabled-ntp_tile_grid_layout.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/TileGridLayoutTest.NightModeEnabled-ntp_tile_grid_layout.Nexus_5-19.png.sha1 new file mode 100644 index 0000000..b5150b0 --- /dev/null +++ b/chrome/test/data/android/render_tests/TileGridLayoutTest.NightModeEnabled-ntp_tile_grid_layout.Nexus_5-19.png.sha1
@@ -0,0 +1 @@ +a6e324ebdb0df3daa1bf76e374b5ec04d61ddbc2 \ No newline at end of file
diff --git a/chrome/test/data/android/render_tests/TileGridLayoutTest.NightModeEnabled-tile_modern.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/TileGridLayoutTest.NightModeEnabled-tile_modern.Nexus_5-19.png.sha1 new file mode 100644 index 0000000..85763fb --- /dev/null +++ b/chrome/test/data/android/render_tests/TileGridLayoutTest.NightModeEnabled-tile_modern.Nexus_5-19.png.sha1
@@ -0,0 +1 @@ +8422cf7c0878dcc4fbe7e6b9579ab2fd16ca66c0 \ No newline at end of file
diff --git a/chrome/test/data/android/render_tests/TileGridLayoutTest.NightModeEnabled-tile_modern_offline.Nexus_5-19.png.sha1 b/chrome/test/data/android/render_tests/TileGridLayoutTest.NightModeEnabled-tile_modern_offline.Nexus_5-19.png.sha1 new file mode 100644 index 0000000..dd9d7ac --- /dev/null +++ b/chrome/test/data/android/render_tests/TileGridLayoutTest.NightModeEnabled-tile_modern_offline.Nexus_5-19.png.sha1
@@ -0,0 +1 @@ +4eb9cc4040870419304c81ce16a3cd45b1b406ce \ No newline at end of file
diff --git a/chrome/test/data/local_ntp/customize_menu_browsertest.js b/chrome/test/data/local_ntp/customize_menu_browsertest.js index 6bdaa17..da1e79f 100644 --- a/chrome/test/data/local_ntp/customize_menu_browsertest.js +++ b/chrome/test/data/local_ntp/customize_menu_browsertest.js
@@ -757,6 +757,31 @@ $(test.customizeMenu.IDS.BACKGROUNDS_IMAGE_MENU) .getElementsByClassName('selected')[0] .firstChild.id === 'coll_0_img_tile_0'); + + // Clicking the image again should deselect it. + $('coll_0_img_tile_0').click(); + assertTrue( + $(test.customizeMenu.IDS.BACKGROUNDS_IMAGE_MENU) + .getElementsByClassName('selected') + .length === 0); + + // Close and reopen the submenu and ensure nothing is selected. + $(test.customizeMenu.IDS.MENU_BACK).click(); + assertTrue(elementIsVisible(backgroundSubmenu)); + assertFalse(elementIsVisible(backgroundImageSubmenu)); + assertEquals(0, test.customizeMenu.timesCustomBackgroundWasSet); + $('coll_tile_0').click(); + + assertFalse(elementIsVisible(backgroundSubmenu)); + assertTrue(elementIsVisible(backgroundImageSubmenu)); + assertTrue( + $(test.customizeMenu.IDS.BACKGROUNDS_IMAGE_MENU) + .getElementsByClassName('bg-sel-tile') + .length === 4); + assertTrue( + $(test.customizeMenu.IDS.BACKGROUNDS_IMAGE_MENU) + .getElementsByClassName('selected') + .length === 0); }; // ******************************* HELPERS *******************************
diff --git a/chrome/test/data/safe_browsing/download_protection/README b/chrome/test/data/safe_browsing/download_protection/README index d860a66..b8dd5f4 100644 --- a/chrome/test/data/safe_browsing/download_protection/README +++ b/chrome/test/data/safe_browsing/download_protection/README
@@ -24,3 +24,4 @@ - zip zipfile_no_binaries.zip simple_exe.cc - zip zipfile_one_unsigned_binary.zip unsigned.exe - zip zipfile_two_binaries_one_signed.zip unsigned.exe signed.exe +- zip -e encrypted.zip signed.exe
diff --git a/chrome/test/data/safe_browsing/download_protection/encrypted.zip b/chrome/test/data/safe_browsing/download_protection/encrypted.zip new file mode 100644 index 0000000..62d5bd38 --- /dev/null +++ b/chrome/test/data/safe_browsing/download_protection/encrypted.zip Binary files differ
diff --git a/chrome/test/data/webui/engagement/site_engagement_browsertest.js b/chrome/test/data/webui/engagement/site_engagement_browsertest.js index 8b3bad1..8980132 100644 --- a/chrome/test/data/webui/engagement/site_engagement_browsertest.js +++ b/chrome/test/data/webui/engagement/site_engagement_browsertest.js
@@ -39,8 +39,9 @@ /** @override */ setUp: function() { testing.Test.prototype.setUp.call(this); - suiteSetup(function() { - return whenPageIsPopulatedForTest().then(disableAutoupdateForTests); + suiteSetup(async function() { + await whenPageIsPopulatedForTest(); + await disableAutoupdateForTests(); }); }, }; @@ -83,15 +84,14 @@ ['10', '3.14'], cells.map((x) => x.totalScore.textContent)); }); - test('change score', function() { + test('change score', async function() { var firstRow = cells[0]; firstRow.scoreInput.value = 50; firstRow.scoreInput.dispatchEvent(new Event('change')); - return uiHandler.getSiteEngagementDetails().then((response) => { - assertEquals(firstRow.origin.textContent, response.info[0].origin.url); - assertEquals(50, response.info[0].baseScore); - }); + let {info} = await engagementDetailsProvider.getSiteEngagementDetails(); + assertEquals(firstRow.origin.textContent, info[0].origin.url); + assertEquals(50, info[0].baseScore); }); mocha.run(); });
diff --git a/chrome/test/data/webui/settings/cr_settings_browsertest.js b/chrome/test/data/webui/settings/cr_settings_browsertest.js index 30900f14..08cc8c98 100644 --- a/chrome/test/data/webui/settings/cr_settings_browsertest.js +++ b/chrome/test/data/webui/settings/cr_settings_browsertest.js
@@ -1182,8 +1182,6 @@ /** @override */ browsePreload: 'chrome://settings/privacy_page/privacy_page.html', - featureList: {enabled: ['features::kSiteSettings']}, - /** @override */ extraLibraries: CrSettingsBrowserTest.prototype.extraLibraries.concat([ '../test_browser_proxy.js', @@ -1336,8 +1334,6 @@ /** @override */ browsePreload: 'chrome://settings/privacy_page/privacy_page.html', - featureList: {enabled: ['features::kSiteSettings']}, - /** @override */ extraLibraries: CrSettingsBrowserTest.prototype.extraLibraries.concat([ '../test_browser_proxy.js', @@ -1422,8 +1418,6 @@ /** @override */ browsePreload: 'chrome://settings/privacy_page/privacy_page.html', - featureList: {enabled: ['features::kSiteSettings']}, - /** @override */ extraLibraries: CrSettingsBrowserTest.prototype.extraLibraries.concat([ '../test_browser_proxy.js',
diff --git a/chrome/test/data/webui/settings/site_details_tests.js b/chrome/test/data/webui/settings/site_details_tests.js index f66e356..8ed5e394 100644 --- a/chrome/test/data/webui/settings/site_details_tests.js +++ b/chrome/test/data/webui/settings/site_details_tests.js
@@ -177,15 +177,8 @@ } }); - test('usage heading shows when site settings enabled', function() { + test('usage heading shows properly', function() { browserProxy.setPrefs(prefs); - // Expect usage to be hidden when Site Settings is disabled. - loadTimeData.overrideValues({enableSiteSettings: false}); - testElement = createSiteDetails('https://foo.com:443'); - Polymer.dom.flush(); - assert(!testElement.$$('#usage')); - - loadTimeData.overrideValues({enableSiteSettings: true}); testElement = createSiteDetails('https://foo.com:443'); Polymer.dom.flush(); assert(!!testElement.$$('#usage')); @@ -207,7 +200,6 @@ test('storage gets trashed properly', function() { const origin = 'https://foo.com:443'; browserProxy.setPrefs(prefs); - loadTimeData.overrideValues({enableSiteSettings: true}); testElement = createSiteDetails(origin); // Remove the current website-usage-private-api element. @@ -251,7 +243,6 @@ test('cookies gets deleted properly', function() { const origin = 'https://foo.com:443'; browserProxy.setPrefs(prefs); - loadTimeData.overrideValues({enableSiteSettings: true}); testElement = createSiteDetails(origin); // Remove the current website-usage-private-api element. @@ -377,7 +368,6 @@ test('show confirmation dialog on clear storage', function() { browserProxy.setPrefs(prefs); - loadTimeData.overrideValues({enableSiteSettings: true}); testElement = createSiteDetails('https://foo.com:443'); // Give |testElement.storedData_| a non-empty value to make the clear @@ -473,7 +463,6 @@ settings.navigateTo(settings.routes.SITE_SETTINGS); - loadTimeData.overrideValues({enableSiteSettings: false}); testElement = createSiteDetails(invalid_url); assertEquals( settings.routes.SITE_SETTINGS_SITE_DETAILS.path, @@ -495,7 +484,6 @@ test('call fetch block autoplay status', function() { const origin = 'https://foo.com:443'; browserProxy.setPrefs(prefs); - loadTimeData.overrideValues({enableSiteSettings: true}); testElement = createSiteDetails(origin); return browserProxy.whenCalled('fetchBlockAutoplayStatus'); });
diff --git a/chrome/test/data/webui/settings/site_list_entry_tests.js b/chrome/test/data/webui/settings/site_list_entry_tests.js index fd15ff3..b286f46 100644 --- a/chrome/test/data/webui/settings/site_list_entry_tests.js +++ b/chrome/test/data/webui/settings/site_list_entry_tests.js
@@ -61,7 +61,6 @@ } test('not valid origin does not go to site details page', function() { - loadTimeData.overrideValues({enableSiteSettings: true}); browserProxy.setIsOriginValid(false); testElement.model = { controlledBy: chrome.settingsPrivate.ControlledBy.USER_POLICY, @@ -85,7 +84,6 @@ }); test('valid origin goes to site details page', function() { - loadTimeData.overrideValues({enableSiteSettings: true}); browserProxy.setIsOriginValid(true); testElement.model = { controlledBy: chrome.settingsPrivate.ControlledBy.USER_POLICY,
diff --git a/chrome/test/origin_policy/OWNERS b/chrome/test/origin_policy/OWNERS index cc8f52f4..b0812f6 100644 --- a/chrome/test/origin_policy/OWNERS +++ b/chrome/test/origin_policy/OWNERS
@@ -1 +1,2 @@ file://third_party/blink/common/origin_policy/OWNERS +# COMPONENT: Blink>SecurityFeature
diff --git a/chrome/test/perf/OWNERS b/chrome/test/perf/OWNERS index 28794d4..0269bda 100644 --- a/chrome/test/perf/OWNERS +++ b/chrome/test/perf/OWNERS
@@ -2,3 +2,4 @@ miu@chromium.org nduca@chromium.org zmo@chromium.org +# COMPONENT: Speed>Benchmarks>Waterfall
diff --git a/chromeos/components/multidevice/OWNERS b/chromeos/components/multidevice/OWNERS index 548d810a..81df0146 100644 --- a/chromeos/components/multidevice/OWNERS +++ b/chromeos/components/multidevice/OWNERS
@@ -1,3 +1,4 @@ khorimoto@chromium.org hansberry@chromium.org nohle@chromium.org +# COMPONENT: OS>Systems>Multidevice
diff --git a/chromeos/components/tether/OWNERS b/chromeos/components/tether/OWNERS index 692254c7..1738f62a3 100644 --- a/chromeos/components/tether/OWNERS +++ b/chromeos/components/tether/OWNERS
@@ -1,2 +1,4 @@ khorimoto@chromium.org hansberry@chromium.org + +# COMPONENT: OS>Systems>Multidevice>Tethering
diff --git a/chromeos/geolocation/OWNERS b/chromeos/geolocation/OWNERS index 2dcc458..6f8d32d 100644 --- a/chromeos/geolocation/OWNERS +++ b/chromeos/geolocation/OWNERS
@@ -1 +1,2 @@ alemate@chromium.org +# COMPONENT: Internals
diff --git a/chromeos/network/OWNERS b/chromeos/network/OWNERS index 9288b61f..7ac9225 100644 --- a/chromeos/network/OWNERS +++ b/chromeos/network/OWNERS
@@ -1,3 +1,4 @@ khorimoto@chromium.org stevenjb@chromium.org -tbarzic@chromium.org \ No newline at end of file +tbarzic@chromium.org +# COMPONENT: OS>Systems>Network
diff --git a/chromeos/network/onc/OWNERS b/chromeos/network/onc/OWNERS new file mode 100644 index 0000000..e271dba2 --- /dev/null +++ b/chromeos/network/onc/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: Enterprise
diff --git a/chromeos/network/portal_detector/OWNERS b/chromeos/network/portal_detector/OWNERS index dccd40f..45c102e 100644 --- a/chromeos/network/portal_detector/OWNERS +++ b/chromeos/network/portal_detector/OWNERS
@@ -1,3 +1,4 @@ achuith@chromium.org alemate@chromium.org stevenjb@chromium.org +# COMPONENT: Internals>Services>Ash
diff --git a/chromeos/network/proxy/OWNERS b/chromeos/network/proxy/OWNERS new file mode 100644 index 0000000..b1daceb5 --- /dev/null +++ b/chromeos/network/proxy/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: OS>Systems>Network
diff --git a/chromeos/services/assistant/BUILD.gn b/chromeos/services/assistant/BUILD.gn index 75fdc06..f43525ee 100644 --- a/chromeos/services/assistant/BUILD.gn +++ b/chromeos/services/assistant/BUILD.gn
@@ -41,16 +41,20 @@ "//chromeos/dbus/power:power_manager_proto", "//chromeos/services/assistant/public/proto", "//components/account_id", + "//components/prefs", "//components/user_manager", "//services/device/public/mojom", "//services/identity/public/mojom", "//services/network/public/cpp:cpp", + "//services/preferences/public/cpp", + "//services/preferences/public/mojom", "//ui/accessibility:ax_assistant", ] public_deps = [ "//ash/public/cpp:cpp", "//chromeos/services/assistant/public:feature_flags", + "//chromeos/services/assistant/public/cpp:prefs", "//chromeos/services/assistant/public/mojom", "//mojo/public/cpp/bindings:bindings", "//services/audio/public/cpp:cpp", @@ -175,6 +179,7 @@ ] deps = [ "//base", + "//chromeos/services/assistant/public/cpp:prefs", "//chromeos/services/assistant/public/mojom", "//testing/gmock", ]
diff --git a/chromeos/services/assistant/DEPS b/chromeos/services/assistant/DEPS index 061e3f7..af5766b 100644 --- a/chromeos/services/assistant/DEPS +++ b/chromeos/services/assistant/DEPS
@@ -12,6 +12,7 @@ "+services/identity/public", "+services/media_session/public", "+services/network/public", + "+services/preferences/public/cpp", "+services/service_manager/public", "+ui/accessibility/ax_assistant_structure.h", "+ui/accessibility/mojom",
diff --git a/chromeos/services/assistant/assistant_manager_service_impl.cc b/chromeos/services/assistant/assistant_manager_service_impl.cc index e7867040b..37e0094 100644 --- a/chromeos/services/assistant/assistant_manager_service_impl.cc +++ b/chromeos/services/assistant/assistant_manager_service_impl.cc
@@ -36,6 +36,7 @@ #include "libassistant/shared/internal_api/assistant_manager_delegate.h" #include "libassistant/shared/internal_api/assistant_manager_internal.h" #include "libassistant/shared/public/media_manager.h" +#include "mojo/public/mojom/base/time.mojom.h" #include "services/media_session/public/mojom/constants.mojom.h" #include "services/media_session/public/mojom/media_session.mojom.h" #include "services/network/public/cpp/shared_url_loader_factory.h" @@ -609,6 +610,11 @@ notification_ptr->grouping_key = notification.grouping_key; notification_ptr->obfuscated_gaia_id = notification.obfuscated_gaia_id; + if (notification.expiry_timestamp_ms) { + notification_ptr->expiry_time = + base::Time::FromJavaTime(notification.expiry_timestamp_ms); + } + // The server sometimes sends an empty |notification_id|, but our client // requires a non-empty |client_id| for notifications. Known instances in // which the server sends an empty |notification_id| are for Reminders.
diff --git a/chromeos/services/assistant/public/cpp/BUILD.gn b/chromeos/services/assistant/public/cpp/BUILD.gn index 13b97ba..dd68bdd 100644 --- a/chromeos/services/assistant/public/cpp/BUILD.gn +++ b/chromeos/services/assistant/public/cpp/BUILD.gn
@@ -28,3 +28,14 @@ "//services/service_manager/public/cpp", ] } + +source_set("prefs") { + sources = [ + "assistant_prefs.cc", + "assistant_prefs.h", + ] + + deps = [ + "//components/prefs", + ] +}
diff --git a/chromeos/services/assistant/public/cpp/assistant_prefs.cc b/chromeos/services/assistant/public/cpp/assistant_prefs.cc new file mode 100644 index 0000000..40d9afe --- /dev/null +++ b/chromeos/services/assistant/public/cpp/assistant_prefs.cc
@@ -0,0 +1,37 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" + +#include <string> + +#include "components/prefs/pref_registry_simple.h" + +namespace chromeos { +namespace assistant { +namespace prefs { + +// A preference that indicates the activity control consent status from user. +// This preference should only be changed in browser. +const char kAssistantConsentStatus[] = + "settings.voice_interaction.activity_control.consent_status"; + +void RegisterProfilePrefsForBrowser(PrefRegistrySimple* registry) { + registry->RegisterIntegerPref(kAssistantConsentStatus, + ConsentStatus::kUnknown, PrefRegistry::PUBLIC); +} + +void RegisterProfilePrefsForeign(PrefRegistrySimple* registry, bool for_test) { + if (for_test) { + // In tests there are no remote pref service. Register the prefs as own if + // necessary. + RegisterProfilePrefsForBrowser(registry); + return; + } + registry->RegisterForeignPref(kAssistantConsentStatus); +} + +} // namespace prefs +} // namespace assistant +} // namespace chromeos
diff --git a/chromeos/services/assistant/public/cpp/assistant_prefs.h b/chromeos/services/assistant/public/cpp/assistant_prefs.h new file mode 100644 index 0000000..62425c0b --- /dev/null +++ b/chromeos/services/assistant/public/cpp/assistant_prefs.h
@@ -0,0 +1,46 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_SERVICES_ASSISTANT_PUBLIC_CPP_ASSISTANT_PREFS_H_ +#define CHROMEOS_SERVICES_ASSISTANT_PUBLIC_CPP_ASSISTANT_PREFS_H_ + +#include "components/prefs/pref_service.h" + +class PrefRegistrySimple; + +namespace chromeos { +namespace assistant { +namespace prefs { + +// The status of the user's consent. The enum values cannot be changed because +// they are persisted on disk. +enum ConsentStatus { + // The status is unknown. + kUnknown = 0, + + // The user accepted activity control access. + kActivityControlAccepted = 1, + + // The user is not authorized to give consent. + kUnauthorized = 2, + + // The user's consent information is not found. This is typically the case + // when consent from the user has never been requested. + kNotFound = 3, +}; + +extern const char kAssistantConsentStatus[]; + +// Registers Assistant specific profile preferences for browser prefs. +void RegisterProfilePrefsForBrowser(PrefRegistrySimple* registry); + +// Registers Assistant specific profile preferences from foreign pref services. +void RegisterProfilePrefsForeign(PrefRegistrySimple* registry, + bool for_test = false); + +} // namespace prefs +} // namespace assistant +} // namespace chromeos + +#endif // CHROMEOS_SERVICES_ASSISTANT_PUBLIC_CPP_ASSISTANT_PREFS_H_
diff --git a/chromeos/services/assistant/public/cpp/manifest.cc b/chromeos/services/assistant/public/cpp/manifest.cc index 270d1105..989c17c 100644 --- a/chromeos/services/assistant/public/cpp/manifest.cc +++ b/chromeos/services/assistant/public/cpp/manifest.cc
@@ -35,6 +35,7 @@ .RequireCapability( chromeos::network_config::mojom::kServiceName, chromeos::network_config::mojom::kNetworkConfigCapability) + .RequireCapability("preferences", "pref_client") .Build()}; return *manifest;
diff --git a/chromeos/services/assistant/public/mojom/assistant.mojom b/chromeos/services/assistant/public/mojom/assistant.mojom index 0b8d098a..adb929c 100644 --- a/chromeos/services/assistant/public/mojom/assistant.mojom +++ b/chromeos/services/assistant/public/mojom/assistant.mojom
@@ -295,6 +295,10 @@ // Whether this notification can turn on the display if it was off. bool is_high_priority = false; + + // When the notification should expire. + // Expressed as milliseconds since Unix Epoch. + mojo_base.mojom.Time? expiry_time; }; // Models status of an app.
diff --git a/chromeos/services/assistant/service.cc b/chromeos/services/assistant/service.cc index 6d62a07..34bec34 100644 --- a/chromeos/services/assistant/service.cc +++ b/chromeos/services/assistant/service.cc
@@ -25,12 +25,16 @@ #include "chromeos/services/assistant/assistant_settings_manager.h" #include "chromeos/services/assistant/fake_assistant_manager_service_impl.h" #include "chromeos/services/assistant/fake_assistant_settings_manager_impl.h" +#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" #include "chromeos/services/assistant/public/features.h" +#include "components/prefs/pref_registry_simple.h" +#include "components/prefs/pref_service.h" #include "components/user_manager/known_user.h" #include "google_apis/gaia/google_service_auth_error.h" #include "services/identity/public/cpp/scope_set.h" #include "services/identity/public/mojom/constants.mojom.h" #include "services/network/public/cpp/shared_url_loader_factory.h" +#include "services/preferences/public/cpp/pref_service_factory.h" #include "services/service_manager/public/cpp/connector.h" #if BUILDFLAG(ENABLE_CROS_LIBASSISTANT) @@ -125,7 +129,16 @@ token_refresh_timer_ = std::move(timer); } -void Service::OnStart() {} +void Service::OnStart() { + auto pref_registry = base::MakeRefCounted<PrefRegistrySimple>(); + prefs::RegisterProfilePrefsForeign(pref_registry.get()); + ::prefs::mojom::PrefStoreConnectorPtr pref_store_connector; + + ::prefs::ConnectToPrefService( + service_binding_.GetConnector(), std::move(pref_registry), + base::Bind(&Service::OnPrefServiceConnected, base::Unretained(this)), + ::prefs::mojom::kServiceName); +} void Service::OnBindInterface( const service_manager::BindSourceInfo& source_info, @@ -281,6 +294,13 @@ RequestAccessToken(); } +void Service::OnPrefServiceConnected( + std::unique_ptr<::PrefService> pref_service) { + // TODO(b/110211045): Switch to user pref service after migrating other + // Assistant related prefs. + pref_service_ = std::move(pref_service); +} + identity::mojom::IdentityAccessor* Service::GetIdentityAccessor() { if (!identity_accessor_) { service_binding_.GetConnector()->BindInterface(
diff --git a/chromeos/services/assistant/service.h b/chromeos/services/assistant/service.h index 4d1981cf..0e4016a 100644 --- a/chromeos/services/assistant/service.h +++ b/chromeos/services/assistant/service.h
@@ -34,6 +34,7 @@ #include "services/service_manager/public/mojom/service.mojom.h" class GoogleServiceAuthError; +class PrefService; namespace base { class OneShotTimer; @@ -145,6 +146,8 @@ mojom::DeviceActionsPtr device_actions, bool is_test) override; + void OnPrefServiceConnected(std::unique_ptr<::PrefService> pref_service); + identity::mojom::IdentityAccessor* GetIdentityAccessor(); void GetPrimaryAccountInfoCallback( @@ -214,6 +217,8 @@ // non-null until |assistant_manager_service_| is created. std::unique_ptr<network::SharedURLLoaderFactoryInfo> url_loader_factory_info_; + std::unique_ptr<PrefService> pref_service_; + base::WeakPtrFactory<Service> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(Service);
diff --git a/chromeos/timezone/OWNERS b/chromeos/timezone/OWNERS index 2dcc458..0b6f1c2c 100644 --- a/chromeos/timezone/OWNERS +++ b/chromeos/timezone/OWNERS
@@ -1 +1,2 @@ alemate@chromium.org +# COMPONENT: Internals>Core
diff --git a/components/account_id/OWNERS b/components/account_id/OWNERS index a0c217c..e2162608 100644 --- a/components/account_id/OWNERS +++ b/components/account_id/OWNERS
@@ -1,3 +1,4 @@ alemate@chromium.org rogerta@chromium.org xiyuan@chromium.org +# COMPONENT: Services>SignIn
diff --git a/components/browser_watcher/OWNERS b/components/browser_watcher/OWNERS index a2ea389c..14b912c 100644 --- a/components/browser_watcher/OWNERS +++ b/components/browser_watcher/OWNERS
@@ -1,2 +1,3 @@ siggi@chromium.org manzagop@chromium.org +# COMPONENT: Internals>PlatformIntegration
diff --git a/components/cast_certificate/OWNERS b/components/cast_certificate/OWNERS index 2a6f7a58..ca8567d 100644 --- a/components/cast_certificate/OWNERS +++ b/components/cast_certificate/OWNERS
@@ -1,2 +1,3 @@ file://chromecast/OWNERS dougsteed@chromium.org +# COMPONENT: Internals>Network>Certificate
diff --git a/components/content_settings/OWNERS b/components/content_settings/OWNERS index b27914a..2349c98 100644 --- a/components/content_settings/OWNERS +++ b/components/content_settings/OWNERS
@@ -3,3 +3,4 @@ msramek@chromium.org # COMPONENT: Internals>Permissions>Model +# TEAM: permissions-dev@chromium.org
diff --git a/components/cronet/url_request_context_config.cc b/components/cronet/url_request_context_config.cc index 9afb746..be6390df 100644 --- a/components/cronet/url_request_context_config.cc +++ b/components/cronet/url_request_context_config.cc
@@ -340,20 +340,20 @@ quic::ParsedQuicVersionVector supported_versions = ParseQuicVersions(quic_version_string); if (!supported_versions.empty()) - session_params->quic_supported_versions = supported_versions; + session_params->quic_params.supported_versions = supported_versions; } std::string quic_connection_options; if (quic_args->GetString(kQuicConnectionOptions, &quic_connection_options)) { - session_params->quic_connection_options = + session_params->quic_params.connection_options = net::ParseQuicConnectionOptions(quic_connection_options); } std::string quic_client_connection_options; if (quic_args->GetString(kQuicClientConnectionOptions, &quic_client_connection_options)) { - session_params->quic_client_connection_options = + session_params->quic_params.client_connection_options = net::ParseQuicConnectionOptions(quic_client_connection_options); } @@ -362,7 +362,7 @@ bool quic_store_server_configs_in_properties = false; if (quic_args->GetBoolean(kQuicStoreServerConfigsInProperties, &quic_store_server_configs_in_properties)) { - session_params->quic_max_server_configs_stored_in_properties = + session_params->quic_params.max_server_configs_stored_in_properties = net::kDefaultMaxQuicServerEntries; } @@ -370,14 +370,14 @@ if (quic_args->GetInteger( kQuicMaxServerConfigsStoredInProperties, &quic_max_server_configs_stored_in_properties)) { - session_params->quic_max_server_configs_stored_in_properties = + session_params->quic_params.max_server_configs_stored_in_properties = static_cast<size_t>(quic_max_server_configs_stored_in_properties); } int quic_idle_connection_timeout_seconds = 0; if (quic_args->GetInteger(kQuicIdleConnectionTimeoutSeconds, &quic_idle_connection_timeout_seconds)) { - session_params->quic_idle_connection_timeout_seconds = + session_params->quic_params.idle_connection_timeout_seconds = quic_idle_connection_timeout_seconds; } @@ -385,7 +385,7 @@ if (quic_args->GetInteger( kQuicMaxTimeBeforeCryptoHandshakeSeconds, &quic_max_time_before_crypto_handshake_seconds)) { - session_params->quic_max_time_before_crypto_handshake_seconds = + session_params->quic_params.max_time_before_crypto_handshake_seconds = quic_max_time_before_crypto_handshake_seconds; } @@ -393,14 +393,15 @@ if (quic_args->GetInteger( kQuicMaxIdleTimeBeforeCryptoHandshakeSeconds, &quic_max_idle_time_before_crypto_handshake_seconds)) { - session_params->quic_max_idle_time_before_crypto_handshake_seconds = + session_params->quic_params + .max_idle_time_before_crypto_handshake_seconds = quic_max_idle_time_before_crypto_handshake_seconds; } bool quic_close_sessions_on_ip_change = false; if (quic_args->GetBoolean(kQuicCloseSessionsOnIpChange, &quic_close_sessions_on_ip_change)) { - session_params->quic_close_sessions_on_ip_change = + session_params->quic_params.close_sessions_on_ip_change = quic_close_sessions_on_ip_change; if (quic_close_sessions_on_ip_change && kDefaultQuicGoAwaySessionsOnIpChange) { @@ -408,33 +409,33 @@ // are mutually exclusive. Turn off the goaway option which is // default on for iOS if "close_sessions_on_ip_change" is set via // experimental options. - session_params->quic_goaway_sessions_on_ip_change = false; + session_params->quic_params.goaway_sessions_on_ip_change = false; } } bool goaway_sessions_on_ip_change; if (quic_args->GetBoolean(kQuicGoAwaySessionsOnIpChange, &goaway_sessions_on_ip_change)) { - session_params->quic_goaway_sessions_on_ip_change = + session_params->quic_params.goaway_sessions_on_ip_change = goaway_sessions_on_ip_change; } bool quic_allow_server_migration = false; if (quic_args->GetBoolean(kQuicAllowServerMigration, &quic_allow_server_migration)) { - session_params->quic_allow_server_migration = + session_params->quic_params.allow_server_migration = quic_allow_server_migration; } std::string quic_user_agent_id; if (quic_args->GetString(kQuicUserAgentId, &quic_user_agent_id)) { - session_params->quic_user_agent_id = quic_user_agent_id; + session_params->quic_params.user_agent_id = quic_user_agent_id; } bool quic_enable_socket_recv_optimization = false; if (quic_args->GetBoolean(kQuicEnableSocketRecvOptimization, &quic_enable_socket_recv_optimization)) { - session_params->quic_enable_socket_recv_optimization = + session_params->quic_params.enable_socket_recv_optimization = quic_enable_socket_recv_optimization; } @@ -444,27 +445,27 @@ int quic_max_migrations_to_non_default_network_on_path_degrading = 0; if (quic_args->GetBoolean(kQuicMigrateSessionsOnNetworkChangeV2, &quic_migrate_sessions_on_network_change_v2)) { - session_params->quic_migrate_sessions_on_network_change_v2 = + session_params->quic_params.migrate_sessions_on_network_change_v2 = quic_migrate_sessions_on_network_change_v2; if (quic_args->GetInteger( kQuicMaxTimeOnNonDefaultNetworkSeconds, &quic_max_time_on_non_default_network_seconds)) { - session_params->quic_max_time_on_non_default_network = + session_params->quic_params.max_time_on_non_default_network = base::TimeDelta::FromSeconds( quic_max_time_on_non_default_network_seconds); } if (quic_args->GetInteger( kQuicMaxMigrationsToNonDefaultNetworkOnWriteError, &quic_max_migrations_to_non_default_network_on_write_error)) { - session_params - ->quic_max_migrations_to_non_default_network_on_write_error = + session_params->quic_params + .max_migrations_to_non_default_network_on_write_error = quic_max_migrations_to_non_default_network_on_write_error; } if (quic_args->GetInteger( kQuicMaxMigrationsToNonDefaultNetworkOnPathDegrading, &quic_max_migrations_to_non_default_network_on_path_degrading)) { - session_params - ->quic_max_migrations_to_non_default_network_on_path_degrading = + session_params->quic_params + .max_migrations_to_non_default_network_on_path_degrading = quic_max_migrations_to_non_default_network_on_path_degrading; } } @@ -472,11 +473,12 @@ int quic_idle_session_migration_period_seconds = 0; if (quic_args->GetBoolean(kQuicMigrateIdleSessions, &quic_migrate_idle_sessions)) { - session_params->quic_migrate_idle_sessions = quic_migrate_idle_sessions; + session_params->quic_params.migrate_idle_sessions = + quic_migrate_idle_sessions; if (quic_args->GetInteger( kQuicIdleSessionMigrationPeriodSeconds, &quic_idle_session_migration_period_seconds)) { - session_params->quic_idle_session_migration_period = + session_params->quic_params.idle_session_migration_period = base::TimeDelta::FromSeconds( quic_idle_session_migration_period_seconds); } @@ -485,7 +487,7 @@ bool quic_migrate_sessions_early_v2 = false; if (quic_args->GetBoolean(kQuicMigrateSessionsEarlyV2, &quic_migrate_sessions_early_v2)) { - session_params->quic_migrate_sessions_early_v2 = + session_params->quic_params.migrate_sessions_early_v2 = quic_migrate_sessions_early_v2; } @@ -493,7 +495,8 @@ if (quic_args->GetInteger( kQuicRetransmittableOnWireTimeoutMilliseconds, &quic_retransmittable_on_wire_timeout_milliseconds)) { - session_params->quic_retransmittable_on_wire_timeout_milliseconds = + session_params->quic_params + .retransmittable_on_wire_timeout_milliseconds = quic_retransmittable_on_wire_timeout_milliseconds; } @@ -501,28 +504,29 @@ if (quic_args->GetBoolean( kQuicRetryOnAlternateNetworkBeforeHandshake, &quic_retry_on_alternate_network_before_handshake)) { - session_params->quic_retry_on_alternate_network_before_handshake = + session_params->quic_params + .retry_on_alternate_network_before_handshake = quic_retry_on_alternate_network_before_handshake; } bool quic_race_stale_dns_on_connection = false; if (quic_args->GetBoolean(kQuicRaceStaleDNSOnConnection, &quic_race_stale_dns_on_connection)) { - session_params->quic_race_stale_dns_on_connection = + session_params->quic_params.race_stale_dns_on_connection = quic_race_stale_dns_on_connection; } bool quic_disable_bidirectional_streams = false; if (quic_args->GetBoolean(kQuicDisableBidirectionalStreams, &quic_disable_bidirectional_streams)) { - session_params->quic_disable_bidirectional_streams = + session_params->quic_params.disable_bidirectional_streams = quic_disable_bidirectional_streams; } bool quic_race_cert_verification = false; if (quic_args->GetBoolean(kQuicRaceCertVerification, &quic_race_cert_verification)) { - session_params->quic_race_cert_verification = + session_params->quic_params.race_cert_verification = quic_race_cert_verification; } @@ -742,10 +746,10 @@ session_params.enable_http2 = enable_spdy; session_params.enable_quic = enable_quic; if (enable_quic) { - session_params.quic_user_agent_id = quic_user_agent_id; + session_params.quic_params.user_agent_id = quic_user_agent_id; // Note goaway sessions on ip change will be turned on by default // for iOS unless overrided via experiemental options. - session_params.quic_goaway_sessions_on_ip_change = + session_params.quic_params.goaway_sessions_on_ip_change = kDefaultQuicGoAwaySessionsOnIpChange; }
diff --git a/components/cronet/url_request_context_config_unittest.cc b/components/cronet/url_request_context_config_unittest.cc index ff2729a7..3478267 100644 --- a/components/cronet/url_request_context_config_unittest.cc +++ b/components/cronet/url_request_context_config_unittest.cc
@@ -189,28 +189,28 @@ quic_connection_options.push_back(quic::kTIME); quic_connection_options.push_back(quic::kTBBR); quic_connection_options.push_back(quic::kREJ); - EXPECT_EQ(quic_connection_options, params->quic_connection_options); + EXPECT_EQ(quic_connection_options, params->quic_params.connection_options); // Check Custom QUIC User Agent Id. - EXPECT_EQ("Custom QUIC UAID", params->quic_user_agent_id); + EXPECT_EQ("Custom QUIC UAID", params->quic_params.user_agent_id); // Check max_server_configs_stored_in_properties. - EXPECT_EQ(2u, params->quic_max_server_configs_stored_in_properties); + EXPECT_EQ(2u, params->quic_params.max_server_configs_stored_in_properties); // Check idle_connection_timeout_seconds. - EXPECT_EQ(300, params->quic_idle_connection_timeout_seconds); + EXPECT_EQ(300, params->quic_params.idle_connection_timeout_seconds); - EXPECT_TRUE(params->quic_close_sessions_on_ip_change); - EXPECT_FALSE(params->quic_goaway_sessions_on_ip_change); - EXPECT_FALSE(params->quic_allow_server_migration); - EXPECT_FALSE(params->quic_migrate_sessions_on_network_change_v2); - EXPECT_FALSE(params->quic_migrate_sessions_early_v2); - EXPECT_FALSE(params->quic_migrate_idle_sessions); - EXPECT_FALSE(params->quic_retry_on_alternate_network_before_handshake); - EXPECT_FALSE(params->quic_race_stale_dns_on_connection); + EXPECT_TRUE(params->quic_params.close_sessions_on_ip_change); + EXPECT_FALSE(params->quic_params.goaway_sessions_on_ip_change); + EXPECT_FALSE(params->quic_params.allow_server_migration); + EXPECT_FALSE(params->quic_params.migrate_sessions_on_network_change_v2); + EXPECT_FALSE(params->quic_params.migrate_sessions_early_v2); + EXPECT_FALSE(params->quic_params.migrate_idle_sessions); + EXPECT_FALSE(params->quic_params.retry_on_alternate_network_before_handshake); + EXPECT_FALSE(params->quic_params.race_stale_dns_on_connection); // Check race_cert_verification. - EXPECT_TRUE(params->quic_race_cert_verification); + EXPECT_TRUE(params->quic_params.race_cert_verification); #if defined(ENABLE_BUILT_IN_DNS) // Check AsyncDNS resolver is enabled (not supported on iOS). @@ -336,8 +336,8 @@ std::unique_ptr<net::URLRequestContext> context(builder.Build()); const net::HttpNetworkSession::Params* params = context->GetNetworkSessionParams(); - EXPECT_EQ(params->quic_supported_versions.size(), 1u); - EXPECT_EQ(params->quic_supported_versions[0], + EXPECT_EQ(params->quic_params.supported_versions.size(), 1u); + EXPECT_EQ(params->quic_params.supported_versions[0], quic::ParsedQuicVersion(quic::PROTOCOL_QUIC_CRYPTO, quic::QUIC_VERSION_46)); } @@ -389,8 +389,8 @@ std::unique_ptr<net::URLRequestContext> context(builder.Build()); const net::HttpNetworkSession::Params* params = context->GetNetworkSessionParams(); - EXPECT_EQ(params->quic_supported_versions.size(), 1u); - EXPECT_EQ(params->quic_supported_versions[0], + EXPECT_EQ(params->quic_params.supported_versions.size(), 1u); + EXPECT_EQ(params->quic_params.supported_versions[0], quic::ParsedQuicVersion(quic::PROTOCOL_QUIC_CRYPTO, quic::QUIC_VERSION_46)); } @@ -443,8 +443,8 @@ const net::HttpNetworkSession::Params* params = context->GetNetworkSessionParams(); - EXPECT_FALSE(params->quic_close_sessions_on_ip_change); - EXPECT_TRUE(params->quic_allow_server_migration); + EXPECT_FALSE(params->quic_params.close_sessions_on_ip_change); + EXPECT_TRUE(params->quic_params.allow_server_migration); } // Test that goaway_sessions_on_ip_change is set on by default for iOS. @@ -504,8 +504,8 @@ const net::HttpNetworkSession::Params* params = context->GetNetworkSessionParams(); - EXPECT_FALSE(params->quic_close_sessions_on_ip_change); - EXPECT_TRUE(params->quic_goaway_sessions_on_ip_change); + EXPECT_FALSE(params->quic_params.close_sessions_on_ip_change); + EXPECT_TRUE(params->quic_params.goaway_sessions_on_ip_change); } // Tests that goaway_sessions_on_ip_changes can be set on via @@ -566,8 +566,8 @@ const net::HttpNetworkSession::Params* params = context->GetNetworkSessionParams(); - EXPECT_FALSE(params->quic_close_sessions_on_ip_change); - EXPECT_TRUE(params->quic_goaway_sessions_on_ip_change); + EXPECT_FALSE(params->quic_params.close_sessions_on_ip_change); + EXPECT_TRUE(params->quic_params.goaway_sessions_on_ip_change); } // Test that goaway_sessions_on_ip_change can be set to false via @@ -628,8 +628,8 @@ const net::HttpNetworkSession::Params* params = context->GetNetworkSessionParams(); - EXPECT_FALSE(params->quic_close_sessions_on_ip_change); - EXPECT_FALSE(params->quic_goaway_sessions_on_ip_change); + EXPECT_FALSE(params->quic_params.close_sessions_on_ip_change); + EXPECT_FALSE(params->quic_params.goaway_sessions_on_ip_change); } TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationV2Options) { @@ -688,19 +688,21 @@ const net::HttpNetworkSession::Params* params = context->GetNetworkSessionParams(); - EXPECT_TRUE(params->quic_migrate_sessions_on_network_change_v2); - EXPECT_TRUE(params->quic_migrate_sessions_early_v2); - EXPECT_TRUE(params->quic_retry_on_alternate_network_before_handshake); - EXPECT_EQ(1000, params->quic_retransmittable_on_wire_timeout_milliseconds); - EXPECT_TRUE(params->quic_migrate_idle_sessions); + EXPECT_TRUE(params->quic_params.migrate_sessions_on_network_change_v2); + EXPECT_TRUE(params->quic_params.migrate_sessions_early_v2); + EXPECT_TRUE(params->quic_params.retry_on_alternate_network_before_handshake); + EXPECT_EQ(1000, + params->quic_params.retransmittable_on_wire_timeout_milliseconds); + EXPECT_TRUE(params->quic_params.migrate_idle_sessions); EXPECT_EQ(base::TimeDelta::FromSeconds(15), - params->quic_idle_session_migration_period); + params->quic_params.idle_session_migration_period); EXPECT_EQ(base::TimeDelta::FromSeconds(10), - params->quic_max_time_on_non_default_network); - EXPECT_EQ(3, - params->quic_max_migrations_to_non_default_network_on_write_error); + params->quic_params.max_time_on_non_default_network); EXPECT_EQ( - 4, params->quic_max_migrations_to_non_default_network_on_path_degrading); + 3, + params->quic_params.max_migrations_to_non_default_network_on_write_error); + EXPECT_EQ(4, params->quic_params + .max_migrations_to_non_default_network_on_path_degrading); } TEST(URLRequestContextConfigTest, SetQuicStaleDNSracing) { @@ -751,7 +753,7 @@ const net::HttpNetworkSession::Params* params = context->GetNetworkSessionParams(); - EXPECT_TRUE(params->quic_race_stale_dns_on_connection); + EXPECT_TRUE(params->quic_params.race_stale_dns_on_connection); } TEST(URLRequestContextConfigTest, SetQuicHostWhitelist) { @@ -855,8 +857,9 @@ const net::HttpNetworkSession::Params* params = context->GetNetworkSessionParams(); - EXPECT_EQ(7, params->quic_max_time_before_crypto_handshake_seconds); - EXPECT_EQ(11, params->quic_max_idle_time_before_crypto_handshake_seconds); + EXPECT_EQ(7, params->quic_params.max_time_before_crypto_handshake_seconds); + EXPECT_EQ(11, + params->quic_params.max_idle_time_before_crypto_handshake_seconds); } TEST(URLURLRequestContextConfigTest, SetQuicConnectionOptions) { @@ -912,12 +915,13 @@ connection_options.push_back(quic::kTIME); connection_options.push_back(quic::kTBBR); connection_options.push_back(quic::kREJ); - EXPECT_EQ(connection_options, params->quic_connection_options); + EXPECT_EQ(connection_options, params->quic_params.connection_options); quic::QuicTagVector client_connection_options; client_connection_options.push_back(quic::kTBBR); client_connection_options.push_back(quic::k1RTT); - EXPECT_EQ(client_connection_options, params->quic_client_connection_options); + EXPECT_EQ(client_connection_options, + params->quic_params.client_connection_options); } TEST(URLURLRequestContextConfigTest, SetAcceptLanguageAndUserAgent) {
diff --git a/components/dom_distiller_strings_grdp/OWNERS b/components/dom_distiller_strings_grdp/OWNERS index 9db3893..1b6f4e1a 100644 --- a/components/dom_distiller_strings_grdp/OWNERS +++ b/components/dom_distiller_strings_grdp/OWNERS
@@ -1 +1,2 @@ file://components/dom_distiller/OWNERS +# COMPONENT: UI>Browser>ReaderMode
diff --git a/components/download/public/common/download_danger_type.h b/components/download/public/common/download_danger_type.h index bf83d4b..e93fbb52 100644 --- a/components/download/public/common/download_danger_type.h +++ b/components/download/public/common/download_danger_type.h
@@ -50,6 +50,9 @@ // Download is pending a more detailed verdict. DOWNLOAD_DANGER_TYPE_ASYNC_SCANNING = 10, + // Download is password protected, and should be blocked according to policy. + DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED = 11, + // Memory space for histograms is determined by the max. // ALWAYS ADD NEW VALUES BEFORE THIS ONE. DOWNLOAD_DANGER_TYPE_MAX
diff --git a/components/exo/wayland/wl_output.cc b/components/exo/wayland/wl_output.cc index 91c7cf0..b6b80bf5 100644 --- a/components/exo/wayland/wl_output.cc +++ b/components/exo/wayland/wl_output.cc
@@ -22,6 +22,12 @@ //////////////////////////////////////////////////////////////////////////////// // wl_output_interface: +void output_release(wl_client* client, wl_resource* resource) { + wl_resource_destroy(resource); +} + +const struct wl_output_interface output_implementation = {output_release}; + void bind_output(wl_client* client, void* data, uint32_t version, uint32_t id) { WaylandDisplayOutput* output = static_cast<WaylandDisplayOutput*>(data); @@ -29,7 +35,7 @@ client, &wl_output_interface, std::min(version, kWlOutputVersion), id); SetImplementation( - resource, nullptr, + resource, &output_implementation, std::make_unique<WaylandDisplayObserver>(output->id(), resource)); }
diff --git a/components/exo/wayland/wl_output.h b/components/exo/wayland/wl_output.h index c0f7ffe..9721629c 100644 --- a/components/exo/wayland/wl_output.h +++ b/components/exo/wayland/wl_output.h
@@ -12,7 +12,7 @@ namespace exo { namespace wayland { -constexpr uint32_t kWlOutputVersion = 2; +constexpr uint32_t kWlOutputVersion = 3; void bind_output(wl_client* client, void* data, uint32_t version, uint32_t id);
diff --git a/components/history/content/browser/download_conversions.cc b/components/history/content/browser/download_conversions.cc index 4dcf7d5f..3aae6419 100644 --- a/components/history/content/browser/download_conversions.cc +++ b/components/history/content/browser/download_conversions.cc
@@ -74,6 +74,8 @@ return download::DOWNLOAD_DANGER_TYPE_WHITELISTED_BY_POLICY; case DownloadDangerType::ASYNC_SCANNING: return download::DOWNLOAD_DANGER_TYPE_ASYNC_SCANNING; + case DownloadDangerType::BLOCKED_PASSWORD_PROTECTED: + return download::DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED; case DownloadDangerType::INVALID: NOTREACHED(); return download::DOWNLOAD_DANGER_TYPE_MAX; @@ -107,6 +109,8 @@ return DownloadDangerType::WHITELISTED_BY_POLICY; case download::DOWNLOAD_DANGER_TYPE_ASYNC_SCANNING: return DownloadDangerType::ASYNC_SCANNING; + case download::DOWNLOAD_DANGER_TYPE_BLOCKED_PASSWORD_PROTECTED: + return DownloadDangerType::BLOCKED_PASSWORD_PROTECTED; default: NOTREACHED(); return DownloadDangerType::INVALID;
diff --git a/components/history/core/browser/download_constants.h b/components/history/core/browser/download_constants.h index 0f87d6f..96fc825 100644 --- a/components/history/core/browser/download_constants.h +++ b/components/history/core/browser/download_constants.h
@@ -37,6 +37,7 @@ POTENTIALLY_UNWANTED = 8, WHITELISTED_BY_POLICY = 9, ASYNC_SCANNING = 10, + BLOCKED_PASSWORD_PROTECTED = 11, }; // DownloadId represents the id of a DownloadRow into the DownloadDatabase.
diff --git a/components/history/core/browser/download_types.cc b/components/history/core/browser/download_types.cc index 0234542..0a155da 100644 --- a/components/history/core/browser/download_types.cc +++ b/components/history/core/browser/download_types.cc
@@ -65,6 +65,7 @@ case DownloadDangerType::POTENTIALLY_UNWANTED: case DownloadDangerType::WHITELISTED_BY_POLICY: case DownloadDangerType::ASYNC_SCANNING: + case DownloadDangerType::BLOCKED_PASSWORD_PROTECTED: return static_cast<DownloadDangerType>(danger_type); case DownloadDangerType::INVALID: @@ -106,6 +107,9 @@ return stream << "history::DownloadDangerType::WHITELISTED_BY_POLICY"; case DownloadDangerType::ASYNC_SCANNING: return stream << "history::DownloadDangerType::ASYNC_SCANNING"; + case DownloadDangerType::BLOCKED_PASSWORD_PROTECTED: + return stream + << "history::DownloadDangerType::BLOCKED_PASSWORD_PROTECTED"; } NOTREACHED(); return stream;
diff --git a/components/nacl/OWNERS b/components/nacl/OWNERS index 4d29309..29154dc 100644 --- a/components/nacl/OWNERS +++ b/components/nacl/OWNERS
@@ -3,3 +3,4 @@ mseaborn@chromium.org # COMPONENT: Platform>NaCl +# TEAM: chromium-reviews@chromium.org
diff --git a/components/network_session_configurator/browser/network_session_configurator.cc b/components/network_session_configurator/browser/network_session_configurator.cc index 287bf91..409c0685 100644 --- a/components/network_session_configurator/browser/network_session_configurator.cc +++ b/components/network_session_configurator/browser/network_session_configurator.cc
@@ -451,123 +451,125 @@ params->enable_quic = ShouldEnableQuic(quic_trial_group, quic_trial_params, is_quic_force_disabled, is_quic_force_enabled); - params->mark_quic_broken_when_network_blackholes = + params->quic_params.mark_quic_broken_when_network_blackholes = ShouldMarkQuicBrokenWhenNetworkBlackholes(quic_trial_params); params->enable_server_push_cancellation = ShouldEnableServerPushCancelation(quic_trial_params); - params->retry_without_alt_svc_on_quic_errors = + params->quic_params.retry_without_alt_svc_on_quic_errors = ShouldRetryWithoutAltSvcOnQuicErrors(quic_trial_params); - params->support_ietf_format_quic_altsvc = + params->quic_params.support_ietf_format_quic_altsvc = ShouldSupportIetfFormatQuicAltSvc(quic_trial_params); if (params->enable_quic) { params->enable_quic_proxies_for_https_urls = ShouldEnableQuicProxiesForHttpsUrls(quic_trial_params); - params->quic_connection_options = + params->quic_params.connection_options = GetQuicConnectionOptions(quic_trial_params); - params->quic_client_connection_options = + params->quic_params.client_connection_options = GetQuicClientConnectionOptions(quic_trial_params); - params->quic_close_sessions_on_ip_change = + params->quic_params.close_sessions_on_ip_change = ShouldQuicCloseSessionsOnIpChange(quic_trial_params); - params->quic_goaway_sessions_on_ip_change = + params->quic_params.goaway_sessions_on_ip_change = ShouldQuicGoAwaySessionsOnIpChange(quic_trial_params); int idle_connection_timeout_seconds = GetQuicIdleConnectionTimeoutSeconds(quic_trial_params); if (idle_connection_timeout_seconds != 0) { - params->quic_idle_connection_timeout_seconds = + params->quic_params.idle_connection_timeout_seconds = idle_connection_timeout_seconds; } int reduced_ping_timeout_seconds = GetQuicReducedPingTimeoutSeconds(quic_trial_params); if (reduced_ping_timeout_seconds > 0 && reduced_ping_timeout_seconds < quic::kPingTimeoutSecs) { - params->quic_reduced_ping_timeout_seconds = reduced_ping_timeout_seconds; + params->quic_params.reduced_ping_timeout_seconds = + reduced_ping_timeout_seconds; } int max_time_before_crypto_handshake_seconds = GetQuicMaxTimeBeforeCryptoHandshakeSeconds(quic_trial_params); if (max_time_before_crypto_handshake_seconds > 0) { - params->quic_max_time_before_crypto_handshake_seconds = + params->quic_params.max_time_before_crypto_handshake_seconds = max_time_before_crypto_handshake_seconds; } int max_idle_time_before_crypto_handshake_seconds = GetQuicMaxIdleTimeBeforeCryptoHandshakeSeconds(quic_trial_params); if (max_idle_time_before_crypto_handshake_seconds > 0) { - params->quic_max_idle_time_before_crypto_handshake_seconds = + params->quic_params.max_idle_time_before_crypto_handshake_seconds = max_idle_time_before_crypto_handshake_seconds; } - params->quic_race_cert_verification = + params->quic_params.race_cert_verification = ShouldQuicRaceCertVerification(quic_trial_params); - params->quic_estimate_initial_rtt = + params->quic_params.estimate_initial_rtt = ShouldQuicEstimateInitialRtt(quic_trial_params); - params->quic_headers_include_h2_stream_dependency = + params->quic_params.headers_include_h2_stream_dependency = ShouldQuicHeadersIncludeH2StreamDependencies(quic_trial_params); - params->quic_migrate_sessions_on_network_change_v2 = + params->quic_params.migrate_sessions_on_network_change_v2 = ShouldQuicMigrateSessionsOnNetworkChangeV2(quic_trial_params); - params->quic_migrate_sessions_early_v2 = + params->quic_params.migrate_sessions_early_v2 = ShouldQuicMigrateSessionsEarlyV2(quic_trial_params); - params->quic_retry_on_alternate_network_before_handshake = + params->quic_params.retry_on_alternate_network_before_handshake = ShouldQuicRetryOnAlternateNetworkBeforeHandshake(quic_trial_params); - params->quic_go_away_on_path_degrading = + params->quic_params.go_away_on_path_degrading = ShouldQuicGoawayOnPathDegrading(quic_trial_params); int initial_rtt_for_handshake_milliseconds = GetQuicInitialRttForHandshakeMilliseconds(quic_trial_params); if (initial_rtt_for_handshake_milliseconds > 0) { - params->quic_initial_rtt_for_handshake_milliseconds = + params->quic_params.initial_rtt_for_handshake_milliseconds = initial_rtt_for_handshake_milliseconds; } int retransmittable_on_wire_timeout_milliseconds = GetQuicRetransmittableOnWireTimeoutMilliseconds(quic_trial_params); if (retransmittable_on_wire_timeout_milliseconds > 0) { - params->quic_retransmittable_on_wire_timeout_milliseconds = + params->quic_params.retransmittable_on_wire_timeout_milliseconds = retransmittable_on_wire_timeout_milliseconds; } - params->quic_migrate_idle_sessions = + params->quic_params.migrate_idle_sessions = ShouldQuicMigrateIdleSessions(quic_trial_params); int idle_session_migration_period_seconds = GetQuicIdleSessionMigrationPeriodSeconds(quic_trial_params); if (idle_session_migration_period_seconds > 0) { - params->quic_idle_session_migration_period = + params->quic_params.idle_session_migration_period = base::TimeDelta::FromSeconds(idle_session_migration_period_seconds); } int max_time_on_non_default_network_seconds = GetQuicMaxTimeOnNonDefaultNetworkSeconds(quic_trial_params); if (max_time_on_non_default_network_seconds > 0) { - params->quic_max_time_on_non_default_network = + params->quic_params.max_time_on_non_default_network = base::TimeDelta::FromSeconds(max_time_on_non_default_network_seconds); } int max_migrations_to_non_default_network_on_write_error = GetQuicMaxNumMigrationsToNonDefaultNetworkOnWriteError( quic_trial_params); if (max_migrations_to_non_default_network_on_write_error > 0) { - params->quic_max_migrations_to_non_default_network_on_write_error = + params->quic_params.max_migrations_to_non_default_network_on_write_error = max_migrations_to_non_default_network_on_write_error; } int max_migrations_to_non_default_network_on_path_degrading = GetQuicMaxNumMigrationsToNonDefaultNetworkOnPathDegrading( quic_trial_params); if (max_migrations_to_non_default_network_on_path_degrading > 0) { - params->quic_max_migrations_to_non_default_network_on_path_degrading = + params->quic_params + .max_migrations_to_non_default_network_on_path_degrading = max_migrations_to_non_default_network_on_path_degrading; } - params->quic_allow_server_migration = + params->quic_params.allow_server_migration = ShouldQuicAllowServerMigration(quic_trial_params); params->quic_host_whitelist = GetQuicHostWhitelist(quic_trial_params); } size_t max_packet_length = GetQuicMaxPacketLength(quic_trial_params); if (max_packet_length != 0) { - params->quic_max_packet_length = max_packet_length; + params->quic_params.max_packet_length = max_packet_length; } - params->quic_user_agent_id = quic_user_agent_id; + params->quic_params.user_agent_id = quic_user_agent_id; quic::ParsedQuicVersionVector supported_versions = GetQuicVersions(quic_trial_params); if (!supported_versions.empty()) - params->quic_supported_versions = supported_versions; + params->quic_params.supported_versions = supported_versions; } } // anonymous namespace @@ -629,7 +631,7 @@ if (params->enable_quic) { if (command_line.HasSwitch(switches::kQuicConnectionOptions)) { - params->quic_connection_options = net::ParseQuicConnectionOptions( + params->quic_params.connection_options = net::ParseQuicConnectionOptions( command_line.GetSwitchValueASCII(switches::kQuicConnectionOptions)); } @@ -638,7 +640,7 @@ if (base::StringToUint( command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), &value)) { - params->quic_max_packet_length = value; + params->quic_params.max_packet_length = value; } } @@ -647,7 +649,7 @@ network_session_configurator::ParseQuicVersions( command_line.GetSwitchValueASCII(switches::kQuicVersion)); if (!supported_versions.empty()) - params->quic_supported_versions = supported_versions; + params->quic_params.supported_versions = supported_versions; } if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { @@ -656,11 +658,12 @@ for (const std::string& host_port : base::SplitString( origins, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { if (host_port == "*") - params->origins_to_force_quic_on.insert(net::HostPortPair()); + params->quic_params.origins_to_force_quic_on.insert( + net::HostPortPair()); net::HostPortPair quic_origin = net::HostPortPair::FromString(host_port); if (!quic_origin.IsEmpty()) - params->origins_to_force_quic_on.insert(quic_origin); + params->quic_params.origins_to_force_quic_on.insert(quic_origin); } } }
diff --git a/components/network_session_configurator/browser/network_session_configurator_unittest.cc b/components/network_session_configurator/browser/network_session_configurator_unittest.cc index 67c81dd2..d1f13354 100644 --- a/components/network_session_configurator/browser/network_session_configurator_unittest.cc +++ b/components/network_session_configurator/browser/network_session_configurator_unittest.cc
@@ -71,8 +71,9 @@ EXPECT_FALSE(params_.enable_quic); EXPECT_FALSE(params_.enable_quic_proxies_for_https_urls); - EXPECT_EQ("Chrome/52.0.2709.0 Linux x86_64", params_.quic_user_agent_id); - EXPECT_EQ(0u, params_.origins_to_force_quic_on.size()); + EXPECT_EQ("Chrome/52.0.2709.0 Linux x86_64", + params_.quic_params.user_agent_id); + EXPECT_EQ(0u, params_.quic_params.origins_to_force_quic_on.size()); } TEST_F(NetworkSessionConfiguratorTest, Http2FieldTrialGroupNameDoesNotMatter) { @@ -101,37 +102,40 @@ ParseFieldTrials(); EXPECT_TRUE(params_.enable_quic); - EXPECT_FALSE(params_.mark_quic_broken_when_network_blackholes); - EXPECT_TRUE(params_.retry_without_alt_svc_on_quic_errors); - EXPECT_FALSE(params_.support_ietf_format_quic_altsvc); - EXPECT_EQ(1350u, params_.quic_max_packet_length); - EXPECT_EQ(quic::QuicTagVector(), params_.quic_connection_options); - EXPECT_EQ(quic::QuicTagVector(), params_.quic_client_connection_options); + EXPECT_FALSE(params_.quic_params.mark_quic_broken_when_network_blackholes); + EXPECT_TRUE(params_.quic_params.retry_without_alt_svc_on_quic_errors); + EXPECT_FALSE(params_.quic_params.support_ietf_format_quic_altsvc); + EXPECT_EQ(1350u, params_.quic_params.max_packet_length); + EXPECT_EQ(quic::QuicTagVector(), params_.quic_params.connection_options); + EXPECT_EQ(quic::QuicTagVector(), + params_.quic_params.client_connection_options); EXPECT_FALSE(params_.enable_server_push_cancellation); - EXPECT_FALSE(params_.quic_close_sessions_on_ip_change); - EXPECT_FALSE(params_.quic_goaway_sessions_on_ip_change); + EXPECT_FALSE(params_.quic_params.close_sessions_on_ip_change); + EXPECT_FALSE(params_.quic_params.goaway_sessions_on_ip_change); EXPECT_EQ(net::kIdleConnectionTimeoutSeconds, - params_.quic_idle_connection_timeout_seconds); - EXPECT_EQ(quic::kPingTimeoutSecs, params_.quic_reduced_ping_timeout_seconds); + params_.quic_params.idle_connection_timeout_seconds); + EXPECT_EQ(quic::kPingTimeoutSecs, + params_.quic_params.reduced_ping_timeout_seconds); EXPECT_EQ(quic::kMaxTimeForCryptoHandshakeSecs, - params_.quic_max_time_before_crypto_handshake_seconds); + params_.quic_params.max_time_before_crypto_handshake_seconds); EXPECT_EQ(quic::kInitialIdleTimeoutSecs, - params_.quic_max_idle_time_before_crypto_handshake_seconds); - EXPECT_FALSE(params_.quic_race_cert_verification); - EXPECT_FALSE(params_.quic_estimate_initial_rtt); - EXPECT_FALSE(params_.quic_migrate_sessions_on_network_change_v2); - EXPECT_FALSE(params_.quic_migrate_sessions_early_v2); - EXPECT_FALSE(params_.quic_retry_on_alternate_network_before_handshake); - EXPECT_FALSE(params_.quic_migrate_idle_sessions); - EXPECT_FALSE(params_.quic_go_away_on_path_degrading); - EXPECT_EQ(0, params_.quic_initial_rtt_for_handshake_milliseconds); - EXPECT_FALSE(params_.quic_allow_server_migration); + params_.quic_params.max_idle_time_before_crypto_handshake_seconds); + EXPECT_FALSE(params_.quic_params.race_cert_verification); + EXPECT_FALSE(params_.quic_params.estimate_initial_rtt); + EXPECT_FALSE(params_.quic_params.migrate_sessions_on_network_change_v2); + EXPECT_FALSE(params_.quic_params.migrate_sessions_early_v2); + EXPECT_FALSE(params_.quic_params.retry_on_alternate_network_before_handshake); + EXPECT_FALSE(params_.quic_params.migrate_idle_sessions); + EXPECT_FALSE(params_.quic_params.go_away_on_path_degrading); + EXPECT_EQ(0, params_.quic_params.initial_rtt_for_handshake_milliseconds); + EXPECT_FALSE(params_.quic_params.allow_server_migration); EXPECT_TRUE(params_.quic_host_whitelist.empty()); - EXPECT_EQ(0, params_.quic_retransmittable_on_wire_timeout_milliseconds); + EXPECT_EQ(0, + params_.quic_params.retransmittable_on_wire_timeout_milliseconds); net::HttpNetworkSession::Params default_params; - EXPECT_EQ(default_params.quic_supported_versions, - params_.quic_supported_versions); + EXPECT_EQ(default_params.quic_params.supported_versions, + params_.quic_params.supported_versions); } TEST_F(NetworkSessionConfiguratorTest, EnableQuicFromParams) { @@ -175,7 +179,7 @@ ParseFieldTrials(); - EXPECT_TRUE(params_.mark_quic_broken_when_network_blackholes); + EXPECT_TRUE(params_.quic_params.mark_quic_broken_when_network_blackholes); } TEST_F(NetworkSessionConfiguratorTest, DisableRetryWithoutAltSvcOnQuicErrors) { @@ -186,7 +190,7 @@ ParseFieldTrials(); - EXPECT_FALSE(params_.retry_without_alt_svc_on_quic_errors); + EXPECT_FALSE(params_.quic_params.retry_without_alt_svc_on_quic_errors); } TEST_F(NetworkSessionConfiguratorTest, SupportIetfFormatQuicAltSvc) { @@ -197,7 +201,7 @@ ParseFieldTrials(); - EXPECT_TRUE(params_.support_ietf_format_quic_altsvc); + EXPECT_TRUE(params_.quic_params.support_ietf_format_quic_altsvc); } TEST_F(NetworkSessionConfiguratorTest, @@ -209,7 +213,7 @@ ParseFieldTrials(); - EXPECT_TRUE(params_.quic_close_sessions_on_ip_change); + EXPECT_TRUE(params_.quic_params.close_sessions_on_ip_change); } TEST_F(NetworkSessionConfiguratorTest, @@ -221,7 +225,7 @@ ParseFieldTrials(); - EXPECT_TRUE(params_.quic_goaway_sessions_on_ip_change); + EXPECT_TRUE(params_.quic_params.goaway_sessions_on_ip_change); } TEST_F(NetworkSessionConfiguratorTest, @@ -233,7 +237,8 @@ ParseFieldTrials(); - EXPECT_EQ(1000, params_.quic_retransmittable_on_wire_timeout_milliseconds); + EXPECT_EQ(1000, + params_.quic_params.retransmittable_on_wire_timeout_milliseconds); } TEST_F(NetworkSessionConfiguratorTest, @@ -245,7 +250,7 @@ ParseFieldTrials(); - EXPECT_EQ(300, params_.quic_idle_connection_timeout_seconds); + EXPECT_EQ(300, params_.quic_params.idle_connection_timeout_seconds); } TEST_F(NetworkSessionConfiguratorTest, @@ -255,7 +260,8 @@ variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); ParseFieldTrials(); - EXPECT_EQ(quic::kPingTimeoutSecs, params_.quic_reduced_ping_timeout_seconds); + EXPECT_EQ(quic::kPingTimeoutSecs, + params_.quic_params.reduced_ping_timeout_seconds); } TEST_F(NetworkSessionConfiguratorTest, @@ -265,7 +271,8 @@ variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); ParseFieldTrials(); - EXPECT_EQ(quic::kPingTimeoutSecs, params_.quic_reduced_ping_timeout_seconds); + EXPECT_EQ(quic::kPingTimeoutSecs, + params_.quic_params.reduced_ping_timeout_seconds); } TEST_F(NetworkSessionConfiguratorTest, @@ -275,7 +282,7 @@ variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); ParseFieldTrials(); - EXPECT_EQ(10, params_.quic_reduced_ping_timeout_seconds); + EXPECT_EQ(10, params_.quic_params.reduced_ping_timeout_seconds); } TEST_F(NetworkSessionConfiguratorTest, @@ -285,7 +292,7 @@ variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); ParseFieldTrials(); - EXPECT_EQ(7, params_.quic_max_time_before_crypto_handshake_seconds); + EXPECT_EQ(7, params_.quic_params.max_time_before_crypto_handshake_seconds); } TEST_F(NetworkSessionConfiguratorTest, @@ -296,7 +303,7 @@ base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); ParseFieldTrials(); EXPECT_EQ(quic::kMaxTimeForCryptoHandshakeSecs, - params_.quic_max_time_before_crypto_handshake_seconds); + params_.quic_params.max_time_before_crypto_handshake_seconds); } TEST_F(NetworkSessionConfiguratorTest, @@ -306,7 +313,8 @@ variations::AssociateVariationParams("QUIC", "Enabled", field_trial_params); base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); ParseFieldTrials(); - EXPECT_EQ(11, params_.quic_max_idle_time_before_crypto_handshake_seconds); + EXPECT_EQ(11, + params_.quic_params.max_idle_time_before_crypto_handshake_seconds); } TEST_F(NetworkSessionConfiguratorTest, @@ -317,7 +325,7 @@ base::FieldTrialList::CreateFieldTrial("QUIC", "Enabled"); ParseFieldTrials(); EXPECT_EQ(quic::kInitialIdleTimeoutSecs, - params_.quic_max_idle_time_before_crypto_handshake_seconds); + params_.quic_params.max_idle_time_before_crypto_handshake_seconds); } TEST_F(NetworkSessionConfiguratorTest, QuicRaceCertVerification) { @@ -328,7 +336,7 @@ ParseFieldTrials(); - EXPECT_TRUE(params_.quic_race_cert_verification); + EXPECT_TRUE(params_.quic_params.race_cert_verification); } TEST_F(NetworkSessionConfiguratorTest, EnableServerPushCancellation) { @@ -350,7 +358,7 @@ ParseFieldTrials(); - EXPECT_TRUE(params_.quic_estimate_initial_rtt); + EXPECT_TRUE(params_.quic_params.estimate_initial_rtt); } TEST_F(NetworkSessionConfiguratorTest, @@ -362,7 +370,7 @@ ParseFieldTrials(); - EXPECT_TRUE(params_.quic_migrate_sessions_on_network_change_v2); + EXPECT_TRUE(params_.quic_params.migrate_sessions_on_network_change_v2); } TEST_F(NetworkSessionConfiguratorTest, @@ -374,7 +382,7 @@ ParseFieldTrials(); - EXPECT_TRUE(params_.quic_migrate_sessions_early_v2); + EXPECT_TRUE(params_.quic_params.migrate_sessions_early_v2); } TEST_F(NetworkSessionConfiguratorTest, @@ -386,7 +394,7 @@ ParseFieldTrials(); - EXPECT_TRUE(params_.quic_retry_on_alternate_network_before_handshake); + EXPECT_TRUE(params_.quic_params.retry_on_alternate_network_before_handshake); } TEST_F(NetworkSessionConfiguratorTest, @@ -398,7 +406,7 @@ ParseFieldTrials(); - EXPECT_TRUE(params_.quic_go_away_on_path_degrading); + EXPECT_TRUE(params_.quic_params.go_away_on_path_degrading); } TEST_F(NetworkSessionConfiguratorTest, @@ -411,9 +419,9 @@ ParseFieldTrials(); - EXPECT_TRUE(params_.quic_migrate_idle_sessions); + EXPECT_TRUE(params_.quic_params.migrate_idle_sessions); EXPECT_EQ(base::TimeDelta::FromSeconds(15), - params_.quic_idle_session_migration_period); + params_.quic_params.idle_session_migration_period); } TEST_F(NetworkSessionConfiguratorTest, @@ -426,7 +434,7 @@ ParseFieldTrials(); EXPECT_EQ(base::TimeDelta::FromSeconds(10), - params_.quic_max_time_on_non_default_network); + params_.quic_params.max_time_on_non_default_network); } TEST_F( @@ -440,8 +448,9 @@ ParseFieldTrials(); - EXPECT_EQ(3, - params_.quic_max_migrations_to_non_default_network_on_write_error); + EXPECT_EQ( + 3, + params_.quic_params.max_migrations_to_non_default_network_on_write_error); } TEST_F( @@ -455,8 +464,8 @@ ParseFieldTrials(); - EXPECT_EQ( - 4, params_.quic_max_migrations_to_non_default_network_on_path_degrading); + EXPECT_EQ(4, params_.quic_params + .max_migrations_to_non_default_network_on_path_degrading); } TEST_F(NetworkSessionConfiguratorTest, @@ -468,7 +477,7 @@ ParseFieldTrials(); - EXPECT_TRUE(params_.quic_allow_server_migration); + EXPECT_TRUE(params_.quic_params.allow_server_migration); } TEST_F(NetworkSessionConfiguratorTest, PacketLengthFromFieldTrialParams) { @@ -479,7 +488,7 @@ ParseFieldTrials(); - EXPECT_EQ(1450u, params_.quic_max_packet_length); + EXPECT_EQ(1450u, params_.quic_params.max_packet_length); } TEST_F(NetworkSessionConfiguratorTest, QuicVersionFromFieldTrialParams) { @@ -494,7 +503,7 @@ quic::ParsedQuicVersionVector supported_versions = { {quic::PROTOCOL_QUIC_CRYPTO, quic::AllSupportedTransportVersions().back()}}; - EXPECT_EQ(supported_versions, params_.quic_supported_versions); + EXPECT_EQ(supported_versions, params_.quic_params.supported_versions); } TEST_F(NetworkSessionConfiguratorTest, @@ -517,7 +526,7 @@ {quic::PROTOCOL_QUIC_CRYPTO, version1}, {quic::PROTOCOL_QUIC_CRYPTO, version2}, }; - EXPECT_EQ(supported_versions, params_.quic_supported_versions); + EXPECT_EQ(supported_versions, params_.quic_params.supported_versions); } TEST_F(NetworkSessionConfiguratorTest, SameQuicVersionsFromFieldTrialParams) { @@ -535,7 +544,7 @@ quic::ParsedQuicVersionVector supported_versions; supported_versions.push_back(quic::AllSupportedVersions().front()); - EXPECT_EQ(supported_versions, params_.quic_supported_versions); + EXPECT_EQ(supported_versions, params_.quic_params.supported_versions); } TEST_F(NetworkSessionConfiguratorTest, @@ -551,7 +560,7 @@ options.push_back(quic::kTIME); options.push_back(quic::kTBBR); options.push_back(quic::kREJ); - EXPECT_EQ(options, params_.quic_connection_options); + EXPECT_EQ(options, params_.quic_params.connection_options); } TEST_F(NetworkSessionConfiguratorTest, @@ -566,7 +575,7 @@ quic::QuicTagVector options; options.push_back(quic::kTBBR); options.push_back(quic::k1RTT); - EXPECT_EQ(options, params_.quic_client_connection_options); + EXPECT_EQ(options, params_.quic_params.client_connection_options); } TEST_F(NetworkSessionConfiguratorTest, QuicHostWhitelist) { @@ -650,7 +659,7 @@ expected_options.push_back(quic::kTIME); expected_options.push_back(quic::kTBBR); expected_options.push_back(quic::kREJ); - EXPECT_EQ(expected_options, params_.quic_connection_options); + EXPECT_EQ(expected_options, params_.quic_params.connection_options); } TEST_F(NetworkSessionConfiguratorTest, QuicMaxPacketLength) { @@ -658,7 +667,7 @@ command_line.AppendSwitch(switches::kEnableQuic); command_line.AppendSwitchASCII(switches::kQuicMaxPacketLength, "42"); ParseCommandLineAndFieldTrials(command_line); - EXPECT_EQ(42u, params_.quic_max_packet_length); + EXPECT_EQ(42u, params_.quic_params.max_packet_length); } TEST_F(NetworkSessionConfiguratorTest, QuicVersion) { @@ -670,8 +679,9 @@ command_line.AppendSwitchASCII(switches::kQuicVersion, quic::QuicVersionToString(version)); ParseCommandLineAndFieldTrials(command_line); - ASSERT_EQ(1u, params_.quic_supported_versions.size()); - EXPECT_EQ(version, params_.quic_supported_versions[0].transport_version); + ASSERT_EQ(1u, params_.quic_params.supported_versions.size()); + EXPECT_EQ(version, + params_.quic_params.supported_versions[0].transport_version); } } @@ -680,8 +690,9 @@ command_line.AppendSwitch(switches::kEnableQuic); command_line.AppendSwitchASCII(switches::kOriginToForceQuicOn, "*"); ParseCommandLineAndFieldTrials(command_line); - EXPECT_EQ(1u, params_.origins_to_force_quic_on.size()); - EXPECT_EQ(1u, params_.origins_to_force_quic_on.count(net::HostPortPair())); + EXPECT_EQ(1u, params_.quic_params.origins_to_force_quic_on.size()); + EXPECT_EQ(1u, params_.quic_params.origins_to_force_quic_on.count( + net::HostPortPair())); } TEST_F(NetworkSessionConfiguratorTest, OriginToForceQuicOn2) { @@ -689,8 +700,8 @@ command_line.AppendSwitch(switches::kEnableQuic); command_line.AppendSwitchASCII(switches::kOriginToForceQuicOn, "foo:1234"); ParseCommandLineAndFieldTrials(command_line); - EXPECT_EQ(1u, params_.origins_to_force_quic_on.size()); - EXPECT_EQ(1u, params_.origins_to_force_quic_on.count( + EXPECT_EQ(1u, params_.quic_params.origins_to_force_quic_on.size()); + EXPECT_EQ(1u, params_.quic_params.origins_to_force_quic_on.count( net::HostPortPair("foo", 1234))); } @@ -699,11 +710,11 @@ command_line.AppendSwitch(switches::kEnableQuic); command_line.AppendSwitchASCII(switches::kOriginToForceQuicOn, "foo:1,bar:2"); ParseCommandLineAndFieldTrials(command_line); - EXPECT_EQ(2u, params_.origins_to_force_quic_on.size()); - EXPECT_EQ( - 1u, params_.origins_to_force_quic_on.count(net::HostPortPair("foo", 1))); - EXPECT_EQ( - 1u, params_.origins_to_force_quic_on.count(net::HostPortPair("bar", 2))); + EXPECT_EQ(2u, params_.quic_params.origins_to_force_quic_on.size()); + EXPECT_EQ(1u, params_.quic_params.origins_to_force_quic_on.count( + net::HostPortPair("foo", 1))); + EXPECT_EQ(1u, params_.quic_params.origins_to_force_quic_on.count( + net::HostPortPair("bar", 2))); } TEST_F(NetworkSessionConfiguratorTest, EnableUserAlternateProtocolPorts) { @@ -785,7 +796,7 @@ ParseFieldTrials(); - EXPECT_TRUE(params_.quic_headers_include_h2_stream_dependency); + EXPECT_TRUE(params_.quic_params.headers_include_h2_stream_dependency); } TEST_F(NetworkSessionConfiguratorTest, Http2GreaseSettings) { @@ -850,7 +861,7 @@ ParseFieldTrials(); - EXPECT_EQ(500, params_.quic_initial_rtt_for_handshake_milliseconds); + EXPECT_EQ(500, params_.quic_params.initial_rtt_for_handshake_milliseconds); } } // namespace network_session_configurator
diff --git a/components/ntp_tiles/OWNERS b/components/ntp_tiles/OWNERS index 91a328f..ec42eef 100644 --- a/components/ntp_tiles/OWNERS +++ b/components/ntp_tiles/OWNERS
@@ -3,3 +3,4 @@ kristipark@chromium.org mastiz@chromium.org treib@chromium.org +# COMPONENT: UI>Browser>ContentSuggestions>History
diff --git a/components/omnibox/browser/BUILD.gn b/components/omnibox/browser/BUILD.gn index a13b546..e42edbee 100644 --- a/components/omnibox/browser/BUILD.gn +++ b/components/omnibox/browser/BUILD.gn
@@ -363,7 +363,7 @@ "//components/test/data/omnibox/Shortcuts.v1.sql", "//components/test/data/omnibox/in_memory_url_index_test.sql", "//components/test/data/omnibox/in_memory_url_index_test_limited.sql", - "//components/test/data/omnibox/on_device_head_test_model.bin", + "//components/test/data/omnibox/on_device_head_test_model_index.bin", ] outputs = [ "{{bundle_resources_dir}}/" +
diff --git a/components/omnibox/browser/on_device_head_provider.cc b/components/omnibox/browser/on_device_head_provider.cc index 5da5881..ec405e26 100644 --- a/components/omnibox/browser/on_device_head_provider.cc +++ b/components/omnibox/browser/on_device_head_provider.cc
@@ -6,15 +6,19 @@ #include <limits> -#include "base/files/file_path.h" +#include "base/files/file_enumerator.h" #include "base/files/file_util.h" #include "base/i18n/case_conversion.h" #include "base/metrics/field_trial_params.h" +#include "base/path_service.h" #include "base/strings/utf_string_conversions.h" #include "base/task/post_task.h" #include "base/trace_event/trace_event.h" +#include "build/build_config.h" +#include "components/component_updater/component_updater_paths.h" #include "components/omnibox/browser/autocomplete_provider_listener.h" #include "components/omnibox/browser/base_search_provider.h" +#include "components/omnibox/browser/on_device_head_provider.h" #include "components/omnibox/common/omnibox_features.h" #include "components/search_engines/search_terms_data.h" #include "components/search_engines/template_url_service.h" @@ -23,6 +27,7 @@ namespace { const int kBaseRelevance = 99; const size_t kMaxRequestId = std::numeric_limits<size_t>::max() - 1; +constexpr char kOnDeviceHeadComponentId[] = "feejiaigafnbpeeogmhmjfmkcjplcneb"; bool IsDefaultSearchProviderGoogle( const TemplateURLService* template_url_service) { @@ -84,6 +89,9 @@ observer_.Add(component_update_service); } } + task_runner_->PostTask( + FROM_HERE, base::BindOnce(&OnDeviceHeadProvider::LoadPreInstalledModel, + weak_ptr_factory_.GetWeakPtr())); } OnDeviceHeadProvider::~OnDeviceHeadProvider() { @@ -160,10 +168,68 @@ done_ = true; } -bool OnDeviceHeadProvider::CreateOnDeviceHeadServingInstance() { - // TODO(crbug.com/925072): A placeholder later will be used to create - // serving instance from downloaded model. - return serving_ ? true : false; +std::string OnDeviceHeadProvider::GetModelFilenameFromInstalledDirectory() + const { + // The model file name always ends with "_index.bin" + base::FileEnumerator model_enum(installed_directory_, false, + base::FileEnumerator::FILES, + FILE_PATH_LITERAL("*_index.bin")); + + base::FilePath model_file_path = model_enum.Next(); + std::string model_filename; + + if (!model_file_path.empty()) { +#if defined(OS_WIN) + model_filename = base::WideToUTF8(model_file_path.value()); +#else + model_filename = model_file_path.value(); +#endif // defined(OS_WIN) + } + + return model_filename; +} + +// static +void OnDeviceHeadProvider::OverrideEnumDirOnDeviceHeadSuggestForTest( + const base::FilePath file_path) { + base::PathService::Override(component_updater::DIR_ON_DEVICE_HEAD_SUGGEST, + file_path); +} + +// TODO(crbug/925072): Consider to add a listener here and in +// OnDeviceHeadSuggestInstallerPolicy::ComponentReady to load the on device +// model; see discussion at https://chromium-review.googlesource.com/1686677. +void OnDeviceHeadProvider::LoadPreInstalledModel() { + // Retry the loading for at most 3 times or until the model is successfully + // loaded. + for (int i = 3;;) { + CreateOnDeviceHeadServingInstance(); + --i; + if (serving_ || i <= 0) + return; + base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(15)); + } +} + +void OnDeviceHeadProvider::DeleteInstalledDirectory() { + // TODO(crbug/925072): Maybe log event if deletion fails. + if (base::PathExists(installed_directory_)) + base::DeleteFile(installed_directory_, true); + + installed_directory_.clear(); +} + +void OnDeviceHeadProvider::CreateOnDeviceHeadServingInstance() { + base::FilePath file_path; + base::PathService::Get(component_updater::DIR_ON_DEVICE_HEAD_SUGGEST, + &file_path); + + if (!file_path.empty() && file_path != installed_directory_) { + DeleteInstalledDirectory(); + installed_directory_ = file_path; + serving_ = OnDeviceHeadServing::Create( + GetModelFilenameFromInstalledDirectory(), provider_max_matches_); + } } void OnDeviceHeadProvider::AddProviderInfo(ProvidersInfo* provider_info) const { @@ -235,11 +301,11 @@ // Events::COMPONENT_UPDATED when the download is finished. In this case we will // reload the new model and maybe clean up the old one. void OnDeviceHeadProvider::OnEvent(Events event, const std::string& id) { - // TODO(crbug.com/925072): Returns early if the given id does not match on - // device head model updater. - if (event != Events::COMPONENT_UPDATED) + if (event != Events::COMPONENT_UPDATED || id != kOnDeviceHeadComponentId) return; - CreateOnDeviceHeadServingInstance(); - // TODO(crbug.com/925072): Cleans up the old model. + task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&OnDeviceHeadProvider::CreateOnDeviceHeadServingInstance, + weak_ptr_factory_.GetWeakPtr())); }
diff --git a/components/omnibox/browser/on_device_head_provider.h b/components/omnibox/browser/on_device_head_provider.h index 7b7fdcb..f4f6939 100644 --- a/components/omnibox/browser/on_device_head_provider.h +++ b/components/omnibox/browser/on_device_head_provider.h
@@ -7,6 +7,7 @@ #include <memory> +#include "base/files/file_path.h" #include "base/scoped_observer.h" #include "components/component_updater/component_updater_service.h" #include "components/omnibox/browser/autocomplete_provider.h" @@ -18,8 +19,10 @@ // An asynchronous autocomplete provider which receives input string and tries // to find the matches in an on device head model. This provider is designed to // help users get suggestions when they are in poor network. -// All matches provided by this provider will have a relevance no greater than -// 99, such that its matches will not show before any other providers. +// By default, all matches provided by this provider will have a relevance no +// greater than 99, such that its matches will not show before any other +// providers; However the relevance can be changed to any arbitrary value by +// Finch when the input is not classified as a URL. class OnDeviceHeadProvider : public AutocompleteProvider, public component_updater::ServiceObserver { public: @@ -30,10 +33,6 @@ void Stop(bool clear_cached_results, bool due_to_user_inactivity) override; void AddProviderInfo(ProvidersInfo* provider_info) const override; - // Creates the on device head serving service from a local head model. - // Returns true if the creation is successful. - bool CreateOnDeviceHeadServingInstance(); - AutocompleteProviderClient* client() { return client_; } private: @@ -59,9 +58,28 @@ // fetches by DoSearch and then calls OnProviderUpdate. void SearchDone(std::unique_ptr<OnDeviceHeadProviderParams> params); + // Helper function which finds the model and return its filename from the + // model installed directory. + std::string GetModelFilenameFromInstalledDirectory() const; + + // Helper function only for unit tests to set the test model directory. + static void OverrideEnumDirOnDeviceHeadSuggestForTest( + const base::FilePath file_path); + + // The function to load pre installed model from DIR_ON_DEVICE_HEAD_SUGGEST + // which will be called during provider's initialization. + void LoadPreInstalledModel(); + + // Clears up the directory which contains the current model. + void DeleteInstalledDirectory(); + // Required by component_updater::ServiceObserver. void OnEvent(Events event, const std::string& id) override; + // Creates the on device head serving service from a local head model, which + // can return up to |provider_max_matches_| suggestions. + void CreateOnDeviceHeadServingInstance(); + AutocompleteProviderClient* client_; AutocompleteProviderListener* listener_; @@ -83,6 +101,9 @@ OnDeviceHeadProvider> observer_; + // The directory where the on device model and its manifest are installed. + base::FilePath installed_directory_; + base::WeakPtrFactory<OnDeviceHeadProvider> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(OnDeviceHeadProvider);
diff --git a/components/omnibox/browser/on_device_head_provider_unittest.cc b/components/omnibox/browser/on_device_head_provider_unittest.cc index ef636c9..1263974 100644 --- a/components/omnibox/browser/on_device_head_provider_unittest.cc +++ b/components/omnibox/browser/on_device_head_provider_unittest.cc
@@ -4,7 +4,6 @@ #include "components/omnibox/browser/on_device_head_provider.h" -#include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/path_service.h" #include "base/strings/string_util.h" @@ -28,7 +27,9 @@ protected: void SetUp() override { client_.reset(new FakeAutocompleteProviderClient()); + SetTestOnDeviceHeadModel(); provider_ = OnDeviceHeadProvider::Create(client_.get(), this); + base::RunLoop().RunUntilIdle(); } void TearDown() override { @@ -42,20 +43,13 @@ // No action required. } - void SetTestOnDeviceHeadServing() { + void SetTestOnDeviceHeadModel() { base::FilePath file_path; base::PathService::Get(base::DIR_SOURCE_ROOT, &file_path); // The same test model also used in ./on_device_head_serving_unittest.cc. - file_path = file_path.AppendASCII( - "components/test/data/omnibox/on_device_head_test_model.bin"); + file_path = file_path.AppendASCII("components/test/data/omnibox"); ASSERT_TRUE(base::PathExists(file_path)); -#if defined(OS_WIN) - provider_->serving_ = - OnDeviceHeadServing::Create(base::WideToUTF8(file_path.value()), 3); -#else - provider_->serving_ = OnDeviceHeadServing::Create(file_path.value(), 3); -#endif - ASSERT_TRUE(provider_->serving_); + OnDeviceHeadProvider::OverrideEnumDirOnDeviceHeadSuggestForTest(file_path); } base::test::ScopedTaskEnvironment scoped_task_environment_; @@ -86,7 +80,6 @@ TestSchemeClassifier()); input.set_want_asynchronous_matches(false); - SetTestOnDeviceHeadServing(); provider_->Start(input, false); if (!provider_->done()) base::RunLoop().RunUntilIdle(); @@ -103,7 +96,6 @@ EXPECT_CALL(*client_.get(), IsOffTheRecord()).WillOnce(Return(true)); - SetTestOnDeviceHeadServing(); provider_->Start(input, false); if (!provider_->done()) base::RunLoop().RunUntilIdle(); @@ -121,7 +113,6 @@ EXPECT_CALL(*client_.get(), IsOffTheRecord()).WillOnce(Return(false)); EXPECT_CALL(*client_.get(), SearchSuggestEnabled()).WillOnce(Return(true)); - SetTestOnDeviceHeadServing(); provider_->Start(input, false); if (!provider_->done()) base::RunLoop().RunUntilIdle(); @@ -139,7 +130,6 @@ EXPECT_CALL(*client_.get(), IsOffTheRecord()).WillOnce(Return(false)); EXPECT_CALL(*client_.get(), SearchSuggestEnabled()).WillOnce(Return(true)); - SetTestOnDeviceHeadServing(); provider_->Start(input, false); if (!provider_->done()) base::RunLoop().RunUntilIdle(); @@ -165,7 +155,6 @@ EXPECT_CALL(*client_.get(), SearchSuggestEnabled()) .WillRepeatedly(Return(true)); - SetTestOnDeviceHeadServing(); provider_->Start(input1, false); EXPECT_FALSE(provider_->done()); provider_->Start(input2, false);
diff --git a/components/omnibox/browser/on_device_head_serving_unittest.cc b/components/omnibox/browser/on_device_head_serving_unittest.cc index ef043ac..10852a81 100644 --- a/components/omnibox/browser/on_device_head_serving_unittest.cc +++ b/components/omnibox/browser/on_device_head_serving_unittest.cc
@@ -53,7 +53,7 @@ base::FilePath file_path; base::PathService::Get(base::DIR_SOURCE_ROOT, &file_path); file_path = file_path.AppendASCII( - "components/test/data/omnibox/on_device_head_test_model.bin"); + "components/test/data/omnibox/on_device_head_test_model_index.bin"); return file_path; }
diff --git a/components/omnibox/browser/vector_icons/clock.icon b/components/omnibox/browser/vector_icons/clock.icon index afc2d935..8c37feb5 100644 --- a/components/omnibox/browser/vector_icons/clock.icon +++ b/components/omnibox/browser/vector_icons/clock.icon
@@ -2,24 +2,26 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Source: time_16px.svg --> SVGOMG --> Skiafy +// Source: bklmn@ provided: clock_16px.svg --> SVGOMG --> Skiafy CANVAS_DIMENSIONS, 16, -MOVE_TO, 8, 0, -ARC_TO, 7.99f, 7.99f, 0, 0, 0, 0, 8, -R_CUBIC_TO, 0, 4.42f, 3.58f, 8, 8, 8, -R_ARC_TO, 8, 8, 0, 1, 0, 0, -16, +MOVE_TO, 7.99f, 1, +ARC_TO, 7, 7, 0, 0, 1, 15, 8, +R_CUBIC_TO, 0, 3.86f, -3.14f, 7, -7.01f, 7, +ARC_TO, 7, 7, 0, 0, 1, 1, 8, +R_CUBIC_TO, 0, -3.86f, 3.13f, -7, 6.99f, -7, CLOSE, -MOVE_TO, 8, 14, -R_CUBIC_TO, -3.31f, 0, -6, -2.68f, -6, -6, -R_CUBIC_TO, 0, -3.32f, 2.69f, -6, 6, -6, -R_CUBIC_TO, 3.31f, 0, 6, 2.69f, 6, 6, -R_CUBIC_TO, 0, 3.31f, -2.68f, 6, -6, 6, +MOVE_TO, 8, 13.6f, +R_CUBIC_TO, 3.09f, 0, 5.6f, -2.51f, 5.6f, -5.6f, +CUBIC_TO_SHORTHAND, 11.09f, 2.4f, 8, 2.4f, +ARC_TO, 5.6f, 5.6f, 0, 0, 0, 2.4f, 8, +R_CUBIC_TO, 0, 3.09f, 2.51f, 5.6f, 5.6f, 5.6f, CLOSE, -MOVE_TO, 8, 5, -H_LINE_TO, 7, -R_V_LINE_TO, 3.93f, -LINE_TO, 10.5f, 11, -R_LINE_TO, 0.5f, -0.81f, -R_LINE_TO, -3, -1.75f, +R_MOVE_TO, 0.35f, -9.1f, +R_V_LINE_TO, 3.68f, +R_LINE_TO, 3.15f, 1.87f, +R_LINE_TO, -0.52f, 0.86f, +LINE_TO, 7.3f, 8.7f, +V_LINE_TO, 4.5f, +R_H_LINE_TO, 1.05f, CLOSE
diff --git a/components/ownership/OWNERS b/components/ownership/OWNERS index 2dcc458..6f8d32d 100644 --- a/components/ownership/OWNERS +++ b/components/ownership/OWNERS
@@ -1 +1,2 @@ alemate@chromium.org +# COMPONENT: Internals
diff --git a/components/page_info_strings.grdp b/components/page_info_strings.grdp index 03db48688..a2cb9e6 100644 --- a/components/page_info_strings.grdp +++ b/components/page_info_strings.grdp
@@ -29,6 +29,20 @@ You're viewing the source of a web page </message> + <!-- Safety Tip summary strings --> + <message name="IDS_PAGE_INFO_SAFETY_TIP_NAME" desc="Name of safety tips, displayed in bold as part of the title of the safety tip bubble."> + Safety tip: + </message> + <message name="IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE" desc="Title of Safety Tip bubble when triggered."> + <ph name="SAFETY_TIP">$1<ex>Safety tip:</ex></ph> suspicious behavior + </message> + <message name="IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_DESCRIPTION" desc="Body of message to display in the page info bubble when you are viewing a page that triggered a safety tip."> + This page might try to trick you, steal personal information, or harm your device. Be cautious when entering personal information or opening downloaded files. + </message> + <message name="IDS_PAGE_INFO_SAFETY_TIP_LEAVE_BUTTON" desc="Text of button to leave a suspicious page shown on the safety tip page info bubble."> + Leave this site + </message> + <!-- Viewing file strings --> <message name="IDS_PAGE_INFO_FILE_PAGE" desc="Message to display in the page info bubble when the page the user has navigated to is a file:// page"> You're viewing a local or shared file
diff --git a/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_DESCRIPTION.png.sha1 b/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_DESCRIPTION.png.sha1 new file mode 100644 index 0000000..db9fb7b --- /dev/null +++ b/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_DESCRIPTION.png.sha1
@@ -0,0 +1 @@ +286691c1acd6ead1593fb72f3bc054fb607a67ed \ No newline at end of file
diff --git a/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE.png.sha1 b/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE.png.sha1 new file mode 100644 index 0000000..db9fb7b --- /dev/null +++ b/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_BAD_REPUTATION_TITLE.png.sha1
@@ -0,0 +1 @@ +286691c1acd6ead1593fb72f3bc054fb607a67ed \ No newline at end of file
diff --git a/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_LEAVE_BUTTON.png.sha1 b/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_LEAVE_BUTTON.png.sha1 new file mode 100644 index 0000000..db9fb7b --- /dev/null +++ b/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_LEAVE_BUTTON.png.sha1
@@ -0,0 +1 @@ +286691c1acd6ead1593fb72f3bc054fb607a67ed \ No newline at end of file
diff --git a/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_NAME.png.sha1 b/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_NAME.png.sha1 new file mode 100644 index 0000000..db9fb7b --- /dev/null +++ b/components/page_info_strings_grdp/IDS_PAGE_INFO_SAFETY_TIP_NAME.png.sha1
@@ -0,0 +1 @@ +286691c1acd6ead1593fb72f3bc054fb607a67ed \ No newline at end of file
diff --git a/components/page_info_strings_grdp/OWNERS b/components/page_info_strings_grdp/OWNERS index 7c601fd..12441de 100644 --- a/components/page_info_strings_grdp/OWNERS +++ b/components/page_info_strings_grdp/OWNERS
@@ -1 +1,2 @@ file://chrome/browser/ui/page_info/OWNERS +# COMPONENT: UI>Browser>Bubbles>PageInfo
diff --git a/components/policy/OWNERS b/components/policy/OWNERS index 83fca31..68959359 100644 --- a/components/policy/OWNERS +++ b/components/policy/OWNERS
@@ -8,4 +8,5 @@ rsorokin@chromium.org zmin@chromium.org -# COMPONENT: Enterprise +# COMPONENT: Enterprise>Cloud Policy +# TEAM: chromium-reviews@chromium.org
diff --git a/components/previews/content/previews_optimization_guide.cc b/components/previews/content/previews_optimization_guide.cc index 1822615..ec54ada 100644 --- a/components/previews/content/previews_optimization_guide.cc +++ b/components/previews/content/previews_optimization_guide.cc
@@ -406,12 +406,6 @@ if (!update_closure.is_null()) std::move(update_closure).Run(); - // Record the result of updating the hints. This is used as a signal for the - // hints being fully processed in testing. - LOCAL_HISTOGRAM_BOOLEAN( - kPreviewsOptimizationGuideUpdateHintsResultHistogramString, - hints_ != NULL); - // If the client is eligible to fetch hints, currently controlled by a feature // flag |kOptimizationHintsFetching|, fetch hints from the remote Optimization // Guide Service.
diff --git a/components/previews/core/previews_constants.cc b/components/previews/core/previews_constants.cc index 7597b091..68263516 100644 --- a/components/previews/core/previews_constants.cc +++ b/components/previews/core/previews_constants.cc
@@ -6,9 +6,6 @@ namespace previews { -const char kPreviewsOptimizationGuideUpdateHintsResultHistogramString[] = - "PreviewsOptimizationGuide.UpdateHints.Result"; - const char kPreviewsOptimizationGuideOnLoadedHintResultHistogramString[] = "PreviewsOptimizationGuide.OnLoadedHint.Result";
diff --git a/components/previews/core/previews_constants.h b/components/previews/core/previews_constants.h index 87216f4..7c90a47 100644 --- a/components/previews/core/previews_constants.h +++ b/components/previews/core/previews_constants.h
@@ -7,10 +7,6 @@ namespace previews { -// The local histogram used by PreviewsOptimizationGuide to record the result of -// UpdateHints(). -extern const char kPreviewsOptimizationGuideUpdateHintsResultHistogramString[]; - // The local histogram used by PreviewsOptimizationGuide to record that a hint // finished loading. extern const char kPreviewsOptimizationGuideOnLoadedHintResultHistogramString[];
diff --git a/components/reading_list/OWNERS b/components/reading_list/OWNERS index c6815f7..918a15b 100644 --- a/components/reading_list/OWNERS +++ b/components/reading_list/OWNERS
@@ -1,2 +1,4 @@ noyau@chromium.org olivierrobin@chromium.org +# COMPONENT: UI>Browser>ReaderMode +# TEAM: ios-directory-owners@chromium.org
diff --git a/components/safe_browsing/browser/base_parallel_resource_throttle.cc b/components/safe_browsing/browser/base_parallel_resource_throttle.cc index 94bc744..ddb86f3 100644 --- a/components/safe_browsing/browser/base_parallel_resource_throttle.cc +++ b/components/safe_browsing/browser/base_parallel_resource_throttle.cc
@@ -81,8 +81,12 @@ : request_(request), resource_type_(resource_type) { content::ResourceRequestInfo* info = content::ResourceRequestInfo::ForRequest(request_); - auto throttle = BrowserURLLoaderThrottle::MaybeCreate( - std::move(url_checker_delegate), info->GetWebContentsGetterForRequest()); + auto throttle = BrowserURLLoaderThrottle::Create( + base::BindOnce([](scoped_refptr<UrlCheckerDelegate> delegate, + content::ResourceContext*) { return delegate; }, + url_checker_delegate), + info->GetWebContentsGetterForRequest(), info->GetFrameTreeNodeId(), + info->GetContext()); url_loader_throttle_holder_ = std::make_unique<URLLoaderThrottleHolder>(this, std::move(throttle)); }
diff --git a/components/safe_browsing/browser/browser_url_loader_throttle.cc b/components/safe_browsing/browser/browser_url_loader_throttle.cc index a90c39a..cf40771 100644 --- a/components/safe_browsing/browser/browser_url_loader_throttle.cc +++ b/components/safe_browsing/browser/browser_url_loader_throttle.cc
@@ -11,32 +11,169 @@ #include "components/safe_browsing/browser/url_checker_delegate.h" #include "components/safe_browsing/common/safebrowsing_constants.h" #include "components/safe_browsing/common/utils.h" +#include "content/public/browser/browser_task_traits.h" #include "net/log/net_log_event_type.h" #include "net/url_request/redirect_info.h" #include "services/network/public/cpp/resource_request.h" #include "services/network/public/cpp/resource_response.h" namespace safe_browsing { +namespace { -// static -std::unique_ptr<BrowserURLLoaderThrottle> BrowserURLLoaderThrottle::MaybeCreate( - scoped_refptr<UrlCheckerDelegate> url_checker_delegate, - const base::Callback<content::WebContents*()>& web_contents_getter) { - if (!url_checker_delegate || - !url_checker_delegate->GetDatabaseManager()->IsSupported()) { - return nullptr; +// Runs |task| on the thread specified by |thread_id| if already on that thread, +// otherwise posts a task to that thread. +void RunOrPostTaskIfNecessary(const base::Location& from_here, + content::BrowserThread::ID thread_id, + base::OnceClosure task) { + if (content::BrowserThread::CurrentlyOn(thread_id)) { + std::move(task).Run(); + return; } + base::PostTaskWithTraits(from_here, {thread_id}, std::move(task)); +} + +} // namespace + +// TODO(http://crbug.com/824843): Remove this if safe browsing is moved to the +// UI thread. +class BrowserURLLoaderThrottle::CheckerOnIO + : public base::SupportsWeakPtr<BrowserURLLoaderThrottle::CheckerOnIO> { + public: + CheckerOnIO( + GetDelegateCallback delegate_getter, + content::ResourceContext* resource_context, + int frame_tree_node_id, + base::RepeatingCallback<content::WebContents*()> web_contents_getter, + content::BrowserThread::ID throttle_thread_id, + base::WeakPtr<BrowserURLLoaderThrottle> throttle) + : delegate_getter_(std::move(delegate_getter)), + resource_context_(resource_context), + frame_tree_node_id_(frame_tree_node_id), + web_contents_getter_(web_contents_getter), + throttle_thread_id_(throttle_thread_id), + throttle_(std::move(throttle)) {} + + // Starts the initial safe browsing check. This check and future checks may be + // skipped after checking with the UrlCheckerDelegate. + void Start(const net::HttpRequestHeaders& headers, + int load_flags, + content::ResourceType resource_type, + bool has_user_gesture, + bool originated_from_service_worker, + const GURL& url, + const std::string& method) { + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + scoped_refptr<UrlCheckerDelegate> url_checker_delegate = + std::move(delegate_getter_).Run(resource_context_); + skip_checks_ = !url_checker_delegate || + !url_checker_delegate->GetDatabaseManager()->IsSupported() || + url_checker_delegate->ShouldSkipRequestCheck( + resource_context_, url, frame_tree_node_id_, + -1 /* render_process_id */, -1 /* render_frame_id */, + originated_from_service_worker); + if (skip_checks_) { + RunOrPostTaskIfNecessary( + FROM_HERE, throttle_thread_id_, + base::BindOnce(&BrowserURLLoaderThrottle::SkipChecks, throttle_)); + return; + } + + url_checker_ = std::make_unique<SafeBrowsingUrlCheckerImpl>( + headers, load_flags, resource_type, has_user_gesture, + url_checker_delegate, web_contents_getter_); + + CheckUrl(url, method); + } + + // Checks the specified |url| using |url_checker_|. + void CheckUrl(const GURL& url, const std::string& method) { + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + if (skip_checks_) { + RunOrPostTaskIfNecessary( + FROM_HERE, throttle_thread_id_, + base::BindOnce(&BrowserURLLoaderThrottle::SkipChecks, throttle_)); + return; + } + + DCHECK(url_checker_); + url_checker_->CheckUrl( + url, method, + base::BindOnce(&BrowserURLLoaderThrottle::CheckerOnIO::OnCheckUrlResult, + base::Unretained(this))); + } + + private: + // If |slow_check_notifier| is non-null, it indicates that a "slow check" is + // ongoing, i.e., the URL may be unsafe and a more time-consuming process is + // required to get the final result. In that case, the rest of the callback + // arguments should be ignored. This method sets the |slow_check_notifier| + // output parameter to a callback to receive the final result. + void OnCheckUrlResult(NativeUrlCheckNotifier* slow_check_notifier, + bool proceed, + bool showed_interstitial) { + if (!slow_check_notifier) { + OnCompleteCheck(false /* slow_check */, proceed, showed_interstitial); + return; + } + + RunOrPostTaskIfNecessary( + FROM_HERE, throttle_thread_id_, + base::BindOnce(&BrowserURLLoaderThrottle::NotifySlowCheck, throttle_)); + + // In this case |proceed| and |showed_interstitial| should be ignored. The + // result will be returned by calling |*slow_check_notifier| callback. + *slow_check_notifier = + base::BindOnce(&BrowserURLLoaderThrottle::CheckerOnIO::OnCompleteCheck, + base::Unretained(this), true /* slow_check */); + } + + // |slow_check| indicates whether it reports the result of a slow check. + // (Please see comments of OnCheckUrlResult() for what slow check means). + void OnCompleteCheck(bool slow_check, + bool proceed, + bool showed_interstitial) { + RunOrPostTaskIfNecessary( + FROM_HERE, throttle_thread_id_, + base::BindOnce(&BrowserURLLoaderThrottle::OnCompleteCheck, throttle_, + slow_check, proceed, showed_interstitial)); + } + + // The following member stays valid until |url_checker_| is created. + GetDelegateCallback delegate_getter_; + + content::ResourceContext* resource_context_; + std::unique_ptr<SafeBrowsingUrlCheckerImpl> url_checker_; + int frame_tree_node_id_; + base::RepeatingCallback<content::WebContents*()> web_contents_getter_; + bool skip_checks_ = false; + content::BrowserThread::ID throttle_thread_id_; + base::WeakPtr<BrowserURLLoaderThrottle> throttle_; +}; + +// static +std::unique_ptr<BrowserURLLoaderThrottle> BrowserURLLoaderThrottle::Create( + GetDelegateCallback delegate_getter, + const base::Callback<content::WebContents*()>& web_contents_getter, + int frame_tree_node_id, + content::ResourceContext* resource_context) { return base::WrapUnique<BrowserURLLoaderThrottle>( - new BrowserURLLoaderThrottle(std::move(url_checker_delegate), - web_contents_getter)); + new BrowserURLLoaderThrottle(std::move(delegate_getter), + web_contents_getter, frame_tree_node_id, + resource_context)); } BrowserURLLoaderThrottle::BrowserURLLoaderThrottle( - scoped_refptr<UrlCheckerDelegate> url_checker_delegate, - const base::Callback<content::WebContents*()>& web_contents_getter) - : url_checker_delegate_(std::move(url_checker_delegate)), - web_contents_getter_(web_contents_getter) {} + GetDelegateCallback delegate_getter, + const base::Callback<content::WebContents*()>& web_contents_getter, + int frame_tree_node_id, + content::ResourceContext* resource_context) { + content::BrowserThread::ID thread_id; + CHECK(content::BrowserThread::GetCurrentThreadIdentifier(&thread_id)); + io_checker_ = std::make_unique<CheckerOnIO>( + std::move(delegate_getter), resource_context, frame_tree_node_id, + web_contents_getter, thread_id, weak_factory_.GetWeakPtr()); +} BrowserURLLoaderThrottle::~BrowserURLLoaderThrottle() { if (deferred_) @@ -44,6 +181,8 @@ if (!user_action_involved_) LogNoUserActionResourceLoadingDelay(total_delay_); + + DeleteCheckerOnIO(); } void BrowserURLLoaderThrottle::WillStartRequest( @@ -51,20 +190,17 @@ bool* defer) { DCHECK_EQ(0u, pending_checks_); DCHECK(!blocked_); - DCHECK(!url_checker_); original_url_ = request->url; pending_checks_++; - url_checker_ = std::make_unique<SafeBrowsingUrlCheckerImpl>( - request->headers, request->load_flags, - static_cast<content::ResourceType>(request->resource_type), - request->has_user_gesture, std::move(url_checker_delegate_), - web_contents_getter_); - - url_checker_->CheckUrl( - request->url, request->method, - base::BindOnce(&BrowserURLLoaderThrottle::OnCheckUrlResult, - base::Unretained(this))); + RunOrPostTaskIfNecessary( + FROM_HERE, content::BrowserThread::IO, + base::BindOnce( + &BrowserURLLoaderThrottle::CheckerOnIO::Start, + io_checker_->AsWeakPtr(), request->headers, request->load_flags, + static_cast<content::ResourceType>(request->resource_type), + request->has_user_gesture, request->originated_from_service_worker, + request->url, request->method)); } void BrowserURLLoaderThrottle::WillRedirectRequest( @@ -81,11 +217,15 @@ return; } + if (skip_checks_) + return; + pending_checks_++; - url_checker_->CheckUrl( - redirect_info->new_url, redirect_info->new_method, - base::BindOnce(&BrowserURLLoaderThrottle::OnCheckUrlResult, - base::Unretained(this))); + RunOrPostTaskIfNecessary( + FROM_HERE, content::BrowserThread::IO, + base::BindOnce(&BrowserURLLoaderThrottle::CheckerOnIO::CheckUrl, + io_checker_->AsWeakPtr(), redirect_info->new_url, + redirect_info->new_method)); } void BrowserURLLoaderThrottle::WillProcessResponse( @@ -142,7 +282,7 @@ } else { blocked_ = true; - url_checker_.reset(); + DeleteCheckerOnIO(); pending_checks_ = 0; pending_slow_checks_ = 0; delegate_->CancelWithError(GetNetErrorCodeForSafeBrowsing(), @@ -150,18 +290,18 @@ } } -void BrowserURLLoaderThrottle::OnCheckUrlResult( - NativeUrlCheckNotifier* slow_check_notifier, - bool proceed, - bool showed_interstitial) { - DCHECK(!blocked_); +void BrowserURLLoaderThrottle::SkipChecks() { + // Future checks for redirects will be skipped. + skip_checks_ = true; - if (!slow_check_notifier) { - OnCompleteCheck(false, proceed, showed_interstitial); - return; - } + pending_checks_--; + if (pending_checks_ == 0 && deferred_) + delegate_->Resume(); +} +void BrowserURLLoaderThrottle::NotifySlowCheck() { pending_slow_checks_++; + // Pending slow checks indicate that the resource may be unsafe. In that case, // pause reading response body from network to minimize the chance of // processing unsafe contents (e.g., writing unsafe contents into cache), @@ -169,12 +309,12 @@ // or cancel the resource load. if (pending_slow_checks_ == 1) delegate_->PauseReadingBodyFromNet(); +} - // In this case |proceed| and |showed_interstitial| should be ignored. The - // result will be returned by calling |*slow_check_notifier| callback. - *slow_check_notifier = - base::BindOnce(&BrowserURLLoaderThrottle::OnCompleteCheck, - base::Unretained(this), true /* slow_check */); +void BrowserURLLoaderThrottle::DeleteCheckerOnIO() { + RunOrPostTaskIfNecessary(FROM_HERE, content::BrowserThread::IO, + base::BindOnce([](std::unique_ptr<CheckerOnIO>) {}, + std::move(io_checker_))); } } // namespace safe_browsing
diff --git a/components/safe_browsing/browser/browser_url_loader_throttle.h b/components/safe_browsing/browser/browser_url_loader_throttle.h index 6228405..33d4dd7 100644 --- a/components/safe_browsing/browser/browser_url_loader_throttle.h +++ b/components/safe_browsing/browser/browser_url_loader_throttle.h
@@ -10,17 +10,23 @@ #include "base/callback.h" #include "base/macros.h" #include "base/memory/ref_counted.h" +#include "base/task/post_task.h" #include "base/time/time.h" +#include "content/public/browser/browser_thread.h" #include "content/public/common/url_loader_throttle.h" #include "url/gurl.h" namespace content { +class ResourceContext; class WebContents; } +namespace net { +class HttpRequestHeaders; +} + namespace safe_browsing { -class SafeBrowsingUrlCheckerImpl; class UrlCheckerDelegate; // BrowserURLLoaderThrottle is used in the browser process to query @@ -34,9 +40,15 @@ // the load if any URLs turn out to be bad. class BrowserURLLoaderThrottle : public content::URLLoaderThrottle { public: - static std::unique_ptr<BrowserURLLoaderThrottle> MaybeCreate( - scoped_refptr<UrlCheckerDelegate> url_checker_delegate, - const base::Callback<content::WebContents*()>& web_contents_getter); + using GetDelegateCallback = + base::OnceCallback<scoped_refptr<UrlCheckerDelegate>( + content::ResourceContext*)>; + + static std::unique_ptr<BrowserURLLoaderThrottle> Create( + GetDelegateCallback delegate_getter, + const base::Callback<content::WebContents*()>& web_contents_getter, + int frame_tree_node_id, + content::ResourceContext* resource_context); ~BrowserURLLoaderThrottle() override; @@ -53,6 +65,13 @@ bool* defer) override; private: + // CheckerOnIO handles calling methods on SafeBrowsingUrlCheckerImpl, which + // must be called on the IO thread. The results are synced back to the + // throttle. + // TODO(http://crbug.com/824843): Remove this if safe browsing is moved to the + // UI thread. + class CheckerOnIO; + using NativeUrlCheckNotifier = base::OnceCallback<void(bool /* proceed */, bool /* showed_interstitial */)>; @@ -60,28 +79,25 @@ // |web_contents_getter| is used for displaying SafeBrowsing UI when // necessary. BrowserURLLoaderThrottle( - scoped_refptr<UrlCheckerDelegate> url_checker_delegate, - const base::Callback<content::WebContents*()>& web_contents_getter); + GetDelegateCallback delegate_getter, + const base::Callback<content::WebContents*()>& web_contents_getter, + int frame_tree_node_id, + content::ResourceContext* resource_context); // |slow_check| indicates whether it reports the result of a slow check. - // (Please see comments of OnCheckUrlResult() for what slow check means). + // (Please see comments of CheckerOnIO::OnCheckUrlResult() for what slow check + // means). void OnCompleteCheck(bool slow_check, bool proceed, bool showed_interstitial); - // If |slow_check_notifier| is non-null, it indicates that a "slow check" is - // ongoing, i.e., the URL may be unsafe and a more time-consuming process is - // required to get the final result. In that case, the rest of the callback - // arguments should be ignored. This method sets the |slow_check_notifier| - // output parameter to a callback to receive the final result. - void OnCheckUrlResult(NativeUrlCheckNotifier* slow_check_notifier, - bool proceed, - bool showed_interstitial); + // Called to skip future safe browsing checks and resume the request if + // necessary. + void SkipChecks(); - // The following member stays valid until |url_checker_| is created. - scoped_refptr<UrlCheckerDelegate> url_checker_delegate_; + // Called when a slow safe browsing check is ongoing. + void NotifySlowCheck(); - base::Callback<content::WebContents*()> web_contents_getter_; - - std::unique_ptr<SafeBrowsingUrlCheckerImpl> url_checker_; + // Destroys |io_checker_| on the IO thread. + void DeleteCheckerOnIO(); size_t pending_checks_ = 0; // How many slow checks that haven't received results. @@ -100,6 +116,13 @@ GURL original_url_; + // Whether future safe browsing checks should be skipped. + bool skip_checks_ = false; + + std::unique_ptr<CheckerOnIO> io_checker_; + + base::WeakPtrFactory<BrowserURLLoaderThrottle> weak_factory_{this}; + DISALLOW_COPY_AND_ASSIGN(BrowserURLLoaderThrottle); };
diff --git a/components/safe_browsing/browser/mojo_safe_browsing_impl.cc b/components/safe_browsing/browser/mojo_safe_browsing_impl.cc index 0b39040..d4b5d93 100644 --- a/components/safe_browsing/browser/mojo_safe_browsing_impl.cc +++ b/components/safe_browsing/browser/mojo_safe_browsing_impl.cc
@@ -98,7 +98,7 @@ void MojoSafeBrowsingImpl::MaybeCreate( int render_process_id, content::ResourceContext* resource_context, - const base::Callback<UrlCheckerDelegate*()>& delegate_getter, + const base::Callback<scoped_refptr<UrlCheckerDelegate>()>& delegate_getter, mojom::SafeBrowsingRequest request) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
diff --git a/components/safe_browsing/browser/mojo_safe_browsing_impl.h b/components/safe_browsing/browser/mojo_safe_browsing_impl.h index 7a670b7..5be78d4c4 100644 --- a/components/safe_browsing/browser/mojo_safe_browsing_impl.h +++ b/components/safe_browsing/browser/mojo_safe_browsing_impl.h
@@ -29,7 +29,8 @@ static void MaybeCreate( int render_process_id, content::ResourceContext* resource_context, - const base::Callback<UrlCheckerDelegate*()>& delegate_getter, + const base::Callback<scoped_refptr<UrlCheckerDelegate>()>& + delegate_getter, mojom::SafeBrowsingRequest request); private:
diff --git a/components/safe_browsing/common/safe_browsing_prefs.cc b/components/safe_browsing/common/safe_browsing_prefs.cc index e224e09..69281f6 100644 --- a/components/safe_browsing/common/safe_browsing_prefs.cc +++ b/components/safe_browsing/common/safe_browsing_prefs.cc
@@ -106,6 +106,8 @@ "safebrowsing.password_protection_warning_trigger"; const char kAdvancedProtectionLastRefreshInUs[] = "safebrowsing.advanced_protection_last_refresh"; +const char kPasswordProtectedAllowed[] = + "safebrowsing.password_protected_allowed"; } // namespace prefs namespace safe_browsing { @@ -167,6 +169,7 @@ registry->RegisterIntegerPref(prefs::kPasswordProtectionWarningTrigger, PASSWORD_PROTECTION_OFF); registry->RegisterInt64Pref(prefs::kAdvancedProtectionLastRefreshInUs, 0); + registry->RegisterBooleanPref(prefs::kPasswordProtectedAllowed, true); } void RegisterLocalStatePrefs(PrefRegistrySimple* registry) {
diff --git a/components/safe_browsing/common/safe_browsing_prefs.h b/components/safe_browsing/common/safe_browsing_prefs.h index 160d5da..0e8532a 100644 --- a/components/safe_browsing/common/safe_browsing_prefs.h +++ b/components/safe_browsing/common/safe_browsing_prefs.h
@@ -80,6 +80,9 @@ // Last time Chrome refreshes advanced protection status for sign-in users (in // microseconds); extern const char kAdvancedProtectionLastRefreshInUs[]; + +// Whether or not to allow downloads of password-protected files. +extern const char kPasswordProtectedAllowed[]; } namespace safe_browsing {
diff --git a/components/safe_browsing/features.h b/components/safe_browsing/features.h index fd73826..7775c5f8 100644 --- a/components/safe_browsing/features.h +++ b/components/safe_browsing/features.h
@@ -43,8 +43,9 @@ // navigations instead of overlays. extern const base::Feature kCommittedSBInterstitials; -// Controls whether the user has forcible enabled AP download protection. See -// also |kUseAPDownloadProtection|. +// Controls whether the user has forcibly enabled AP download protection. This +// flag will enable AP downloads protections even for users not enrolled in +// APP. See also |kUseAPDownloadProtection|. extern const base::Feature kForceUseAPDownloadProtection; // Enable GAIA password protection for signed-in users. @@ -79,8 +80,8 @@ // trials simultaneously. extern const base::Feature kTriggerThrottlerDailyQuotaFeature; -// Controls whether we use AP download protection. See also -// |kForceUseAPDownloadProtection|. +// Controls whether we use AP download protection. This flag only has any effect +// for users enrolled in APP. See also |kForceUseAPDownloadProtection|. extern const base::Feature kUseAPDownloadProtection; // Controls whether Chrome on Android uses locally cached blacklists.
diff --git a/components/services/pdf_compositor/OWNERS b/components/services/pdf_compositor/OWNERS index 9b08c66..01ea38e 100644 --- a/components/services/pdf_compositor/OWNERS +++ b/components/services/pdf_compositor/OWNERS
@@ -1 +1,2 @@ file://printing/OWNERS +# COMPONENT: Internals>Printing
diff --git a/components/startup_metric_utils/OWNERS b/components/startup_metric_utils/OWNERS index 711005f..32d1ee3c 100644 --- a/components/startup_metric_utils/OWNERS +++ b/components/startup_metric_utils/OWNERS
@@ -2,3 +2,5 @@ # To increase bus factor but prefer above OWNERS :). gab@chromium.org +# COMPONENT: Internals>Metrics +# TEAM: catan-team@chromium.org
diff --git a/components/test/data/omnibox/on_device_head_test_model.bin b/components/test/data/omnibox/on_device_head_test_model_index.bin similarity index 100% rename from components/test/data/omnibox/on_device_head_test_model.bin rename to components/test/data/omnibox/on_device_head_test_model_index.bin Binary files differ
diff --git a/components/test/data/payments/render_tests/PaymentRequestFreeShippingTest.free_shipping.Nexus_5-19.png.sha1 b/components/test/data/payments/render_tests/PaymentRequestFreeShippingTest.NightModeDisabled-free_shipping.Nexus_5-19.png.sha1 similarity index 100% rename from components/test/data/payments/render_tests/PaymentRequestFreeShippingTest.free_shipping.Nexus_5-19.png.sha1 rename to components/test/data/payments/render_tests/PaymentRequestFreeShippingTest.NightModeDisabled-free_shipping.Nexus_5-19.png.sha1
diff --git a/components/test/data/payments/render_tests/PaymentRequestFreeShippingTest.unmask.Nexus_5-19.png.sha1 b/components/test/data/payments/render_tests/PaymentRequestFreeShippingTest.NightModeDisabled-unmask.Nexus_5-19.png.sha1 similarity index 100% rename from components/test/data/payments/render_tests/PaymentRequestFreeShippingTest.unmask.Nexus_5-19.png.sha1 rename to components/test/data/payments/render_tests/PaymentRequestFreeShippingTest.NightModeDisabled-unmask.Nexus_5-19.png.sha1
diff --git a/components/test/data/payments/render_tests/PaymentRequestFreeShippingTest.NightModeEnabled-free_shipping.Nexus_5-19.png.sha1 b/components/test/data/payments/render_tests/PaymentRequestFreeShippingTest.NightModeEnabled-free_shipping.Nexus_5-19.png.sha1 new file mode 100644 index 0000000..0c97dae --- /dev/null +++ b/components/test/data/payments/render_tests/PaymentRequestFreeShippingTest.NightModeEnabled-free_shipping.Nexus_5-19.png.sha1
@@ -0,0 +1 @@ +2b1858790afe0c3550c8867237f68db66d542cc7 \ No newline at end of file
diff --git a/components/test/data/payments/render_tests/PaymentRequestFreeShippingTest.NightModeEnabled-unmask.Nexus_5-19.png.sha1 b/components/test/data/payments/render_tests/PaymentRequestFreeShippingTest.NightModeEnabled-unmask.Nexus_5-19.png.sha1 new file mode 100644 index 0000000..eac4639d --- /dev/null +++ b/components/test/data/payments/render_tests/PaymentRequestFreeShippingTest.NightModeEnabled-unmask.Nexus_5-19.png.sha1
@@ -0,0 +1 @@ +85a117d0fe717a5fa8ab5ba1596cd7410a908277 \ No newline at end of file
diff --git a/components/viz/service/display/direct_renderer.cc b/components/viz/service/display/direct_renderer.cc index 2ca528a..59cfded 100644 --- a/components/viz/service/display/direct_renderer.cc +++ b/components/viz/service/display/direct_renderer.cc
@@ -397,13 +397,6 @@ ¤t_frame()->root_damage_rect, ¤t_frame()->root_content_bounds); - // Draw all non-root render passes except for the root render pass. - for (const auto& pass : *render_passes_in_draw_order) { - if (pass.get() == root_render_pass) - break; - DrawRenderPassAndExecuteCopyRequests(pass.get()); - } - bool was_using_dc_layers = using_dc_layers_; if (!current_frame()->dc_layer_overlay_list.empty()) { DCHECK(supports_dc_layers_); @@ -413,6 +406,17 @@ kNumberOfFramesBeforeDisablingDCLayers) { using_dc_layers_ = false; } + + if (supports_dc_layers_ && (was_using_dc_layers != using_dc_layers_)) + SetEnableDCLayers(using_dc_layers_); + + // Draw all non-root render passes except for the root render pass. + for (const auto& pass : *render_passes_in_draw_order) { + if (pass.get() == root_render_pass) + break; + DrawRenderPassAndExecuteCopyRequests(pass.get()); + } + if (supports_dc_layers_ && (did_reshape || (was_using_dc_layers != using_dc_layers_))) { // The entire surface has to be redrawn if it was reshaped or if switching @@ -756,9 +760,6 @@ current_frame()->current_render_pass = render_pass; if (render_pass == current_frame()->root_render_pass) { BindFramebufferToOutputSurface(); - - if (supports_dc_layers_) - SetEnableDCLayers(using_dc_layers_); output_surface_->SetDrawRectangle(current_frame()->root_damage_rect); InitializeViewport(current_frame(), render_pass->output_rect, gfx::Rect(current_frame()->device_viewport_size),
diff --git a/components/viz/service/display/gl_renderer_unittest.cc b/components/viz/service/display/gl_renderer_unittest.cc index 4eb8ff4..3c612932 100644 --- a/components/viz/service/display/gl_renderer_unittest.cc +++ b/components/viz/service/display/gl_renderer_unittest.cc
@@ -2891,9 +2891,9 @@ // Frame 0 should have DC Layers enabled because of the overlay. // After 60 frames of no overlays DC layers should be disabled again. - if (i < 60) + if (i == 0) EXPECT_CALL(*gl, SetEnableDCLayersCHROMIUM(GL_TRUE)); - else + else if (i == 60) EXPECT_CALL(*gl, SetEnableDCLayersCHROMIUM(GL_FALSE)); renderer.DecideRenderPassAllocationsForFrame(render_passes_in_draw_order_);
diff --git a/content/browser/accessibility/accessibility_action_browsertest.cc b/content/browser/accessibility/accessibility_action_browsertest.cc index 5a1bbc7..6eba8bc 100644 --- a/content/browser/accessibility/accessibility_action_browsertest.cc +++ b/content/browser/accessibility/accessibility_action_browsertest.cc
@@ -801,4 +801,34 @@ } #endif // !defined(OS_ANDROID) +IN_PROC_BROWSER_TEST_F(AccessibilityActionBrowserTest, ClickSVG) { + // Create an svg link element that has the shape of a small, red square. + LoadInitialAccessibilityTreeFromHtml(R"HTML( + <svg aria-label="svg" width="10" height="10" viewBox="0 0 10 10" + onclick="(function() { + let para = document.createElement('p'); + para.innerHTML = 'SVG link was clicked!'; + document.body.appendChild(para);})()"> + <a xlink:href="#"> + <path fill-opacity="1" fill="#ff0000" + d="M 0 0 L 10 0 L 10 10 L 0 10 Z"></path> + </a> + </svg> + )HTML"); + + AccessibilityNotificationWaiter click_waiter( + shell()->web_contents(), ui::kAXModeComplete, ax::mojom::Event::kClicked); + BrowserAccessibility* target_node = + FindNode(ax::mojom::Role::kSvgRoot, "svg"); + ASSERT_NE(target_node, nullptr); + GetManager()->DoDefaultAction(*target_node); + click_waiter.WaitForNotification(); +#if !defined(OS_ANDROID) + // This waiter times out on some Android try bots. + // TODO(akihiroota): Refactor test to be applicable to all platforms. + WaitForAccessibilityTreeToContainNodeWithName(shell()->web_contents(), + "SVG link was clicked!"); +#endif // !defined(OS_ANDROID) +} + } // namespace content
diff --git a/content/browser/devtools/devtools_instrumentation.cc b/content/browser/devtools/devtools_instrumentation.cc index 8f0d291d8..4c23f34 100644 --- a/content/browser/devtools/devtools_instrumentation.cc +++ b/content/browser/devtools/devtools_instrumentation.cc
@@ -51,6 +51,28 @@ DispatchToAgents(ftn, method, std::forward<Args>(args)...); } +FrameTreeNode* GetFtnForNetworkRequest(int process_id, int routing_id) { + // Navigation requests start in the browser, before process_id is assigned, so + // the id is set to 0. In these situations, the routing_id is the frame tree + // node id, and can be used directly. + int frame_tree_node_id = + process_id == 0 ? routing_id + : RenderFrameHost::GetFrameTreeNodeIdForRoutingId( + process_id, routing_id); + FrameTreeNode* ftn = FrameTreeNode::GloballyFindByID(frame_tree_node_id); + + // If this is a navigation request (process_id == 0) of a child frame + // (ftn->parent()), then requestWillBeSent and responseReceived are delivered + // to the parent frame instead of the child because we don't know if the child + // will become an OOPIF with a separate target yet or not. Do the same for + // requestWillBeSentExtraInfo and responseReceivedExtraInfo. + if (ftn && process_id == 0 && ftn->parent()) { + ftn = ftn->parent(); + } + + return ftn; +} + } // namespace void OnResetNavigationRequest(NavigationRequest* navigation_request) { @@ -402,6 +424,36 @@ &protocol::TargetHandler::UpdatePortals); } +void OnRequestWillBeSentExtraInfo( + int process_id, + int routing_id, + const std::string& devtools_request_id, + const net::CookieStatusList& request_cookie_list, + const std::vector<std::pair<std::string, std::string>>& request_headers) { + FrameTreeNode* ftn = GetFtnForNetworkRequest(process_id, routing_id); + if (!ftn) + return; + + DispatchToAgents(ftn, &protocol::NetworkHandler::OnRequestWillBeSentExtraInfo, + devtools_request_id, request_cookie_list, request_headers); +} + +void OnResponseReceivedExtraInfo( + int process_id, + int routing_id, + const std::string& devtools_request_id, + const net::CookieAndLineStatusList& response_cookie_list, + const std::vector<std::pair<std::string, std::string>>& response_headers, + const base::Optional<std::string>& response_headers_text) { + FrameTreeNode* ftn = GetFtnForNetworkRequest(process_id, routing_id); + if (!ftn) + return; + + DispatchToAgents(ftn, &protocol::NetworkHandler::OnResponseReceivedExtraInfo, + devtools_request_id, response_cookie_list, response_headers, + response_headers_text); +} + } // namespace devtools_instrumentation } // namespace content
diff --git a/content/browser/devtools/devtools_instrumentation.h b/content/browser/devtools/devtools_instrumentation.h index 16e9152..ff531425 100644 --- a/content/browser/devtools/devtools_instrumentation.h +++ b/content/browser/devtools/devtools_instrumentation.h
@@ -111,6 +111,20 @@ const base::UnguessableToken& request_id, const network::URLLoaderCompletionStatus& status); +void OnRequestWillBeSentExtraInfo( + int process_id, + int routing_id, + const std::string& devtools_request_id, + const net::CookieStatusList& request_cookie_list, + const std::vector<std::pair<std::string, std::string>>& request_headers); +void OnResponseReceivedExtraInfo( + int process_id, + int routing_id, + const std::string& devtools_request_id, + const net::CookieAndLineStatusList& response_cookie_list, + const std::vector<std::pair<std::string, std::string>>& response_headers, + const base::Optional<std::string>& response_headers_text); + std::vector<std::unique_ptr<NavigationThrottle>> CreateNavigationThrottles( NavigationHandleImpl* navigation_handle);
diff --git a/content/browser/devtools/protocol/network_handler.cc b/content/browser/devtools/protocol/network_handler.cc index 3e5e145..3ade3f9 100644 --- a/content/browser/devtools/protocol/network_handler.cc +++ b/content/browser/devtools/protocol/network_handler.cc
@@ -24,6 +24,7 @@ #include "content/browser/devtools/devtools_io_context.h" #include "content/browser/devtools/devtools_stream_pipe.h" #include "content/browser/devtools/devtools_url_loader_interceptor.h" +#include "content/browser/devtools/protocol/network.h" #include "content/browser/devtools/protocol/page.h" #include "content/browser/devtools/protocol/security.h" #include "content/browser/devtools/service_worker_devtools_agent_host.h" @@ -53,6 +54,7 @@ #include "content/public/common/content_client.h" #include "content/public/common/content_features.h" #include "content/public/common/origin_util.h" +#include "net/base/features.h" #include "net/base/host_port_pair.h" #include "net/base/ip_endpoint.h" #include "net/base/net_errors.h" @@ -814,6 +816,152 @@ return signed_exchange_errors; } +base::Optional<Network::SetCookieBlockedReason> +GetProtocolBlockedSetCookieReason( + net::CanonicalCookie::CookieInclusionStatus status) { + switch (status) { + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_SECURE_ONLY: + return Network::SetCookieBlockedReasonEnum::SecureOnly; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_SAMESITE_STRICT: + return Network::SetCookieBlockedReasonEnum::SameSiteStrict; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_SAMESITE_LAX: + return Network::SetCookieBlockedReasonEnum::SameSiteLax; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_SAMESITE_EXTENDED: + return Network::SetCookieBlockedReasonEnum::SameSiteExtended; + case net::CanonicalCookie::CookieInclusionStatus:: + EXCLUDE_SAMESITE_UNSPECIFIED_TREATED_AS_LAX: + return Network::SetCookieBlockedReasonEnum:: + SameSiteUnspecifiedTreatedAsLax; + case net::CanonicalCookie::CookieInclusionStatus:: + EXCLUDE_SAMESITE_NONE_INSECURE: + return Network::SetCookieBlockedReasonEnum::SameSiteNoneInsecure; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_USER_PREFERENCES: + return Network::SetCookieBlockedReasonEnum::UserPreferences; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_FAILURE_TO_STORE: + return Network::SetCookieBlockedReasonEnum::SyntaxError; + case net::CanonicalCookie::CookieInclusionStatus:: + EXCLUDE_NONCOOKIEABLE_SCHEME: + return Network::SetCookieBlockedReasonEnum::SchemeNotSupported; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_OVERWRITE_SECURE: + return Network::SetCookieBlockedReasonEnum::OverwriteSecure; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_INVALID_DOMAIN: + return Network::SetCookieBlockedReasonEnum::InvalidDomain; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_INVALID_PREFIX: + return Network::SetCookieBlockedReasonEnum::InvalidPrefix; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR: + return Network::SetCookieBlockedReasonEnum::UnknownError; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_HTTP_ONLY: + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_NOT_ON_PATH: + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_DOMAIN_MISMATCH: + case net::CanonicalCookie::CookieInclusionStatus:: + EXCLUDE_OVERWRITE_HTTP_ONLY: + case net::CanonicalCookie::CookieInclusionStatus::INCLUDE: + return base::nullopt; + } +} + +base::Optional<Network::CookieBlockedReason> GetProtocolBlockedCookieReason( + net::CanonicalCookie::CookieInclusionStatus status) { + switch (status) { + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_SECURE_ONLY: + return Network::CookieBlockedReasonEnum::SecureOnly; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_NOT_ON_PATH: + return Network::CookieBlockedReasonEnum::NotOnPath; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_DOMAIN_MISMATCH: + return Network::CookieBlockedReasonEnum::DomainMismatch; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_SAMESITE_STRICT: + return Network::CookieBlockedReasonEnum::SameSiteStrict; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_SAMESITE_LAX: + return Network::CookieBlockedReasonEnum::SameSiteLax; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_SAMESITE_EXTENDED: + return Network::CookieBlockedReasonEnum::SameSiteExtended; + case net::CanonicalCookie::CookieInclusionStatus:: + EXCLUDE_SAMESITE_UNSPECIFIED_TREATED_AS_LAX: + return Network::CookieBlockedReasonEnum::SameSiteUnspecifiedTreatedAsLax; + case net::CanonicalCookie::CookieInclusionStatus:: + EXCLUDE_SAMESITE_NONE_INSECURE: + return Network::CookieBlockedReasonEnum::SameSiteNoneInsecure; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_USER_PREFERENCES: + return Network::CookieBlockedReasonEnum::UserPreferences; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR: + return Network::CookieBlockedReasonEnum::UnknownError; + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_FAILURE_TO_STORE: + case net::CanonicalCookie::CookieInclusionStatus:: + EXCLUDE_NONCOOKIEABLE_SCHEME: + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_OVERWRITE_SECURE: + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_INVALID_DOMAIN: + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_INVALID_PREFIX: + case net::CanonicalCookie::CookieInclusionStatus:: + EXCLUDE_OVERWRITE_HTTP_ONLY: + case net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_HTTP_ONLY: + case net::CanonicalCookie::CookieInclusionStatus::INCLUDE: + return base::nullopt; + } +} + +std::unique_ptr<Array<Network::BlockedSetCookieWithReason>> +BuildProtocolBlockedSetCookies(const net::CookieAndLineStatusList& net_list) { + std::unique_ptr<Array<Network::BlockedSetCookieWithReason>> protocol_list = + std::make_unique<Array<Network::BlockedSetCookieWithReason>>(); + + for (const net::CookieAndLineWithStatus& cookie : net_list) { + base::Optional<Network::SetCookieBlockedReason> blocked_reason = + GetProtocolBlockedSetCookieReason(cookie.status); + if (!blocked_reason.has_value()) + continue; + + protocol_list->push_back( + Network::BlockedSetCookieWithReason::Create() + .SetBlockedReason(blocked_reason.value()) + .SetCookieLine(cookie.cookie_string) + .SetCookie(cookie.cookie.has_value() + ? BuildCookie(cookie.cookie.value()) + : nullptr) + .Build()); + } + return protocol_list; +} + +std::unique_ptr<Array<Network::BlockedCookieWithReason>> +BuildProtocolBlockedCookies(const net::CookieStatusList& net_list) { + std::unique_ptr<Array<Network::BlockedCookieWithReason>> protocol_list = + std::make_unique<Array<Network::BlockedCookieWithReason>>(); + + bool samesite_by_default_enabled = base::FeatureList::IsEnabled( + net::features::kSameSiteByDefaultCookies); + bool must_be_secure_enabled = base::FeatureList::IsEnabled( + net::features::kCookiesWithoutSameSiteMustBeSecure); + + for (const net::CookieWithStatus& cookie : net_list) { + // These CookieInclusionStatus values will be passed to us from network + // service even if the cookies were actually included - the actual + // inclusion depends on these flags. If the flags are disabled, then don't + // forward them to the frontend because they were not actually blocked. + if (!samesite_by_default_enabled) { + if (cookie.status == net::CanonicalCookie::CookieInclusionStatus:: + EXCLUDE_SAMESITE_UNSPECIFIED_TREATED_AS_LAX) { + continue; + } + if (!must_be_secure_enabled && + cookie.status == net::CanonicalCookie::CookieInclusionStatus:: + EXCLUDE_SAMESITE_NONE_INSECURE) { + continue; + } + } + + base::Optional<Network::CookieBlockedReason> blocked_reason = + GetProtocolBlockedCookieReason(cookie.status); + if (!blocked_reason.has_value()) + continue; + + protocol_list->push_back(Network::BlockedCookieWithReason::Create() + .SetBlockedReason(blocked_reason.value()) + .SetCookie(BuildCookie(cookie.cookie)) + .Build()); + } + return protocol_list; +} + } // namespace class BackgroundSyncRestorer { @@ -2291,5 +2439,32 @@ : nullptr); } +void NetworkHandler::OnRequestWillBeSentExtraInfo( + const std::string& devtools_request_id, + const net::CookieStatusList& request_cookie_list, + const std::vector<std::pair<std::string, std::string>>& request_headers) { + if (!enabled_) + return; + + frontend_->RequestWillBeSentExtraInfo( + devtools_request_id, BuildProtocolBlockedCookies(request_cookie_list), + GetHeaders(request_headers)); +} + +void NetworkHandler::OnResponseReceivedExtraInfo( + const std::string& devtools_request_id, + const net::CookieAndLineStatusList& response_cookie_list, + const std::vector<std::pair<std::string, std::string>>& response_headers, + const base::Optional<std::string>& response_headers_text) { + if (!enabled_) + return; + + frontend_->ResponseReceivedExtraInfo( + devtools_request_id, BuildProtocolBlockedSetCookies(response_cookie_list), + GetHeaders(response_headers), + response_headers_text.has_value() ? response_headers_text.value() + : nullptr); +} + } // namespace protocol } // namespace content
diff --git a/content/browser/devtools/protocol/network_handler.h b/content/browser/devtools/protocol/network_handler.h index b7c1f8f..feb70f35 100644 --- a/content/browser/devtools/protocol/network_handler.h +++ b/content/browser/devtools/protocol/network_handler.h
@@ -187,6 +187,16 @@ const base::Optional<net::SSLInfo>& ssl_info, const std::vector<SignedExchangeError>& errors); + void OnRequestWillBeSentExtraInfo( + const std::string& devtools_request_id, + const net::CookieStatusList& request_cookie_list, + const std::vector<std::pair<std::string, std::string>>& request_headers); + void OnResponseReceivedExtraInfo( + const std::string& devtools_request_id, + const net::CookieAndLineStatusList& response_cookie_list, + const std::vector<std::pair<std::string, std::string>>& response_headers, + const base::Optional<std::string>& response_headers_text); + bool enabled() const { return enabled_; } Network::Frontend* frontend() const { return frontend_.get(); }
diff --git a/content/browser/devtools/protocol_config.json b/content/browser/devtools/protocol_config.json index 96e9ab8..8ece09e 100644 --- a/content/browser/devtools/protocol_config.json +++ b/content/browser/devtools/protocol_config.json
@@ -46,7 +46,7 @@ { "domain": "Network", "include": ["enable", "disable", "clearBrowserCache", "clearBrowserCookies", "getCookies", "getAllCookies", "deleteCookies", "setCookie", "setCookies", "setExtraHTTPHeaders", "canEmulateNetworkConditions", "emulateNetworkConditions", "setBypassServiceWorker", "setRequestInterception", "continueInterceptedRequest", "getResponseBodyForInterception", "setCacheDisabled", "takeResponseBodyForInterceptionAsStream"], - "include_events": ["requestWillBeSent", "responseReceived", "loadingFinished", "loadingFailed", "requestIntercepted", "signedExchangeReceived"], + "include_events": ["requestWillBeSent", "responseReceived", "loadingFinished", "loadingFailed", "requestIntercepted", "signedExchangeReceived", "requestWillBeSentExtraInfo", "responseReceivedExtraInfo"], "async": ["clearBrowserCookies", "clearBrowserCache", "getCookies", "getAllCookies", "deleteCookies", "setCookie", "setCookies", "continueInterceptedRequest", "getResponseBodyForInterception", "takeResponseBodyForInterceptionAsStream"] }, {
diff --git a/content/browser/gpu/OWNERS b/content/browser/gpu/OWNERS index 55d9b9b..cc10ebf8 100644 --- a/content/browser/gpu/OWNERS +++ b/content/browser/gpu/OWNERS
@@ -4,3 +4,4 @@ backer@chromium.org # COMPONENT: Internals>GPU>Internals +# TEAM: graphics-dev@chromium.org
diff --git a/content/browser/indexed_db/database_impl.cc b/content/browser/indexed_db/database_impl.cc index 42413a7..a22cacc 100644 --- a/content/browser/indexed_db/database_impl.cc +++ b/content/browser/indexed_db/database_impl.cc
@@ -75,6 +75,7 @@ if (transaction->mode() != blink::mojom::IDBTransactionMode::VersionChange) { mojo::ReportBadMessage( "RenameObjectStore must be called from a version change transaction."); + return; } // Note: This doesn't schedule a task on the transaction because version @@ -241,6 +242,7 @@ if (transaction->mode() != blink::mojom::IDBTransactionMode::VersionChange) { mojo::ReportBadMessage( "SetIndexKeys must be called from a version change transaction."); + return; } connection_->database()->SetIndexKeys( @@ -263,6 +265,7 @@ if (transaction->mode() != blink::mojom::IDBTransactionMode::VersionChange) { mojo::ReportBadMessage( "SetIndexesReady must be called from a version change transaction."); + return; } connection_->database()->SetIndexesReady(transaction, object_store_id, @@ -295,6 +298,7 @@ mojo::ReportBadMessage( "OpenCursor with |Preemptive| task type must be called from a version " "change transaction."); + return; } connection_->database()->OpenCursor( @@ -406,6 +410,7 @@ if (transaction->mode() != blink::mojom::IDBTransactionMode::VersionChange) { mojo::ReportBadMessage( "CreateIndex must be called from a version change transaction."); + return; } connection_->database()->CreateIndex(transaction, object_store_id, index_id, @@ -427,6 +432,7 @@ if (transaction->mode() != blink::mojom::IDBTransactionMode::VersionChange) { mojo::ReportBadMessage( "DeleteIndex must be called from a version change transaction."); + return; } connection_->database()->DeleteIndex(transaction, object_store_id, index_id); @@ -448,6 +454,7 @@ if (transaction->mode() != blink::mojom::IDBTransactionMode::VersionChange) { mojo::ReportBadMessage( "RenameIndex must be called from a version change transaction."); + return; } connection_->database()->RenameIndex(transaction, object_store_id, index_id,
diff --git a/content/browser/indexed_db/transaction_impl.cc b/content/browser/indexed_db/transaction_impl.cc index 3c3a56b..412c180 100644 --- a/content/browser/indexed_db/transaction_impl.cc +++ b/content/browser/indexed_db/transaction_impl.cc
@@ -98,6 +98,7 @@ if (transaction_->mode() != blink::mojom::IDBTransactionMode::VersionChange) { mojo::ReportBadMessage( "CreateObjectStore must be called from a version change transaction."); + return; } IndexedDBConnection* connection = transaction_->connection(); @@ -118,6 +119,7 @@ if (transaction_->mode() != blink::mojom::IDBTransactionMode::VersionChange) { mojo::ReportBadMessage( "DeleteObjectStore must be called from a version change transaction."); + return; } IndexedDBConnection* connection = transaction_->connection();
diff --git a/content/browser/loader/mojo_async_resource_handler.cc b/content/browser/loader/mojo_async_resource_handler.cc index 6a54037..9979795 100644 --- a/content/browser/loader/mojo_async_resource_handler.cc +++ b/content/browser/loader/mojo_async_resource_handler.cc
@@ -26,7 +26,7 @@ #include "services/network/public/cpp/constants.h" #include "services/network/public/cpp/resource_response.h" #include "services/network/public/cpp/url_loader_completion_status.h" -#include "services/network/resource_scheduler.h" +#include "services/network/resource_scheduler/resource_scheduler.h" namespace content { namespace {
diff --git a/content/browser/loader/mojo_async_resource_handler_unittest.cc b/content/browser/loader/mojo_async_resource_handler_unittest.cc index 43a6de88..710c06dae 100644 --- a/content/browser/loader/mojo_async_resource_handler_unittest.cc +++ b/content/browser/loader/mojo_async_resource_handler_unittest.cc
@@ -58,7 +58,7 @@ #include "services/network/public/cpp/url_loader_completion_status.h" #include "services/network/public/mojom/url_loader.mojom.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" -#include "services/network/resource_scheduler.h" +#include "services/network/resource_scheduler/resource_scheduler.h" #include "services/network/test/test_url_loader_client.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/page_transition_types.h"
diff --git a/content/browser/loader/navigation_url_loader_impl_unittest.cc b/content/browser/loader/navigation_url_loader_impl_unittest.cc index 5ac8fb9..80636e42 100644 --- a/content/browser/loader/navigation_url_loader_impl_unittest.cc +++ b/content/browser/loader/navigation_url_loader_impl_unittest.cc
@@ -40,7 +40,7 @@ #include "net/url_request/url_request_context_builder.h" #include "ppapi/buildflags/buildflags.h" #include "services/network/public/cpp/features.h" -#include "services/network/resource_scheduler_client.h" +#include "services/network/resource_scheduler/resource_scheduler_client.h" #include "services/network/url_loader.h" #include "services/network/url_request_context_owner.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc index a87b6a6..d2f737c 100644 --- a/content/browser/loader/resource_dispatcher_host_impl.cc +++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -102,7 +102,7 @@ #include "services/network/public/cpp/resource_request.h" #include "services/network/public/cpp/resource_request_body.h" #include "services/network/public/cpp/url_loader_completion_status.h" -#include "services/network/resource_scheduler.h" +#include "services/network/resource_scheduler/resource_scheduler.h" #include "services/network/throttling/scoped_throttling_token.h" #include "services/network/url_loader_factory.h" #include "storage/browser/blob/blob_data_handle.h"
diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc index bb9a7847..93b4d62 100644 --- a/content/browser/loader/resource_dispatcher_host_unittest.cc +++ b/content/browser/loader/resource_dispatcher_host_unittest.cc
@@ -82,8 +82,8 @@ #include "net/url_request/url_request_test_util.h" #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/resource_request.h" -#include "services/network/resource_scheduler.h" -#include "services/network/resource_scheduler_params_manager.h" +#include "services/network/resource_scheduler/resource_scheduler.h" +#include "services/network/resource_scheduler/resource_scheduler_params_manager.h" #include "services/network/test/test_url_loader_client.h" #include "storage/browser/blob/shareable_file_reference.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/content/browser/manifest/OWNERS b/content/browser/manifest/OWNERS index e60c0b9..ff8b1e3 100644 --- a/content/browser/manifest/OWNERS +++ b/content/browser/manifest/OWNERS
@@ -1,3 +1,4 @@ file://third_party/blink/renderer/modules/manifest/OWNERS # COMPONENT: Manifest +# TEAM: chromium-reviews@chromium.org
diff --git a/content/browser/picture_in_picture/OWNERS b/content/browser/picture_in_picture/OWNERS index b234e09..8d861d50 100644 --- a/content/browser/picture_in_picture/OWNERS +++ b/content/browser/picture_in_picture/OWNERS
@@ -1,3 +1,4 @@ file://third_party/blink/renderer/modules/picture_in_picture/OWNERS # COMPONENT: Internals>Media>UI +# TEAM: media-dev@chromium.org
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index ba406465..dcdc9a6 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -427,7 +427,6 @@ render_frame_metadata_provider_.RemoveObserver(this); if (!destroyed_) Destroy(false); - CHECK(!notifying_of_visibility_change_); } // static @@ -691,15 +690,11 @@ process_->UpdateClientPriority(this); bool is_visible = false; - { - CHECK(!notifying_of_visibility_change_); - NotificationService::current()->Notify( - NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, - Source<RenderWidgetHost>(this), Details<bool>(&is_visible)); - base::AutoReset<bool> setter(¬ifying_of_visibility_change_, true); - for (auto& observer : observers_) - observer.RenderWidgetHostVisibilityChanged(this, false); - } + NotificationService::current()->Notify( + NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, + Source<RenderWidgetHost>(this), Details<bool>(&is_visible)); + for (auto& observer : observers_) + observer.RenderWidgetHostVisibilityChanged(this, false); } void RenderWidgetHostImpl::WasShown( @@ -729,15 +724,11 @@ process_->UpdateClientPriority(this); bool is_visible = true; - { - CHECK(!notifying_of_visibility_change_); - base::AutoReset<bool> setter(¬ifying_of_visibility_change_, true); - NotificationService::current()->Notify( - NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, - Source<RenderWidgetHost>(this), Details<bool>(&is_visible)); - for (auto& observer : observers_) - observer.RenderWidgetHostVisibilityChanged(this, true); - } + NotificationService::current()->Notify( + NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, + Source<RenderWidgetHost>(this), Details<bool>(&is_visible)); + for (auto& observer : observers_) + observer.RenderWidgetHostVisibilityChanged(this, true); // It's possible for our size to be out of sync with the renderer. The // following is one case that leads to this:
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index 655e18f..3d61b81 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -1204,9 +1204,6 @@ // necessarily sent yet. bool autoscroll_in_progress_ = false; - // TODO(crbug.com/976199): remove this, used in tracking a crash. - bool notifying_of_visibility_change_ = false; - // Event IDs for touch event acks that should be ignored. std::unordered_set<uint32_t> touch_event_acks_to_ignore_;
diff --git a/content/browser/screen_orientation/OWNERS b/content/browser/screen_orientation/OWNERS index 5be0ec7c..5db2a8f 100644 --- a/content/browser/screen_orientation/OWNERS +++ b/content/browser/screen_orientation/OWNERS
@@ -1,2 +1,4 @@ file://third_party/blink/renderer/modules/screen_orientation/OWNERS +# COMPONENT: Blink>ScreenOrientation +# TEAM: media-dev@chromium.org
diff --git a/content/browser/utility_process_host_browsertest.cc b/content/browser/utility_process_host_browsertest.cc index 0c9fd30..862c4e5 100644 --- a/content/browser/utility_process_host_browsertest.cc +++ b/content/browser/utility_process_host_browsertest.cc
@@ -125,8 +125,11 @@ const ChildProcessTerminationInfo& info) override { DCHECK_CURRENTLY_ON(BrowserThread::UI); #if defined(OS_WIN) - EXPECT_EQ(EXCEPTION_BREAKPOINT, DWORD{info.exit_code}); -#elif defined(OS_MACOSX) || defined(OS_LINUX) + EXPECT_EQ(EXCEPTION_ILLEGAL_INSTRUCTION, DWORD{info.exit_code}); +#elif defined(OS_MACOSX) + EXPECT_TRUE(WIFSIGNALED(info.exit_code)); + EXPECT_EQ(SIGILL, WTERMSIG(info.exit_code)); +#elif defined(OS_LINUX) EXPECT_TRUE(WIFSIGNALED(info.exit_code)); EXPECT_EQ(SIGTRAP, WTERMSIG(info.exit_code)); #endif
diff --git a/content/browser/worker_network_isolation_key_browsertest.cc b/content/browser/worker_network_isolation_key_browsertest.cc index 9cadb36..9173bf12 100644 --- a/content/browser/worker_network_isolation_key_browsertest.cc +++ b/content/browser/worker_network_isolation_key_browsertest.cc
@@ -260,6 +260,10 @@ // also won't trigger an update. IN_PROC_BROWSER_TEST_F(WorkerNetworkIsolationKeyBrowserTest, ServiceWorkerMainScriptRequest) { + // TODO(http://crbug.com/984099): Fix this with network service disabled. + if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) + return; + // Discard the old process to clear the in-memory cache. CrossProcessNavigation();
diff --git a/content/renderer/media/stream/media_stream_constraints_util_audio.cc b/content/renderer/media/stream/media_stream_constraints_util_audio.cc index 6f5dec7a..d0df8c4 100644 --- a/content/renderer/media/stream/media_stream_constraints_util_audio.cc +++ b/content/renderer/media/stream/media_stream_constraints_util_audio.cc
@@ -12,7 +12,6 @@ #include "base/strings/string_number_conversions.h" #include "build/build_config.h" -#include "content/public/common/content_features.h" #include "content/renderer/media/stream/processed_local_audio_source.h" #include "media/audio/audio_features.h" #include "media/base/audio_parameters.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 dd19798..8ac0b445 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
@@ -139,13 +139,9 @@ // Create our own SubresourceLoader to route the request to the controller // ServiceWorker. - // TODO(crbug.com/796425): Temporarily wrap the raw mojom::URLLoaderFactory - // pointer into SharedURLLoaderFactory. return std::make_unique<WebURLLoaderImpl>( RenderThreadImpl::current()->resource_dispatcher(), - std::move(task_runner_handle), - base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( - context()->GetSubresourceLoaderFactory())); + std::move(task_runner_handle), context()->GetSubresourceLoaderFactory()); } blink::mojom::ControllerServiceWorkerMode
diff --git a/content/renderer/service_worker/service_worker_provider_context.cc b/content/renderer/service_worker/service_worker_provider_context.cc index 9d0ae40..8780966 100644 --- a/content/renderer/service_worker/service_worker_provider_context.cc +++ b/content/renderer/service_worker/service_worker_provider_context.cc
@@ -23,6 +23,7 @@ #include "mojo/public/cpp/bindings/strong_associated_binding.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "services/network/public/cpp/shared_url_loader_factory.h" +#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" #include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/interface_provider.h" @@ -99,7 +100,7 @@ } network::mojom::URLLoaderFactory* -ServiceWorkerProviderContext::GetSubresourceLoaderFactory() { +ServiceWorkerProviderContext::GetSubresourceLoaderFactoryInternal() { DCHECK(state_for_client_); auto* state = state_for_client_.get(); if (!state->controller_endpoint && !state->controller_connector) { @@ -135,10 +136,29 @@ mojo::MakeRequest(&state->controller_connector), mojo::MakeRequest(&state->subresource_loader_factory), task_runner)); + + DCHECK(!state->weak_wrapped_subresource_loader_factory); + state->weak_wrapped_subresource_loader_factory = + base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( + state->subresource_loader_factory.get()); } return state->subresource_loader_factory.get(); } +scoped_refptr<network::WeakWrapperSharedURLLoaderFactory> +ServiceWorkerProviderContext::GetSubresourceLoaderFactory() { + // If we can't get our internal factory it means the state is not currently + // good to process new requests regardless of the presence of an existing + // weak_wrapped_subresource_loader_factory. + if (!GetSubresourceLoaderFactoryInternal()) { + return nullptr; + } + + DCHECK(state_for_client_); + auto* state = state_for_client_.get(); + return state->weak_wrapped_subresource_loader_factory; +} + blink::mojom::ServiceWorkerContainerHost* ServiceWorkerProviderContext::container_host() const { DCHECK_EQ(blink::mojom::ServiceWorkerProviderType::kForWindow,
diff --git a/content/renderer/service_worker/service_worker_provider_context.h b/content/renderer/service_worker/service_worker_provider_context.h index 64f8a75..c420dc6 100644 --- a/content/renderer/service_worker/service_worker_provider_context.h +++ b/content/renderer/service_worker/service_worker_provider_context.h
@@ -10,6 +10,7 @@ #include <string> #include <vector> +#include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" @@ -39,6 +40,10 @@ namespace service_worker_provider_context_unittest { class ServiceWorkerProviderContextTest; +FORWARD_DECLARE_TEST(ServiceWorkerProviderContextTest, + SetControllerServiceWorker); +FORWARD_DECLARE_TEST(ServiceWorkerProviderContextTest, + ControllerWithoutFetchHandler); } // namespace service_worker_provider_context_unittest class WebServiceWorkerRegistrationImpl; @@ -97,9 +102,13 @@ // any, otherwise returns nullptr. blink::mojom::ServiceWorkerObjectInfoPtr TakeController(); - // Returns URLLoaderFactory for loading subresources with the controller - // ServiceWorker, or nullptr if no controller is attached. - network::mojom::URLLoaderFactory* GetSubresourceLoaderFactory(); + // Returns the factory for loading subresources with the controller + // ServiceWorker, or nullptr if no controller is attached. Returns a + // WeakWrapperSharedURLLoaderFactory because the inner factory is destroyed + // when this context is destroyed but loaders may persist a reference to the + // loader returned from this method. + scoped_refptr<network::WeakWrapperSharedURLLoaderFactory> + GetSubresourceLoaderFactory(); // Returns the feature usage of the controller service worker. const std::set<blink::mojom::WebFeature>& used_features() const; @@ -171,6 +180,12 @@ ServiceWorkerProviderContextTest; friend class WebServiceWorkerRegistrationImpl; friend struct ServiceWorkerProviderContextDeleter; + FRIEND_TEST_ALL_PREFIXES(service_worker_provider_context_unittest:: + ServiceWorkerProviderContextTest, + SetControllerServiceWorker); + FRIEND_TEST_ALL_PREFIXES(service_worker_provider_context_unittest:: + ServiceWorkerProviderContextTest, + ControllerWithoutFetchHandler); ~ServiceWorkerProviderContext() override; void DestructOnMainThread() const; @@ -191,6 +206,10 @@ // can be created for this context. bool CanCreateSubresourceLoaderFactory() const; + // Returns URLLoaderFactory for loading subresources with the controller + // ServiceWorker, or nullptr if no controller is attached. + network::mojom::URLLoaderFactory* GetSubresourceLoaderFactoryInternal(); + const blink::mojom::ServiceWorkerProviderType provider_type_; scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
diff --git a/content/renderer/service_worker/service_worker_provider_context_unittest.cc b/content/renderer/service_worker/service_worker_provider_context_unittest.cc index 90763c6..3be26bb 100644 --- a/content/renderer/service_worker/service_worker_provider_context_unittest.cc +++ b/content/renderer/service_worker/service_worker_provider_context_unittest.cc
@@ -25,6 +25,7 @@ #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/shared_url_loader_factory.h" +#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" #include "services/network/public/cpp/wrapper_shared_url_loader_factory.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" #include "services/network/test/test_url_loader_client.h" @@ -449,8 +450,11 @@ std::move(controller_info1), loader_factory_); // The subresource loader factory must be available. + scoped_refptr<network::WeakWrapperSharedURLLoaderFactory> + wrapped_loader_factory1 = provider_context->GetSubresourceLoaderFactory(); + ASSERT_NE(nullptr, wrapped_loader_factory1); network::mojom::URLLoaderFactory* subresource_loader_factory1 = - provider_context->GetSubresourceLoaderFactory(); + provider_context->GetSubresourceLoaderFactoryInternal(); ASSERT_NE(nullptr, subresource_loader_factory1); // Performing a request should reach the controller. @@ -492,8 +496,12 @@ // Subresource loader factory must be available, and should be the same // one as we got before. + scoped_refptr<network::WeakWrapperSharedURLLoaderFactory> + wrapped_loader_factory2 = provider_context->GetSubresourceLoaderFactory(); + ASSERT_NE(nullptr, wrapped_loader_factory2); + EXPECT_EQ(wrapped_loader_factory1, wrapped_loader_factory2); network::mojom::URLLoaderFactory* subresource_loader_factory2 = - provider_context->GetSubresourceLoaderFactory(); + provider_context->GetSubresourceLoaderFactoryInternal(); ASSERT_NE(nullptr, subresource_loader_factory2); EXPECT_EQ(subresource_loader_factory1, subresource_loader_factory2); @@ -527,6 +535,7 @@ // Subresource loader factory must not be available. EXPECT_EQ(nullptr, provider_context->GetSubresourceLoaderFactory()); + EXPECT_EQ(nullptr, provider_context->GetSubresourceLoaderFactoryInternal()); // The SetController() call results in another Mojo call to // ControllerServiceWorkerConnector.UpdateController(). Flush that interface @@ -568,8 +577,11 @@ container_ptr.FlushForTesting(); // Subresource loader factory must be available. + scoped_refptr<network::WeakWrapperSharedURLLoaderFactory> + wrapped_loader_factory4 = provider_context->GetSubresourceLoaderFactory(); + ASSERT_NE(nullptr, wrapped_loader_factory4); auto* subresource_loader_factory4 = - provider_context->GetSubresourceLoaderFactory(); + provider_context->GetSubresourceLoaderFactoryInternal(); ASSERT_NE(nullptr, subresource_loader_factory4); // The SetController() call results in another Mojo call to @@ -624,6 +636,7 @@ // Subresource loader factory must not be available. EXPECT_EQ(nullptr, provider_context->GetSubresourceLoaderFactory()); + EXPECT_EQ(nullptr, provider_context->GetSubresourceLoaderFactoryInternal()); } TEST_F(ServiceWorkerProviderContextTest, PostMessageToClient) { @@ -736,5 +749,61 @@ provider_context->NotifyExecutionReady(); } +TEST_F(ServiceWorkerProviderContextTest, + SubresourceLoaderFactoryUseableAfterContextDestructs) { + EnableNetworkService(); + + // Make the object host for .controller. + auto mock_service_worker_object_host = + std::make_unique<MockServiceWorkerObjectHost>(201 /* version_id */); + ASSERT_EQ(0, mock_service_worker_object_host->GetBindingCount()); + blink::mojom::ServiceWorkerObjectInfoPtr object_info = + mock_service_worker_object_host->CreateObjectInfo(); + EXPECT_EQ(1, mock_service_worker_object_host->GetBindingCount()); + + // Make the ControllerServiceWorkerInfo. + FakeControllerServiceWorker fake_controller; + auto controller_info = blink::mojom::ControllerServiceWorkerInfo::New(); + blink::mojom::ControllerServiceWorkerPtr controller_ptr; + fake_controller.Clone(mojo::MakeRequest(&controller_ptr)); + controller_info->mode = + blink::mojom::ControllerServiceWorkerMode::kControlled; + controller_info->object_info = std::move(object_info); + controller_info->endpoint = controller_ptr.PassInterface(); + + // Make the container host and container pointers. + blink::mojom::ServiceWorkerContainerHostAssociatedPtr host_ptr; + blink::mojom::ServiceWorkerContainerHostAssociatedRequest host_request = + mojo::MakeRequestAssociatedWithDedicatedPipe(&host_ptr); + blink::mojom::ServiceWorkerContainerAssociatedPtr container_ptr; + blink::mojom::ServiceWorkerContainerAssociatedRequest container_request = + mojo::MakeRequestAssociatedWithDedicatedPipe(&container_ptr); + + // Make the ServiceWorkerProviderContext, pasing it the controller, container, + // and container host. + auto provider_context = base::MakeRefCounted<ServiceWorkerProviderContext>( + blink::mojom::ServiceWorkerProviderType::kForWindow, + std::move(container_request), host_ptr.PassInterface(), + std::move(controller_info), loader_factory_); + + scoped_refptr<network::WeakWrapperSharedURLLoaderFactory> + wrapped_loader_factory = provider_context->GetSubresourceLoaderFactory(); + ASSERT_NE(nullptr, wrapped_loader_factory); + + // Clear our context and ensure that we don't crash when later trying to use + // the factory. + provider_context.reset(); + + network::ResourceRequest request; + request.url = GURL("https://www.example.com/random.js"); + request.resource_type = static_cast<int>(ResourceType::kSubResource); + network::mojom::URLLoaderPtr loader; + network::TestURLLoaderClient loader_client; + wrapped_loader_factory->CreateLoaderAndStart( + mojo::MakeRequest(&loader), 0, 0, network::mojom::kURLLoadOptionNone, + request, loader_client.CreateInterfacePtr(), + net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS)); +} + } // namespace service_worker_provider_context_unittest } // namespace content
diff --git a/content/renderer/service_worker/service_worker_provider_state_for_client.cc b/content/renderer/service_worker/service_worker_provider_state_for_client.cc index b5c043f0..88cbd84 100644 --- a/content/renderer/service_worker/service_worker_provider_state_for_client.cc +++ b/content/renderer/service_worker/service_worker_provider_state_for_client.cc
@@ -6,13 +6,18 @@ #include <utility> +#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" + namespace content { ServiceWorkerProviderStateForClient::ServiceWorkerProviderStateForClient( scoped_refptr<network::SharedURLLoaderFactory> fallback_loader_factory) : fallback_loader_factory(std::move(fallback_loader_factory)) {} -ServiceWorkerProviderStateForClient::~ServiceWorkerProviderStateForClient() = - default; +ServiceWorkerProviderStateForClient::~ServiceWorkerProviderStateForClient() { + if (weak_wrapped_subresource_loader_factory) { + weak_wrapped_subresource_loader_factory->Detach(); + } +} } // namespace content
diff --git a/content/renderer/service_worker/service_worker_provider_state_for_client.h b/content/renderer/service_worker/service_worker_provider_state_for_client.h index d07d11c..67beff3b 100644 --- a/content/renderer/service_worker/service_worker_provider_state_for_client.h +++ b/content/renderer/service_worker/service_worker_provider_state_for_client.h
@@ -22,6 +22,10 @@ #include "third_party/blink/public/mojom/service_worker/service_worker_provider.mojom.h" #include "third_party/blink/public/mojom/web_feature/web_feature.mojom.h" +namespace network { +class WeakWrapperSharedURLLoaderFactory; +} + namespace content { // Holds state for ServiceWorkerProviderContext instances for service worker @@ -43,6 +47,11 @@ // Used when we create |subresource_loader_factory|. scoped_refptr<network::SharedURLLoaderFactory> fallback_loader_factory; + // Used to ensure handed out loader factories are properly detached when the + // contained subresource_loader_factory goes away. + scoped_refptr<network::WeakWrapperSharedURLLoaderFactory> + weak_wrapped_subresource_loader_factory; + // The Client#id value of the client. std::string client_id;
diff --git a/content/test/gpu/gpu_tests/cloud_storage_integration_test_base.py b/content/test/gpu/gpu_tests/cloud_storage_integration_test_base.py index bd7e18e1..df103c2 100644 --- a/content/test/gpu/gpu_tests/cloud_storage_integration_test_base.py +++ b/content/test/gpu/gpu_tests/cloud_storage_integration_test_base.py
@@ -397,6 +397,20 @@ 'view_test_results.html?%s for this run\'s test results') % ( error_image_cloud_storage_bucket, upload_dir) + # TODO(https://crbug.com/983600): Remove this once the truncated images are + # determined to be legitimate or due to upload issues. + @classmethod + def _UploadGoldErrorImageToCloudStorage(cls, image_name, screenshot): + machine_name = re.sub(r'\W+', '_', + cls.GetParsedCommandLineOptions().test_machine_name) + base_bucket = '%s/gold_failures' % (error_image_cloud_storage_bucket) + image_name_with_revision_and_machine = '%s_%s_%s.png' % ( + image_name, machine_name, + cls.GetParsedCommandLineOptions().build_revision) + cls._UploadBitmapToCloudStorage( + base_bucket, image_name_with_revision_and_machine, screenshot, + public=True) + def _ValidateScreenshotSamples(self, tab, url, screenshot, expectations, tolerance, device_pixel_ratio): """Samples the given screenshot and verifies pixel color values. @@ -478,8 +492,7 @@ logging.error('goldctl failed with output: %s', e.output) # TODO(https://crbug.com/983600): Remove this once the truncated images # are determined to be legitimate or due to upload issues. - failure_name = 'gold_%s' % image_name - self._UploadErrorImagesToCloudStorage(failure_name, screenshot, None) + self._UploadGoldErrorImageToCloudStorage(image_name, screenshot) if not self.GetParsedCommandLineOptions().no_skia_gold_failure: raise Exception('goldctl command failed')
diff --git a/content/test/gpu/gpu_tests/test_expectations/context_lost_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/context_lost_expectations.txt index 1a881a03..272a7a7 100644 --- a/content/test/gpu/gpu_tests/test_expectations/context_lost_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/context_lost_expectations.txt
@@ -1,5 +1,6 @@ # tags: [ android linux lion mac mountainlion win win7 win8 ] # tags: [ debug ] +# tags: [ skia-renderer no-skia-renderer ] # tags: [ amd-0x6779 nvidia qualcomm-adreno-(tm)-418 qualcomm-adreno-(tm)-420 ] # tags: [ asan no-asan ] # results: [ Failure RetryOnFailure Skip ] @@ -45,3 +46,5 @@ crbug.com/611906 [ android qualcomm-adreno-(tm)-420 ] ContextLost_WebGLContextLostFromLoseContextExtension [ Failure ] crbug.com/611906 [ android qualcomm-adreno-(tm)-420 ] ContextLost_WebGLContextLostFromQuantity [ Failure ] +# Consistent Failure in SkiaRenderer +crbug.com/984110 [ linux skia-renderer ] ContextLost_WebGL2Blocked [ Skip ]
diff --git a/device/OWNERS b/device/OWNERS index efaea64..0d8a219 100644 --- a/device/OWNERS +++ b/device/OWNERS
@@ -7,3 +7,4 @@ per-file *.xtb=file://tools/translation/TRANSLATION_OWNERS # TEAM: device-dev@chromium.org +# COMPONENT: Internals>Services>Device
diff --git a/docs/privacy/OWNERS b/docs/privacy/OWNERS index 30f1309..0eeaf5c 100644 --- a/docs/privacy/OWNERS +++ b/docs/privacy/OWNERS
@@ -5,3 +5,4 @@ msramek@chromium.org rhalavati@chromium.org tnagel@chromium.org +# COMPONENT: Privacy
diff --git a/docs/security/severity-guidelines.md b/docs/security/severity-guidelines.md index 9985d0f..3937ba83 100644 --- a/docs/security/severity-guidelines.md +++ b/docs/security/severity-guidelines.md
@@ -27,7 +27,8 @@ [SheriffBot](https://www.chromium.org/issue-tracking/autotriage) will automatically assign the milestone. -#### For critical vulnerabilities, we aim to deploy the patch to all Chrome users in under 30 days. +**For critical severity vulnerabilities, we aim to deploy the patch to all +Chrome users in under 30 days.** Critical vulnerability details may be made public in 60 days, in accordance with Google's general [vulnerability disclosure recommendations](https://security.googleblog.com/2010/07/rebooting-responsible-disclosure-focus.html), @@ -60,8 +61,8 @@ [SheriffBot](https://www.chromium.org/issue-tracking/autotriage) will automatically assign the milestone. -For high severity vulnerabilities, we aim to deploy the patch to all Chrome -users in under 60 days. +**For high severity vulnerabilities, we aim to deploy the patch to all Chrome +users in under 60 days.** Example bugs: @@ -88,9 +89,9 @@ information, or are not harmful on their own but potentially harmful when combined with other bugs. This includes information leaks that could be useful in potential memory corruption exploits, or exposure of sensitive user -information that an attacker can exfiltrate. Bugs that would normally rated at a -higher severity level with unusual mitigating factors may be rated as medium -severity. +information that an attacker can exfiltrate. Bugs that would normally be rated +at a higher severity level with unusual mitigating factors may be rated as +medium severity. They are normally assigned priority **Pri-1** and assigned to the current stable milestone (or earliest milestone affected). If the fix seems too complicated to @@ -141,4 +142,3 @@ The [security FAQ](faq.md) covers many of the cases that we do not consider to be security bugs, such as [denial of service](faq.md#TOC-Are-denial-of-service-issues-considered-security-bugs-). -
diff --git a/google_apis/OWNERS b/google_apis/OWNERS index 18ac20e..75d1a79 100644 --- a/google_apis/OWNERS +++ b/google_apis/OWNERS
@@ -2,3 +2,4 @@ file://components/signin/OWNERS per-file BUILD.gn=* +# COMPONENT: Services>SignIn
diff --git a/google_apis/build/OWNERS b/google_apis/build/OWNERS new file mode 100644 index 0000000..ab5f1ae7 --- /dev/null +++ b/google_apis/build/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: Build
diff --git a/google_apis/test/OWNERS b/google_apis/test/OWNERS new file mode 100644 index 0000000..06c2e2b --- /dev/null +++ b/google_apis/test/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: Internals>Services>Network
diff --git a/gpu/ipc/service/stream_texture_android.cc b/gpu/ipc/service/stream_texture_android.cc index 921c3c71..0f81fa1d 100644 --- a/gpu/ipc/service/stream_texture_android.cc +++ b/gpu/ipc/service/stream_texture_android.cc
@@ -142,11 +142,6 @@ sync_point_client_state_->Destroy(); sync_point_client_state_ = nullptr; channel_ = nullptr; - - // If the channel goes away, there is no need to keep the SurfaceTexture - // around. The GL texture will keep working regardless with the currently - // bound frame. - surface_owner_ = nullptr; } // gpu::gles2::GLStreamTextureMatrix implementation
diff --git a/infra/config/cr-buildbucket.cfg b/infra/config/cr-buildbucket.cfg index db38360..f4b9aad 100644 --- a/infra/config/cr-buildbucket.cfg +++ b/infra/config/cr-buildbucket.cfg
@@ -341,7 +341,7 @@ builder_mixins { name: "android-gpu-ci" - dimensions: "os:Ubuntu-14.04" + dimensions: "os:Ubuntu-16.04" mixins: "builderless" recipe { properties: "mastername:chromium.gpu" @@ -350,7 +350,7 @@ builder_mixins { name: "android-gpu-fyi-ci" - dimensions: "os:Ubuntu-14.04" + dimensions: "os:Ubuntu-16.04" mixins: "builderless" mixins: "gpu-fyi-ci" mixins: "gpu-slow-bot" @@ -669,7 +669,7 @@ name: "linux-gpu-ci-builder" dimensions: "cores:8" mixins: "builderless" - mixins: "linux" + mixins: "linux-xenial" recipe { properties: "mastername:chromium.gpu" } @@ -679,7 +679,7 @@ name: "linux-gpu-ci-tester" dimensions: "cores:2" mixins: "builderless" - mixins: "linux" + mixins: "linux-xenial" recipe { properties: "mastername:chromium.gpu" } @@ -691,7 +691,7 @@ mixins: "builderless" mixins: "gpu-fyi-ci" mixins: "gpu-slow-bot" - mixins: "linux" + mixins: "linux-xenial" } builder_mixins { @@ -700,7 +700,7 @@ mixins: "builderless" mixins: "gpu-fyi-ci" mixins: "gpu-slow-bot" - mixins: "linux" + mixins: "linux-xenial" } builder_mixins {
diff --git a/ios/build/bots/chromium.fyi/ios-device-goma-canary-clobber.json b/ios/build/bots/chromium.fyi/ios-device-goma-canary-clobber.json index 443ca8e4..d89cf64f 100644 --- a/ios/build/bots/chromium.fyi/ios-device-goma-canary-clobber.json +++ b/ios/build/bots/chromium.fyi/ios-device-goma-canary-clobber.json
@@ -9,6 +9,7 @@ "ios_enable_code_signing=false", "is_component_build=false", "is_debug=false", + "symbol_level=0", "target_cpu=\"arm64\"", "target_os=\"ios\"", "use_goma=true"
diff --git a/ios/build/bots/chromium.fyi/ios-device-goma-latest-clobber.json b/ios/build/bots/chromium.fyi/ios-device-goma-latest-clobber.json index ccfc0648..70e71fe1 100644 --- a/ios/build/bots/chromium.fyi/ios-device-goma-latest-clobber.json +++ b/ios/build/bots/chromium.fyi/ios-device-goma-latest-clobber.json
@@ -9,6 +9,7 @@ "ios_enable_code_signing=false", "is_component_build=false", "is_debug=false", + "symbol_level=0", "target_cpu=\"arm64\"", "target_os=\"ios\"", "use_goma=true"
diff --git a/media/gpu/android/codec_image.cc b/media/gpu/android/codec_image.cc index 5c753a5..95959d2 100644 --- a/media/gpu/android/codec_image.cc +++ b/media/gpu/android/codec_image.cc
@@ -59,7 +59,7 @@ promotion_hint_cb_ = std::move(promotion_hint_cb); } -void CodecImage::SetDestructionCb(DestructionCb destruction_cb) { +void CodecImage::SetDestructionCB(DestructionCB destruction_cb) { destruction_cb_ = std::move(destruction_cb); }
diff --git a/media/gpu/android/codec_image.h b/media/gpu/android/codec_image.h index bb539473bf..edbfe10 100644 --- a/media/gpu/android/codec_image.h +++ b/media/gpu/android/codec_image.h
@@ -32,7 +32,7 @@ public: // A callback for observing CodecImage destruction. This is a repeating cb // since CodecImageGroup calls the same cb for multiple images. - using DestructionCb = base::RepeatingCallback<void(CodecImage*)>; + using DestructionCB = base::RepeatingCallback<void(CodecImage*)>; CodecImage(); @@ -45,7 +45,7 @@ scoped_refptr<TextureOwner> texture_owner, PromotionHintAggregator::NotifyPromotionHintCB promotion_hint_cb); - void SetDestructionCb(DestructionCb destruction_cb); + void SetDestructionCB(DestructionCB destruction_cb); // gl::GLImage implementation gfx::Size GetSize() override; @@ -155,7 +155,7 @@ // Callback to notify about promotion hints and overlay position. PromotionHintAggregator::NotifyPromotionHintCB promotion_hint_cb_; - DestructionCb destruction_cb_; + DestructionCB destruction_cb_; bool was_tex_image_bound_ = false; DISALLOW_COPY_AND_ASSIGN(CodecImage);
diff --git a/media/gpu/android/codec_image_group.cc b/media/gpu/android/codec_image_group.cc index 97b6c0b..f39f81f 100644 --- a/media/gpu/android/codec_image_group.cc +++ b/media/gpu/android/codec_image_group.cc
@@ -38,8 +38,8 @@ CodecImageGroup::~CodecImageGroup() {} -void CodecImageGroup::SetDestructionCb( - CodecImage::DestructionCb destruction_cb) { +void CodecImageGroup::SetDestructionCB( + CodecImage::DestructionCB destruction_cb) { destruction_cb_ = std::move(destruction_cb); } @@ -55,7 +55,7 @@ // Bind a strong ref to |this| so that the callback will prevent us from being // destroyed until the CodecImage is destroyed. - image->SetDestructionCb( + image->SetDestructionCB( base::BindRepeating(&CodecImageGroup::OnCodecImageDestroyed, scoped_refptr<CodecImageGroup>(this))); }
diff --git a/media/gpu/android/codec_image_group.h b/media/gpu/android/codec_image_group.h index 34470c2..0b6c6b6a 100644 --- a/media/gpu/android/codec_image_group.h +++ b/media/gpu/android/codec_image_group.h
@@ -45,7 +45,7 @@ scoped_refptr<CodecSurfaceBundle> bundle); // Set the callback that we'll notify when any image is destroyed. - void SetDestructionCb(CodecImage::DestructionCb destruction_cb); + void SetDestructionCB(CodecImage::DestructionCB destruction_cb); // Notify us that |image| uses |surface_bundle_|. void AddCodecImage(CodecImage* image); @@ -69,7 +69,7 @@ std::unordered_set<CodecImage*> images_; // We'll forward CodecImage destructions to |destruction_cb_|. - CodecImage::DestructionCb destruction_cb_; + CodecImage::DestructionCB destruction_cb_; base::WeakPtrFactory<CodecImageGroup> weak_this_factory_; };
diff --git a/media/gpu/android/codec_image_group_unittest.cc b/media/gpu/android/codec_image_group_unittest.cc index 663cecf..9f661aa9 100644 --- a/media/gpu/android/codec_image_group_unittest.cc +++ b/media/gpu/android/codec_image_group_unittest.cc
@@ -148,7 +148,7 @@ Record rec = CreateImageGroup(); scoped_refptr<CodecImage> image_1 = new MockCodecImage(); scoped_refptr<CodecImage> image_2 = new MockCodecImage(); - rec.image_group->SetDestructionCb(base::Bind( + rec.image_group->SetDestructionCB(base::BindRepeating( &CodecImageGroupTest::OnCodecImageDestroyed, base::Unretained(this))); rec.image_group->AddCodecImage(image_1.get()); rec.image_group->AddCodecImage(image_2.get());
diff --git a/media/gpu/android/codec_image_unittest.cc b/media/gpu/android/codec_image_unittest.cc index 96f8edd..acfc017 100644 --- a/media/gpu/android/codec_image_unittest.cc +++ b/media/gpu/android/codec_image_unittest.cc
@@ -78,7 +78,7 @@ enum ImageKind { kOverlay, kTextureOwner }; scoped_refptr<CodecImage> NewImage( ImageKind kind, - CodecImage::DestructionCb destruction_cb = base::DoNothing()) { + CodecImage::DestructionCB destruction_cb = base::DoNothing()) { std::unique_ptr<CodecOutputBuffer> buffer; wrapper_->DequeueOutputBuffer(nullptr, nullptr, &buffer); scoped_refptr<CodecImage> image = new CodecImage(); @@ -87,7 +87,7 @@ base::BindRepeating(&PromotionHintReceiver::OnPromotionHint, base::Unretained(&promotion_hint_receiver_))); - image->SetDestructionCb(std::move(destruction_cb)); + image->SetDestructionCB(std::move(destruction_cb)); return image; } @@ -114,8 +114,8 @@ bool BindsTextureOnUpdate() override { return false; } }; -TEST_F(CodecImageTest, DestructionCbRuns) { - base::MockCallback<CodecImage::DestructionCb> cb; +TEST_F(CodecImageTest, DestructionCBRuns) { + base::MockCallback<CodecImage::DestructionCB> cb; auto i = NewImage(kOverlay, cb.Get()); EXPECT_CALL(cb, Run(i.get())); i = nullptr;
diff --git a/media/gpu/android/maybe_render_early_manager.cc b/media/gpu/android/maybe_render_early_manager.cc index fcec8fa..67f1a6d 100644 --- a/media/gpu/android/maybe_render_early_manager.cc +++ b/media/gpu/android/maybe_render_early_manager.cc
@@ -21,7 +21,7 @@ void SetCodecImageGroup(scoped_refptr<CodecImageGroup> image_group) { image_group_ = std::move(image_group); - image_group_->SetDestructionCb( + image_group_->SetDestructionCB( base::BindRepeating(&GpuMaybeRenderEarlyImpl::OnImageDestructed, weak_factory_.GetWeakPtr())); }
diff --git a/media/gpu/linux/platform_video_frame_utils.cc b/media/gpu/linux/platform_video_frame_utils.cc index 7c591c32..5056c713 100644 --- a/media/gpu/linux/platform_video_frame_utils.cc +++ b/media/gpu/linux/platform_video_frame_utils.cc
@@ -102,6 +102,19 @@ return nullptr; } +base::Optional<VideoFrameLayout> GetPlatformVideoFrameLayout( + VideoPixelFormat pixel_format, + const gfx::Size& coded_size, + gfx::BufferUsage buffer_usage) { + // |visible_rect| and |natural_size| are not matter here. |coded_size| is set + // as a dummy variable. + auto frame = + CreatePlatformVideoFrame(pixel_format, coded_size, gfx::Rect(coded_size), + coded_size, base::TimeDelta(), buffer_usage); + return frame ? base::make_optional<VideoFrameLayout>(frame->layout()) + : base::nullopt; +} + gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferHandle( const VideoFrame* video_frame) { DCHECK(video_frame);
diff --git a/media/gpu/linux/platform_video_frame_utils.h b/media/gpu/linux/platform_video_frame_utils.h index bbc7b798..4d13814 100644 --- a/media/gpu/linux/platform_video_frame_utils.h +++ b/media/gpu/linux/platform_video_frame_utils.h
@@ -26,6 +26,14 @@ base::TimeDelta timestamp, gfx::BufferUsage buffer_usage); +// Get VideoFrameLayout of platform dependent video frame with |pixel_format|, +// |coded_size| and |buffer_usage|. This function is not cost-free as this +// allocates a platform dependent video frame. +MEDIA_GPU_EXPORT base::Optional<VideoFrameLayout> GetPlatformVideoFrameLayout( + VideoPixelFormat pixel_format, + const gfx::Size& coded_size, + gfx::BufferUsage buffer_usage); + // Create a shared GPU memory handle to the |video_frame|'s data. MEDIA_GPU_EXPORT gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferHandle( const VideoFrame* video_frame);
diff --git a/media/mojo/services/gpu_mojo_media_client.cc b/media/mojo/services/gpu_mojo_media_client.cc index a2707dd..f90c135 100644 --- a/media/mojo/services/gpu_mojo_media_client.cc +++ b/media/mojo/services/gpu_mojo_media_client.cc
@@ -203,20 +203,20 @@ switch (implementation) { case VideoDecoderImplementation::kDefault: { #if defined(OS_ANDROID) - auto get_stub_cb = - base::Bind(&GetCommandBufferStub, media_gpu_channel_manager_, - command_buffer_id->channel_token, command_buffer_id->route_id); - auto image_provider = std::make_unique<DirectSharedImageVideoProvider>( - gpu_task_runner_, std::move(get_stub_cb)); - video_decoder = std::make_unique<MediaCodecVideoDecoder>( - gpu_preferences_, gpu_feature_info_, DeviceInfo::GetInstance(), - CodecAllocator::GetInstance(gpu_task_runner_), - std::make_unique<AndroidVideoSurfaceChooserImpl>( - DeviceInfo::GetInstance()->IsSetOutputSurfaceSupported()), - android_overlay_factory_cb_, std::move(request_overlay_info_cb), - std::make_unique<VideoFrameFactoryImpl>( - gpu_task_runner_, gpu_preferences_, std::move(image_provider), - MaybeRenderEarlyManager::Create(gpu_task_runner_))); + auto get_stub_cb = base::Bind( + &GetCommandBufferStub, media_gpu_channel_manager_, + command_buffer_id->channel_token, command_buffer_id->route_id); + auto image_provider = std::make_unique<DirectSharedImageVideoProvider>( + gpu_task_runner_, std::move(get_stub_cb)); + video_decoder = std::make_unique<MediaCodecVideoDecoder>( + gpu_preferences_, gpu_feature_info_, DeviceInfo::GetInstance(), + CodecAllocator::GetInstance(gpu_task_runner_), + std::make_unique<AndroidVideoSurfaceChooserImpl>( + DeviceInfo::GetInstance()->IsSetOutputSurfaceSupported()), + android_overlay_factory_cb_, std::move(request_overlay_info_cb), + std::make_unique<VideoFrameFactoryImpl>( + gpu_task_runner_, gpu_preferences_, std::move(image_provider), + MaybeRenderEarlyManager::Create(gpu_task_runner_))); #elif defined(OS_CHROMEOS) std::unique_ptr<VideoDecoder> cros_video_decoder; @@ -258,19 +258,19 @@ case VideoDecoderImplementation::kAlternate: #if defined(OS_WIN) - if (base::FeatureList::IsEnabled(kD3D11VideoDecoder)) { - // If nothing has cached the configs yet, then do so now. - if (!d3d11_supported_configs_) - GetSupportedVideoDecoderConfigs(); + if (base::FeatureList::IsEnabled(kD3D11VideoDecoder)) { + // If nothing has cached the configs yet, then do so now. + if (!d3d11_supported_configs_) + GetSupportedVideoDecoderConfigs(); - video_decoder = D3D11VideoDecoder::Create( - gpu_task_runner_, media_log->Clone(), gpu_preferences_, - gpu_workarounds_, - base::BindRepeating(&GetCommandBufferStub, media_gpu_channel_manager_, - command_buffer_id->channel_token, - command_buffer_id->route_id), - GetD3D11DeviceCallback(), *d3d11_supported_configs_); - } + video_decoder = D3D11VideoDecoder::Create( + gpu_task_runner_, media_log->Clone(), gpu_preferences_, + gpu_workarounds_, + base::BindRepeating( + &GetCommandBufferStub, media_gpu_channel_manager_, + command_buffer_id->channel_token, command_buffer_id->route_id), + GetD3D11DeviceCallback(), *d3d11_supported_configs_); + } #endif // defined(OS_WIN) break; }; // switch
diff --git a/media/renderers/paint_canvas_video_renderer.cc b/media/renderers/paint_canvas_video_renderer.cc index 91449c52..2a290b9 100644 --- a/media/renderers/paint_canvas_video_renderer.cc +++ b/media/renderers/paint_canvas_video_renderer.cc
@@ -12,7 +12,6 @@ #include "base/memory/ptr_util.h" #include "cc/paint/paint_canvas.h" #include "cc/paint/paint_flags.h" -#include "cc/paint/paint_image.h" #include "cc/paint/paint_image_builder.h" #include "components/viz/common/gpu/context_provider.h" #include "gpu/GLES2/gl2extchromium.h" @@ -572,16 +571,14 @@ }; PaintCanvasVideoRenderer::PaintCanvasVideoRenderer() - : last_image_deleting_timer_( + : cache_deleting_timer_( FROM_HERE, base::TimeDelta::FromSeconds(kTemporaryResourceDeletionDelay), this, &PaintCanvasVideoRenderer::ResetCache), renderer_stable_id_(cc::PaintImage::GetNextId()) {} -PaintCanvasVideoRenderer::~PaintCanvasVideoRenderer() { - ResetCache(); -} +PaintCanvasVideoRenderer::~PaintCanvasVideoRenderer() = default; void PaintCanvasVideoRenderer::Paint(scoped_refptr<VideoFrame> video_frame, cc::PaintCanvas* canvas, @@ -615,6 +612,9 @@ if (!UpdateLastImage(video_frame, context_provider, false /* allow_wrap_texture */)) return; + DCHECK(cache_); + cc::PaintImage image = cache_->paint_image; + DCHECK(image); cc::PaintFlags video_flags; video_flags.setAlpha(flags.getAlpha()); @@ -623,7 +623,7 @@ const bool need_rotation = video_transformation.rotation != VIDEO_ROTATION_0; const bool need_scaling = - dest_rect.size() != gfx::SizeF(last_image_.width(), last_image_.height()); + dest_rect.size() != gfx::SizeF(image.width(), image.height()); const bool need_translation = !dest_rect.origin().IsOrigin(); // TODO(tmathmeyer): apply horizontal / vertical mirroring if needed. bool need_transform = need_rotation || need_scaling || need_translation; @@ -654,11 +654,10 @@ rotated_dest_size = gfx::SizeF(rotated_dest_size.height(), rotated_dest_size.width()); } - canvas->scale( - SkFloatToScalar(rotated_dest_size.width() / last_image_.width()), - SkFloatToScalar(rotated_dest_size.height() / last_image_.height())); - canvas->translate(-SkFloatToScalar(last_image_.width() * 0.5f), - -SkFloatToScalar(last_image_.height() * 0.5f)); + canvas->scale(SkFloatToScalar(rotated_dest_size.width() / image.width()), + SkFloatToScalar(rotated_dest_size.height() / image.height())); + canvas->translate(-SkFloatToScalar(image.width() * 0.5f), + -SkFloatToScalar(image.height() * 0.5f)); } // This is a workaround for crbug.com/524717. A texture backed image is not @@ -667,15 +666,13 @@ // sw image into the SkPicture. The long term solution is for Skia to provide // a SkPicture filter that makes a picture safe for multiple CPU raster // threads. (skbug.com/4321). - cc::PaintImage image = last_image_; if (canvas->imageInfo().colorType() == kUnknown_SkColorType && - last_image_.IsTextureBacked()) { + image.IsTextureBacked()) { sk_sp<SkImage> non_texture_image = - last_image_.GetSkImage()->makeNonTextureImage(); - image = - cc::PaintImageBuilder::WithProperties(last_image_) - .set_image(std::move(non_texture_image), last_image_.content_id()) - .TakePaintImage(); + image.GetSkImage()->makeNonTextureImage(); + image = cc::PaintImageBuilder::WithProperties(image) + .set_image(std::move(non_texture_image), image.content_id()) + .TakePaintImage(); } canvas->drawImage(image, 0, 0, &video_flags); @@ -692,9 +689,9 @@ context_provider->ContextSupport()); } // Because we are not retaining a reference to the VideoFrame, it would be - // invalid for last_image_ to directly wrap its texture(s), as they will be + // invalid for the cache to directly wrap its texture(s), as they will be // recycled. - DCHECK(!last_image_wraps_video_frame_texture_); + DCHECK(!cache_ || !cache_->wraps_video_frame_texture); } void PaintCanvasVideoRenderer::Copy(scoped_refptr<VideoFrame> video_frame, @@ -1129,8 +1126,10 @@ return false; } + DCHECK(cache_); + DCHECK(cache_->source_image); GrBackendTexture backend_texture = - last_image_.GetSkImage()->getBackendTexture(true); + cache_->source_image->getBackendTexture(true); if (!backend_texture.isValid()) return false; GrGLTextureInfo texture_info; @@ -1154,9 +1153,10 @@ destination_gl->CreateAndConsumeTextureCHROMIUM( mailbox_holder.mailbox.name); - destination_gl->CopyTextureCHROMIUM(intermediate_texture, 0, target, - texture, level, internal_format, type, - flip_y, premultiply_alpha, false); + VideoFrameCopyTextureOrSubTexture( + destination_gl, cache_->coded_size, cache_->visible_rect, + intermediate_texture, target, texture, internal_format, format, type, + level, premultiply_alpha, flip_y); destination_gl->DeleteTextures(1, &intermediate_texture); @@ -1167,14 +1167,14 @@ canvas_gl->WaitSyncTokenCHROMIUM(dest_sync_token.GetConstData()); // Because we are not retaining a reference to the VideoFrame, it would be - // invalid to keep last_image_ around if it directly wraps the VideoFrame + // invalid to keep the cache around if it directly wraps the VideoFrame // texture(s), as they will be recycled. - if (last_image_wraps_video_frame_texture_) - ResetCache(); + if (cache_->wraps_video_frame_texture) + cache_.reset(); // Synchronize |video_frame| with the read operations in UpdateLastImage(), // which are triggered by getBackendTexture() or CopyTextureCHROMIUM (in the - // case last_image_ was referencing its texture(s) directly). + // case the cache was referencing its texture(s) directly). SynchronizeVideoFrameRead(std::move(video_frame), canvas_gl, context_provider->ContextSupport()); } else { @@ -1183,7 +1183,7 @@ format, type, level, premultiply_alpha, flip_y); SynchronizeVideoFrameRead(std::move(video_frame), destination_gl, nullptr); } - DCHECK(!last_image_wraps_video_frame_texture_); + DCHECK(!cache_ || !cache_->wraps_video_frame_texture); return true; } @@ -1259,7 +1259,7 @@ SyncTokenClientImpl client(source_gl); video_frame->UpdateReleaseSyncToken(&client); - DCHECK(!last_image_wraps_video_frame_texture_); + DCHECK(!cache_ || !cache_->wraps_video_frame_texture); return true; } @@ -1412,7 +1412,7 @@ // The temporary SkImages should be automatically cleaned up here. // Kick off a timer to release the cache. - last_image_deleting_timer_.Reset(); + cache_deleting_timer_.Reset(); return true; } @@ -1490,28 +1490,28 @@ void PaintCanvasVideoRenderer::ResetCache() { DCHECK(thread_checker_.CalledOnValidThread()); - // Clear cached values. - last_image_ = cc::PaintImage(); - last_id_.reset(); - last_image_wraps_video_frame_texture_ = false; + cache_.reset(); yuv_cache_.Reset(); } +PaintCanvasVideoRenderer::Cache::Cache(int frame_id) : frame_id(frame_id) {} + +PaintCanvasVideoRenderer::Cache::~Cache() = default; + bool PaintCanvasVideoRenderer::UpdateLastImage( scoped_refptr<VideoFrame> video_frame, viz::ContextProvider* context_provider, bool allow_wrap_texture) { - DCHECK(!last_image_wraps_video_frame_texture_); - if (!last_image_ || video_frame->unique_id() != last_id_ || - !last_image_.GetSkImage()->getBackendTexture(true).isValid()) { - ResetCache(); + DCHECK(!cache_ || !cache_->wraps_video_frame_texture); + if (!cache_ || video_frame->unique_id() != cache_->frame_id || + !cache_->source_image) { + cache_.emplace(video_frame->unique_id()); auto paint_image_builder = cc::PaintImageBuilder::WithDefault() .set_id(renderer_stable_id_) .set_animation_type(cc::PaintImage::AnimationType::VIDEO) .set_completion_state(cc::PaintImage::CompletionState::DONE); - // Generate a new image. // Note: Skia will hold onto |video_frame| via |video_generator| only when // |video_frame| is software. @@ -1522,29 +1522,38 @@ DCHECK(context_provider->GrContext()); DCHECK(context_provider->ContextGL()); if (video_frame->NumTextures() > 1) { - paint_image_builder.set_image(NewSkImageFromVideoFrameYUVTextures( - video_frame.get(), context_provider), - cc::PaintImage::GetNextContentId()); + cache_->source_image = NewSkImageFromVideoFrameYUVTextures( + video_frame.get(), context_provider); } else { - paint_image_builder.set_image( - NewSkImageFromVideoFrameNative( - video_frame.get(), context_provider, allow_wrap_texture, - &last_image_wraps_video_frame_texture_), - cc::PaintImage::GetNextContentId()); + cache_->source_image = NewSkImageFromVideoFrameNative( + video_frame.get(), context_provider, allow_wrap_texture, + &cache_->wraps_video_frame_texture); } + if (!cache_->source_image) { + // Couldn't create the SkImage. + cache_.reset(); + return false; + } + cache_->coded_size = video_frame->coded_size(); + cache_->visible_rect = video_frame->visible_rect(); + paint_image_builder.set_image( + cache_->source_image->makeSubset( + gfx::RectToSkIRect(cache_->visible_rect)), + cc::PaintImage::GetNextContentId()); } else { paint_image_builder.set_paint_image_generator( sk_make_sp<VideoImageGenerator>(video_frame)); } - last_image_ = paint_image_builder.TakePaintImage(); - CorrectLastImageDimensions(gfx::RectToSkIRect(video_frame->visible_rect())); - if (!last_image_) // Couldn't create the SkImage. + cache_->paint_image = paint_image_builder.TakePaintImage(); + if (!cache_->paint_image) { + // Couldn't create the SkImage. + cache_.reset(); return false; - last_id_ = video_frame->unique_id(); + } } - DCHECK(last_image_); - last_image_deleting_timer_.Reset(); + DCHECK(cache_); + cache_deleting_timer_.Reset(); return true; } @@ -1553,9 +1562,7 @@ viz::ContextProvider* context_provider, unsigned int textureTarget, unsigned int texture) { - // We are about to replace last_image_, make sure to reset related state such - // as last_id_ or last_image_wraps_video_frame_texture_. - ResetCache(); + cache_.emplace(video_frame->unique_id()); auto paint_image_builder = cc::PaintImageBuilder::WithDefault() .set_id(renderer_stable_id_) @@ -1572,25 +1579,29 @@ DCHECK(context_provider->GrContext()); DCHECK(context_provider->ContextGL()); if (video_frame->NumTextures() > 1) { - paint_image_builder.set_image( + cache_->source_image = NewSkImageFromVideoFrameYUVTexturesWithExternalBackend( - video_frame.get(), context_provider, textureTarget, texture), - cc::PaintImage::GetNextContentId()); + video_frame.get(), context_provider, textureTarget, texture); + if (!cache_->source_image) { + // Couldn't create the SkImage. + cache_.reset(); + return false; + } } else { // We don't support Android now. + cache_.reset(); return false; } + cache_->coded_size = video_frame->coded_size(); + cache_->visible_rect = video_frame->visible_rect(); + paint_image_builder.set_image(cache_->source_image->makeSubset( + gfx::RectToSkIRect(cache_->visible_rect)), + cc::PaintImage::GetNextContentId()); } else { paint_image_builder.set_paint_image_generator( sk_make_sp<VideoImageGenerator>(video_frame)); } - last_image_ = paint_image_builder.TakePaintImage(); - CorrectLastImageDimensions(gfx::RectToSkIRect(video_frame->visible_rect())); - if (!last_image_) // Couldn't create the SkImage. - return false; - last_id_ = video_frame->unique_id(); - last_image_deleting_timer_.Reset(); - DCHECK(!!last_image_); + cache_deleting_timer_.Reset(); return true; } @@ -1618,21 +1629,10 @@ context_provider.reset(); } -void PaintCanvasVideoRenderer::CorrectLastImageDimensions( - const SkIRect& visible_rect) { - last_image_dimensions_for_testing_ = visible_rect.size(); - if (!last_image_) - return; - SkIRect bounds = SkIRect::MakeWH(last_image_.width(), last_image_.height()); - if (bounds.size() != visible_rect.size() && bounds.contains(visible_rect)) { - last_image_ = cc::PaintImageBuilder::WithCopy(std::move(last_image_)) - .make_subset(gfx::SkIRectToRect(visible_rect)) - .TakePaintImage(); - } -} - -SkISize PaintCanvasVideoRenderer::LastImageDimensionsForTesting() { - return last_image_dimensions_for_testing_; +gfx::Size PaintCanvasVideoRenderer::LastImageDimensionsForTesting() { + DCHECK(cache_); + DCHECK(cache_->paint_image); + return gfx::Size(cache_->paint_image.width(), cache_->paint_image.height()); } } // namespace media
diff --git a/media/renderers/paint_canvas_video_renderer.h b/media/renderers/paint_canvas_video_renderer.h index 3027169..4664b93f 100644 --- a/media/renderers/paint_canvas_video_renderer.h +++ b/media/renderers/paint_canvas_video_renderer.h
@@ -180,43 +180,66 @@ void ResetCache(); // Used for unit test. - SkISize LastImageDimensionsForTesting(); + gfx::Size LastImageDimensionsForTesting(); private: + // This structure wraps information extracted out of a VideoFrame and/or + // constructed out of it. The various calls in PaintCanvasVideoRenderer must + // not keep a reference to the VideoFrame so necessary data is extracted out + // of it. + struct Cache { + explicit Cache(int frame_id); + ~Cache(); + + // VideoFrame::unique_id() of the videoframe used to generate the cache. + int frame_id; + + // A PaintImage that can be used to draw into a PaintCanvas. This is sized + // to the visible size of the VideoFrame. Its contents are generated lazily. + cc::PaintImage paint_image; + + // A SkImage that contain the source texture for |paint_image|. This can be + // either the source VideoFrame's texture (if wraps_video_frame_texture is + // true) or a newly allocated texture (if wraps_video_frame_texture is + // false) if a copy or conversion was necessary. + // This is only set if the VideoFrame was texture-backed. + sk_sp<SkImage> source_image; + + // The allocated size of |source_image|. + // This is only set if the VideoFrame was texture-backed. + gfx::Size coded_size; + + // The visible subrect of |coded_size| that represents the logical contents + // of the frame after cropping. + // This is only set if the VideoFrame was texture-backed. + gfx::Rect visible_rect; + + // Whether |source_image| directly points to a texture of the VideoFrame + // (if true), or to an allocated texture (if false). + bool wraps_video_frame_texture = false; + }; + // Update the cache holding the most-recently-painted frame. Returns false // if the image couldn't be updated. bool UpdateLastImage(scoped_refptr<VideoFrame> video_frame, viz::ContextProvider* context_provider, bool allow_wrap_texture); - void CorrectLastImageDimensions(const SkIRect& visible_rect); - bool PrepareVideoFrame(scoped_refptr<VideoFrame> video_frame, viz::ContextProvider* context_provider, unsigned int textureTarget, unsigned int texture); - // Last image used to draw to the canvas. - cc::PaintImage last_image_; + base::Optional<Cache> cache_; - // last_image_ directly wraps a texture from a VideoFrame, in which case we - // need to synchronize access before releasing the VideoFrame. - bool last_image_wraps_video_frame_texture_ = false; - - // VideoFrame::unique_id() of the videoframe used to generate |last_image_|. - base::Optional<int> last_id_; - - // If |last_image_| is not used for a while, it's deleted to save memory. - base::DelayTimer last_image_deleting_timer_; + // If |cache_| is not used for a while, it's deleted to save memory. + base::DelayTimer cache_deleting_timer_; // Stable paint image id to provide to draw image calls. cc::PaintImage::Id renderer_stable_id_; // Used for DCHECKs to ensure method calls executed in the correct thread. base::ThreadChecker thread_checker_; - // Used for unit test. - SkISize last_image_dimensions_for_testing_; - struct YUVTextureCache { YUVTextureCache(); ~YUVTextureCache();
diff --git a/mojo/public/cpp/bindings/receiver_set.h b/mojo/public/cpp/bindings/receiver_set.h index 182ff91f..cf740d26 100644 --- a/mojo/public/cpp/bindings/receiver_set.h +++ b/mojo/public/cpp/bindings/receiver_set.h
@@ -230,6 +230,13 @@ current_receiver()); } + void FlushForTesting() { + for (const auto& it : receivers_) { + if (it.second) + it.second->FlushForTesting(); + } + } + private: friend class Entry; @@ -252,6 +259,8 @@ base::BindOnce(&Entry::OnDisconnect, base::Unretained(this))); } + void FlushForTesting() { receiver_.FlushForTesting(); } + private: class DispatchFilter : public MessageReceiver { public:
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc index 40d1755..88c1f52 100644 --- a/net/http/http_network_session.cc +++ b/net/http/http_network_session.cc
@@ -98,46 +98,8 @@ enable_websocket_over_http2(false), enable_quic(false), enable_quic_proxies_for_https_urls(false), - quic_max_packet_length(quic::kDefaultMaxPacketSize), - quic_max_server_configs_stored_in_properties(0u), - quic_enable_socket_recv_optimization(false), - mark_quic_broken_when_network_blackholes(false), - retry_without_alt_svc_on_quic_errors(true), - support_ietf_format_quic_altsvc(false), - quic_close_sessions_on_ip_change(false), - quic_goaway_sessions_on_ip_change(false), - quic_idle_connection_timeout_seconds(kIdleConnectionTimeoutSeconds), - quic_reduced_ping_timeout_seconds(quic::kPingTimeoutSecs), - quic_retransmittable_on_wire_timeout_milliseconds(0), - quic_max_time_before_crypto_handshake_seconds( - quic::kMaxTimeForCryptoHandshakeSecs), - quic_max_idle_time_before_crypto_handshake_seconds( - quic::kInitialIdleTimeoutSecs), - quic_migrate_sessions_on_network_change_v2(false), - quic_migrate_sessions_early_v2(false), - quic_retry_on_alternate_network_before_handshake(false), - quic_migrate_idle_sessions(false), - quic_idle_session_migration_period(base::TimeDelta::FromSeconds( - kDefaultIdleSessionMigrationPeriodSeconds)), - quic_max_time_on_non_default_network( - base::TimeDelta::FromSeconds(kMaxTimeOnNonDefaultNetworkSecs)), - quic_max_migrations_to_non_default_network_on_write_error( - kMaxMigrationsToNonDefaultNetworkOnWriteError), - quic_max_migrations_to_non_default_network_on_path_degrading( - kMaxMigrationsToNonDefaultNetworkOnPathDegrading), - quic_allow_server_migration(false), - quic_allow_remote_alt_svc(true), - quic_race_stale_dns_on_connection(false), - quic_go_away_on_path_degrading(false), - quic_disable_bidirectional_streams(false), - quic_race_cert_verification(false), - quic_estimate_initial_rtt(false), - quic_headers_include_h2_stream_dependency(false), - quic_initial_rtt_for_handshake_milliseconds(0), http_09_on_non_default_ports_enabled(false), disable_idle_sockets_close_on_memory_pressure(false) { - quic_supported_versions.push_back(quic::ParsedQuicVersion( - quic::PROTOCOL_QUIC_CRYPTO, quic::QUIC_VERSION_46)); enable_early_data = base::FeatureList::IsEnabled(features::kEnableTLS13EarlyData); } @@ -210,42 +172,14 @@ : quic::QuicRandom::GetInstance(), context.quic_clock ? context.quic_clock : quic::QuicChromiumClock::GetInstance(), - params.quic_max_packet_length, - params.quic_user_agent_id, - params.quic_max_server_configs_stored_in_properties > 0, - params.quic_close_sessions_on_ip_change, - params.quic_goaway_sessions_on_ip_change, - params.mark_quic_broken_when_network_blackholes, - params.quic_idle_connection_timeout_seconds, - params.quic_reduced_ping_timeout_seconds, - params.quic_retransmittable_on_wire_timeout_milliseconds, - params.quic_max_time_before_crypto_handshake_seconds, - params.quic_max_idle_time_before_crypto_handshake_seconds, - params.quic_migrate_sessions_on_network_change_v2, - params.quic_migrate_sessions_early_v2, - params.quic_retry_on_alternate_network_before_handshake, - params.quic_migrate_idle_sessions, - params.quic_idle_session_migration_period, - params.quic_max_time_on_non_default_network, - params.quic_max_migrations_to_non_default_network_on_write_error, - params.quic_max_migrations_to_non_default_network_on_path_degrading, - params.quic_allow_server_migration, - params.quic_race_stale_dns_on_connection, - params.quic_go_away_on_path_degrading, - params.quic_race_cert_verification, - params.quic_estimate_initial_rtt, - params.quic_headers_include_h2_stream_dependency, - params.quic_connection_options, - params.quic_client_connection_options, - params.quic_enable_socket_recv_optimization, - params.quic_initial_rtt_for_handshake_milliseconds), + params.quic_params), spdy_session_pool_(context.host_resolver, context.ssl_config_service, context.http_server_properties, context.transport_security_state, - params.quic_supported_versions, + params.quic_params.supported_versions, params.enable_spdy_ping_based_connection_checking, - params.support_ietf_format_quic_altsvc, + params.quic_params.support_ietf_format_quic_altsvc, params.spdy_session_max_recv_window_size, AddDefaultHttp2Settings(params.http2_settings), params.greased_http2_frame, @@ -274,7 +208,7 @@ next_protos_.push_back(kProtoHTTP11); http_server_properties_->SetMaxServerConfigsStoredInProperties( - params.quic_max_server_configs_stored_in_properties); + params.quic_params.max_server_configs_stored_in_properties); if (!params_.disable_idle_sockets_close_on_memory_pressure) { memory_pressure_listener_.reset( @@ -327,69 +261,77 @@ dict->SetBoolean("quic_enabled", IsQuicEnabled()); auto connection_options(std::make_unique<base::ListValue>()); - for (const auto& option : params_.quic_connection_options) + for (const auto& option : params_.quic_params.connection_options) connection_options->AppendString(quic::QuicTagToString(option)); dict->Set("connection_options", std::move(connection_options)); auto supported_versions(std::make_unique<base::ListValue>()); - for (const auto& version : params_.quic_supported_versions) + for (const auto& version : params_.quic_params.supported_versions) supported_versions->AppendString(ParsedQuicVersionToString(version)); dict->Set("supported_versions", std::move(supported_versions)); auto origins_to_force_quic_on(std::make_unique<base::ListValue>()); - for (const auto& origin : params_.origins_to_force_quic_on) + for (const auto& origin : params_.quic_params.origins_to_force_quic_on) origins_to_force_quic_on->AppendString(origin.ToString()); dict->Set("origins_to_force_quic_on", std::move(origins_to_force_quic_on)); - dict->SetInteger("max_packet_length", params_.quic_max_packet_length); + dict->SetInteger("max_packet_length", params_.quic_params.max_packet_length); dict->SetInteger("max_server_configs_stored_in_properties", - params_.quic_max_server_configs_stored_in_properties); + params_.quic_params.max_server_configs_stored_in_properties); dict->SetInteger("idle_connection_timeout_seconds", - params_.quic_idle_connection_timeout_seconds); + params_.quic_params.idle_connection_timeout_seconds); dict->SetInteger("reduced_ping_timeout_seconds", - params_.quic_reduced_ping_timeout_seconds); - dict->SetBoolean("mark_quic_broken_when_network_blackholes", - params_.mark_quic_broken_when_network_blackholes); + params_.quic_params.reduced_ping_timeout_seconds); + dict->SetBoolean( + "mark_quic_broken_when_network_blackholes", + params_.quic_params.mark_quic_broken_when_network_blackholes); dict->SetBoolean("retry_without_alt_svc_on_quic_errors", - params_.retry_without_alt_svc_on_quic_errors); + params_.quic_params.retry_without_alt_svc_on_quic_errors); dict->SetBoolean("race_cert_verification", - params_.quic_race_cert_verification); + params_.quic_params.race_cert_verification); dict->SetBoolean("disable_bidirectional_streams", - params_.quic_disable_bidirectional_streams); + params_.quic_params.disable_bidirectional_streams); dict->SetBoolean("close_sessions_on_ip_change", - params_.quic_close_sessions_on_ip_change); + params_.quic_params.close_sessions_on_ip_change); dict->SetBoolean("goaway_sessions_on_ip_change", - params_.quic_goaway_sessions_on_ip_change); + params_.quic_params.goaway_sessions_on_ip_change); dict->SetBoolean("migrate_sessions_on_network_change_v2", - params_.quic_migrate_sessions_on_network_change_v2); + params_.quic_params.migrate_sessions_on_network_change_v2); dict->SetBoolean("migrate_sessions_early_v2", - params_.quic_migrate_sessions_early_v2); - dict->SetInteger("retransmittable_on_wire_timeout_milliseconds", - params_.quic_retransmittable_on_wire_timeout_milliseconds); - dict->SetBoolean("retry_on_alternate_network_before_handshake", - params_.quic_retry_on_alternate_network_before_handshake); - dict->SetBoolean("migrate_idle_sessions", params_.quic_migrate_idle_sessions); - dict->SetInteger("idle_session_migration_period_seconds", - params_.quic_idle_session_migration_period.InSeconds()); - dict->SetInteger("max_time_on_non_default_network_seconds", - params_.quic_max_time_on_non_default_network.InSeconds()); + params_.quic_params.migrate_sessions_early_v2); + dict->SetInteger( + "retransmittable_on_wire_timeout_milliseconds", + params_.quic_params.retransmittable_on_wire_timeout_milliseconds); + dict->SetBoolean( + "retry_on_alternate_network_before_handshake", + params_.quic_params.retry_on_alternate_network_before_handshake); + dict->SetBoolean("migrate_idle_sessions", + params_.quic_params.migrate_idle_sessions); + dict->SetInteger( + "idle_session_migration_period_seconds", + params_.quic_params.idle_session_migration_period.InSeconds()); + dict->SetInteger( + "max_time_on_non_default_network_seconds", + params_.quic_params.max_time_on_non_default_network.InSeconds()); dict->SetInteger( "max_num_migrations_to_non_default_network_on_write_error", - params_.quic_max_migrations_to_non_default_network_on_write_error); + params_.quic_params.max_migrations_to_non_default_network_on_write_error); dict->SetInteger( "max_num_migrations_to_non_default_network_on_path_degrading", - params_.quic_max_migrations_to_non_default_network_on_path_degrading); + params_.quic_params + .max_migrations_to_non_default_network_on_path_degrading); dict->SetBoolean("allow_server_migration", - params_.quic_allow_server_migration); + params_.quic_params.allow_server_migration); dict->SetBoolean("race_stale_dns_on_connection", - params_.quic_race_stale_dns_on_connection); + params_.quic_params.race_stale_dns_on_connection); dict->SetBoolean("go_away_on_path_degrading", - params_.quic_go_away_on_path_degrading); - dict->SetBoolean("estimate_initial_rtt", params_.quic_estimate_initial_rtt); + params_.quic_params.go_away_on_path_degrading); + dict->SetBoolean("estimate_initial_rtt", + params_.quic_params.estimate_initial_rtt); dict->SetBoolean("server_push_cancellation", params_.enable_server_push_cancellation); dict->SetInteger("initial_rtt_for_handshake_milliseconds", - params_.quic_initial_rtt_for_handshake_milliseconds); + params_.quic_params.initial_rtt_for_handshake_milliseconds); return std::move(dict); } @@ -502,7 +444,7 @@ : ClientSocketFactory::GetDefaultFactory(), context_.host_resolver, &http_auth_cache_, context_.http_auth_handler_factory, &spdy_session_pool_, - ¶ms_.quic_supported_versions, &quic_stream_factory_, + ¶ms_.quic_params.supported_versions, &quic_stream_factory_, context_.proxy_delegate, context_.http_user_agent_settings, CreateClientSocketContext(context_, &ssl_client_session_cache_), CreateClientSocketContext(context_,
diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h index d6caef9c..6c012bd 100644 --- a/net/http/http_network_session.h +++ b/net/http/http_network_session.h
@@ -136,105 +136,8 @@ // If true, HTTPS URLs can be sent to QUIC proxies. bool enable_quic_proxies_for_https_urls; - // QUIC runtime configuration options. - - // Versions of QUIC which may be used. - quic::ParsedQuicVersionVector quic_supported_versions; - // User agent description to send in the QUIC handshake. - std::string quic_user_agent_id; - // Limit on the size of QUIC packets. - size_t quic_max_packet_length; - // Maximum number of server configs that are to be stored in - // HttpServerProperties, instead of the disk cache. - size_t quic_max_server_configs_stored_in_properties; - // QUIC will be used for all connections in this set. - std::set<HostPortPair> origins_to_force_quic_on; - // Set of QUIC tags to send in the handshake's connection options. - quic::QuicTagVector quic_connection_options; - // Set of QUIC tags to send in the handshake's connection options that only - // affect the client. - quic::QuicTagVector quic_client_connection_options; - // Enables experimental optimization for receiving data in UDPSocket. - bool quic_enable_socket_recv_optimization; - - // Active QUIC experiments - - // Marks a QUIC server broken when a connection blackholes after the - // handshake is confirmed. - bool mark_quic_broken_when_network_blackholes; - // Retry requests which fail with QUIC_PROTOCOL_ERROR, and mark QUIC - // broken if the retry succeeds. - bool retry_without_alt_svc_on_quic_errors; - // If true, alt-svc headers advertising QUIC in IETF format will be - // supported. - bool support_ietf_format_quic_altsvc; - // If true, all QUIC sessions are closed when any local IP address changes. - bool quic_close_sessions_on_ip_change; - // If true, all QUIC sessions are marked as goaway when any local IP address - // changes. - bool quic_goaway_sessions_on_ip_change; - // Specifies QUIC idle connection state lifetime. - int quic_idle_connection_timeout_seconds; - // Specifies the reduced ping timeout subsequent connections should use when - // a connection was timed out with open streams. - int quic_reduced_ping_timeout_seconds; - // Maximum time that a session can have no retransmittable packets on the - // wire. Set to zero if not specified and no retransmittable PING will be - // sent to peer when the wire has no retransmittable packets. - int quic_retransmittable_on_wire_timeout_milliseconds; - // Maximum time the session can be alive before crypto handshake is - // finished. - int quic_max_time_before_crypto_handshake_seconds; - // Maximum idle time before the crypto handshake has completed. - int quic_max_idle_time_before_crypto_handshake_seconds; - // If true, connection migration v2 will be used to migrate existing - // sessions to network when the platform indicates that the default network - // is changing. - bool quic_migrate_sessions_on_network_change_v2; - // If true, connection migration v2 may be used to migrate active QUIC - // sessions to alternative network if current network connectivity is poor. - bool quic_migrate_sessions_early_v2; - // If true, a new connection may be kicked off on an alternate network when - // a connection fails on the default network before handshake is confirmed. - bool quic_retry_on_alternate_network_before_handshake; - // If true, an idle session will be migrated within the idle migration - // period. - bool quic_migrate_idle_sessions; - // A session can be migrated if its idle time is within this period. - base::TimeDelta quic_idle_session_migration_period; - // Maximum time the session could be on the non-default network before - // migrates back to default network. Defaults to - // kMaxTimeOnNonDefaultNetwork. - base::TimeDelta quic_max_time_on_non_default_network; - // Maximum number of migrations to the non-default network on write error - // per network for each session. - int quic_max_migrations_to_non_default_network_on_write_error; - // Maximum number of migrations to the non-default network on path - // degrading per network for each session. - int quic_max_migrations_to_non_default_network_on_path_degrading; - // If true, allows migration of QUIC connections to a server-specified - // alternate server address. - bool quic_allow_server_migration; - // If true, allows QUIC to use alternative services with a different - // hostname from the origin. - bool quic_allow_remote_alt_svc; - // If true, the quic stream factory may race connection from stale dns - // result with the original dns resolution - bool quic_race_stale_dns_on_connection; - // If true, the quic session may mark itself as GOAWAY on path degrading. - bool quic_go_away_on_path_degrading; - // If true, bidirectional streams over QUIC will be disabled. - bool quic_disable_bidirectional_streams; - // If true, race cert verification with host resolution. - bool quic_race_cert_verification; - // If true, estimate the initial RTT for QUIC connections based on network. - bool quic_estimate_initial_rtt; - // If true, client headers will include HTTP/2 stream dependency info - // derived from the request priority. - bool quic_headers_include_h2_stream_dependency; - // The initial rtt that will be used in crypto handshake if no cached - // smoothed rtt is present. - int quic_initial_rtt_for_handshake_milliseconds; + // QUIC runtime configuration options and active experiments. + QuicParams quic_params; // If non-empty, QUIC will only be spoken to hosts in this list. base::flat_set<std::string> quic_host_whitelist;
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index cba4773..9aea7f0 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc
@@ -1659,7 +1659,8 @@ retry_attempts_++; ResetConnectionAndRequestForResend(); error = OK; - } else if (session_->params().retry_without_alt_svc_on_quic_errors) { + } else if (session_->params() + .quic_params.retry_without_alt_svc_on_quic_errors) { // Disable alternative services for this request and retry it. If the // retry succeeds, then the alternative service will be marked as // broken then.
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index e88fd253..0745934 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc
@@ -12195,7 +12195,7 @@ base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); http_server_properties->SetQuicAlternativeService( test_server, alternative_service, expiration, - session->params().quic_supported_versions); + session->params().quic_params.supported_versions); EXPECT_EQ( 1u, http_server_properties->GetAlternativeServiceInfos(test_server).size()); @@ -12348,7 +12348,7 @@ base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); http_server_properties->SetQuicAlternativeService( server, alternative_service, expiration, - HttpNetworkSession::Params().quic_supported_versions); + HttpNetworkSession::Params().quic_params.supported_versions); // Mark the QUIC alternative service as broken. http_server_properties->MarkAlternativeServiceBroken(alternative_service); @@ -12413,12 +12413,12 @@ alternative_service_info_vector.push_back( AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( alternative_service1, expiration, - session->params().quic_supported_versions)); + session->params().quic_params.supported_versions)); AlternativeService alternative_service2(kProtoQUIC, alternative2); alternative_service_info_vector.push_back( AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( alternative_service2, expiration, - session->params().quic_supported_versions)); + session->params().quic_params.supported_versions)); http_server_properties->SetAlternativeServices( server, alternative_service_info_vector);
diff --git a/net/http/http_server_properties_impl_unittest.cc b/net/http/http_server_properties_impl_unittest.cc index 7a9f932..95aa25dd 100644 --- a/net/http/http_server_properties_impl_unittest.cc +++ b/net/http/http_server_properties_impl_unittest.cc
@@ -89,7 +89,7 @@ if (alternative_service.protocol == kProtoQUIC) { return impl_.SetQuicAlternativeService( origin, alternative_service, expiration, - HttpNetworkSession::Params().quic_supported_versions); + HttpNetworkSession::Params().quic_params.supported_versions); } else { return impl_.SetHttp2AlternativeService(origin, alternative_service, expiration); @@ -376,7 +376,7 @@ AlternativeServiceInfo alternative_service_info4 = AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( AlternativeService(kProtoQUIC, "foo", 443), expiration, - HttpNetworkSession::Params().quic_supported_versions); + HttpNetworkSession::Params().quic_params.supported_versions); alternative_service_info_vector.push_back(alternative_service_info4); url::SchemeHostPort test_server("https", "foo", 443); @@ -571,7 +571,7 @@ const AlternativeServiceInfo alternative_service_info = AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( alternative_service, expiration, - HttpNetworkSession::Params().quic_supported_versions); + HttpNetworkSession::Params().quic_params.supported_versions); impl_.SetAlternativeServices( canonical_server, @@ -987,7 +987,7 @@ alternative_service_info_vector.push_back( AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( canonical_alternative_service1, expiration, - HttpNetworkSession::Params().quic_supported_versions)); + HttpNetworkSession::Params().quic_params.supported_versions)); const AlternativeService canonical_alternative_service2(kProtoHTTP2, "", 443); alternative_service_info_vector.push_back( AlternativeServiceInfo::CreateHttp2AlternativeServiceInfo( @@ -1234,12 +1234,12 @@ AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( AlternativeService(kProtoQUIC, "bar", 443), now + base::TimeDelta::FromHours(1), - HttpNetworkSession::Params().quic_supported_versions)); + HttpNetworkSession::Params().quic_params.supported_versions)); alternative_service_info_vector.push_back( AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( AlternativeService(kProtoQUIC, "baz", 443), now + base::TimeDelta::FromHours(1), - HttpNetworkSession::Params().quic_supported_versions)); + HttpNetworkSession::Params().quic_params.supported_versions)); impl_.SetAlternativeServices(url::SchemeHostPort("https", "youtube.com", 443), alternative_service_info_vector);
diff --git a/net/http/http_server_properties_manager_unittest.cc b/net/http/http_server_properties_manager_unittest.cc index 78238d1..c2f3f81 100644 --- a/net/http/http_server_properties_manager_unittest.cc +++ b/net/http/http_server_properties_manager_unittest.cc
@@ -111,7 +111,8 @@ void SetUp() override { one_day_from_now_ = base::Time::Now() + base::TimeDelta::FromDays(1); - advertised_versions_ = HttpNetworkSession::Params().quic_supported_versions; + advertised_versions_ = + HttpNetworkSession::Params().quic_params.supported_versions; pref_delegate_ = new MockPrefDelegate; http_server_props_manager_ = std::make_unique<HttpServerPropertiesManager>(
diff --git a/net/http/http_stream_factory.cc b/net/http/http_stream_factory.cc index 1413fd4..51bcae2 100644 --- a/net/http/http_stream_factory.cc +++ b/net/http/http_stream_factory.cc
@@ -78,8 +78,9 @@ quic::ParsedQuicVersionVector advertised_versions; if (protocol == kProtoQUIC && !alternative_service_entry.version.empty()) { advertised_versions = FilterSupportedAltSvcVersions( - alternative_service_entry, session->params().quic_supported_versions, - session->params().support_ietf_format_quic_altsvc); + alternative_service_entry, + session->params().quic_params.supported_versions, + session->params().quic_params.support_ietf_format_quic_altsvc); if (advertised_versions.empty()) continue; }
diff --git a/net/http/http_stream_factory_job.cc b/net/http/http_stream_factory_job.cc index f8210048..88dc051 100644 --- a/net/http/http_stream_factory_job.cc +++ b/net/http/http_stream_factory_job.cc
@@ -176,7 +176,7 @@ if (quic_version_ == quic::UnsupportedQuicVersion() && ShouldForceQuic(session, destination, origin_url, proxy_info, using_ssl_)) { - quic_version_ = session->params().quic_supported_versions[0]; + quic_version_ = session->params().quic_params.supported_versions[0]; } if (using_quic_) @@ -358,9 +358,9 @@ // handled by the socket pools, using an HttpProxyConnectJob. if (proxy_info.is_quic()) return !using_ssl; - return (base::Contains(session->params().origins_to_force_quic_on, + return (base::Contains(session->params().quic_params.origins_to_force_quic_on, HostPortPair()) || - base::Contains(session->params().origins_to_force_quic_on, + base::Contains(session->params().quic_params.origins_to_force_quic_on, destination)) && proxy_info.is_direct() && origin_url.SchemeIs(url::kHttpsScheme); }
diff --git a/net/http/http_stream_factory_job_controller.cc b/net/http/http_stream_factory_job_controller.cc index 460ac3f..7f2d6f6 100644 --- a/net/http/http_stream_factory_job_controller.cc +++ b/net/http/http_stream_factory_job_controller.cc
@@ -1047,7 +1047,7 @@ continue; if (stream_type == HttpStreamRequest::BIDIRECTIONAL_STREAM && - session_->params().quic_disable_bidirectional_streams) { + session_->params().quic_params.disable_bidirectional_streams) { continue; } @@ -1069,7 +1069,7 @@ HostPortPair destination(alternative_service_info.host_port_pair()); if (session_key.host() != destination.host() && - !session_->params().quic_allow_remote_alt_svc) { + !session_->params().quic_params.allow_remote_alt_svc) { continue; } ignore_result(ApplyHostMappingRules(original_url, &destination)); @@ -1096,7 +1096,7 @@ quic::ParsedQuicVersion HttpStreamFactory::JobController::SelectQuicVersion( const quic::ParsedQuicVersionVector& advertised_versions) { const quic::ParsedQuicVersionVector& supported_versions = - session_->params().quic_supported_versions; + session_->params().quic_params.supported_versions; if (advertised_versions.empty()) return supported_versions[0];
diff --git a/net/http/http_stream_factory_job_controller_unittest.cc b/net/http/http_stream_factory_job_controller_unittest.cc index 07a68bf..b43d88bd 100644 --- a/net/http/http_stream_factory_job_controller_unittest.cc +++ b/net/http/http_stream_factory_job_controller_unittest.cc
@@ -274,7 +274,7 @@ if (alternative_service.protocol == kProtoQUIC) { session_->http_server_properties()->SetQuicAlternativeService( server, alternative_service, expiration, - session_->params().quic_supported_versions); + session_->params().quic_params.supported_versions); } else { session_->http_server_properties()->SetHttp2AlternativeService( server, alternative_service, expiration); @@ -321,7 +321,7 @@ quic::MockClock clock_; quic::test::MockRandom random_generator_{0}; QuicTestPacketMaker client_maker_{ - HttpNetworkSession::Params().quic_supported_versions[0], + HttpNetworkSession::Params().quic_params.supported_versions[0], quic::QuicUtils::CreateRandomConnectionId(&random_generator_), &clock_, kServerHostname, @@ -707,7 +707,7 @@ // Prepare the mocked data. MockQuicData quic_data( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data.AddRead(ASYNC, ERR_QUIC_PROTOCOL_ERROR); quic_data.AddWrite(ASYNC, OK); quic_data.AddSocketDataToFactory(session_deps_.socket_factory.get()); @@ -798,7 +798,7 @@ crypto_client_stream_factory_.set_handshake_mode( MockCryptoClientStream::COLD_START); quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddRead(SYNCHRONOUS, OK); tcp_data_ = std::make_unique<SequencedSocketData>(); @@ -859,7 +859,7 @@ void HttpStreamFactoryJobControllerTest::TestOnStreamFailedForBothJobs( bool alt_job_retried_on_non_default_network) { quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddConnect(ASYNC, ERR_FAILED); tcp_data_ = std::make_unique<SequencedSocketData>(); tcp_data_->set_connect_data(MockConnect(ASYNC, ERR_FAILED)); @@ -911,7 +911,7 @@ void HttpStreamFactoryJobControllerTest::TestAltJobFailsAfterMainJobSucceeded( bool alt_job_retried_on_non_default_network) { quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddRead(ASYNC, ERR_FAILED); crypto_client_stream_factory_.set_handshake_mode( MockCryptoClientStream::COLD_START); @@ -981,7 +981,7 @@ // Tests that when alt job succeeds, main job is destroyed. TEST_F(HttpStreamFactoryJobControllerTest, AltJobSucceedsMainJobDestroyed) { quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddRead(SYNCHRONOUS, ERR_IO_PENDING); // Use cold start and complete alt job manually. crypto_client_stream_factory_.set_handshake_mode( @@ -1030,7 +1030,7 @@ TEST_F(HttpStreamFactoryJobControllerTest, AltJobSucceedsMainJobBlockedControllerDestroyed) { quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddWrite(SYNCHRONOUS, client_maker_.MakeInitialSettingsPacket(1)); quic_data_->AddRead(ASYNC, OK); @@ -1109,7 +1109,7 @@ TEST_F(HttpStreamFactoryJobControllerTest, OrphanedJobCompletesControllerDestroyed) { quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddRead(SYNCHRONOUS, ERR_IO_PENDING); // Use cold start and complete alt job manually. crypto_client_stream_factory_.set_handshake_mode( @@ -1164,7 +1164,7 @@ void HttpStreamFactoryJobControllerTest::TestAltJobSucceedsAfterMainJobFailed( bool alt_job_retried_on_non_default_network) { quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddRead(SYNCHRONOUS, ERR_IO_PENDING); // Use cold start and complete alt job manually. crypto_client_stream_factory_.set_handshake_mode( @@ -1233,7 +1233,7 @@ TestAltJobSucceedsAfterMainJobSucceeded( bool alt_job_retried_on_non_default_network) { quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddRead(SYNCHRONOUS, ERR_IO_PENDING); // Use cold start and complete alt job manually. crypto_client_stream_factory_.set_handshake_mode( @@ -1317,7 +1317,7 @@ TestMainJobSucceedsAfterAltJobSucceeded( bool alt_job_retried_on_non_default_network) { quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddRead(SYNCHRONOUS, ERR_IO_PENDING); // Use cold start and complete alt job manually. crypto_client_stream_factory_.set_handshake_mode( @@ -1393,7 +1393,7 @@ void HttpStreamFactoryJobControllerTest::TestMainJobFailsAfterAltJobSucceeded( bool alt_job_retried_on_non_default_network) { quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddRead(SYNCHRONOUS, ERR_IO_PENDING); // Use cold start and complete alt job manually. crypto_client_stream_factory_.set_handshake_mode( @@ -1457,7 +1457,7 @@ void HttpStreamFactoryJobControllerTest::TestMainJobSucceedsAfterAltJobFailed( bool alt_job_retried_on_non_default_network) { quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddConnect(SYNCHRONOUS, ERR_FAILED); tcp_data_ = std::make_unique<SequencedSocketData>(); @@ -1526,7 +1526,7 @@ TEST_F(HttpStreamFactoryJobControllerTest, MainJobSucceedsAfterConnectionChanged) { quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddConnect(SYNCHRONOUS, ERR_NETWORK_CHANGED); tcp_data_ = std::make_unique<SequencedSocketData>(); tcp_data_->set_connect_data(MockConnect(SYNCHRONOUS, OK)); @@ -1569,7 +1569,7 @@ TEST_F(HttpStreamFactoryJobControllerTest, GetLoadStateAfterMainJobFailed) { // Use COLD_START to complete alt job manually. quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddRead(SYNCHRONOUS, ERR_IO_PENDING); crypto_client_stream_factory_.set_handshake_mode( MockCryptoClientStream::COLD_START); @@ -1617,7 +1617,7 @@ TEST_F(HttpStreamFactoryJobControllerTest, ResumeMainJobWhenAltJobStalls) { // Use COLD_START to stall alt job. quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddRead(SYNCHRONOUS, ERR_IO_PENDING); crypto_client_stream_factory_.set_handshake_mode( MockCryptoClientStream::COLD_START); @@ -1687,7 +1687,7 @@ // handshake will fail asynchronously after mock data is unpaused. MockQuicData quic_data( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data.AddRead(ASYNC, ERR_IO_PENDING); // Pause quic_data.AddRead(ASYNC, ERR_FAILED); quic_data.AddWrite(ASYNC, ERR_FAILED); @@ -1760,7 +1760,7 @@ // Handshake will fail asynchronously after mock data is unpaused. MockQuicData quic_data( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data.AddRead(ASYNC, ERR_IO_PENDING); // Pause quic_data.AddRead(ASYNC, ERR_FAILED); quic_data.AddWrite(ASYNC, ERR_FAILED); @@ -1901,7 +1901,7 @@ // handshake will fail asynchronously after mock data is unpaused. MockQuicData quic_data( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data.AddRead(ASYNC, ERR_IO_PENDING); // Pause quic_data.AddRead(ASYNC, ERR_FAILED); quic_data.AddWrite(ASYNC, ERR_FAILED); @@ -1961,7 +1961,7 @@ // handshake will fail asynchronously after mock data is unpaused. MockQuicData quic_data( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data.AddRead(ASYNC, ERR_IO_PENDING); // Pause quic_data.AddRead(ASYNC, ERR_FAILED); quic_data.AddWrite(ASYNC, ERR_FAILED); @@ -2083,7 +2083,7 @@ // Handshake will fail asynchronously after mock data is unpaused. MockQuicData quic_data( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data.AddRead(ASYNC, ERR_IO_PENDING); // Pause quic_data.AddRead(ASYNC, ERR_FAILED); quic_data.AddWrite(ASYNC, ERR_FAILED); @@ -2142,7 +2142,7 @@ session_deps_.socket_factory->AddProxyClientSocketDataProvider(&proxy_data); quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddConnect(SYNCHRONOUS, ERR_FAILED); tcp_data_ = std::make_unique<SequencedSocketData>(); tcp_data_->set_connect_data(MockConnect(SYNCHRONOUS, OK)); @@ -2196,7 +2196,7 @@ session_deps_.socket_factory->AddProxyClientSocketDataProvider(&proxy_data); quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddConnect(SYNCHRONOUS, ERR_INTERNET_DISCONNECTED); tcp_data_ = std::make_unique<SequencedSocketData>(); tcp_data_->set_connect_data(MockConnect(SYNCHRONOUS, OK)); @@ -2250,7 +2250,7 @@ crypto_client_stream_factory_.set_handshake_mode( MockCryptoClientStream::COLD_START); quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddRead(SYNCHRONOUS, ERR_IO_PENDING); tcp_data_ = std::make_unique<SequencedSocketData>(); tcp_data_->set_connect_data(MockConnect(SYNCHRONOUS, OK)); @@ -2299,7 +2299,7 @@ TEST_F(HttpStreamFactoryJobControllerTest, PreconnectToHostWithValidAltSvc) { quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddWrite(SYNCHRONOUS, client_maker_.MakeInitialSettingsPacket(1)); quic_data_->AddRead(ASYNC, OK); @@ -2730,7 +2730,7 @@ crypto_client_stream_factory_.set_handshake_mode( MockCryptoClientStream::COLD_START); quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddRead(SYNCHRONOUS, ERR_IO_PENDING); MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING)}; tcp_data_ = @@ -2796,7 +2796,7 @@ const bool enable_alternative_services = ::testing::get<1>(GetParam()); if (enable_alternative_services) { quic_data_ = std::make_unique<MockQuicData>( - HttpNetworkSession::Params().quic_supported_versions.front()); + HttpNetworkSession::Params().quic_params.supported_versions.front()); quic_data_->AddConnect(SYNCHRONOUS, OK); quic_data_->AddWrite(SYNCHRONOUS, client_maker_.MakeInitialSettingsPacket(1)); @@ -2932,7 +2932,7 @@ // Set alternative service for the same server with the same list of versions // that is supported. quic::ParsedQuicVersionVector supported_versions = - session_->params().quic_supported_versions; + session_->params().quic_params.supported_versions; ASSERT_TRUE(session_->http_server_properties()->SetQuicAlternativeService( server, alternative_service, expiration, supported_versions)); @@ -2964,9 +2964,11 @@ // Set alternative service for the same server with two QUIC versions: // - one unsupported version: |unsupported_version_1|, - // - one supported version: session_->params().quic_supported_versions[0]. + // - one supported version: + // session_->params().quic_params.supported_versions[0]. quic::ParsedQuicVersionVector mixed_quic_versions = { - unsupported_version_1, session_->params().quic_supported_versions[0]}; + unsupported_version_1, + session_->params().quic_params.supported_versions[0]}; ASSERT_TRUE(session_->http_server_properties()->SetQuicAlternativeService( server, alternative_service, expiration, mixed_quic_versions)); @@ -3009,13 +3011,13 @@ // Set HttpNetworkSession's QUIC host whitelist to only have www.example.com HttpNetworkSessionPeer session_peer(session_.get()); session_peer.params()->quic_host_whitelist.insert("www.example.com"); - session_peer.params()->quic_allow_remote_alt_svc = true; + session_peer.params()->quic_params.allow_remote_alt_svc = true; // Set alternative service for www.google.com to be www.example.com over QUIC. url::SchemeHostPort server(request_info.url); base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); quic::ParsedQuicVersionVector supported_versions = - session_->params().quic_supported_versions; + session_->params().quic_params.supported_versions; session_->http_server_properties()->SetQuicAlternativeService( server, AlternativeService(kProtoQUIC, "www.example.com", 443), expiration, supported_versions);
diff --git a/net/http/http_stream_factory_unittest.cc b/net/http/http_stream_factory_unittest.cc index bb7f75c0..cecebee 100644 --- a/net/http/http_stream_factory_unittest.cc +++ b/net/http/http_stream_factory_unittest.cc
@@ -1186,7 +1186,7 @@ host_port_pair.port()); http_server_properties.SetQuicAlternativeService( server, alternative_service, expiration, - session_params.quic_supported_versions); + session_params.quic_params.supported_versions); HttpNetworkSession::Context session_context = SpdySessionDependencies::CreateSessionContext(&session_deps); @@ -2253,13 +2253,14 @@ // Disable bidirectional stream over QUIC. This should be invoked before // Initialize(). void DisableQuicBidirectionalStream() { - params_.quic_disable_bidirectional_streams = true; + params_.quic_params.disable_bidirectional_streams = true; } void Initialize() { params_.enable_quic = true; - params_.quic_supported_versions = quic::test::SupportedVersions(version_); - params_.quic_headers_include_h2_stream_dependency = + params_.quic_params.supported_versions = + quic::test::SupportedVersions(version_); + params_.quic_params.headers_include_h2_stream_dependency = client_headers_include_h2_stream_dependency_; HttpNetworkSession::Context session_context; @@ -2296,7 +2297,7 @@ base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); http_server_properties_.SetQuicAlternativeService( url::SchemeHostPort(default_url_), alternative_service, expiration, - session_->params().quic_supported_versions); + session_->params().quic_params.supported_versions); } test::QuicTestPacketMaker& client_packet_maker() {
diff --git a/net/nqe/network_congestion_analyzer.cc b/net/nqe/network_congestion_analyzer.cc index c9344c26..0ed0de32 100644 --- a/net/nqe/network_congestion_analyzer.cc +++ b/net/nqe/network_congestion_analyzer.cc
@@ -13,12 +13,32 @@ namespace net { +namespace { + +// The threshold for the observed peak queueing delay in milliseconds. +// A peak queueing delay is HIGH if it exceeds this threshold. The value is the +// 98th percentile value of the peak queueing delay observed by all requests. +static constexpr int64_t kHighQueueingDelayMsec = 5000; + +// The minimal time interval between two consecutive empty queue observations +// when the number of in-flight requests is relatively low (i.e. 2). This time +// interval is required so that a new measurement period could start. +static constexpr int64_t kMinEmptyQueueObservingTimeMsec = 1500; + +} // namespace + namespace nqe { namespace internal { -NetworkCongestionAnalyzer::NetworkCongestionAnalyzer() - : recent_active_hosts_count_(0u) {} +NetworkCongestionAnalyzer::NetworkCongestionAnalyzer( + const base::TickClock* tick_clock) + : tick_clock_(tick_clock), + recent_active_hosts_count_(0u), + count_inflight_requests_for_peak_queueing_delay_(0u), + peak_count_inflight_requests_measurement_period_(0u) { + DCHECK(tick_clock_); +} NetworkCongestionAnalyzer::~NetworkCongestionAnalyzer() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -139,6 +159,88 @@ } } +bool NetworkCongestionAnalyzer::ShouldStartNewMeasurement( + const base::TimeDelta& delay, + size_t count_inflight_requests) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + // The queue is not empty if either the queueing delay is high or the number + // of in-flight requests is high. + if (delay > base::TimeDelta::FromMilliseconds(500) || + count_inflight_requests >= 3) { + observing_empty_queue_timestamp_ = base::nullopt; + return false; + } + + // Starts a new measurement period immediately if there is very few number of + // in-flight requests. + if (count_inflight_requests <= 1) { + observing_empty_queue_timestamp_ = base::nullopt; + return true; + } + + base::TimeTicks now = tick_clock_->NowTicks(); + // Requires a sufficient time interval between consecutive empty queue + // observations to claim the queue is empty. + if (observing_empty_queue_timestamp_.has_value()) { + if (now - observing_empty_queue_timestamp_.value() >= + base::TimeDelta::FromMilliseconds(kMinEmptyQueueObservingTimeMsec)) { + observing_empty_queue_timestamp_ = base::nullopt; + return true; + } + } else { + observing_empty_queue_timestamp_ = now; + } + return false; +} + +void NetworkCongestionAnalyzer::UpdatePeakDelayMapping( + const base::TimeDelta& delay, + size_t count_inflight_requests) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + // Discards an abnormal observation. This high queueing delay is likely + // caused by retransmission packets from a previous measurement period. + if (delay >= base::TimeDelta::FromSeconds(20)) + return; + + if (ShouldStartNewMeasurement(delay, count_inflight_requests)) { + // This is the logic to export the tracked mapping data from the last + // measurement period. + // Updates the count of in-flight requests that would likely cause a high + // network queueing delay later. + if (peak_queueing_delay_ >= + base::TimeDelta::FromMilliseconds(kHighQueueingDelayMsec)) { + count_inflight_requests_causing_high_delay_ = + count_inflight_requests_for_peak_queueing_delay_; + } + + // Resets the tracked data for the new measurement period. + peak_queueing_delay_ = delay; + count_inflight_requests_for_peak_queueing_delay_ = count_inflight_requests; + peak_count_inflight_requests_measurement_period_ = count_inflight_requests; + } else { + // This is the logic to update the tracking data. + // First, updates the pending peak count of in-flight requests if a higher + // number of in-flight requests is observed. + // Second, updates the peak queueing delay and the peak count of inflight + // requests if a higher queueing delay is observed. The new peak queueing + // delay should be mapped to the peak count of in-flight requests that are + // observed before within this measurement period. + peak_count_inflight_requests_measurement_period_ = + std::max(peak_count_inflight_requests_measurement_period_, + count_inflight_requests); + + if (delay > peak_queueing_delay_) { + // Updates the peak queueing delay and the count of in-flight requests + // that are responsible for the delay. + peak_queueing_delay_ = delay; + count_inflight_requests_for_peak_queueing_delay_ = + peak_count_inflight_requests_measurement_period_; + } + } +} + void NetworkCongestionAnalyzer::set_recent_downlink_throughput_kbps( const int32_t downlink_kbps) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/net/nqe/network_congestion_analyzer.h b/net/nqe/network_congestion_analyzer.h index 0985baf..7442bf6 100644 --- a/net/nqe/network_congestion_analyzer.h +++ b/net/nqe/network_congestion_analyzer.h
@@ -9,6 +9,7 @@ #include <map> #include <unordered_map> +#include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/optional.h" #include "base/sequence_checker.h" @@ -30,7 +31,7 @@ // recent downlink throughput. class NET_EXPORT_PRIVATE NetworkCongestionAnalyzer { public: - NetworkCongestionAnalyzer(); + explicit NetworkCongestionAnalyzer(const base::TickClock* tick_clock); ~NetworkCongestionAnalyzer(); // Returns the number of hosts that are involved in the last attempt of @@ -59,6 +60,13 @@ historical_rtt_stats, const int32_t downlink_kbps); + // Updates new observations of queueing delay and count of in-flight requests + // in order to track peak queueing delay and peak count of in-flight requests. + // |delay| is a newly observed queueing delay. |count_inflight_requests| is a + // newly observed count of in-flight requests. + void UpdatePeakDelayMapping(const base::TimeDelta& delay, + size_t count_inflight_requests); + base::Optional<float> recent_queue_length() const { return recent_queue_length_; } @@ -68,6 +76,20 @@ } private: + FRIEND_TEST_ALL_PREFIXES(NetworkCongestionAnalyzerTest, + TestUpdatePeakDelayMapping); + + base::Optional<size_t> count_inflight_requests_causing_high_delay() const { + return count_inflight_requests_causing_high_delay_; + } + + // Returns true if a new measurement period should start. A new measurement + // period should start when the observed queueing delay is small and there are + // few in-flight requests. |delay| is a new queueing delay observation. + // |count_inflight_requests| is a new observed count of in-flight requests. + bool ShouldStartNewMeasurement(const base::TimeDelta& delay, + size_t count_inflight_requests); + // Starts tracking the peak queueing delay for |request|. void TrackPeakQueueingDelayBegin(const URLRequest* request); @@ -86,9 +108,13 @@ return recent_downlink_throughput_kbps_; } + // Guaranteed to be non-null during the lifetime of |this|. + const base::TickClock* tick_clock_; + // Recent downstream throughput estimate. It is the median of most recent // downstream throughput observations (in kilobits per second). base::Optional<int32_t> recent_downlink_throughput_kbps_; + // Time of transmitting one 1500-Byte TCP packet under // |recent_downlink_throughput_kbps_|. base::Optional<int32_t> recent_downlink_per_packet_time_ms_; @@ -96,6 +122,7 @@ // The estimate of packet queue length. Computation is done based on the last // observed downlink throughput. base::Optional<float> recent_queue_length_; + // The estimate of queueing delay induced by packet queue. base::TimeDelta recent_queueing_delay_; @@ -112,6 +139,28 @@ // recent queueing delay. size_t recent_active_hosts_count_; + // The peak queueing delay that is observed within the current ongoing + // measurement period. + base::TimeDelta peak_queueing_delay_; + + // The peak number of in-flight requests that are responsible for the peak + // queueing delay within the current ongoing measurement period. These + // requests should be in-flight before the peak queueing delay is observed. + size_t count_inflight_requests_for_peak_queueing_delay_; + + // The peak number of in-flight requests during the current measurement + // period. It updates the |count_inflight_requests_for_peak_queueing_delay_| + // only if a higher queueing delay is observed later. + size_t peak_count_inflight_requests_measurement_period_; + + // Timestamp when the app started observing an empty queue. Resets to nullopt + // if the queue is unlikely to be empty or if a new measurement period starts. + base::Optional<base::TimeTicks> observing_empty_queue_timestamp_; + + // The count of in-flight requests that would cause a high network queueing + // delay. + base::Optional<size_t> count_inflight_requests_causing_high_delay_; + SEQUENCE_CHECKER(sequence_checker_); DISALLOW_COPY_AND_ASSIGN(NetworkCongestionAnalyzer);
diff --git a/net/nqe/network_congestion_analyzer_unittest.cc b/net/nqe/network_congestion_analyzer_unittest.cc index a693e72..7ebd741 100644 --- a/net/nqe/network_congestion_analyzer_unittest.cc +++ b/net/nqe/network_congestion_analyzer_unittest.cc
@@ -8,6 +8,7 @@ #include "base/macros.h" #include "base/optional.h" +#include "base/test/simple_test_tick_clock.h" #include "base/time/time.h" #include "net/nqe/network_quality.h" #include "net/nqe/observation_buffer.h" @@ -20,12 +21,20 @@ namespace internal { namespace { + constexpr float kEpsilon = 0.001f; +// These values should remain synchronized with the values in +// net/nqe/network_congestion_analyzer.cc. +constexpr int64_t kHighQueueingDelayMsec = 5000; +constexpr int64_t kMinEmptyQueueObservingTimeMsec = 1500; + // Verify that the network queueing delay is computed correctly based on RTT // and downlink throughput observations. TEST(NetworkCongestionAnalyzerTest, TestComputingQueueingDelay) { - NetworkCongestionAnalyzer analyzer; + base::SimpleTestTickClock tick_clock; + + NetworkCongestionAnalyzer analyzer(&tick_clock); std::map<uint64_t, CanonicalStats> recent_rtt_stats; std::map<uint64_t, CanonicalStats> historical_rtt_stats; int32_t downlink_kbps = nqe::internal::INVALID_RTT_THROUGHPUT; @@ -75,6 +84,82 @@ } // namespace +// Verify that the peak queueing delay is correctly mapped to the count of +// in-flight requests that are responsible for that delay. +TEST(NetworkCongestionAnalyzerTest, TestUpdatePeakDelayMapping) { + base::SimpleTestTickClock tick_clock; + + NetworkCongestionAnalyzer analyzer(&tick_clock); + EXPECT_EQ(base::nullopt, + analyzer.count_inflight_requests_causing_high_delay()); + + // Checks that a measurement period starts correctly when an empty queue + // observation shows up. + EXPECT_FALSE(analyzer.ShouldStartNewMeasurement( + base::TimeDelta::FromMilliseconds(500), 2)); + EXPECT_TRUE(analyzer.ShouldStartNewMeasurement( + base::TimeDelta::FromMilliseconds(500), 0)); + + // Checks that a new measurement period starts after waiting for a sufficient + // time interval when the number of in-flight requests is relatively low (=2). + EXPECT_FALSE(analyzer.ShouldStartNewMeasurement( + base::TimeDelta::FromMilliseconds(500), 2)); + tick_clock.Advance( + base::TimeDelta::FromMilliseconds(kMinEmptyQueueObservingTimeMsec / 2)); + EXPECT_FALSE(analyzer.ShouldStartNewMeasurement( + base::TimeDelta::FromMilliseconds(500), 2)); + tick_clock.Advance( + base::TimeDelta::FromMilliseconds(kMinEmptyQueueObservingTimeMsec / 2)); + EXPECT_TRUE(analyzer.ShouldStartNewMeasurement( + base::TimeDelta::FromMilliseconds(500), 2)); + + // Checks that the count of in-flight requests for peak queueing delay is + // correctly recorded. + // Case #1: the peak queueing delay was observed after the max count (7) of + // in-flight requests was observed. + const size_t expected_count_requests_1 = 7; + std::vector<std::pair<base::TimeDelta, size_t>> queueing_delay_samples_1 = { + std::make_pair(base::TimeDelta::FromMilliseconds(10), 1), + std::make_pair(base::TimeDelta::FromMilliseconds(10), 3), + std::make_pair(base::TimeDelta::FromMilliseconds(400), 5), + std::make_pair(base::TimeDelta::FromMilliseconds(800), + expected_count_requests_1), + std::make_pair(base::TimeDelta::FromMilliseconds(kHighQueueingDelayMsec), + 5), + std::make_pair(base::TimeDelta::FromMilliseconds(1000), 3), + std::make_pair(base::TimeDelta::FromMilliseconds(700), 3), + std::make_pair(base::TimeDelta::FromMilliseconds(600), 1), + std::make_pair(base::TimeDelta::FromMilliseconds(300), 0), + }; + for (const auto& sample : queueing_delay_samples_1) { + analyzer.UpdatePeakDelayMapping(sample.first, sample.second); + } + EXPECT_EQ(expected_count_requests_1, + analyzer.count_inflight_requests_causing_high_delay().value_or(0)); + + // Case #2: the peak queueing delay is observed before the max count (11) of + // in-flight requests was observed. The 8 requests should be responsible for + // the peak queueing delay. + const size_t expected_count_requests_2 = 10; + std::vector<std::pair<base::TimeDelta, size_t>> queueing_delay_samples_2 = { + std::make_pair(base::TimeDelta::FromMilliseconds(10), 1), + std::make_pair(base::TimeDelta::FromMilliseconds(10), 3), + std::make_pair(base::TimeDelta::FromMilliseconds(400), 5), + std::make_pair(base::TimeDelta::FromMilliseconds(800), 5), + std::make_pair(base::TimeDelta::FromMilliseconds(kHighQueueingDelayMsec), + expected_count_requests_2), + std::make_pair(base::TimeDelta::FromMilliseconds(3000), 11), + std::make_pair(base::TimeDelta::FromMilliseconds(700), 3), + std::make_pair(base::TimeDelta::FromMilliseconds(600), 1), + std::make_pair(base::TimeDelta::FromMilliseconds(300), 0), + }; + for (const auto& sample : queueing_delay_samples_2) { + analyzer.UpdatePeakDelayMapping(sample.first, sample.second); + } + EXPECT_EQ(expected_count_requests_2, + analyzer.count_inflight_requests_causing_high_delay().value_or(0)); +} + } // namespace internal } // namespace nqe
diff --git a/net/nqe/network_quality_estimator.cc b/net/nqe/network_quality_estimator.cc index 4c2af1d3..51a7c16 100644 --- a/net/nqe/network_quality_estimator.cc +++ b/net/nqe/network_quality_estimator.cc
@@ -169,6 +169,7 @@ transport_rtt_observation_count_last_ect_computation_(0), new_rtt_observations_since_last_ect_computation_(0), new_throughput_observations_since_last_ect_computation_(0), + network_congestion_analyzer_(tick_clock_), effective_connection_type_(EFFECTIVE_CONNECTION_TYPE_UNKNOWN), cached_estimate_applied_(false), net_log_(NetLogWithSource::Make( @@ -329,7 +330,9 @@ return true; } -void NetworkQualityEstimator::NotifyHeadersReceived(const URLRequest& request) { +void NetworkQualityEstimator::NotifyHeadersReceived( + const URLRequest& request, + int64_t prefilter_total_bytes_read) { TRACE_EVENT0(NetTracingCategory(), "NetworkQualityEstimator::NotifyHeadersReceived"); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -376,7 +379,9 @@ request, request.GetExpectedContentSize()); } -void NetworkQualityEstimator::NotifyBytesRead(const URLRequest& request) { +void NetworkQualityEstimator::NotifyBytesRead( + const URLRequest& request, + int64_t prefilter_total_bytes_read) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); throughput_analyzer_->NotifyBytesRead(request); } @@ -774,6 +779,17 @@ network_congestion_analyzer_.ComputeRecentQueueingDelay( recent_rtt_stats, historical_rtt_stats, downlink_kbps); + + // Gets the total number of inflight requests including hanging GETs. The app + // cannot determine whether a request is hanging or is still in the wire. + size_t count_inflight_requests = + throughput_analyzer_->CountTotalInFlightRequests(); + + // Tracks the mapping between the peak observed queueing delay to the peak + // count of in-flight requests. + network_congestion_analyzer_.UpdatePeakDelayMapping( + network_congestion_analyzer_.recent_queueing_delay(), + count_inflight_requests); } void NetworkQualityEstimator::ComputeEffectiveConnectionType() {
diff --git a/net/nqe/network_quality_estimator.h b/net/nqe/network_quality_estimator.h index 1eab4cd6..b1b9cbd 100644 --- a/net/nqe/network_quality_estimator.h +++ b/net/nqe/network_quality_estimator.h
@@ -179,12 +179,16 @@ RTTAndThroughputEstimatesObserver* observer); // Notifies NetworkQualityEstimator that the response header of |request| has - // been received. - void NotifyHeadersReceived(const URLRequest& request); + // been received. Reports the total prefilter network bytes that have been + // read for the response of |request|. + void NotifyHeadersReceived(const URLRequest& request, + int64_t prefilter_total_bytes_read); // Notifies NetworkQualityEstimator that unfiltered bytes have been read for - // |request|. - void NotifyBytesRead(const URLRequest& request); + // |request|. Reports the total prefilter network bytes that have been read + // for the response of |request|. + void NotifyBytesRead(const URLRequest& request, + int64_t prefilter_total_bytes_read); // Notifies NetworkQualityEstimator that the headers of |request| are about to // be sent.
diff --git a/net/nqe/throughput_analyzer.cc b/net/nqe/throughput_analyzer.cc index bf51acc..250ba9f 100644 --- a/net/nqe/throughput_analyzer.cc +++ b/net/nqe/throughput_analyzer.cc
@@ -385,11 +385,16 @@ return NetworkActivityMonitor::GetInstance()->GetBytesReceived() * 8; } -size_t ThroughputAnalyzer::CountInFlightRequests() const { +size_t ThroughputAnalyzer::CountActiveInFlightRequests() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return requests_.size(); } +size_t ThroughputAnalyzer::CountTotalInFlightRequests() const { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + return response_content_sizes_.size(); +} + int64_t ThroughputAnalyzer::CountTotalContentSizeBytes() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/net/nqe/throughput_analyzer.h b/net/nqe/throughput_analyzer.h index 72e109c0..5e3e14c 100644 --- a/net/nqe/throughput_analyzer.h +++ b/net/nqe/throughput_analyzer.h
@@ -110,7 +110,11 @@ // Returns the number of in-flight requests that can be used for computing // throughput. - size_t CountInFlightRequests() const; + size_t CountActiveInFlightRequests() const; + + // Returns the total number of in-flight requests. This also includes hanging + // requests. + size_t CountTotalInFlightRequests() const; // Returns the sum of expected response content size in bytes for all inflight // requests. Request with an unknown response content size have the default
diff --git a/net/nqe/throughput_analyzer_unittest.cc b/net/nqe/throughput_analyzer_unittest.cc index ff1a531..ebcb224 100644 --- a/net/nqe/throughput_analyzer_unittest.cc +++ b/net/nqe/throughput_analyzer_unittest.cc
@@ -87,7 +87,7 @@ context->set_host_resolver(&mock_host_resolver_); } - using internal::ThroughputAnalyzer::CountInFlightRequests; + using internal::ThroughputAnalyzer::CountActiveInFlightRequests; using internal::ThroughputAnalyzer:: disable_throughput_measurements_for_testing; using internal::ThroughputAnalyzer::EraseHangingRequests; @@ -315,18 +315,18 @@ if (test.requests_hang_duration >= base::TimeDelta()) base::PlatformThread::Sleep(test.requests_hang_duration); - EXPECT_EQ(num_requests, throughput_analyzer.CountInFlightRequests()); + EXPECT_EQ(num_requests, throughput_analyzer.CountActiveInFlightRequests()); for (size_t i = 0; i < num_requests; ++i) { throughput_analyzer.NotifyRequestCompleted(*requests_not_local.at(i)); if (!test.expect_throughput_observation) { // All in-flight requests should be marked as hanging, and thus should // be deleted from the set of in-flight requests. - EXPECT_EQ(0u, throughput_analyzer.CountInFlightRequests()); + EXPECT_EQ(0u, throughput_analyzer.CountActiveInFlightRequests()); } else { // One request should be deleted at one time. EXPECT_EQ(requests_not_local.size() - i - 1, - throughput_analyzer.CountInFlightRequests()); + throughput_analyzer.CountActiveInFlightRequests()); } } @@ -379,35 +379,35 @@ throughput_analyzer.NotifyStartTransaction(*requests_not_local.at(i)); } - EXPECT_EQ(2u, throughput_analyzer.CountInFlightRequests()); + EXPECT_EQ(2u, throughput_analyzer.CountActiveInFlightRequests()); tick_clock.Advance(base::TimeDelta::FromMilliseconds(3500)); // Current time is t = 5.5 seconds. throughput_analyzer.EraseHangingRequests(*some_other_request); - EXPECT_EQ(2u, throughput_analyzer.CountInFlightRequests()); + EXPECT_EQ(2u, throughput_analyzer.CountActiveInFlightRequests()); tick_clock.Advance(base::TimeDelta::FromMilliseconds(1000)); // Current time is t = 6.5 seconds. One request should be marked as hanging. throughput_analyzer.EraseHangingRequests(*some_other_request); - EXPECT_EQ(1u, throughput_analyzer.CountInFlightRequests()); + EXPECT_EQ(1u, throughput_analyzer.CountActiveInFlightRequests()); // Current time is t = 6.5 seconds. Calling NotifyBytesRead again should not // run the hanging request checker since the last check was at t=6.5 seconds. throughput_analyzer.EraseHangingRequests(*some_other_request); - EXPECT_EQ(1u, throughput_analyzer.CountInFlightRequests()); + EXPECT_EQ(1u, throughput_analyzer.CountActiveInFlightRequests()); tick_clock.Advance(base::TimeDelta::FromMilliseconds(600)); // Current time is t = 7.1 seconds. Calling NotifyBytesRead again should not // run the hanging request checker since the last check was at t=6.5 seconds // (less than 1 second ago). throughput_analyzer.EraseHangingRequests(*some_other_request); - EXPECT_EQ(1u, throughput_analyzer.CountInFlightRequests()); + EXPECT_EQ(1u, throughput_analyzer.CountActiveInFlightRequests()); tick_clock.Advance(base::TimeDelta::FromMilliseconds(400)); // Current time is t = 7.5 seconds. Calling NotifyBytesRead again should run // the hanging request checker since the last check was at t=6.5 seconds (at // least 1 second ago). throughput_analyzer.EraseHangingRequests(*some_other_request); - EXPECT_EQ(0u, throughput_analyzer.CountInFlightRequests()); + EXPECT_EQ(0u, throughput_analyzer.CountActiveInFlightRequests()); } // Tests that the last received time for a request is updated when data is @@ -449,19 +449,19 @@ // Current time is t=4.0 seconds. throughput_analyzer.EraseHangingRequests(*some_other_request); - EXPECT_EQ(1u, throughput_analyzer.CountInFlightRequests()); + EXPECT_EQ(1u, throughput_analyzer.CountActiveInFlightRequests()); // The request will be marked as hanging at t=9 seconds. throughput_analyzer.NotifyBytesRead(*request_not_local); tick_clock.Advance(base::TimeDelta::FromMilliseconds(4000)); // Current time is t=8 seconds. throughput_analyzer.EraseHangingRequests(*some_other_request); - EXPECT_EQ(1u, throughput_analyzer.CountInFlightRequests()); + EXPECT_EQ(1u, throughput_analyzer.CountActiveInFlightRequests()); tick_clock.Advance(base::TimeDelta::FromMilliseconds(2000)); // Current time is t=10 seconds. throughput_analyzer.EraseHangingRequests(*some_other_request); - EXPECT_EQ(0u, throughput_analyzer.CountInFlightRequests()); + EXPECT_EQ(0u, throughput_analyzer.CountActiveInFlightRequests()); } // Test that a request that has been hanging for a long time is deleted @@ -494,19 +494,19 @@ // Start time for the request is t=0 second. The request will be marked as // hanging at t=2 seconds. throughput_analyzer.NotifyStartTransaction(*request_not_local); - EXPECT_EQ(1u, throughput_analyzer.CountInFlightRequests()); + EXPECT_EQ(1u, throughput_analyzer.CountActiveInFlightRequests()); tick_clock.Advance(base::TimeDelta::FromMilliseconds(2900)); // Current time is t=2.9 seconds. throughput_analyzer.EraseHangingRequests(*request_not_local); - EXPECT_EQ(1u, throughput_analyzer.CountInFlightRequests()); + EXPECT_EQ(1u, throughput_analyzer.CountActiveInFlightRequests()); // |request_not_local| should be deleted since it has been idle for 2.4 // seconds. tick_clock.Advance(base::TimeDelta::FromMilliseconds(500)); throughput_analyzer.NotifyBytesRead(*request_not_local); - EXPECT_EQ(0u, throughput_analyzer.CountInFlightRequests()); + EXPECT_EQ(0u, throughput_analyzer.CountActiveInFlightRequests()); } // Tests if the throughput observation is taken correctly when local and network
diff --git a/net/quic/quic_chromium_client_session.cc b/net/quic/quic_chromium_client_session.cc index 8d478983..1e94464 100644 --- a/net/quic/quic_chromium_client_session.cc +++ b/net/quic/quic_chromium_client_session.cc
@@ -74,9 +74,6 @@ // network. const int kDefaultRTTMilliSecs = 300; -// The maximum size of uncompressed QUIC headers that will be allowed. -const size_t kMaxUncompressedHeaderSize = 256 * 1024; - // Histograms for tracking down the crashes from http://crbug.com/354669 // Note: these values must be kept in sync with the corresponding values in: // tools/metrics/histograms/histograms.xml @@ -929,10 +926,10 @@ } void QuicChromiumClientSession::Initialize() { + set_max_inbound_header_list_size(kQuicMaxHeaderListSize); quic::QuicSpdyClientSessionBase::Initialize(); SetHpackEncoderDebugVisitor(std::make_unique<HpackEncoderDebugVisitor>()); SetHpackDecoderDebugVisitor(std::make_unique<HpackDecoderDebugVisitor>()); - set_max_uncompressed_header_bytes(kMaxUncompressedHeaderSize); } size_t QuicChromiumClientSession::WriteHeadersOnHeadersStream(
diff --git a/net/quic/quic_chromium_client_session.h b/net/quic/quic_chromium_client_session.h index 35efd18..941215a 100644 --- a/net/quic/quic_chromium_client_session.h +++ b/net/quic/quic_chromium_client_session.h
@@ -64,6 +64,10 @@ class QuicChromiumClientSessionPeer; } // namespace test +// SETTINGS_MAX_HEADERS_LIST_SIZE, the maximum size of uncompressed QUIC headers +// that the server is allowed to send. +const size_t kQuicMaxHeaderListSize = 256 * 1024; + // Result of a session migration attempt. enum class MigrationResult { SUCCESS, // Migration succeeded.
diff --git a/net/quic/quic_end_to_end_unittest.cc b/net/quic/quic_end_to_end_unittest.cc index 85dabee8..fa86012 100644 --- a/net/quic/quic_end_to_end_unittest.cc +++ b/net/quic/quic_end_to_end_unittest.cc
@@ -141,7 +141,7 @@ // To simplify the test, and avoid the race with the HTTP request, we force // QUIC for these requests. - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("test.example.com:443")); transaction_factory_.reset(
diff --git a/net/quic/quic_flags_list.h b/net/quic/quic_flags_list.h index 2eb9675..88eb3b5 100644 --- a/net/quic/quic_flags_list.h +++ b/net/quic/quic_flags_list.h
@@ -109,10 +109,6 @@ // Mechanism to override version label and ALPN for IETF interop. QUIC_FLAG(int32_t, FLAGS_quic_ietf_draft_version, 0) -// Stop checking QuicUnackedPacketMap::HasUnackedRetransmittableFrames and -// instead rely on the existing check that bytes_in_flight > 0 -QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_optimize_inflight_check, false) - // If true, stop resetting ideal_next_packet_send_time_ in pacing sender. QUIC_FLAG( bool, @@ -229,11 +225,6 @@ FLAGS_quic_reloadable_flag_quic_conservative_cwnd_and_pacing_gains, false) -// If true, check whether connection is connected before flush. -QUIC_FLAG(bool, - FLAGS_quic_reloadable_flag_quic_check_connected_before_flush, - true) - // When true, QuicConnectionId will allocate long connection IDs on the heap // instead of inline in the object. QUIC_FLAG(bool, FLAGS_quic_restart_flag_quic_use_allocated_connection_ids, true) @@ -250,7 +241,7 @@ // If true, ignore TLPR if there is no pending stream data. QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_ignore_tlpr_if_no_pending_stream_data, - true) + false) // If true, when detecting losses, use packets_acked of corresponding packet // number space.
diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc index 810b0f2..04e3b04 100644 --- a/net/quic/quic_network_transaction_unittest.cc +++ b/net/quic/quic_network_transaction_unittest.cc
@@ -642,8 +642,8 @@ void CreateSession(const quic::ParsedQuicVersionVector& supported_versions) { session_params_.enable_quic = true; - session_params_.quic_supported_versions = supported_versions; - session_params_.quic_headers_include_h2_stream_dependency = + session_params_.quic_params.supported_versions = supported_versions; + session_params_.quic_params.headers_include_h2_stream_dependency = client_headers_include_h2_stream_dependency_; session_context_.quic_clock = &clock_; @@ -818,9 +818,10 @@ } void SetUpTestForRetryConnectionOnAlternateNetwork() { - session_params_.quic_migrate_sessions_on_network_change_v2 = true; - session_params_.quic_migrate_sessions_early_v2 = true; - session_params_.quic_retry_on_alternate_network_before_handshake = true; + session_params_.quic_params.migrate_sessions_on_network_change_v2 = true; + session_params_.quic_params.migrate_sessions_early_v2 = true; + session_params_.quic_params.retry_on_alternate_network_before_handshake = + true; scoped_mock_change_notifier_.reset(new ScopedMockNetworkChangeNotifier()); MockNetworkChangeNotifier* mock_ncn = scoped_mock_change_notifier_->mock_network_change_notifier(); @@ -978,9 +979,9 @@ ::testing::Bool())); TEST_P(QuicNetworkTransactionTest, WriteErrorHandshakeConfirmed) { - session_params_.retry_without_alt_svc_on_quic_errors = false; + session_params_.quic_params.retry_without_alt_svc_on_quic_errors = false; base::HistogramTester histograms; - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); crypto_client_stream_factory_.set_handshake_mode( MockCryptoClientStream::CONFIRM_HANDSHAKE); @@ -1008,9 +1009,9 @@ } TEST_P(QuicNetworkTransactionTest, WriteErrorHandshakeConfirmedAsync) { - session_params_.retry_without_alt_svc_on_quic_errors = false; + session_params_.quic_params.retry_without_alt_svc_on_quic_errors = false; base::HistogramTester histograms; - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); crypto_client_stream_factory_.set_handshake_mode( MockCryptoClientStream::CONFIRM_HANDSHAKE); @@ -1038,7 +1039,7 @@ } TEST_P(QuicNetworkTransactionTest, SocketWatcherEnabled) { - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData mock_quic_data(version_); @@ -1072,7 +1073,7 @@ } TEST_P(QuicNetworkTransactionTest, SocketWatcherDisabled) { - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData mock_quic_data(version_); @@ -1106,7 +1107,7 @@ } TEST_P(QuicNetworkTransactionTest, ForceQuic) { - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData mock_quic_data(version_); @@ -1183,7 +1184,7 @@ if (quic::VersionUsesQpack(version_.transport_version)) return; - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData mock_quic_data(version_); @@ -1252,8 +1253,8 @@ } TEST_P(QuicNetworkTransactionTest, TooLargeResponseHeaders) { - session_params_.retry_without_alt_svc_on_quic_errors = false; - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.retry_without_alt_svc_on_quic_errors = false; + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData mock_quic_data(version_); @@ -1330,7 +1331,7 @@ } TEST_P(QuicNetworkTransactionTest, ForceQuicForAll) { - session_params_.origins_to_force_quic_on.insert(HostPortPair()); + session_params_.quic_params.origins_to_force_quic_on.insert(HostPortPair()); AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE); @@ -1453,7 +1454,7 @@ } TEST_P(QuicNetworkTransactionTest, AlternativeServicesDifferentHost) { - session_params_.quic_allow_remote_alt_svc = true; + session_params_.quic_params.allow_remote_alt_svc = true; HostPortPair origin("www.example.org", 443); HostPortPair alternative("mail.example.org", 443); @@ -1684,7 +1685,7 @@ } TEST_P(QuicNetworkTransactionTest, ForceQuicWithErrorConnecting) { - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData mock_quic_data1(version_); @@ -1719,7 +1720,7 @@ TEST_P(QuicNetworkTransactionTest, DoNotForceQuicForHttps) { // Attempt to "force" quic on 443, which will not be honored. - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("www.google.com:443")); MockRead http_reads[] = { @@ -2552,8 +2553,8 @@ // Verify that if a QUIC connection times out, the QuicHttpStream will // return QUIC_PROTOCOL_ERROR. TEST_P(QuicNetworkTransactionTest, TimeoutAfterHandshakeConfirmed) { - session_params_.retry_without_alt_svc_on_quic_errors = false; - session_params_.quic_idle_connection_timeout_seconds = 5; + session_params_.quic_params.retry_without_alt_svc_on_quic_errors = false; + session_params_.quic_params.idle_connection_timeout_seconds = 5; // The request will initially go out over QUIC. MockQuicData quic_data(version_); @@ -2666,8 +2667,8 @@ // Verify that if a QUIC connection RTOs, the QuicHttpStream will // return QUIC_PROTOCOL_ERROR. TEST_P(QuicNetworkTransactionTest, TooManyRtosAfterHandshakeConfirmed) { - session_params_.retry_without_alt_svc_on_quic_errors = false; - session_params_.quic_connection_options.push_back(quic::k5RTO); + session_params_.quic_params.retry_without_alt_svc_on_quic_errors = false; + session_params_.quic_params.connection_options.push_back(quic::k5RTO); // The request will initially go out over QUIC. MockQuicData quic_data(version_); @@ -2786,7 +2787,7 @@ // QUIC will not be marked as broken. TEST_P(QuicNetworkTransactionTest, TooManyRtosAfterHandshakeConfirmedAndStreamReset) { - session_params_.quic_connection_options.push_back(quic::k5RTO); + session_params_.quic_params.connection_options.push_back(quic::k5RTO); // The request will initially go out over QUIC. MockQuicData quic_data(version_); @@ -2930,7 +2931,7 @@ // Verify that if a QUIC protocol error occurs after the handshake is confirmed // the request fails with QUIC_PROTOCOL_ERROR. TEST_P(QuicNetworkTransactionTest, ProtocolErrorAfterHandshakeConfirmed) { - session_params_.retry_without_alt_svc_on_quic_errors = false; + session_params_.quic_params.retry_without_alt_svc_on_quic_errors = false; // The request will initially go out over QUIC. MockQuicData quic_data(version_); client_maker_.SetEncryptionLevel(quic::ENCRYPTION_ZERO_RTT); @@ -2999,8 +3000,8 @@ // connection times out, then QUIC will be marked as broken and the request // retried over TCP. TEST_P(QuicNetworkTransactionTest, TimeoutAfterHandshakeConfirmedThenBroken) { - session_params_.mark_quic_broken_when_network_blackholes = true; - session_params_.quic_idle_connection_timeout_seconds = 5; + session_params_.quic_params.mark_quic_broken_when_network_blackholes = true; + session_params_.quic_params.idle_connection_timeout_seconds = 5; // The request will initially go out over QUIC. MockQuicData quic_data(version_); @@ -3138,7 +3139,7 @@ // connection times out, then QUIC will be marked as broken and the request // retried over TCP. TEST_P(QuicNetworkTransactionTest, TimeoutAfterHandshakeConfirmedThenBroken2) { - session_params_.quic_idle_connection_timeout_seconds = 5; + session_params_.quic_params.idle_connection_timeout_seconds = 5; // The request will initially go out over QUIC. MockQuicData quic_data(version_); @@ -3279,8 +3280,8 @@ // will not be retried over TCP. TEST_P(QuicNetworkTransactionTest, TimeoutAfterHandshakeConfirmedAndHeadersThenBrokenNotRetried) { - session_params_.mark_quic_broken_when_network_blackholes = true; - session_params_.quic_idle_connection_timeout_seconds = 5; + session_params_.quic_params.mark_quic_broken_when_network_blackholes = true; + session_params_.quic_params.idle_connection_timeout_seconds = 5; // The request will initially go out over QUIC. MockQuicData quic_data(version_); @@ -3429,8 +3430,8 @@ // over TCP. TEST_P(QuicNetworkTransactionTest, TooManyRtosAfterHandshakeConfirmedThenBroken) { - session_params_.mark_quic_broken_when_network_blackholes = true; - session_params_.quic_connection_options.push_back(quic::k5RTO); + session_params_.quic_params.mark_quic_broken_when_network_blackholes = true; + session_params_.quic_params.connection_options.push_back(quic::k5RTO); // The request will initially go out over QUIC. MockQuicData quic_data(version_); @@ -3575,8 +3576,8 @@ // QUIC will be marked as broken. TEST_P(QuicNetworkTransactionTest, TooManyRtosAfterHandshakeConfirmedAndStreamResetThenBroken) { - session_params_.mark_quic_broken_when_network_blackholes = true; - session_params_.quic_connection_options.push_back(quic::k5RTO); + session_params_.quic_params.mark_quic_broken_when_network_blackholes = true; + session_params_.quic_params.connection_options.push_back(quic::k5RTO); // The request will initially go out over QUIC. MockQuicData quic_data(version_); @@ -3720,7 +3721,7 @@ // retried over TCP and the QUIC will be marked as broken. TEST_P(QuicNetworkTransactionTest, ProtocolErrorAfterHandshakeConfirmedThenBroken) { - session_params_.quic_idle_connection_timeout_seconds = 5; + session_params_.quic_params.idle_connection_timeout_seconds = 5; // The request will initially go out over QUIC. MockQuicData quic_data(version_); @@ -3902,7 +3903,7 @@ // the remote Alt-Svc. // This is a regression test for crbug/825646. TEST_P(QuicNetworkTransactionTest, RemoteAltSvcWorkingWhileLocalAltSvcBroken) { - session_params_.quic_allow_remote_alt_svc = true; + session_params_.quic_params.allow_remote_alt_svc = true; GURL origin1 = request_.url; // mail.example.org GURL origin2("https://www.example.org/"); @@ -3952,11 +3953,11 @@ alternative_services.push_back( AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( local_alternative, expiration, - session_->params().quic_supported_versions)); + session_->params().quic_params.supported_versions)); alternative_services.push_back( AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( remote_alternative, expiration, - session_->params().quic_supported_versions)); + session_->params().quic_params.supported_versions)); http_server_properties_.SetAlternativeServices(url::SchemeHostPort(origin1), alternative_services); @@ -3972,7 +3973,7 @@ // This is a regression tests for crbug/731303. TEST_P(QuicNetworkTransactionTest, ResetPooledAfterHandshakeConfirmedThenBroken) { - session_params_.quic_allow_remote_alt_svc = true; + session_params_.quic_params.allow_remote_alt_svc = true; GURL origin1 = request_.url; GURL origin2("https://www.example.org/"); @@ -4115,7 +4116,7 @@ // If no existing QUIC session can be used, use the first alternative service // from the list. TEST_P(QuicNetworkTransactionTest, UseExistingAlternativeServiceForQuic) { - session_params_.quic_allow_remote_alt_svc = true; + session_params_.quic_params.allow_remote_alt_svc = true; MockRead http_reads[] = { MockRead("HTTP/1.1 200 OK\r\n"), MockRead("Alt-Svc: quic=\"foo.example.org:443\", quic=\":444\"\r\n\r\n"), @@ -4272,7 +4273,7 @@ // Pool to existing session with matching quic::QuicServerId // even if alternative service destination is different. TEST_P(QuicNetworkTransactionTest, PoolByOrigin) { - session_params_.quic_allow_remote_alt_svc = true; + session_params_.quic_params.allow_remote_alt_svc = true; MockQuicData mock_quic_data(version_); mock_quic_data.AddWrite(SYNCHRONOUS, ConstructInitialSettingsPacket(1)); @@ -4348,7 +4349,7 @@ // even if origin is different, and even if the alternative service with // matching destination is not the first one on the list. TEST_P(QuicNetworkTransactionTest, PoolByDestination) { - session_params_.quic_allow_remote_alt_svc = true; + session_params_.quic_params.allow_remote_alt_svc = true; GURL origin1 = request_.url; GURL origin2("https://www.example.org/"); ASSERT_NE(origin1.host(), origin2.host()); @@ -4429,11 +4430,11 @@ alternative_services.push_back( AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( alternative_service2, expiration, - session_->params().quic_supported_versions)); + session_->params().quic_params.supported_versions)); alternative_services.push_back( AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( alternative_service1, expiration, - session_->params().quic_supported_versions)); + session_->params().quic_params.supported_versions)); http_server_properties_.SetAlternativeServices(url::SchemeHostPort(origin2), alternative_services); // First request opens connection to |destination1| @@ -4453,7 +4454,7 @@ // if this is also the first existing QUIC session. TEST_P(QuicNetworkTransactionTest, UseSharedExistingAlternativeServiceForQuicWithValidCert) { - session_params_.quic_allow_remote_alt_svc = true; + session_params_.quic_params.allow_remote_alt_svc = true; // Default cert is valid for *.example.org // HTTP data for request to www.example.org. @@ -5102,7 +5103,7 @@ TEST_P(QuicNetworkTransactionTest, LogGranularQuicErrorCodeOnQuicProtocolErrorLocal) { - session_params_.retry_without_alt_svc_on_quic_errors = false; + session_params_.quic_params.retry_without_alt_svc_on_quic_errors = false; MockQuicData mock_quic_data(version_); mock_quic_data.AddWrite(SYNCHRONOUS, ConstructInitialSettingsPacket(1)); mock_quic_data.AddWrite( @@ -5151,7 +5152,7 @@ TEST_P(QuicNetworkTransactionTest, LogGranularQuicErrorCodeOnQuicProtocolErrorRemote) { - session_params_.retry_without_alt_svc_on_quic_errors = false; + session_params_.quic_params.retry_without_alt_svc_on_quic_errors = false; MockQuicData mock_quic_data(version_); mock_quic_data.AddWrite(SYNCHRONOUS, ConstructInitialSettingsPacket(1)); mock_quic_data.AddWrite( @@ -5265,7 +5266,7 @@ } TEST_P(QuicNetworkTransactionTest, RstSteamBeforeHeaders) { - session_params_.retry_without_alt_svc_on_quic_errors = false; + session_params_.quic_params.retry_without_alt_svc_on_quic_errors = false; MockQuicData mock_quic_data(version_); mock_quic_data.AddWrite(SYNCHRONOUS, ConstructInitialSettingsPacket(1)); mock_quic_data.AddWrite( @@ -5818,7 +5819,7 @@ } TEST_P(QuicNetworkTransactionTest, QuicUpload) { - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; @@ -5845,7 +5846,7 @@ } TEST_P(QuicNetworkTransactionTest, QuicUploadWriteError) { - session_params_.retry_without_alt_svc_on_quic_errors = false; + session_params_.quic_params.retry_without_alt_svc_on_quic_errors = false; ScopedMockNetworkChangeNotifier network_change_notifier; MockNetworkChangeNotifier* mock_ncn = network_change_notifier.mock_network_change_notifier(); @@ -5853,9 +5854,9 @@ mock_ncn->SetConnectedNetworksList( {kDefaultNetworkForTests, kNewNetworkForTests}); - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); - session_params_.quic_migrate_sessions_on_network_change_v2 = true; + session_params_.quic_params.migrate_sessions_on_network_change_v2 = true; MockQuicData socket_data(version_); socket_data.AddRead(SYNCHRONOUS, ERR_IO_PENDING); @@ -5897,7 +5898,7 @@ } TEST_P(QuicNetworkTransactionTest, RetryAfterAsyncNoBufferSpace) { - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData socket_data(version_); @@ -5932,7 +5933,7 @@ } TEST_P(QuicNetworkTransactionTest, RetryAfterSynchronousNoBufferSpace) { - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData socket_data(version_); @@ -5967,8 +5968,8 @@ } TEST_P(QuicNetworkTransactionTest, MaxRetriesAfterAsyncNoBufferSpace) { - session_params_.retry_without_alt_svc_on_quic_errors = false; - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.retry_without_alt_svc_on_quic_errors = false; + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData socket_data(version_); @@ -6003,8 +6004,8 @@ } TEST_P(QuicNetworkTransactionTest, MaxRetriesAfterSynchronousNoBufferSpace) { - session_params_.retry_without_alt_svc_on_quic_errors = false; - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.retry_without_alt_svc_on_quic_errors = false; + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData socket_data(version_); @@ -6039,8 +6040,8 @@ } TEST_P(QuicNetworkTransactionTest, NoMigrationForMsgTooBig) { - session_params_.retry_without_alt_svc_on_quic_errors = false; - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.retry_without_alt_svc_on_quic_errors = false; + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); const std::string error_details = quic::QuicStrCat("Write failed with error: ", ERR_MSG_TOO_BIG, " (", @@ -6071,7 +6072,7 @@ // Adds coverage to catch regression such as https://crbug.com/622043 TEST_P(QuicNetworkTransactionTest, QuicServerPush) { - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData mock_quic_data(version_); @@ -6157,8 +6158,8 @@ // is closed before the pushed headers arrive, but after the connection // is closed and before the callbacks are executed. TEST_P(QuicNetworkTransactionTest, CancelServerPushAfterConnectionClose) { - session_params_.retry_without_alt_svc_on_quic_errors = false; - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.retry_without_alt_svc_on_quic_errors = false; + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData mock_quic_data(version_); @@ -6245,7 +6246,7 @@ } TEST_P(QuicNetworkTransactionTest, QuicForceHolBlocking) { - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData mock_quic_data(version_); @@ -6339,7 +6340,7 @@ }; TEST_P(QuicNetworkTransactionTest, RawHeaderSizeSuccessfullRequest) { - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData mock_quic_data(version_); @@ -6409,7 +6410,7 @@ } TEST_P(QuicNetworkTransactionTest, RawHeaderSizeSuccessfullPushHeadersFirst) { - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData mock_quic_data(version_); @@ -6606,9 +6607,9 @@ HttpNetworkSession::Params session_params; session_params.enable_quic = true; - session_params.quic_allow_remote_alt_svc = true; - session_params.quic_supported_versions = supported_versions_; - session_params.quic_headers_include_h2_stream_dependency = + session_params.quic_params.allow_remote_alt_svc = true; + session_params.quic_params.supported_versions = supported_versions_; + session_params.quic_params.headers_include_h2_stream_dependency = client_headers_include_h2_stream_dependency_; HttpNetworkSession::Context session_context; @@ -7062,7 +7063,7 @@ // crbug.com/705109 - this confirms that matching request with a body // triggers a crash (pre-fix). TEST_P(QuicNetworkTransactionTest, QuicServerPushMatchesRequestWithBody) { - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData mock_quic_data(version_); @@ -7185,7 +7186,7 @@ pushed_request_headers[":path"] = "/"; pushed_request_headers[":scheme"] = "nosuchscheme"; - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData mock_quic_data(version_); @@ -8257,7 +8258,7 @@ return; } - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); const quic::QuicStreamId client_stream_0 = @@ -8432,7 +8433,7 @@ NetworkIsolationKey network_isolation_key2( url::Origin::Create(GURL("http://origin2/"))); - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); // Whether to use an H2 proxy. When false, uses HTTPS H2 requests without a @@ -8478,7 +8479,7 @@ // Reads and writes for the unpartitioned case, where only one socket is // used. - session_params_.origins_to_force_quic_on.insert( + session_params_.quic_params.origins_to_force_quic_on.insert( HostPortPair::FromString("mail.example.org:443")); MockQuicData unpartitioned_mock_quic_data(version_);
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc index b21ca9e..7be8413 100644 --- a/net/quic/quic_stream_factory.cc +++ b/net/quic/quic_stream_factory.cc
@@ -225,6 +225,51 @@ } // namespace +QuicParams::QuicParams() + : max_packet_length(quic::kDefaultMaxPacketSize), + max_server_configs_stored_in_properties(0u), + enable_socket_recv_optimization(false), + mark_quic_broken_when_network_blackholes(false), + retry_without_alt_svc_on_quic_errors(true), + support_ietf_format_quic_altsvc(false), + close_sessions_on_ip_change(false), + goaway_sessions_on_ip_change(false), + idle_connection_timeout_seconds(kIdleConnectionTimeoutSeconds), + reduced_ping_timeout_seconds(quic::kPingTimeoutSecs), + retransmittable_on_wire_timeout_milliseconds(0), + max_time_before_crypto_handshake_seconds( + quic::kMaxTimeForCryptoHandshakeSecs), + max_idle_time_before_crypto_handshake_seconds( + quic::kInitialIdleTimeoutSecs), + migrate_sessions_on_network_change_v2(false), + migrate_sessions_early_v2(false), + retry_on_alternate_network_before_handshake(false), + migrate_idle_sessions(false), + idle_session_migration_period(base::TimeDelta::FromSeconds( + kDefaultIdleSessionMigrationPeriodSeconds)), + max_time_on_non_default_network( + base::TimeDelta::FromSeconds(kMaxTimeOnNonDefaultNetworkSecs)), + max_migrations_to_non_default_network_on_write_error( + kMaxMigrationsToNonDefaultNetworkOnWriteError), + max_migrations_to_non_default_network_on_path_degrading( + kMaxMigrationsToNonDefaultNetworkOnPathDegrading), + allow_server_migration(false), + allow_remote_alt_svc(true), + race_stale_dns_on_connection(false), + go_away_on_path_degrading(false), + disable_bidirectional_streams(false), + race_cert_verification(false), + estimate_initial_rtt(false), + headers_include_h2_stream_dependency(false), + initial_rtt_for_handshake_milliseconds(0) { + supported_versions.push_back(quic::ParsedQuicVersion( + quic::PROTOCOL_QUIC_CRYPTO, quic::QUIC_VERSION_46)); +} + +QuicParams::QuicParams(const QuicParams& other) = default; + +QuicParams::~QuicParams() = default; + // Responsible for verifying the certificates saved in // quic::QuicCryptoClientConfig, and for notifying any associated requests when // complete. Results from cert verification are ignored. @@ -1052,35 +1097,7 @@ QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, quic::QuicRandom* random_generator, quic::QuicClock* clock, - size_t max_packet_length, - const std::string& user_agent_id, - bool store_server_configs_in_properties, - bool close_sessions_on_ip_change, - bool goaway_sessions_on_ip_change, - bool mark_quic_broken_when_network_blackholes, - int idle_connection_timeout_seconds, - int reduced_ping_timeout_seconds, - int retransmittable_on_wire_timeout_milliseconds, - int max_time_before_crypto_handshake_seconds, - int max_idle_time_before_crypto_handshake_seconds, - bool migrate_sessions_on_network_change_v2, - bool migrate_sessions_early_v2, - bool retry_on_alternate_network_before_handshake, - bool migrate_idle_sessions, - base::TimeDelta idle_session_migration_period, - base::TimeDelta max_time_on_non_default_network, - int max_migrations_to_non_default_network_on_write_error, - int max_migrations_to_non_default_network_on_path_degrading, - bool allow_server_migration, - bool race_stale_dns_on_connection, - bool go_away_on_path_degrading, - bool race_cert_verification, - bool estimate_initial_rtt, - bool headers_include_h2_stream_dependency, - const quic::QuicTagVector& connection_options, - const quic::QuicTagVector& client_connection_options, - bool enable_socket_recv_optimization, - int initial_rtt_for_handshake_milliseconds) + const QuicParams& params) : require_confirmation_(true), net_log_(net_log), host_resolver_(host_resolver), @@ -1092,68 +1109,47 @@ quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), random_generator_(random_generator), clock_(clock), - max_packet_length_(max_packet_length), + params_(params), clock_skew_detector_(base::TimeTicks::Now(), base::Time::Now()), socket_performance_watcher_factory_(socket_performance_watcher_factory), - config_( - InitializeQuicConfig(connection_options, - client_connection_options, - idle_connection_timeout_seconds, - max_time_before_crypto_handshake_seconds, - max_idle_time_before_crypto_handshake_seconds)), + config_(InitializeQuicConfig( + params.connection_options, + params.client_connection_options, + params.idle_connection_timeout_seconds, + params.max_time_before_crypto_handshake_seconds, + params.max_idle_time_before_crypto_handshake_seconds)), crypto_config_( std::make_unique<ProofVerifierChromium>(cert_verifier, ct_policy_enforcer, transport_security_state, cert_transparency_verifier)), - mark_quic_broken_when_network_blackholes_( - mark_quic_broken_when_network_blackholes), - store_server_configs_in_properties_(store_server_configs_in_properties), ping_timeout_(quic::QuicTime::Delta::FromSeconds(quic::kPingTimeoutSecs)), - reduced_ping_timeout_( - quic::QuicTime::Delta::FromSeconds(reduced_ping_timeout_seconds)), + reduced_ping_timeout_(quic::QuicTime::Delta::FromSeconds( + params.reduced_ping_timeout_seconds)), retransmittable_on_wire_timeout_(quic::QuicTime::Delta::FromMilliseconds( - retransmittable_on_wire_timeout_milliseconds)), + params.retransmittable_on_wire_timeout_milliseconds)), yield_after_packets_(kQuicYieldAfterPacketsRead), yield_after_duration_(quic::QuicTime::Delta::FromMilliseconds( kQuicYieldAfterDurationMilliseconds)), - close_sessions_on_ip_change_(close_sessions_on_ip_change), - goaway_sessions_on_ip_change_(goaway_sessions_on_ip_change), migrate_sessions_on_network_change_v2_( - migrate_sessions_on_network_change_v2 && + params.migrate_sessions_on_network_change_v2 && NetworkChangeNotifier::AreNetworkHandlesSupported()), - migrate_sessions_early_v2_(migrate_sessions_early_v2 && + migrate_sessions_early_v2_(params.migrate_sessions_early_v2 && migrate_sessions_on_network_change_v2_), retry_on_alternate_network_before_handshake_( - retry_on_alternate_network_before_handshake && + params.retry_on_alternate_network_before_handshake && migrate_sessions_on_network_change_v2_), default_network_(NetworkChangeNotifier::kInvalidNetworkHandle), - migrate_idle_sessions_(migrate_idle_sessions && + migrate_idle_sessions_(params.migrate_idle_sessions && migrate_sessions_on_network_change_v2_), - idle_session_migration_period_(idle_session_migration_period), - max_time_on_non_default_network_(max_time_on_non_default_network), - max_migrations_to_non_default_network_on_write_error_( - max_migrations_to_non_default_network_on_write_error), - max_migrations_to_non_default_network_on_path_degrading_( - max_migrations_to_non_default_network_on_path_degrading), - allow_server_migration_(allow_server_migration), - race_stale_dns_on_connection_(race_stale_dns_on_connection), - go_away_on_path_degrading_(go_away_on_path_degrading), - race_cert_verification_(race_cert_verification), - estimate_initial_rtt(estimate_initial_rtt), - headers_include_h2_stream_dependency_( - headers_include_h2_stream_dependency), need_to_check_persisted_supports_quic_(true), num_push_streams_created_(0), tick_clock_(nullptr), task_runner_(nullptr), - ssl_config_service_(ssl_config_service), - enable_socket_recv_optimization_(enable_socket_recv_optimization), - initial_rtt_for_handshake_milliseconds_( - initial_rtt_for_handshake_milliseconds) { + ssl_config_service_(ssl_config_service) { DCHECK(transport_security_state_); DCHECK(http_server_properties_); - crypto_config_.set_user_agent_id(user_agent_id); + crypto_config_.set_user_agent_id(params.user_agent_id); crypto_config_.AddCanonicalSuffix(".c.youtube.com"); crypto_config_.AddCanonicalSuffix(".ggpht.com"); crypto_config_.AddCanonicalSuffix(".googlevideo.com"); @@ -1162,23 +1158,25 @@ !crypto_config_.aead.empty() && (crypto_config_.aead[0] == quic::kAESG); UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.PreferAesGcm", prefer_aes_gcm); - if (migrate_sessions_early_v2 || retry_on_alternate_network_before_handshake) - DCHECK(migrate_sessions_on_network_change_v2); + if (params.migrate_sessions_early_v2 || + params.retry_on_alternate_network_before_handshake) + DCHECK(params.migrate_sessions_on_network_change_v2); - if (retransmittable_on_wire_timeout_milliseconds == 0 && - migrate_sessions_early_v2) { + if (params.retransmittable_on_wire_timeout_milliseconds == 0 && + params.migrate_sessions_early_v2) { retransmittable_on_wire_timeout_ = quic::QuicTime::Delta::FromMilliseconds( kDefaultRetransmittableOnWireTimeoutMillisecs); } // goaway_sessions_on_ip_change and close_sessions_on_ip_change should never // be simultaneously set to true. - DCHECK(!(close_sessions_on_ip_change_ && goaway_sessions_on_ip_change_)); + DCHECK(!(params_.close_sessions_on_ip_change && + params_.goaway_sessions_on_ip_change)); // Connection migration should not be set if explicitly handle ip address // change. - bool handle_ip_change = - close_sessions_on_ip_change_ || goaway_sessions_on_ip_change_; + bool handle_ip_change = params_.close_sessions_on_ip_change || + params_.goaway_sessions_on_ip_change; DCHECK(!(handle_ip_change && migrate_sessions_on_network_change_v2_)); if (handle_ip_change) @@ -1199,7 +1197,8 @@ active_jobs_.clear(); while (!active_cert_verifier_jobs_.empty()) active_cert_verifier_jobs_.erase(active_cert_verifier_jobs_.begin()); - if (close_sessions_on_ip_change_ || goaway_sessions_on_ip_change_) { + if (params_.close_sessions_on_ip_change || + params_.goaway_sessions_on_ip_change) { NetworkChangeNotifier::RemoveIPAddressObserver(this); } if (NetworkChangeNotifier::AreNetworkHandlesSupported()) { @@ -1383,11 +1382,12 @@ StartCertVerifyJob(session_key.server_id(), cert_verify_flags, net_log)); QuicSessionAliasKey key(destination, session_key); - std::unique_ptr<Job> job = std::make_unique<Job>( - this, quic_version, host_resolver_, key, - WasQuicRecentlyBroken(session_key.server_id()), - retry_on_alternate_network_before_handshake_, - race_stale_dns_on_connection_, priority, cert_verify_flags, net_log); + std::unique_ptr<Job> job = + std::make_unique<Job>(this, quic_version, host_resolver_, key, + WasQuicRecentlyBroken(session_key.server_id()), + retry_on_alternate_network_before_handshake_, + params_.race_stale_dns_on_connection, priority, + cert_verify_flags, net_log); int rv = job->Run( base::BindRepeating(&QuicStreamFactory::OnJobComplete, base::Unretained(this), job.get())); @@ -1532,7 +1532,7 @@ if (ping_timeout_ > reduced_ping_timeout_) ping_timeout_ = reduced_ping_timeout_; - if (mark_quic_broken_when_network_blackholes_) { + if (params_.mark_quic_broken_when_network_blackholes) { http_server_properties_->MarkAlternativeServiceBroken(AlternativeService( kProtoQUIC, HostPortPair(session->server_id().host(), session->server_id().port()))); @@ -1608,10 +1608,10 @@ return; set_require_confirmation(true); - if (close_sessions_on_ip_change_) { + if (params_.close_sessions_on_ip_change) { CloseAllSessions(ERR_NETWORK_CHANGED, quic::QUIC_IP_ADDRESS_CHANGED); } else { - DCHECK(goaway_sessions_on_ip_change_); + DCHECK(params_.goaway_sessions_on_ip_change); MarkAllActiveSessionsGoingAway(); } } @@ -1700,7 +1700,7 @@ const NetLogSource& source) { auto socket = client_socket_factory_->CreateDatagramClientSocket( DatagramSocket::DEFAULT_BIND, net_log, source); - if (enable_socket_recv_optimization_) + if (params_.enable_socket_recv_optimization) socket->EnableRecvOptimization(); return socket; } @@ -1847,7 +1847,7 @@ quic::QuicConnectionId connection_id = quic::QuicUtils::CreateRandomConnectionId(random_generator_); std::unique_ptr<QuicServerInfo> server_info; - if (store_server_configs_in_properties_) { + if (params_.max_server_configs_stored_in_properties > 0) { server_info = std::make_unique<PropertiesBasedQuicServerInfo>( server_id, http_server_properties_); } @@ -1860,7 +1860,7 @@ alarm_factory_.get(), writer, true /* owns_writer */, quic::Perspective::IS_CLIENT, {quic_version}); connection->set_ping_timeout(ping_timeout_); - connection->SetMaxPacketLength(max_packet_length_); + connection->SetMaxPacketLength(params_.max_packet_length); quic::QuicConfig config = config_; config.set_max_undecryptable_packets(kMaxUndecryptablePackets); @@ -1898,12 +1898,13 @@ std::move(server_info), key.session_key(), require_confirmation, migrate_sessions_early_v2_, migrate_sessions_on_network_change_v2_, default_network_, retransmittable_on_wire_timeout_, - migrate_idle_sessions_, idle_session_migration_period_, - max_time_on_non_default_network_, - max_migrations_to_non_default_network_on_write_error_, - max_migrations_to_non_default_network_on_path_degrading_, - yield_after_packets_, yield_after_duration_, go_away_on_path_degrading_, - headers_include_h2_stream_dependency_, cert_verify_flags, config, + migrate_idle_sessions_, params_.idle_session_migration_period, + params_.max_time_on_non_default_network, + params_.max_migrations_to_non_default_network_on_write_error, + params_.max_migrations_to_non_default_network_on_path_degrading, + yield_after_packets_, yield_after_duration_, + params_.go_away_on_path_degrading, + params_.headers_include_h2_stream_dependency, cert_verify_flags, config, &crypto_config_, network_connection_.connection_description(), dns_resolution_start_time, dns_resolution_end_time, &push_promise_index_, push_delegate_, tick_clock_, task_runner_, @@ -1967,9 +1968,9 @@ return; } - if (initial_rtt_for_handshake_milliseconds_ > 0) { + if (params_.initial_rtt_for_handshake_milliseconds > 0) { SetInitialRttEstimate(base::TimeDelta::FromMilliseconds( - initial_rtt_for_handshake_milliseconds_), + params_.initial_rtt_for_handshake_milliseconds), INITIAL_RTT_DEFAULT, config); return; } @@ -2012,7 +2013,7 @@ const quic::QuicServerId& server_id, int cert_verify_flags, const NetLogWithSource& net_log) { - if (!race_cert_verification_) + if (!params_.race_cert_verification) return quic::QUIC_FAILURE; quic::QuicCryptoClientConfig::CachedState* cached = crypto_config_.LookupOrCreate(server_id); @@ -2040,11 +2041,13 @@ if (cached->has_server_designated_connection_id()) *connection_id = cached->GetNextServerDesignatedConnectionId(); - if (!cached->IsEmpty()) + if (!cached->IsEmpty()) { return; + } - if (!server_info || !server_info->Load()) + if (!server_info || !server_info->Load()) { return; + } cached->Initialize(server_info->state().server_config, server_info->state().source_address_token,
diff --git a/net/quic/quic_stream_factory.h b/net/quic/quic_stream_factory.h index a5de5f7..55fca42 100644 --- a/net/quic/quic_stream_factory.h +++ b/net/quic/quic_stream_factory.h
@@ -102,6 +102,113 @@ // degrading per network. const int64_t kMaxMigrationsToNonDefaultNetworkOnPathDegrading = 5; +// Structure containing simple configuration options and experiments for QUIC. +struct NET_EXPORT QuicParams { + QuicParams(); + QuicParams(const QuicParams& other); + ~QuicParams(); + + // QUIC runtime configuration options. + + // Versions of QUIC which may be used. + quic::ParsedQuicVersionVector supported_versions; + // User agent description to send in the QUIC handshake. + std::string user_agent_id; + // Limit on the size of QUIC packets. + size_t max_packet_length; + // Maximum number of server configs that are to be stored in + // HttpServerProperties, instead of the disk cache. + size_t max_server_configs_stored_in_properties; + // QUIC will be used for all connections in this set. + std::set<HostPortPair> origins_to_force_quic_on; + // Set of QUIC tags to send in the handshake's connection options. + quic::QuicTagVector connection_options; + // Set of QUIC tags to send in the handshake's connection options that only + // affect the client. + quic::QuicTagVector client_connection_options; + // Enables experimental optimization for receiving data in UDPSocket. + bool enable_socket_recv_optimization; + + // Active QUIC experiments + + // Marks a QUIC server broken when a connection blackholes after the + // handshake is confirmed. + bool mark_quic_broken_when_network_blackholes; + // Retry requests which fail with QUIC_PROTOCOL_ERROR, and mark QUIC + // broken if the retry succeeds. + bool retry_without_alt_svc_on_quic_errors; + // If true, alt-svc headers advertising QUIC in IETF format will be + // supported. + bool support_ietf_format_quic_altsvc; + // If true, all QUIC sessions are closed when any local IP address changes. + bool close_sessions_on_ip_change; + // If true, all QUIC sessions are marked as goaway when any local IP address + // changes. + bool goaway_sessions_on_ip_change; + // Specifies QUIC idle connection state lifetime. + int idle_connection_timeout_seconds; + // Specifies the reduced ping timeout subsequent connections should use when + // a connection was timed out with open streams. + int reduced_ping_timeout_seconds; + // Maximum time that a session can have no retransmittable packets on the + // wire. Set to zero if not specified and no retransmittable PING will be + // sent to peer when the wire has no retransmittable packets. + int retransmittable_on_wire_timeout_milliseconds; + // Maximum time the session can be alive before crypto handshake is + // finished. + int max_time_before_crypto_handshake_seconds; + // Maximum idle time before the crypto handshake has completed. + int max_idle_time_before_crypto_handshake_seconds; + // If true, connection migration v2 will be used to migrate existing + // sessions to network when the platform indicates that the default network + // is changing. + bool migrate_sessions_on_network_change_v2; + // If true, connection migration v2 may be used to migrate active QUIC + // sessions to alternative network if current network connectivity is poor. + bool migrate_sessions_early_v2; + // If true, a new connection may be kicked off on an alternate network when + // a connection fails on the default network before handshake is confirmed. + bool retry_on_alternate_network_before_handshake; + // If true, an idle session will be migrated within the idle migration + // period. + bool migrate_idle_sessions; + // A session can be migrated if its idle time is within this period. + base::TimeDelta idle_session_migration_period; + // Maximum time the session could be on the non-default network before + // migrates back to default network. Defaults to + // kMaxTimeOnNonDefaultNetwork. + base::TimeDelta max_time_on_non_default_network; + // Maximum number of migrations to the non-default network on write error + // per network for each session. + int max_migrations_to_non_default_network_on_write_error; + // Maximum number of migrations to the non-default network on path + // degrading per network for each session. + int max_migrations_to_non_default_network_on_path_degrading; + // If true, allows migration of QUIC connections to a server-specified + // alternate server address. + bool allow_server_migration; + // If true, allows QUIC to use alternative services with a different + // hostname from the origin. + bool allow_remote_alt_svc; + // If true, the quic stream factory may race connection from stale dns + // result with the original dns resolution + bool race_stale_dns_on_connection; + // If true, the quic session may mark itself as GOAWAY on path degrading. + bool go_away_on_path_degrading; + // If true, bidirectional streams over QUIC will be disabled. + bool disable_bidirectional_streams; + // If true, race cert verification with host resolution. + bool race_cert_verification; + // If true, estimate the initial RTT for QUIC connections based on network. + bool estimate_initial_rtt; + // If true, client headers will include HTTP/2 stream dependency info + // derived from the request priority. + bool headers_include_h2_stream_dependency; + // The initial rtt that will be used in crypto handshake if no cached + // smoothed rtt is present. + int initial_rtt_for_handshake_milliseconds; +}; + enum QuicPlatformNotification { NETWORK_CONNECTED, NETWORK_MADE_DEFAULT, @@ -250,35 +357,7 @@ QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, quic::QuicRandom* random_generator, quic::QuicClock* clock, - size_t max_packet_length, - const std::string& user_agent_id, - bool store_server_configs_in_properties, - bool close_sessions_on_ip_change, - bool goway_sessions_on_ip_change, - bool mark_quic_broken_when_network_blackholes, - int idle_connection_timeout_seconds, - int reduced_ping_timeout_seconds, - int retransmittable_on_wire_timeout_milliseconds_, - int max_time_before_crypto_handshake_seconds, - int max_idle_time_before_crypto_handshake_seconds, - bool migrate_sessions_on_network_change_v2, - bool migrate_sessions_early_v2, - bool retry_on_alternate_network_before_handshake, - bool migrate_idle_sessions, - base::TimeDelta idle_session_migration_period, - base::TimeDelta max_time_on_non_default_network, - int max_migrations_to_non_default_network_on_write_error, - int max_migrations_to_non_default_network_on_path_degrading, - bool allow_server_migration, - bool race_stale_dns_on_connection, - bool go_away_on_path_degrading, - bool race_cert_verification, - bool estimate_initial_rtt, - bool headers_include_h2_stream_dependency, - const quic::QuicTagVector& connection_options, - const quic::QuicTagVector& client_connection_options, - bool enable_socket_recv_optimization, - int initial_rtt_for_handshake_milliseconds); + const QuicParams& params); ~QuicStreamFactory() override; // Returns true if there is an existing session for |session_key| or if the @@ -372,7 +451,7 @@ bool require_confirmation() const { return require_confirmation_; } - bool allow_server_migration() const { return allow_server_migration_; } + bool allow_server_migration() const { return params_.allow_server_migration; } void set_require_confirmation(bool require_confirmation); @@ -389,7 +468,7 @@ } bool mark_quic_broken_when_network_blackholes() const { - return mark_quic_broken_when_network_blackholes_; + return params_.mark_quic_broken_when_network_blackholes; } NetworkChangeNotifier::NetworkHandle default_network() const { @@ -460,8 +539,8 @@ bool CryptoConfigCacheIsEmpty(const quic::QuicServerId& server_id); // Starts an asynchronous job for cert verification if - // |race_cert_verification_| is enabled and if there are cached certs for the - // given |server_id|. + // |params_.race_cert_verification| is enabled and if there are cached certs + // for the given |server_id|. quic::QuicAsyncStatus StartCertVerifyJob(const quic::QuicServerId& server_id, int cert_verify_flags, const NetLogWithSource& net_log); @@ -490,7 +569,7 @@ QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory_; quic::QuicRandom* random_generator_; // Unowned. quic::QuicClock* clock_; // Unowned. - const size_t max_packet_length_; + QuicParams params_; QuicClockSkewDetector clock_skew_detector_; // Factory which is used to create socket performance watcher. A new watcher @@ -527,13 +606,6 @@ // Map of quic::QuicServerId to owning CertVerifierJob. CertVerifierJobMap active_cert_verifier_jobs_; - // True if QUIC should be marked as broken when a connection blackholes after - // the handshake is confirmed. - bool mark_quic_broken_when_network_blackholes_; - - // Set if QUIC server configs should be stored in HttpServerProperties. - bool store_server_configs_in_properties_; - // PING timeout for connections. quic::QuicTime::Delta ping_timeout_; quic::QuicTime::Delta reduced_ping_timeout_; @@ -547,13 +619,6 @@ int yield_after_packets_; quic::QuicTime::Delta yield_after_duration_; - // Set if all sessions should be closed when any local IP address changes. - const bool close_sessions_on_ip_change_; - - // Set if all sessions should be marked as go away when any local IP address - // changes. - const bool goaway_sessions_on_ip_change_; - // Set if migration should be attempted after probing. const bool migrate_sessions_on_network_change_v2_; @@ -571,44 +636,10 @@ NetworkChangeNotifier::NetworkHandle default_network_; // Set if idle sessions can be migrated within - // |idle_session_migration_period_| when connection migration is triggered. + // |params_.idle_session_migration_period| when connection migration is + // triggered. const bool migrate_idle_sessions_; - // Sessions can migrate if they have been idle for less than this period. - const base::TimeDelta idle_session_migration_period_; - - // Maximum time sessions could use on non-default network before try to - // migrate back to default network. - const base::TimeDelta max_time_on_non_default_network_; - - // Maximum number of migrations to non default network on write error. - const int max_migrations_to_non_default_network_on_write_error_; - - // Maximum number of migrations to non default network on path degrading. - const int max_migrations_to_non_default_network_on_path_degrading_; - - // If set, allows migration of connection to server-specified alternate - // server address. - const bool allow_server_migration_; - - // Set if stale DNS result may be speculatively used to connect and then - // compared with the original DNS result. - const bool race_stale_dns_on_connection_; - - // Set if client should mark the session as GOAWAY when the connection - // experiences poor connectivity - const bool go_away_on_path_degrading_; - - // Set if cert verification is to be raced with host resolution. - bool race_cert_verification_; - - // If true, estimate the initial RTT based on network type. - bool estimate_initial_rtt; - - // If true, client headers will include HTTP/2 stream dependency info - // derived from spdy::SpdyPriority. - bool headers_include_h2_stream_dependency_; - // Local address of socket that was created in CreateSession. IPEndPoint local_address_; // True if we need to check HttpServerProperties if QUIC was supported last @@ -627,13 +658,6 @@ SSLConfigService* const ssl_config_service_; - // If set to true, the stream factory will create UDP Sockets with - // experimental optimization enabled for receiving data. - bool enable_socket_recv_optimization_; - - // The initial rtt for handshake. - const int initial_rtt_for_handshake_milliseconds_; - base::WeakPtrFactory<QuicStreamFactory> weak_factory_{this}; DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory);
diff --git a/net/quic/quic_stream_factory_fuzzer.cc b/net/quic/quic_stream_factory_fuzzer.cc index ad8b2c7c..783cb010 100644 --- a/net/quic/quic_stream_factory_fuzzer.cc +++ b/net/quic/quic_stream_factory_fuzzer.cc
@@ -93,40 +93,44 @@ // Initialize this on each loop since some options mutate this. HttpServerPropertiesImpl http_server_properties; - bool store_server_configs_in_properties = data_provider.ConsumeBool(); - bool close_sessions_on_ip_change = data_provider.ConsumeBool(); - bool mark_quic_broken_when_network_blackholes = data_provider.ConsumeBool(); - bool allow_server_migration = data_provider.ConsumeBool(); - bool race_cert_verification = data_provider.ConsumeBool(); - bool estimate_initial_rtt = data_provider.ConsumeBool(); - bool headers_include_h2_stream_dependency = data_provider.ConsumeBool(); - bool enable_socket_recv_optimization = data_provider.ConsumeBool(); - bool race_stale_dns_on_connection = data_provider.ConsumeBool(); + QuicParams params; + params.max_server_configs_stored_in_properties = + data_provider.ConsumeBool() ? 1 : 0; + params.close_sessions_on_ip_change = data_provider.ConsumeBool(); + params.mark_quic_broken_when_network_blackholes = data_provider.ConsumeBool(); + params.allow_server_migration = data_provider.ConsumeBool(); + params.race_cert_verification = data_provider.ConsumeBool(); + params.estimate_initial_rtt = data_provider.ConsumeBool(); + params.headers_include_h2_stream_dependency = data_provider.ConsumeBool(); + params.enable_socket_recv_optimization = data_provider.ConsumeBool(); + params.race_stale_dns_on_connection = data_provider.ConsumeBool(); env->crypto_client_stream_factory.AddProofVerifyDetails(&env->verify_details); - bool goaway_sessions_on_ip_change = false; - bool migrate_sessions_early_v2 = false; - bool migrate_sessions_on_network_change_v2 = false; - bool retry_on_alternate_network_before_handshake = false; - bool migrate_idle_sessions = false; - bool go_away_on_path_degrading = false; + params.goaway_sessions_on_ip_change = false; + params.migrate_sessions_early_v2 = false; + params.migrate_sessions_on_network_change_v2 = false; + params.retry_on_alternate_network_before_handshake = false; + params.migrate_idle_sessions = false; + params.go_away_on_path_degrading = false; - if (!close_sessions_on_ip_change) { - goaway_sessions_on_ip_change = data_provider.ConsumeBool(); - if (!goaway_sessions_on_ip_change) { - migrate_sessions_on_network_change_v2 = data_provider.ConsumeBool(); - if (migrate_sessions_on_network_change_v2) { - migrate_sessions_early_v2 = data_provider.ConsumeBool(); - retry_on_alternate_network_before_handshake = + if (!params.close_sessions_on_ip_change) { + params.goaway_sessions_on_ip_change = data_provider.ConsumeBool(); + if (!params.goaway_sessions_on_ip_change) { + params.migrate_sessions_on_network_change_v2 = + data_provider.ConsumeBool(); + if (params.migrate_sessions_on_network_change_v2) { + params.migrate_sessions_early_v2 = data_provider.ConsumeBool(); + params.retry_on_alternate_network_before_handshake = data_provider.ConsumeBool(); - migrate_idle_sessions = data_provider.ConsumeBool(); + params.migrate_idle_sessions = data_provider.ConsumeBool(); } } } - if (!migrate_sessions_early_v2) - go_away_on_path_degrading = data_provider.ConsumeBool(); + if (!params.migrate_sessions_early_v2) { + params.go_away_on_path_degrading = data_provider.ConsumeBool(); + } std::unique_ptr<QuicStreamFactory> factory = std::make_unique<QuicStreamFactory>( @@ -136,25 +140,7 @@ &env->ct_policy_enforcer, &env->transport_security_state, env->cert_transparency_verifier.get(), nullptr, &env->crypto_client_stream_factory, &env->random_generator, - &env->clock, quic::kDefaultMaxPacketSize, std::string(), - store_server_configs_in_properties, close_sessions_on_ip_change, - goaway_sessions_on_ip_change, - mark_quic_broken_when_network_blackholes, - kIdleConnectionTimeoutSeconds, quic::kPingTimeoutSecs, - kDefaultRetransmittableOnWireTimeoutMillisecs, - quic::kMaxTimeForCryptoHandshakeSecs, quic::kInitialIdleTimeoutSecs, - migrate_sessions_on_network_change_v2, migrate_sessions_early_v2, - retry_on_alternate_network_before_handshake, migrate_idle_sessions, - base::TimeDelta::FromSeconds( - kDefaultIdleSessionMigrationPeriodSeconds), - base::TimeDelta::FromSeconds(kMaxTimeOnNonDefaultNetworkSecs), - kMaxMigrationsToNonDefaultNetworkOnWriteError, - kMaxMigrationsToNonDefaultNetworkOnPathDegrading, - allow_server_migration, race_stale_dns_on_connection, - go_away_on_path_degrading, race_cert_verification, - estimate_initial_rtt, headers_include_h2_stream_dependency, - env->connection_options, env->client_connection_options, - enable_socket_recv_optimization, 0); + &env->clock, params); SetQuicFlag(FLAGS_quic_supports_tls_handshake, true); QuicStreamRequest request(factory.get());
diff --git a/net/quic/quic_stream_factory_peer.cc b/net/quic/quic_stream_factory_peer.cc index cb9262e..565e530 100644 --- a/net/quic/quic_stream_factory_peer.cc +++ b/net/quic/quic_stream_factory_peer.cc
@@ -113,13 +113,13 @@ bool QuicStreamFactoryPeer::GetRaceCertVerification( QuicStreamFactory* factory) { - return factory->race_cert_verification_; + return factory->params_.race_cert_verification; } void QuicStreamFactoryPeer::SetRaceCertVerification( QuicStreamFactory* factory, bool race_cert_verification) { - factory->race_cert_verification_ = race_cert_verification; + factory->params_.race_cert_verification = race_cert_verification; } quic::QuicAsyncStatus QuicStreamFactoryPeer::StartCertVerifyJob(
diff --git a/net/quic/quic_stream_factory_test.cc b/net/quic/quic_stream_factory_test.cc index 634c39d..388e824 100644 --- a/net/quic/quic_stream_factory_test.cc +++ b/net/quic/quic_stream_factory_test.cc
@@ -263,9 +263,8 @@ failed_on_default_network_callback_(base::BindRepeating( &QuicStreamFactoryTestBase::OnFailedOnDefaultNetwork, base::Unretained(this))), - failed_on_default_network_(false), - store_server_configs_in_properties_(false) { - test_params_.quic_headers_include_h2_stream_dependency = + failed_on_default_network_(false) { + test_params_.quic_params.headers_include_h2_stream_dependency = client_headers_include_h2_stream_dependency; clock_.AdvanceTime(quic::QuicTime::Delta::FromSeconds(1)); } @@ -279,35 +278,7 @@ cert_transparency_verifier_.get(), /*SocketPerformanceWatcherFactory*/ nullptr, &crypto_client_stream_factory_, &random_generator_, &clock_, - test_params_.quic_max_packet_length, test_params_.quic_user_agent_id, - store_server_configs_in_properties_, - test_params_.quic_close_sessions_on_ip_change, - test_params_.quic_goaway_sessions_on_ip_change, - test_params_.mark_quic_broken_when_network_blackholes, - test_params_.quic_idle_connection_timeout_seconds, - test_params_.quic_reduced_ping_timeout_seconds, - test_params_.quic_retransmittable_on_wire_timeout_milliseconds, - test_params_.quic_max_time_before_crypto_handshake_seconds, - test_params_.quic_max_idle_time_before_crypto_handshake_seconds, - test_params_.quic_migrate_sessions_on_network_change_v2, - test_params_.quic_migrate_sessions_early_v2, - test_params_.quic_retry_on_alternate_network_before_handshake, - test_params_.quic_migrate_idle_sessions, - test_params_.quic_idle_session_migration_period, - test_params_.quic_max_time_on_non_default_network, - test_params_.quic_max_migrations_to_non_default_network_on_write_error, - test_params_ - .quic_max_migrations_to_non_default_network_on_path_degrading, - test_params_.quic_allow_server_migration, - test_params_.quic_race_stale_dns_on_connection, - test_params_.quic_go_away_on_path_degrading, - test_params_.quic_race_cert_verification, - test_params_.quic_estimate_initial_rtt, - test_params_.quic_headers_include_h2_stream_dependency, - test_params_.quic_connection_options, - test_params_.quic_client_connection_options, - test_params_.quic_enable_socket_recv_optimization, - test_params_.quic_initial_rtt_for_handshake_milliseconds)); + test_params_.quic_params)); } void InitializeConnectionMigrationV2Test( @@ -318,8 +289,8 @@ scoped_mock_network_change_notifier_->mock_network_change_notifier(); mock_ncn->ForceNetworkHandlesSupported(); mock_ncn->SetConnectedNetworksList(connected_networks); - test_params_.quic_migrate_sessions_on_network_change_v2 = true; - test_params_.quic_migrate_sessions_early_v2 = true; + test_params_.quic_params.migrate_sessions_on_network_change_v2 = true; + test_params_.quic_params.migrate_sessions_early_v2 = true; socket_factory_.reset(new TestConnectionMigrationSocketFactory); Initialize(); } @@ -514,7 +485,7 @@ // Helper method for server migration tests. void VerifyServerMigration(const quic::QuicConfig& config, IPEndPoint expected_address) { - test_params_.quic_allow_server_migration = true; + test_params_.quic_params.allow_server_migration = true; Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -587,8 +558,8 @@ // Verifies that the QUIC stream factory is initialized correctly. void VerifyInitialization() { - store_server_configs_in_properties_ = true; - test_params_.quic_idle_connection_timeout_seconds = 500; + test_params_.quic_params.max_server_configs_stored_in_properties = 1; + test_params_.quic_params.idle_connection_timeout_seconds = 500; Initialize(); factory_->set_require_confirmation(false); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -896,7 +867,6 @@ // Variables to configure QuicStreamFactory. HttpNetworkSession::Params test_params_; - bool store_server_configs_in_properties_; }; class QuicStreamFactoryTest : public QuicStreamFactoryTestBase, @@ -1132,7 +1102,7 @@ stats.srtt = base::TimeDelta::FromMilliseconds(10); http_server_properties_.SetServerNetworkStats(url::SchemeHostPort(url_), stats); - test_params_.quic_estimate_initial_rtt = true; + test_params_.quic_params.estimate_initial_rtt = true; Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -1165,7 +1135,7 @@ ScopedMockNetworkChangeNotifier notifier; notifier.mock_network_change_notifier()->SetConnectionType( NetworkChangeNotifier::CONNECTION_2G); - test_params_.quic_estimate_initial_rtt = true; + test_params_.quic_params.estimate_initial_rtt = true; Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -1198,7 +1168,7 @@ ScopedMockNetworkChangeNotifier notifier; notifier.mock_network_change_notifier()->SetConnectionType( NetworkChangeNotifier::CONNECTION_3G); - test_params_.quic_estimate_initial_rtt = true; + test_params_.quic_params.estimate_initial_rtt = true; Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -2054,7 +2024,7 @@ } TEST_P(QuicStreamFactoryTest, CloseSessionsOnIPAddressChanged) { - test_params_.quic_close_sessions_on_ip_change = true; + test_params_.quic_params.close_sessions_on_ip_change = true; Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); @@ -2139,7 +2109,7 @@ // as going away on IP address change instead of being closed. New requests will // go to a new connection. TEST_P(QuicStreamFactoryTest, GoAwaySessionsOnIPAddressChanged) { - test_params_.quic_goaway_sessions_on_ip_change = true; + test_params_.quic_params.goaway_sessions_on_ip_change = true; Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); @@ -2742,7 +2712,7 @@ void QuicStreamFactoryTestBase::TestOnNetworkMadeDefaultNonMigratableStream( bool migrate_idle_sessions) { - test_params_.quic_migrate_idle_sessions = migrate_idle_sessions; + test_params_.quic_params.migrate_idle_sessions = migrate_idle_sessions; InitializeConnectionMigrationV2Test( {kDefaultNetworkForTests, kNewNetworkForTests}); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -2908,7 +2878,7 @@ void QuicStreamFactoryTestBase::TestOnNetworkDisconnectedNonMigratableStream( bool migrate_idle_sessions) { - test_params_.quic_migrate_idle_sessions = migrate_idle_sessions; + test_params_.quic_params.migrate_idle_sessions = migrate_idle_sessions; InitializeConnectionMigrationV2Test( {kDefaultNetworkForTests, kNewNetworkForTests}); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -3060,7 +3030,7 @@ void QuicStreamFactoryTestBase::TestOnNetworkMadeDefaultNoOpenStreams( bool migrate_idle_sessions) { - test_params_.quic_migrate_idle_sessions = migrate_idle_sessions; + test_params_.quic_params.migrate_idle_sessions = migrate_idle_sessions; InitializeConnectionMigrationV2Test( {kDefaultNetworkForTests, kNewNetworkForTests}); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -3141,7 +3111,7 @@ void QuicStreamFactoryTestBase::TestOnNetworkDisconnectedNoOpenStreams( bool migrate_idle_sessions) { - test_params_.quic_migrate_idle_sessions = migrate_idle_sessions; + test_params_.quic_params.migrate_idle_sessions = migrate_idle_sessions; InitializeConnectionMigrationV2Test( {kDefaultNetworkForTests, kNewNetworkForTests}); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -3795,7 +3765,7 @@ // This test verifies that the session marks itself GOAWAY on path degrading // and it does not receive any new request TEST_P(QuicStreamFactoryTest, GoawayOnPathDegrading) { - test_params_.quic_go_away_on_path_degrading = true; + test_params_.quic_params.go_away_on_path_degrading = true; Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); @@ -4562,7 +4532,7 @@ void QuicStreamFactoryTestBase::TestMigrateSessionEarlyNonMigratableStream( bool migrate_idle_sessions) { - test_params_.quic_migrate_idle_sessions = migrate_idle_sessions; + test_params_.quic_params.migrate_idle_sessions = migrate_idle_sessions; InitializeConnectionMigrationV2Test( {kDefaultNetworkForTests, kNewNetworkForTests}); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -5164,7 +5134,7 @@ quic::QuicErrorCode quic_error) { DCHECK(quic_error == quic::QUIC_NETWORK_IDLE_TIMEOUT || quic_error == quic::QUIC_HANDSHAKE_TIMEOUT); - test_params_.quic_retry_on_alternate_network_before_handshake = true; + test_params_.quic_params.retry_on_alternate_network_before_handshake = true; InitializeConnectionMigrationV2Test( {kDefaultNetworkForTests, kNewNetworkForTests}); @@ -5313,7 +5283,7 @@ // is triggered before handshake is confirmed and connection migration is turned // on. TEST_P(QuicStreamFactoryTest, MigrationOnWriteErrorBeforeHandshakeConfirmed) { - DCHECK(!test_params_.quic_retry_on_alternate_network_before_handshake); + DCHECK(!test_params_.quic_params.retry_on_alternate_network_before_handshake); InitializeConnectionMigrationV2Test( {kDefaultNetworkForTests, kNewNetworkForTests}); @@ -5384,7 +5354,7 @@ // on, a new connection will be retried on the alternate network. TEST_P(QuicStreamFactoryTest, RetryConnectionOnWriteErrorBeforeHandshakeConfirmed) { - test_params_.quic_retry_on_alternate_network_before_handshake = true; + test_params_.quic_params.retry_on_alternate_network_before_handshake = true; InitializeConnectionMigrationV2Test( {kDefaultNetworkForTests, kNewNetworkForTests}); @@ -6094,7 +6064,7 @@ DVLOG(1) << "Write error mode: " << ((write_error_mode == SYNCHRONOUS) ? "SYNCHRONOUS" : "ASYNC"); DVLOG(1) << "Migrate idle sessions: " << migrate_idle_sessions; - test_params_.quic_migrate_idle_sessions = migrate_idle_sessions; + test_params_.quic_params.migrate_idle_sessions = migrate_idle_sessions; InitializeConnectionMigrationV2Test( {kDefaultNetworkForTests, kNewNetworkForTests}); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -7329,7 +7299,7 @@ // custom value is used. TEST_P(QuicStreamFactoryTest, CustomRetransmittableOnWireTimeoutForMigration) { int custom_timeout_value = 200; - test_params_.quic_retransmittable_on_wire_timeout_milliseconds = + test_params_.quic_params.retransmittable_on_wire_timeout_milliseconds = custom_timeout_value; InitializeConnectionMigrationV2Test( {kDefaultNetworkForTests, kNewNetworkForTests}); @@ -7474,7 +7444,7 @@ // send retransmittable pings with the custom value. TEST_P(QuicStreamFactoryTest, CustomRetransmittableOnWireTimeout) { int custom_timeout_value = 200; - test_params_.quic_retransmittable_on_wire_timeout_milliseconds = + test_params_.quic_params.retransmittable_on_wire_timeout_milliseconds = custom_timeout_value; Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -7719,9 +7689,9 @@ TEST_P(QuicStreamFactoryTest, CustomeRetransmittableOnWireTimeoutWithMigrationOnNetworkChangeOnly) { int custom_timeout_value = 200; - test_params_.quic_retransmittable_on_wire_timeout_milliseconds = + test_params_.quic_params.retransmittable_on_wire_timeout_milliseconds = custom_timeout_value; - test_params_.quic_migrate_sessions_on_network_change_v2 = true; + test_params_.quic_params.migrate_sessions_on_network_change_v2 = true; Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); @@ -7846,7 +7816,7 @@ // NOT send retransmittable pings to the peer with custom value. TEST_P(QuicStreamFactoryTest, NoRetransmittableOnWireTimeoutWithMigrationOnNetworkChangeOnly) { - test_params_.quic_migrate_sessions_on_network_change_v2 = true; + test_params_.quic_params.migrate_sessions_on_network_change_v2 = true; Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); @@ -8250,7 +8220,7 @@ // default network or the idle migration period threshold is exceeded. // The default threshold is 30s. TEST_P(QuicStreamFactoryTest, DefaultIdleMigrationPeriod) { - test_params_.quic_migrate_idle_sessions = true; + test_params_.quic_params.migrate_idle_sessions = true; InitializeConnectionMigrationV2Test( {kDefaultNetworkForTests, kNewNetworkForTests}); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -8371,8 +8341,8 @@ TEST_P(QuicStreamFactoryTest, CustomIdleMigrationPeriod) { // The customized threshold is 15s. - test_params_.quic_migrate_idle_sessions = true; - test_params_.quic_idle_session_migration_period = + test_params_.quic_params.migrate_idle_sessions = true; + test_params_.quic_params.idle_session_migration_period = base::TimeDelta::FromSeconds(15); InitializeConnectionMigrationV2Test( {kDefaultNetworkForTests, kNewNetworkForTests}); @@ -8488,7 +8458,7 @@ } TEST_P(QuicStreamFactoryTest, ServerMigration) { - test_params_.quic_allow_server_migration = true; + test_params_.quic_params.allow_server_migration = true; Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -8624,7 +8594,7 @@ } TEST_P(QuicStreamFactoryTest, ServerMigrationIPv4ToIPv6Fails) { - test_params_.quic_allow_server_migration = true; + test_params_.quic_params.allow_server_migration = true; Initialize(); // Add a resolver rule to make initial connection to an IPv4 address. @@ -8873,7 +8843,7 @@ } TEST_P(QuicStreamFactoryTest, ReducePingTimeoutOnConnectionTimeOutOpenStreams) { - test_params_.quic_reduced_ping_timeout_seconds = 10; + test_params_.quic_params.reduced_ping_timeout_seconds = 10; Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); @@ -9692,18 +9662,18 @@ // Passes connection options and client connection options to QuicStreamFactory, // then checks that its internal quic::QuicConfig is correct. TEST_P(QuicStreamFactoryTest, ConfigConnectionOptions) { - test_params_.quic_connection_options.push_back(quic::kTIME); - test_params_.quic_connection_options.push_back(quic::kTBBR); - test_params_.quic_connection_options.push_back(quic::kREJ); + test_params_.quic_params.connection_options.push_back(quic::kTIME); + test_params_.quic_params.connection_options.push_back(quic::kTBBR); + test_params_.quic_params.connection_options.push_back(quic::kREJ); - test_params_.quic_client_connection_options.push_back(quic::kTBBR); - test_params_.quic_client_connection_options.push_back(quic::k1RTT); + test_params_.quic_params.client_connection_options.push_back(quic::kTBBR); + test_params_.quic_params.client_connection_options.push_back(quic::k1RTT); Initialize(); const quic::QuicConfig* config = QuicStreamFactoryPeer::GetConfig(factory_.get()); - EXPECT_EQ(test_params_.quic_connection_options, + EXPECT_EQ(test_params_.quic_params.connection_options, config->SendConnectionOptions()); EXPECT_TRUE(config->HasClientRequestedIndependentOption( quic::kTBBR, quic::Perspective::IS_CLIENT)); @@ -9781,8 +9751,8 @@ // |quic_max_idle_time_before_crypto_handshake_seconds| to QuicStreamFactory, // checks that its internal quic::QuicConfig is correct. TEST_P(QuicStreamFactoryTest, ConfigMaxTimeBeforeCryptoHandshake) { - test_params_.quic_max_time_before_crypto_handshake_seconds = 11; - test_params_.quic_max_idle_time_before_crypto_handshake_seconds = 13; + test_params_.quic_params.max_time_before_crypto_handshake_seconds = 11; + test_params_.quic_params.max_idle_time_before_crypto_handshake_seconds = 13; Initialize(); const quic::QuicConfig* config = @@ -10037,7 +10007,7 @@ // the final connection is established through the resolved DNS. No racing // connection. TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceAndHostResolutionSync) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10130,7 +10100,7 @@ // With dns race experiment on, DNS resolve returns async, stale dns used, // connects synchrounously, and then the resolved DNS matches. TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceHostResolveAsyncStaleMatch) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10188,7 +10158,7 @@ // async, and then the result matches. TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceHostResolveAsyncConnectAsyncStaleMatch) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10255,7 +10225,7 @@ // return, then connection finishes and matches with the result. TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceHostResolveAsyncStaleMatchConnectAsync) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10318,7 +10288,7 @@ // sync, but dns no match TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceHostResolveAsyncStaleSyncNoMatch) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10389,7 +10359,7 @@ // With dns race experiment on, dns resolve async, stale used and connects // async, finishes before dns, but no match TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceStaleAsyncResolveAsyncNoMatch) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10462,7 +10432,7 @@ // With dns race experiment on, dns resolve async, stale used and connects // async, dns finishes first, but no match TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceResolveAsyncStaleAsyncNoMatch) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10532,7 +10502,7 @@ // With dns race experiment on, dns resolve returns error sync, same behavior // as experiment is not on TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceHostResolveError) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10557,7 +10527,7 @@ // With dns race experiment on, no cache available, dns resolve returns error // async TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceHostResolveAsyncError) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10586,7 +10556,7 @@ // With dns race experiment on, dns resolve async, staled used and connects // sync, dns returns error and no connection is established. TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceStaleSyncHostResolveError) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10641,7 +10611,7 @@ // return error, then dns matches. // This serves as a regression test for crbug.com/956374. TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceStaleErrorDNSMatches) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10690,7 +10660,7 @@ // With dns race experiment on, dns resolve async, stale used and connection // returns error, dns no match, new connection is established TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceStaleErrorDNSNoMatch) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10753,7 +10723,7 @@ // With dns race experiment on, dns resolve async, stale used and connection // returns error, dns no match, new connection error TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceStaleErrorDNSNoMatchError) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10806,7 +10776,7 @@ // With dns race experiment on, dns resolve async and stale connect async, dns // resolve returns error and then preconnect finishes TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceResolveAsyncErrorStaleAsync) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10860,7 +10830,7 @@ // resolve returns error and then preconnect fails. TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceResolveAsyncErrorStaleAsyncError) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10913,7 +10883,7 @@ // With dns race experiment on, test that host resolution callback behaves // normal as experiment is not on TEST_P(QuicStreamFactoryTest, ResultAfterDNSRaceHostResolveAsync) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); Initialize(); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); @@ -10957,7 +10927,7 @@ // With stale dns and migration before handshake experiment on, migration failed // after handshake confirmed, and then fresh resolve returns. TEST_P(QuicStreamFactoryTest, StaleNetworkFailedAfterHandshake) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); InitializeConnectionMigrationV2Test( @@ -11028,7 +10998,7 @@ // With stale dns experiment on, the stale session is killed while waiting for // handshake TEST_P(QuicStreamFactoryTest, StaleNetworkFailedBeforeHandshake) { - test_params_.quic_race_stale_dns_on_connection = true; + test_params_.quic_params.race_stale_dns_on_connection = true; host_resolver_ = std::make_unique<MockCachingHostResolver>(); InitializeConnectionMigrationV2Test( {kDefaultNetworkForTests, kNewNetworkForTests}); @@ -11101,7 +11071,7 @@ TEST_P(QuicStreamFactoryTest, ConfigInitialRttForHandshake) { int kInitialRtt = 400; - test_params_.quic_initial_rtt_for_handshake_milliseconds = kInitialRtt; + test_params_.quic_params.initial_rtt_for_handshake_milliseconds = kInitialRtt; crypto_client_stream_factory_.set_handshake_mode( MockCryptoClientStream::COLD_START_WITH_CHLO_SENT); Initialize();
diff --git a/net/quic/quic_test_packet_maker.cc b/net/quic/quic_test_packet_maker.cc index 9c1f15f..86135876 100644 --- a/net/quic/quic_test_packet_maker.cc +++ b/net/quic/quic_test_packet_maker.cc
@@ -8,6 +8,7 @@ #include <utility> #include "net/quic/mock_crypto_client_stream.h" +#include "net/quic/quic_chromium_client_session.h" #include "net/quic/quic_http_utils.h" #include "net/third_party/quiche/src/quic/core/http/quic_spdy_session.h" #include "net/third_party/quiche/src/quic/core/quic_framer.h" @@ -355,8 +356,7 @@ std::string type(1, 0x00); quic::SettingsFrame settings; - settings.values[quic::kSettingsMaxHeaderListSize] = - quic::kDefaultMaxUncompressedHeaderSize; + settings.values[quic::kSettingsMaxHeaderListSize] = kQuicMaxHeaderListSize; std::unique_ptr<char[]> buffer1; quic::QuicByteCount frame_length1 = http_encoder_.SerializeSettingsFrame(settings, &buffer1); @@ -808,8 +808,7 @@ std::string type(1, 0x00); quic::SettingsFrame settings; - settings.values[quic::kSettingsMaxHeaderListSize] = - quic::kDefaultMaxUncompressedHeaderSize; + settings.values[quic::kSettingsMaxHeaderListSize] = kQuicMaxHeaderListSize; std::unique_ptr<char[]> buffer1; quic::QuicByteCount frame_length1 = http_encoder_.SerializeSettingsFrame(settings, &buffer1); @@ -903,8 +902,7 @@ std::string type(1, 0x00); quic::SettingsFrame settings; - settings.values[quic::kSettingsMaxHeaderListSize] = - quic::kDefaultMaxUncompressedHeaderSize; + settings.values[quic::kSettingsMaxHeaderListSize] = kQuicMaxHeaderListSize; std::unique_ptr<char[]> buffer1; quic::QuicByteCount frame_length1 = http_encoder_.SerializeSettingsFrame(settings, &buffer1); @@ -975,8 +973,7 @@ std::string type(1, 0x00); quic::SettingsFrame settings; - settings.values[quic::kSettingsMaxHeaderListSize] = - quic::kDefaultMaxUncompressedHeaderSize; + settings.values[quic::kSettingsMaxHeaderListSize] = kQuicMaxHeaderListSize; std::unique_ptr<char[]> buffer1; quic::QuicByteCount frame_length1 = http_encoder_.SerializeSettingsFrame(settings, &buffer1); @@ -1287,7 +1284,7 @@ if (!quic::VersionHasStreamType(version_.transport_version)) { spdy::SpdySettingsIR settings_frame; settings_frame.AddSetting(spdy::SETTINGS_MAX_HEADER_LIST_SIZE, - quic::kDefaultMaxUncompressedHeaderSize); + kQuicMaxHeaderListSize); spdy::SpdySerializedFrame spdy_frame( spdy_request_framer_.SerializeFrame(settings_frame)); InitializeHeader(packet_number, should_include_version); @@ -1301,8 +1298,7 @@ // first. std::string type(1, 0x00); quic::SettingsFrame settings; - settings.values[quic::kSettingsMaxHeaderListSize] = - quic::kDefaultMaxUncompressedHeaderSize; + settings.values[quic::kSettingsMaxHeaderListSize] = kQuicMaxHeaderListSize; std::unique_ptr<char[]> buffer; quic::QuicByteCount frame_length = http_encoder_.SerializeSettingsFrame(settings, &buffer); @@ -1333,7 +1329,7 @@ if (!quic::VersionHasStreamType(version_.transport_version)) { spdy::SpdySettingsIR settings_frame; settings_frame.AddSetting(spdy::SETTINGS_MAX_HEADER_LIST_SIZE, - quic::kDefaultMaxUncompressedHeaderSize); + kQuicMaxHeaderListSize); spdy::SpdySerializedFrame spdy_frame( spdy_request_framer_.SerializeFrame(settings_frame)); InitializeHeader(packet_number, /*should_include_version*/ true); @@ -1347,8 +1343,7 @@ // first. std::string type(1, 0x00); quic::SettingsFrame settings; - settings.values[quic::kSettingsMaxHeaderListSize] = - quic::kDefaultMaxUncompressedHeaderSize; + settings.values[quic::kSettingsMaxHeaderListSize] = kQuicMaxHeaderListSize; std::unique_ptr<char[]> buffer; quic::QuicByteCount frame_length = http_encoder_.SerializeSettingsFrame(settings, &buffer);
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index 469cc5b..e5d16bd3 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc
@@ -721,10 +721,10 @@ if (request_->context()->network_quality_estimator()) { if (prefilter_bytes_read() == bytes_read) { request_->context()->network_quality_estimator()->NotifyHeadersReceived( - *request_); + *request_, prefilter_bytes_read()); } else { request_->context()->network_quality_estimator()->NotifyBytesRead( - *request_); + *request_, prefilter_bytes_read()); } }
diff --git a/net/url_request/url_request_quic_perftest.cc b/net/url_request/url_request_quic_perftest.cc index 4941e92..732e363f 100644 --- a/net/url_request/url_request_quic_perftest.cc +++ b/net/url_request/url_request_quic_perftest.cc
@@ -70,7 +70,7 @@ "Alt-Svc", base::StringPrintf("quic=\"%s:%d\"; v=\"%u\"", kAltSvcHost, kAltSvcPort, HttpNetworkSession::Params() - .quic_supported_versions[0] + .quic_params.supported_versions[0] .transport_version)); http_response->set_code(HTTP_OK); http_response->set_content(kHelloOriginResponse); @@ -115,7 +115,7 @@ new HttpNetworkSession::Params); params->enable_quic = true; params->enable_user_alternate_protocol_ports = true; - params->quic_allow_remote_alt_svc = true; + params->quic_params.allow_remote_alt_svc = true; context_->set_host_resolver(host_resolver_.get()); context_->set_http_network_session_params(std::move(params)); context_->set_cert_verifier(&cert_verifier_);
diff --git a/net/url_request/url_request_quic_unittest.cc b/net/url_request/url_request_quic_unittest.cc index 0e00d6f9..e29f02c 100644 --- a/net/url_request/url_request_quic_unittest.cc +++ b/net/url_request/url_request_quic_unittest.cc
@@ -60,7 +60,8 @@ OK); // To simplify the test, and avoid the race with the HTTP request, we force // QUIC for these requests. - params->origins_to_force_quic_on.insert(HostPortPair(kTestServerHost, 443)); + params->quic_params.origins_to_force_quic_on.insert( + HostPortPair(kTestServerHost, 443)); params->enable_quic = true; params->enable_server_push_cancellation = true; context_->set_host_resolver(host_resolver_.get());
diff --git a/remoting/base/grpc_support/grpc_async_executor_unittest.cc b/remoting/base/grpc_support/grpc_async_executor_unittest.cc index 4cd8a88..c24807c 100644 --- a/remoting/base/grpc_support/grpc_async_executor_unittest.cc +++ b/remoting/base/grpc_support/grpc_async_executor_unittest.cc
@@ -36,6 +36,10 @@ using EchoStreamResponder = test::GrpcServerStreamResponder<EchoResponse>; using MockOnceClosure = base::MockCallback<base::OnceClosure>; +using MockMessageCallback = + base::MockCallback<base::RepeatingCallback<void(const EchoResponse&)>>; +using MockStatusCallback = + base::MockCallback<base::OnceCallback<void(const grpc::Status&)>>; base::RepeatingClosure NotReachedClosure() { return base::BindRepeating([]() { NOTREACHED(); }); @@ -76,7 +80,8 @@ base::OnceClosure on_channel_ready, const base::RepeatingCallback<void(const EchoResponse&)>& on_incoming_msg, base::OnceCallback<void(const grpc::Status&)> on_channel_closed, - GrpcAsyncExecutor* executor); + GrpcAsyncExecutor* executor, + base::Time deadline = {}); std::unique_ptr<ScopedGrpcServerStream> StartEchoStream( const std::string& request_text, @@ -95,12 +100,12 @@ std::unique_ptr<GrpcAsyncExecutor> executor_; std::unique_ptr<test::GrpcAsyncTestServer> server_; std::unique_ptr<GrpcAsyncExecutorTestService::Stub> stub_; - - private: - base::test::ScopedTaskEnvironment scoped_task_environment_; + std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment_; }; void GrpcAsyncExecutorTest::SetUp() { + scoped_task_environment_ = + std::make_unique<base::test::ScopedTaskEnvironment>(); executor_ = std::make_unique<GrpcAsyncExecutor>(); server_ = std::make_unique<test::GrpcAsyncTestServer>( std::make_unique<GrpcAsyncExecutorTestService::AsyncService>()); @@ -133,7 +138,8 @@ base::OnceClosure on_channel_ready, const base::RepeatingCallback<void(const EchoResponse&)>& on_incoming_msg, base::OnceCallback<void(const grpc::Status&)> on_channel_closed, - GrpcAsyncExecutor* executor) { + GrpcAsyncExecutor* executor, + base::Time deadline) { EchoRequest request; request.set_text(request_text); std::unique_ptr<ScopedGrpcServerStream> scoped_stream; @@ -142,6 +148,9 @@ base::Unretained(stub_.get())), request, std::move(on_channel_ready), on_incoming_msg, std::move(on_channel_closed), &scoped_stream); + if (!deadline.is_null()) { + grpc_request->set_initial_metadata_deadline(deadline); + } executor->ExecuteRpc(std::move(grpc_request)); return scoped_stream; } @@ -616,4 +625,50 @@ ASSERT_GT(deadline + kDeadlineEpsilon, new_deadline); } +TEST_F(GrpcAsyncExecutorTest, + ServerStreamInitialMetadataDeadline_DefaultDeadline) { + // Other tests can't work with mock time so we have to replace it here. + // We also have to reset the old task environment before creating a new one + // since only one ScopedTaskEnvironment can exist at a time. + scoped_task_environment_.reset(); + scoped_task_environment_ = + std::make_unique<base::test::ScopedTaskEnvironment>( + base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME_AND_NOW); + + MockOnceClosure on_channel_ready; + MockMessageCallback on_incoming_message; + MockStatusCallback on_status; + auto scoped_stream = + StartEchoStream("Hello", on_channel_ready.Get(), + on_incoming_message.Get(), on_status.Get()); + EXPECT_CALL(on_status, Run(Property(&grpc::Status::error_code, + grpc::StatusCode::DEADLINE_EXCEEDED))); + scoped_task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(30)); +} + +TEST_F(GrpcAsyncExecutorTest, + ServerStreamInitialMetadataDeadline_ManualDeadline) { + scoped_task_environment_.reset(); + scoped_task_environment_ = + std::make_unique<base::test::ScopedTaskEnvironment>( + base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME_AND_NOW); + + MockOnceClosure on_channel_ready; + MockMessageCallback on_incoming_message; + MockStatusCallback on_status; + auto scoped_stream = StartEchoStreamOnExecutor( + "Hello", on_channel_ready.Get(), on_incoming_message.Get(), + on_status.Get(), executor_.get(), + base::Time::Now() + base::TimeDelta::FromSeconds(60)); + + // |on_status| shouldn't be called in the first 30 seconds. + scoped_task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(30)); + + EXPECT_CALL(on_status, Run(Property(&grpc::Status::error_code, + grpc::StatusCode::DEADLINE_EXCEEDED))); + + // |on_status| should be called here. + scoped_task_environment_->FastForwardBy(base::TimeDelta::FromSeconds(30)); +} + } // namespace remoting
diff --git a/remoting/base/grpc_support/grpc_async_server_streaming_request.cc b/remoting/base/grpc_support/grpc_async_server_streaming_request.cc index a95b0b1..f58257e4 100644 --- a/remoting/base/grpc_support/grpc_async_server_streaming_request.cc +++ b/remoting/base/grpc_support/grpc_async_server_streaming_request.cc
@@ -10,6 +10,9 @@ namespace { +constexpr base::TimeDelta kDefaultInitialMetadataTimeout = + base::TimeDelta::FromSeconds(30); + void RunTaskIfScopedStreamIsAlive( base::WeakPtr<ScopedGrpcServerStream> scoped_stream, base::OnceClosure task) { @@ -44,6 +47,17 @@ scoped_stream_, std::move(task))); } +void GrpcAsyncServerStreamingRequestBase::StartInitialMetadataTimer() { + base::TimeDelta initial_metadata_timeout = kDefaultInitialMetadataTimeout; + base::Time now = base::Time::Now(); + if (initial_metadata_deadline_ > now) { + initial_metadata_timeout = initial_metadata_deadline_ - now; + } + initial_metadata_timer_.Start( + FROM_HERE, initial_metadata_timeout, this, + &GrpcAsyncServerStreamingRequestBase::OnInitialMetadataTimeout); +} + bool GrpcAsyncServerStreamingRequestBase::OnDequeue(bool operation_succeeded) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (state_ == State::CLOSED) { @@ -103,6 +117,7 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); state_ = State::CLOSED; status_ = grpc::Status::CANCELLED; + initial_metadata_timer_.AbandonAndStop(); weak_factory_.InvalidateWeakPtrs(); } @@ -113,11 +128,21 @@ void GrpcAsyncServerStreamingRequestBase::ResolveChannelReady() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + initial_metadata_timer_.AbandonAndStop(); RunTask(std::move(on_channel_ready_)); } void GrpcAsyncServerStreamingRequestBase::ResolveChannelClosed() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + initial_metadata_timer_.AbandonAndStop(); + RunTask(base::BindOnce(std::move(on_channel_closed_), status_)); +} + +void GrpcAsyncServerStreamingRequestBase::OnInitialMetadataTimeout() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + CancelRequest(); + status_ = grpc::Status(grpc::StatusCode::DEADLINE_EXCEEDED, + "Timed out waiting for initial metadata."); RunTask(base::BindOnce(std::move(on_channel_closed_), status_)); }
diff --git a/remoting/base/grpc_support/grpc_async_server_streaming_request.h b/remoting/base/grpc_support/grpc_async_server_streaming_request.h index 7256ade..e2ca25c 100644 --- a/remoting/base/grpc_support/grpc_async_server_streaming_request.h +++ b/remoting/base/grpc_support/grpc_async_server_streaming_request.h
@@ -13,6 +13,8 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" +#include "base/time/time.h" +#include "base/timer/timer.h" #include "remoting/base/grpc_support/grpc_async_request.h" #include "remoting/base/grpc_support/scoped_grpc_server_stream.h" #include "third_party/grpc/src/include/grpcpp/support/async_stream.h" @@ -38,6 +40,19 @@ std::unique_ptr<ScopedGrpcServerStream>* scoped_stream); ~GrpcAsyncServerStreamingRequestBase() override; + // Sets the deadline of receiving initial metadata (marker of stream being + // started). The request will be closed with a DEADLINE_EXCEEDED error if + // initial metadata has not been received after |deadline|. + // + // Note that this is different than setting deadline on the client context, + // which will close the stream if the server doesn't close it after + // |deadline|. + // + // The default value is 30s after request is started. + void set_initial_metadata_deadline(base::Time deadline) { + initial_metadata_deadline_ = deadline; + } + protected: enum class State { STARTING, @@ -58,6 +73,8 @@ // has been deleted right before it is being executed. void RunTask(base::OnceClosure task); + void StartInitialMetadataTimer(); + virtual void ReadInitialMetadata(void* event_tag) = 0; virtual void ResolveIncomingMessage() = 0; virtual void WaitForIncomingMessage(void* event_tag) = 0; @@ -71,10 +88,13 @@ bool CanStartRequest() const override; void ResolveChannelReady(); void ResolveChannelClosed(); + void OnInitialMetadataTimeout(); base::OnceClosure on_channel_ready_; base::OnceCallback<void(const grpc::Status&)> on_channel_closed_; State state_ = State::STARTING; + base::Time initial_metadata_deadline_; + base::OneShotTimer initial_metadata_timer_; RunTaskCallback run_task_callback_; base::WeakPtr<ScopedGrpcServerStream> scoped_stream_; @@ -132,6 +152,7 @@ void* event_tag) override { reader_ = std::move(create_reader_callback_).Run(cq, event_tag); set_run_task_callback(run_task_cb); + StartInitialMetadataTimer(); } // GrpcAsyncServerStreamingRequestBase implementations.
diff --git a/remoting/signaling/ftl_message_reception_channel.cc b/remoting/signaling/ftl_message_reception_channel.cc index 252d25e8..534e025 100644 --- a/remoting/signaling/ftl_message_reception_channel.cc +++ b/remoting/signaling/ftl_message_reception_channel.cc
@@ -56,6 +56,10 @@ if (state_ == State::STOPPED) { return; } + + // Current stream ready callbacks shouldn't receive notification for future + // stream. + stream_ready_callbacks_.clear(); StopReceivingMessagesInternal(); RunStreamClosedCallbacks(grpc::Status::CANCELLED); } @@ -87,6 +91,7 @@ RetryStartReceivingMessagesWithBackoff(); return; } + stream_ready_callbacks_.clear(); StopReceivingMessagesInternal(); RunStreamClosedCallbacks(status); }
diff --git a/services/OWNERS b/services/OWNERS index 305da08..1bcc466 100644 --- a/services/OWNERS +++ b/services/OWNERS
@@ -2,3 +2,4 @@ jam@chromium.org rockot@google.com sky@chromium.org +# COMPONENT: Internals>Services
diff --git a/services/content/OWNERS b/services/content/OWNERS index eb504e3..672cb65 100644 --- a/services/content/OWNERS +++ b/services/content/OWNERS
@@ -2,3 +2,4 @@ clamy@chromium.org jam@chromium.org rockot@google.com +# COMPONENT: Internals>Services>Content
diff --git a/services/media_session/audio_focus_manager.cc b/services/media_session/audio_focus_manager.cc index 294bcb6fc..ded65191 100644 --- a/services/media_session/audio_focus_manager.cc +++ b/services/media_session/audio_focus_manager.cc
@@ -179,19 +179,19 @@ } void AudioFocusManager::CreateActiveMediaController( - mojom::MediaControllerRequest request) { + mojo::PendingReceiver<mojom::MediaController> receiver) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - active_media_controller_.BindToInterface(std::move(request)); + active_media_controller_.BindToInterface(std::move(receiver)); } void AudioFocusManager::CreateMediaControllerForSession( - mojom::MediaControllerRequest request, - const base::UnguessableToken& request_id) { + mojo::PendingReceiver<mojom::MediaController> receiver, + const base::UnguessableToken& receiver_id) { for (auto& row : audio_focus_stack_) { - if (row->id() != request_id) + if (row->id() != receiver_id) continue; - row->BindToMediaController(std::move(request)); + row->BindToMediaController(std::move(receiver)); break; } }
diff --git a/services/media_session/audio_focus_manager.h b/services/media_session/audio_focus_manager.h index 9c4f7d70..c1968d2 100644 --- a/services/media_session/audio_focus_manager.h +++ b/services/media_session/audio_focus_manager.h
@@ -72,10 +72,10 @@ // mojom::MediaControllerManager. void CreateActiveMediaController( - mojom::MediaControllerRequest request) override; + mojo::PendingReceiver<mojom::MediaController> receiver) override; void CreateMediaControllerForSession( - mojom::MediaControllerRequest request, - const base::UnguessableToken& request_id) override; + mojo::PendingReceiver<mojom::MediaController> receiver, + const base::UnguessableToken& receiver_id) override; void SuspendAllSessions() override; // Bind to a mojom::AudioFocusManagerRequest.
diff --git a/services/media_session/audio_focus_request.cc b/services/media_session/audio_focus_request.cc index 455506d..eff35cd 100644 --- a/services/media_session/audio_focus_request.cc +++ b/services/media_session/audio_focus_request.cc
@@ -104,13 +104,13 @@ } void AudioFocusRequest::BindToMediaController( - mojom::MediaControllerRequest request) { + mojo::PendingReceiver<mojom::MediaController> receiver) { if (!controller_) { controller_ = std::make_unique<MediaController>(); controller_->SetMediaSession(this); } - controller_->BindToInterface(std::move(request)); + controller_->BindToInterface(std::move(receiver)); } void AudioFocusRequest::Suspend(const EnforcementState& state) {
diff --git a/services/media_session/audio_focus_request.h b/services/media_session/audio_focus_request.h index 1b7391d5..129b4e2 100644 --- a/services/media_session/audio_focus_request.h +++ b/services/media_session/audio_focus_request.h
@@ -51,7 +51,8 @@ mojom::AudioFocusRequestStatePtr ToAudioFocusRequestState() const; // Bind a mojo media controller to control the underlying media session. - void BindToMediaController(mojom::MediaControllerRequest request); + void BindToMediaController( + mojo::PendingReceiver<mojom::MediaController> receiver); // Suspends the underlying media session. void Suspend(const EnforcementState& state);
diff --git a/services/media_session/media_controller.cc b/services/media_session/media_controller.cc index 1087c000..c6f7efa 100644 --- a/services/media_session/media_controller.cc +++ b/services/media_session/media_controller.cc
@@ -303,13 +303,14 @@ holder->ClearImage(); } -void MediaController::BindToInterface(mojom::MediaControllerRequest request) { +void MediaController::BindToInterface( + mojo::PendingReceiver<mojom::MediaController> receiver) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - bindings_.AddBinding(this, std::move(request)); + receivers_.Add(this, std::move(receiver)); } void MediaController::FlushForTesting() { - bindings_.FlushForTesting(); + receivers_.FlushForTesting(); } void MediaController::CleanupImageObservers() {
diff --git a/services/media_session/media_controller.h b/services/media_session/media_controller.h index 7ca5c8e..7c615d9 100644 --- a/services/media_session/media_controller.h +++ b/services/media_session/media_controller.h
@@ -15,6 +15,7 @@ #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/binding_set.h" #include "mojo/public/cpp/bindings/interface_ptr_set.h" +#include "mojo/public/cpp/bindings/receiver_set.h" #include "services/media_session/public/cpp/media_metadata.h" #include "services/media_session/public/mojom/media_controller.mojom.h" #include "services/media_session/public/mojom/media_session.mojom.h" @@ -64,7 +65,7 @@ void SetMediaSession(AudioFocusRequest* session); void ClearMediaSession(); - void BindToInterface(mojom::MediaControllerRequest request); + void BindToInterface(mojo::PendingReceiver<mojom::MediaController> receiver); void FlushForTesting(); private: @@ -78,7 +79,7 @@ void Reset(); // Holds mojo bindings for mojom::MediaController. - mojo::BindingSet<mojom::MediaController> bindings_; + mojo::ReceiverSet<mojom::MediaController> receivers_; // The current info for the |session_|. mojom::MediaSessionInfoPtr session_info_;
diff --git a/services/media_session/public/mojom/media_controller.mojom b/services/media_session/public/mojom/media_controller.mojom index 081a475..ad75e863c 100644 --- a/services/media_session/public/mojom/media_controller.mojom +++ b/services/media_session/public/mojom/media_controller.mojom
@@ -12,13 +12,13 @@ // Creates a MediaController linked to a specific session with |request_id|. // This should match the |request_id| from the AudioFocusRequestState. CreateMediaControllerForSession( - MediaController& request, + pending_receiver<MediaController> receiver, mojo_base.mojom.UnguessableToken request_id); // Creates a MediaController linked to the active session. This will // automatically route commands to the correct session if the active session // changes. If there is no active session then commands will be no-ops. - CreateActiveMediaController(MediaController& request); + CreateActiveMediaController(pending_receiver<MediaController> receiver); // Suspends all media sessions. SuspendAllSessions();
diff --git a/services/network/BUILD.gn b/services/network/BUILD.gn index f231bfe..cea11774 100644 --- a/services/network/BUILD.gn +++ b/services/network/BUILD.gn
@@ -123,12 +123,12 @@ "proxy_service_mojo.h", "resolve_host_request.cc", "resolve_host_request.h", - "resource_scheduler.cc", - "resource_scheduler.h", - "resource_scheduler_client.cc", - "resource_scheduler_client.h", - "resource_scheduler_params_manager.cc", - "resource_scheduler_params_manager.h", + "resource_scheduler/resource_scheduler.cc", + "resource_scheduler/resource_scheduler.h", + "resource_scheduler/resource_scheduler_client.cc", + "resource_scheduler/resource_scheduler_client.h", + "resource_scheduler/resource_scheduler_params_manager.cc", + "resource_scheduler/resource_scheduler_params_manager.h", "restricted_cookie_manager.cc", "restricted_cookie_manager.h", "sec_header_helpers.cc", @@ -328,8 +328,8 @@ "proxy_config_service_mojo_unittest.cc", "proxy_resolving_client_socket_unittest.cc", "proxy_resolving_socket_mojo_unittest.cc", - "resource_scheduler_params_manager_unittest.cc", - "resource_scheduler_unittest.cc", + "resource_scheduler/resource_scheduler_params_manager_unittest.cc", + "resource_scheduler/resource_scheduler_unittest.cc", "restricted_cookie_manager_unittest.cc", "sec_header_helpers_unittest.cc", "session_cleanup_cookie_store_unittest.cc",
diff --git a/services/network/OWNERS b/services/network/OWNERS index a8476f61..4738d198 100644 --- a/services/network/OWNERS +++ b/services/network/OWNERS
@@ -32,6 +32,8 @@ per-file network_sandbox_win.*=file://sandbox/win/OWNERS per-file network_quality*=file://net/nqe/OWNERS -per-file resource_scheduler*=tbansal@chromium.org + +per-file BUILD.gn=file://net/nqe/OWNERS +per-file BUILD.gn=file://services/network/resource_scheduler/OWNERS # COMPONENT: Internals>Services>Network
diff --git a/services/network/cors/cors_url_loader_factory.cc b/services/network/cors/cors_url_loader_factory.cc index f2ecf44..6c94ffff 100644 --- a/services/network/cors/cors_url_loader_factory.cc +++ b/services/network/cors/cors_url_loader_factory.cc
@@ -21,7 +21,7 @@ #include "services/network/public/cpp/header_util.h" #include "services/network/public/cpp/resource_request.h" #include "services/network/public/mojom/fetch_api.mojom.h" -#include "services/network/resource_scheduler_client.h" +#include "services/network/resource_scheduler/resource_scheduler_client.h" #include "services/network/url_loader_factory.h" namespace network {
diff --git a/services/network/cors/cors_url_loader_factory_unittest.cc b/services/network/cors/cors_url_loader_factory_unittest.cc index 2e05a0f..6b0047b 100644 --- a/services/network/cors/cors_url_loader_factory_unittest.cc +++ b/services/network/cors/cors_url_loader_factory_unittest.cc
@@ -18,8 +18,8 @@ #include "services/network/public/cpp/resource_request.h" #include "services/network/public/mojom/url_loader.mojom.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" -#include "services/network/resource_scheduler.h" -#include "services/network/resource_scheduler_client.h" +#include "services/network/resource_scheduler/resource_scheduler.h" +#include "services/network/resource_scheduler/resource_scheduler_client.h" #include "services/network/test/test_url_loader_client.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h"
diff --git a/services/network/cors/cors_url_loader_unittest.cc b/services/network/cors/cors_url_loader_unittest.cc index 70712a1..4fe10fd 100644 --- a/services/network/cors/cors_url_loader_unittest.cc +++ b/services/network/cors/cors_url_loader_unittest.cc
@@ -37,8 +37,8 @@ #include "services/network/public/mojom/network_context.mojom.h" #include "services/network/public/mojom/url_loader.mojom.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" -#include "services/network/resource_scheduler.h" -#include "services/network/resource_scheduler_client.h" +#include "services/network/resource_scheduler/resource_scheduler.h" +#include "services/network/resource_scheduler/resource_scheduler_client.h" #include "services/network/test/test_url_loader_client.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/services/network/network_context.cc b/services/network/network_context.cc index d5b30a8..b3026a0 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc
@@ -81,7 +81,7 @@ #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/network_switches.h" #include "services/network/resolve_host_request.h" -#include "services/network/resource_scheduler_client.h" +#include "services/network/resource_scheduler/resource_scheduler_client.h" #include "services/network/restricted_cookie_manager.h" #include "services/network/session_cleanup_cookie_store.h" #include "services/network/ssl_config_service_mojo.h"
diff --git a/services/network/network_context_unittest.cc b/services/network/network_context_unittest.cc index aa46013..20a39e2 100644 --- a/services/network/network_context_unittest.cc +++ b/services/network/network_context_unittest.cc
@@ -594,7 +594,7 @@ ->http_transaction_factory() ->GetSession() ->params() - .quic_user_agent_id); + .quic_params.user_agent_id); } TEST_F(NetworkContextTest, DataUrlSupport) { @@ -714,8 +714,8 @@ EXPECT_TRUE(params.enable_http2); EXPECT_FALSE(params.enable_quic); - EXPECT_EQ(1350u, params.quic_max_packet_length); - EXPECT_TRUE(params.origins_to_force_quic_on.empty()); + EXPECT_EQ(1350u, params.quic_params.max_packet_length); + EXPECT_TRUE(params.quic_params.origins_to_force_quic_on.empty()); EXPECT_FALSE(params.enable_user_alternate_protocol_ports); EXPECT_FALSE(params.ignore_certificate_errors); EXPECT_EQ(0, params.testing_fixed_http_port);
diff --git a/services/network/network_service.cc b/services/network/network_service.cc index 09bec24..e5291c8b 100644 --- a/services/network/network_service.cc +++ b/services/network/network_service.cc
@@ -393,6 +393,16 @@ network_contexts_.erase(network_context); } +#if defined(OS_CHROMEOS) +void NetworkService::ReinitializeLogging(mojom::LoggingSettingsPtr settings) { + logging::LoggingSettings logging_settings; + logging_settings.logging_dest = settings->logging_dest; + logging_settings.log_file = settings->log_file.value().c_str(); + if (!logging::InitLogging(logging_settings)) + LOG(ERROR) << "Unable to reinitialize logging to " << settings->log_file; +} +#endif + void NetworkService::CreateNetLogEntriesForActiveObjects( net::NetLog::ThreadSafeObserver* observer) { std::set<net::URLRequestContext*> contexts;
diff --git a/services/network/network_service.h b/services/network/network_service.h index cb22420c..5ce34457 100644 --- a/services/network/network_service.h +++ b/services/network/network_service.h
@@ -132,6 +132,9 @@ // mojom::NetworkService implementation: void SetClient(mojom::NetworkServiceClientPtr client, mojom::NetworkServiceParamsPtr params) override; +#if defined(OS_CHROMEOS) + void ReinitializeLogging(mojom::LoggingSettingsPtr settings) override; +#endif void StartNetLog(base::File file, net::NetLogCaptureMode capture_mode, base::Value constants) override;
diff --git a/services/network/public/mojom/network_service.mojom b/services/network/public/mojom/network_service.mojom index 18fd4e6..85c34c1 100644 --- a/services/network/public/mojom/network_service.mojom +++ b/services/network/public/mojom/network_service.mojom
@@ -251,6 +251,14 @@ array<EnvironmentVariable> environment; }; +// Information about how logging should be configured. +// Corresponds to logging::LoggingSettings. +[EnableIf=is_chromeos] +struct LoggingSettings { + uint32 logging_dest; + mojo_base.mojom.FilePath log_file; +}; + // Browser interface to the network service. interface NetworkService { // Sets client used by all |NetworkContext|s creating by |NetworkService|. @@ -258,6 +266,12 @@ // complete. SetClient(NetworkServiceClient client, NetworkServiceParams params); + // Reinitializes the Network Service's logging with the given settings. This + // is needed on Chrome OS, which switches to a log file in the user's home + // directory once they log in. + [EnableIf=is_chromeos] + ReinitializeLogging(LoggingSettings settings); + // Starts observing the NetLog event stream and writing entries to |file|. // |constants| is a legend used for decoding constant values in the log; it // will be merged with the |GetNetConstants()| dictionary before being passed
diff --git a/services/network/resource_scheduler/OWNERS b/services/network/resource_scheduler/OWNERS new file mode 100644 index 0000000..6fa38ee --- /dev/null +++ b/services/network/resource_scheduler/OWNERS
@@ -0,0 +1,4 @@ +tbansal@chromium.org +dougarnett@chromium.org + +# COMPONENT: Internals>Network>NetworkQuality \ No newline at end of file
diff --git a/services/network/resource_scheduler/README.md b/services/network/resource_scheduler/README.md new file mode 100644 index 0000000..63c1796a --- /dev/null +++ b/services/network/resource_scheduler/README.md
@@ -0,0 +1,7 @@ +# Resource Scheduler + +Resource scheduler controls the loading of the webpages by scheduling the order in which the HTTP requests are dispatched on the network. It ensures that the loading of lower priority resources (e.g., XHRs, images) does not slow down the loading of the higher priority resources (e.g., HTML, CSS, render blocking JavaScript) while ensuring the maximum usage of the available network resources. + +## Design + +Resource scheduler creates one resource scheduler client is created per execution context (aka per-frame and service worker). This means that iframes get their own scheduler client. Each scheduler client controls the loading of the requests relevat in its context. At a high level, the scheduling logic does not dispatch low priority requests on the network if they are expected to contend for network resources with higher priority requests. This contention is estimated based on the count of higher priority requests in-flight and the estimated network capacity.
diff --git a/services/network/resource_scheduler.cc b/services/network/resource_scheduler/resource_scheduler.cc similarity index 99% rename from services/network/resource_scheduler.cc rename to services/network/resource_scheduler/resource_scheduler.cc index fe85411..306ae4b 100644 --- a/services/network/resource_scheduler.cc +++ b/services/network/resource_scheduler/resource_scheduler.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "services/network/resource_scheduler.h" +#include "services/network/resource_scheduler/resource_scheduler.h" #include <stdint.h>
diff --git a/services/network/resource_scheduler.h b/services/network/resource_scheduler/resource_scheduler.h similarity index 95% rename from services/network/resource_scheduler.h rename to services/network/resource_scheduler/resource_scheduler.h index 999aca1..10949c9 100644 --- a/services/network/resource_scheduler.h +++ b/services/network/resource_scheduler/resource_scheduler.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SERVICES_NETWORK_RESOURCE_SCHEDULER_H_ -#define SERVICES_NETWORK_RESOURCE_SCHEDULER_H_ +#ifndef SERVICES_NETWORK_RESOURCE_SCHEDULER_RESOURCE_SCHEDULER_H_ +#define SERVICES_NETWORK_RESOURCE_SCHEDULER_RESOURCE_SCHEDULER_H_ #include <stddef.h> #include <stdint.h> @@ -26,12 +26,12 @@ #include "net/base/priority_queue.h" #include "net/base/request_priority.h" #include "net/nqe/effective_connection_type.h" -#include "services/network/resource_scheduler_params_manager.h" +#include "services/network/resource_scheduler/resource_scheduler_params_manager.h" namespace base { class SequencedTaskRunner; class TickClock; -} +} // namespace base namespace net { class URLRequest; @@ -201,4 +201,4 @@ } // namespace network -#endif // SERVICES_NETWORK_RESOURCE_SCHEDULER_H_ +#endif // SERVICES_NETWORK_RESOURCE_SCHEDULER_RESOURCE_SCHEDULER_H_
diff --git a/services/network/resource_scheduler_client.cc b/services/network/resource_scheduler/resource_scheduler_client.cc similarity index 94% rename from services/network/resource_scheduler_client.cc rename to services/network/resource_scheduler/resource_scheduler_client.cc index 751e6824..759f2abd 100644 --- a/services/network/resource_scheduler_client.cc +++ b/services/network/resource_scheduler/resource_scheduler_client.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "services/network/resource_scheduler_client.h" +#include "services/network/resource_scheduler/resource_scheduler_client.h" #include "net/url_request/url_request_context.h" #include "services/network/network_context.h"
diff --git a/services/network/resource_scheduler_client.h b/services/network/resource_scheduler/resource_scheduler_client.h similarity index 86% rename from services/network/resource_scheduler_client.h rename to services/network/resource_scheduler/resource_scheduler_client.h index e88e393..e50e75d6 100644 --- a/services/network/resource_scheduler_client.h +++ b/services/network/resource_scheduler/resource_scheduler_client.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 SERVICES_NETWORK_RESOURCE_SCHEDULER_CLIENT_H_ -#define SERVICES_NETWORK_RESOURCE_SCHEDULER_CLIENT_H_ +#ifndef SERVICES_NETWORK_RESOURCE_SCHEDULER_RESOURCE_SCHEDULER_CLIENT_H_ +#define SERVICES_NETWORK_RESOURCE_SCHEDULER_RESOURCE_SCHEDULER_CLIENT_H_ #include "base/memory/ref_counted.h" #include "net/base/request_priority.h" -#include "services/network/resource_scheduler.h" +#include "services/network/resource_scheduler/resource_scheduler.h" namespace net { class URLRequest; @@ -51,4 +51,4 @@ }; } // namespace network -#endif // SERVICES_NETWORK_RESOURCE_SCHEDULER_CLIENT_H_ +#endif // SERVICES_NETWORK_RESOURCE_SCHEDULER_RESOURCE_SCHEDULER_CLIENT_H_
diff --git a/services/network/resource_scheduler_params_manager.cc b/services/network/resource_scheduler/resource_scheduler_params_manager.cc similarity index 99% rename from services/network/resource_scheduler_params_manager.cc rename to services/network/resource_scheduler/resource_scheduler_params_manager.cc index db16883e..f1a64570d 100644 --- a/services/network/resource_scheduler_params_manager.cc +++ b/services/network/resource_scheduler/resource_scheduler_params_manager.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "services/network/resource_scheduler_params_manager.h" +#include "services/network/resource_scheduler/resource_scheduler_params_manager.h" #include "base/feature_list.h" #include "base/metrics/field_trial.h"
diff --git a/services/network/resource_scheduler_params_manager.h b/services/network/resource_scheduler/resource_scheduler_params_manager.h similarity index 94% rename from services/network/resource_scheduler_params_manager.h rename to services/network/resource_scheduler/resource_scheduler_params_manager.h index 71f9de9..3bb4eb7 100644 --- a/services/network/resource_scheduler_params_manager.h +++ b/services/network/resource_scheduler/resource_scheduler_params_manager.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SERVICES_NETWORK_RESOURCE_SCHEDULER_PARAMS_MANAGER_H_ -#define SERVICES_NETWORK_RESOURCE_SCHEDULER_PARAMS_MANAGER_H_ +#ifndef SERVICES_NETWORK_RESOURCE_SCHEDULER_RESOURCE_SCHEDULER_PARAMS_MANAGER_H_ +#define SERVICES_NETWORK_RESOURCE_SCHEDULER_RESOURCE_SCHEDULER_PARAMS_MANAGER_H_ #include <stddef.h> #include <stdint.h> @@ -118,4 +118,4 @@ } // namespace network -#endif // SERVICES_NETWORK_RESOURCE_SCHEDULER_PARAMS_MANAGER_H_ +#endif // SERVICES_NETWORK_RESOURCE_SCHEDULER_RESOURCE_SCHEDULER_PARAMS_MANAGER_H_
diff --git a/services/network/resource_scheduler_params_manager_unittest.cc b/services/network/resource_scheduler/resource_scheduler_params_manager_unittest.cc similarity index 99% rename from services/network/resource_scheduler_params_manager_unittest.cc rename to services/network/resource_scheduler/resource_scheduler_params_manager_unittest.cc index d32151b4..6e5dd97 100644 --- a/services/network/resource_scheduler_params_manager_unittest.cc +++ b/services/network/resource_scheduler/resource_scheduler_params_manager_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "services/network/resource_scheduler_params_manager.h" +#include "services/network/resource_scheduler/resource_scheduler_params_manager.h" #include <map> #include <string>
diff --git a/services/network/resource_scheduler_unittest.cc b/services/network/resource_scheduler/resource_scheduler_unittest.cc similarity index 99% rename from services/network/resource_scheduler_unittest.cc rename to services/network/resource_scheduler/resource_scheduler_unittest.cc index 2705168d..c15a719 100644 --- a/services/network/resource_scheduler_unittest.cc +++ b/services/network/resource_scheduler/resource_scheduler_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "services/network/resource_scheduler.h" +#include "services/network/resource_scheduler/resource_scheduler.h" #include <map> #include <memory> @@ -34,7 +34,7 @@ #include "net/url_request/url_request_test_util.h" #include "services/network/public/cpp/features.h" #include "services/network/public/mojom/network_context.mojom.h" -#include "services/network/resource_scheduler_params_manager.h" +#include "services/network/resource_scheduler/resource_scheduler_params_manager.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/scheme_host_port.h" @@ -538,8 +538,6 @@ EXPECT_TRUE(request->started()); } - - TEST_F(ResourceSchedulerTest, BackgroundRequestStartsImmediately) { const int route_id = 0; // Indicates a background request. std::unique_ptr<TestRequest> request( @@ -1003,7 +1001,6 @@ EXPECT_FALSE(request->started()); } - TEST_F(ResourceSchedulerTest, NewSpdyHostInDelayableRequests) { base::test::ScopedFeatureList scoped_feature_list; InitializeScheduler();
diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc index 442789b8e..4e86726 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc
@@ -50,7 +50,7 @@ #include "services/network/public/cpp/resource_request.h" #include "services/network/public/cpp/resource_response.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" -#include "services/network/resource_scheduler_client.h" +#include "services/network/resource_scheduler/resource_scheduler_client.h" #include "services/network/sec_header_helpers.h" #include "services/network/throttling/scoped_throttling_token.h"
diff --git a/services/network/url_loader.h b/services/network/url_loader.h index 25965a7..9e54588 100644 --- a/services/network/url_loader.h +++ b/services/network/url_loader.h
@@ -30,8 +30,8 @@ #include "services/network/public/mojom/fetch_api.mojom.h" #include "services/network/public/mojom/network_service.mojom.h" #include "services/network/public/mojom/url_loader.mojom.h" -#include "services/network/resource_scheduler.h" -#include "services/network/resource_scheduler_client.h" +#include "services/network/resource_scheduler/resource_scheduler.h" +#include "services/network/resource_scheduler/resource_scheduler_client.h" #include "services/network/upload_progress_tracker.h" namespace net {
diff --git a/services/network/url_loader_factory.cc b/services/network/url_loader_factory.cc index ecf52de..d26585e 100644 --- a/services/network/url_loader_factory.cc +++ b/services/network/url_loader_factory.cc
@@ -17,7 +17,7 @@ #include "services/network/network_service.h" #include "services/network/network_usage_accumulator.h" #include "services/network/public/cpp/resource_request.h" -#include "services/network/resource_scheduler_client.h" +#include "services/network/resource_scheduler/resource_scheduler_client.h" #include "services/network/url_loader.h" #include "url/gurl.h" #include "url/origin.h"
diff --git a/services/network/url_loader_unittest.cc b/services/network/url_loader_unittest.cc index 870f9a3..c619635 100644 --- a/services/network/url_loader_unittest.cc +++ b/services/network/url_loader_unittest.cc
@@ -62,7 +62,7 @@ #include "net/url_request/url_request_test_util.h" #include "services/network/loader_util.h" #include "services/network/public/cpp/resource_request.h" -#include "services/network/resource_scheduler_client.h" +#include "services/network/resource_scheduler/resource_scheduler_client.h" #include "services/network/test/test_data_pipe_getter.h" #include "services/network/test/test_network_context_client.h" #include "services/network/test/test_network_service_client.h"
diff --git a/services/resource_coordinator/memory_instrumentation/OWNERS b/services/resource_coordinator/memory_instrumentation/OWNERS index ca595d79..62d73f2a 100644 --- a/services/resource_coordinator/memory_instrumentation/OWNERS +++ b/services/resource_coordinator/memory_instrumentation/OWNERS
@@ -1,2 +1,3 @@ hjd@chromium.org primiano@chromium.org +# COMPONENT: Internals>Instrumentation>Memory
diff --git a/services/test/OWNERS b/services/test/OWNERS new file mode 100644 index 0000000..eaf0589 --- /dev/null +++ b/services/test/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: Internals>Services
diff --git a/services/test/echo/OWNERS b/services/test/echo/OWNERS index e69de29..eaf0589 100644 --- a/services/test/echo/OWNERS +++ b/services/test/echo/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: Internals>Services
diff --git a/services/tracing/perfetto/track_event_json_exporter.cc b/services/tracing/perfetto/track_event_json_exporter.cc index efd348e1..a27f484e 100644 --- a/services/tracing/perfetto/track_event_json_exporter.cc +++ b/services/tracing/perfetto/track_event_json_exporter.cc
@@ -591,6 +591,10 @@ "StackCpuSampling", TRACE_DISABLED_BY_DEFAULT("cpu_profiler"), TRACE_EVENT_PHASE_INSTANT, current_state_->time_us, current_state_->pid, current_state_->tid); + // Add a dummy thread timestamp to this event to match the format of instant + // events. Useful in the UI to view args of a selected group of samples. + event_builder.AddThreadTimestamp(1); + event_builder.AddFlags(TRACE_EVENT_SCOPE_THREAD, base::nullopt, ""); auto args_builder = event_builder.BuildArgs(); auto* add_arg = args_builder->MaybeAddArg("frames"); if (add_arg) {
diff --git a/storage/browser/fileapi/dragged_file_util.cc b/storage/browser/fileapi/dragged_file_util.cc index 9f913f2..bcc98d3 100644 --- a/storage/browser/fileapi/dragged_file_util.cc +++ b/storage/browser/fileapi/dragged_file_util.cc
@@ -99,7 +99,7 @@ } base::File::Error error = NativeFileUtil::GetFileInfo(url.path(), file_info); - if (base::IsLink(url.path()) && !base::FilePath().IsParent(url.path())) { + if (IsHiddenItem(url.path()) && !base::FilePath().IsParent(url.path())) { // Don't follow symlinks unless it's the one that are selected by the user. return base::File::FILE_ERROR_NOT_FOUND; }
diff --git a/storage/browser/fileapi/local_file_util.cc b/storage/browser/fileapi/local_file_util.cc index 951bfac..a1cc69e5 100644 --- a/storage/browser/fileapi/local_file_util.cc +++ b/storage/browser/fileapi/local_file_util.cc
@@ -26,56 +26,52 @@ return new AsyncFileUtilAdapter(new LocalFileUtil()); } -class LocalFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { +class LocalFileUtil::LocalFileEnumerator + : public FileSystemFileUtil::AbstractFileEnumerator { public: - LocalFileEnumerator(const base::FilePath& platform_root_path, + LocalFileEnumerator(const LocalFileUtil* file_util, + const base::FilePath& platform_root_path, const base::FilePath& virtual_root_path, bool recursive, int file_type) - : file_enum_(platform_root_path, recursive, file_type), + : file_util_(file_util), + file_enum_(platform_root_path, recursive, file_type), platform_root_path_(platform_root_path), virtual_root_path_(virtual_root_path) {} ~LocalFileEnumerator() override = default; - base::FilePath Next() override; - int64_t Size() override; - base::Time LastModifiedTime() override; - bool IsDirectory() override; + base::FilePath Next() override { + base::FilePath next = file_enum_.Next(); + while (!next.empty() && file_util_->IsHiddenItem(next)) + next = file_enum_.Next(); + if (next.empty()) + return next; + file_util_info_ = file_enum_.GetInfo(); + + base::FilePath path; + platform_root_path_.AppendRelativePath(next, &path); + return virtual_root_path_.Append(path); + } + + int64_t Size() override { return file_util_info_.GetSize(); } + + base::Time LastModifiedTime() override { + return file_util_info_.GetLastModifiedTime(); + } + + bool IsDirectory() override { return file_util_info_.IsDirectory(); } private: + // The |LocalFileUtil| producing |this| is expected to remain valid + // through the whole lifetime of the enumerator. + const LocalFileUtil* const file_util_; base::FileEnumerator file_enum_; base::FileEnumerator::FileInfo file_util_info_; base::FilePath platform_root_path_; base::FilePath virtual_root_path_; }; -base::FilePath LocalFileEnumerator::Next() { - base::FilePath next = file_enum_.Next(); - // Don't return symlinks. - while (!next.empty() && base::IsLink(next)) - next = file_enum_.Next(); - if (next.empty()) - return next; - file_util_info_ = file_enum_.GetInfo(); - - base::FilePath path; - platform_root_path_.AppendRelativePath(next, &path); - return virtual_root_path_.Append(path); -} - -int64_t LocalFileEnumerator::Size() { - return file_util_info_.GetSize(); -} - -base::Time LocalFileEnumerator::LastModifiedTime() { - return file_util_info_.GetLastModifiedTime(); -} - -bool LocalFileEnumerator::IsDirectory() { - return file_util_info_.IsDirectory(); -} - LocalFileUtil::LocalFileUtil() = default; LocalFileUtil::~LocalFileUtil() = default; @@ -87,8 +83,7 @@ base::File::Error error = GetLocalFilePath(context, url, &file_path); if (error != base::File::FILE_OK) return base::File(error); - // Disallow opening files in symlinked paths. - if (base::IsLink(file_path)) + if (IsHiddenItem(file_path)) return base::File(base::File::FILE_ERROR_NOT_FOUND); return NativeFileUtil::CreateOrOpen(file_path, file_flags); @@ -126,8 +121,7 @@ base::File::Error error = GetLocalFilePath(context, url, &file_path); if (error != base::File::FILE_OK) return error; - // We should not follow symbolic links in sandboxed file system. - if (base::IsLink(file_path)) + if (IsHiddenItem(file_path)) return base::File::FILE_ERROR_NOT_FOUND; error = NativeFileUtil::GetFileInfo(file_path, file_info); @@ -146,7 +140,7 @@ return base::WrapUnique(new EmptyFileEnumerator); } return std::make_unique<LocalFileEnumerator>( - file_path, root_url.path(), recursive, + this, file_path, root_url.path(), recursive, base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES); } @@ -263,4 +257,9 @@ return storage::ScopedFile(); } +bool LocalFileUtil::IsHiddenItem(const base::FilePath& local_file_path) const { + // We should not follow symbolic links in sandboxed file system. + return base::IsLink(local_file_path); +} + } // namespace storage
diff --git a/storage/browser/fileapi/local_file_util.h b/storage/browser/fileapi/local_file_util.h index 47c98367..96b1b9a2 100644 --- a/storage/browser/fileapi/local_file_util.h +++ b/storage/browser/fileapi/local_file_util.h
@@ -45,10 +45,13 @@ const FileSystemURL& url, base::File::Info* file_info, base::FilePath* platform_file) override; + + // |this| must remain valid through the lifetime of the created enumerator. std::unique_ptr<AbstractFileEnumerator> CreateFileEnumerator( FileSystemOperationContext* context, const FileSystemURL& root_url, bool recursive) override; + base::File::Error GetLocalFilePath(FileSystemOperationContext* context, const FileSystemURL& file_system_url, base::FilePath* local_file_path) override; @@ -78,7 +81,16 @@ base::File::Info* file_info, base::FilePath* platform_path) override; + protected: + // Whether this item should not be accessed. For security reasons by default + // symlinks are not exposed through |this|. If the derived implementation + // can ensure safety of symlinks in some other way, it can lift this + // restriction by overriding this method. + virtual bool IsHiddenItem(const base::FilePath& local_file_path) const; + private: + class LocalFileEnumerator; + DISALLOW_COPY_AND_ASSIGN(LocalFileUtil); };
diff --git a/styleguide/OWNERS b/styleguide/OWNERS new file mode 100644 index 0000000..f136fc1 --- /dev/null +++ b/styleguide/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: Internals
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 4cab272..6b05edd5 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -1148,6 +1148,33 @@ }, "test": "extensions_browsertests" } + ], + "isolated_scripts": [ + { + "args": [ + "--additional-driver-flag=--enable-features=NavigationLoaderOnUI", + "--additional-expectations=../../third_party/blink/web_tests/FlagExpectations/enable-features=NavigationLoaderOnUI", + "--num-retries=3" + ], + "isolate_name": "blink_web_tests_exparchive", + "merge": { + "args": [ + "--verbose" + ], + "script": "//third_party/blink/tools/merge_web_test_results.py" + }, + "name": "webkit_layout_tests", + "results_handler": "layout tests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-14.04" + } + ], + "shards": 12 + } + } ] }, "Mojo Windows": {
diff --git a/testing/buildbot/chromium.gpu.fyi.json b/testing/buildbot/chromium.gpu.fyi.json index 33c54e4e..8071c03 100644 --- a/testing/buildbot/chromium.gpu.fyi.json +++ b/testing/buildbot/chromium.gpu.fyi.json
@@ -11611,6 +11611,188 @@ "isolated_scripts": [ { "args": [ + "context_lost", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --enable-features=VizDisplayCompositor,UseSkiaRenderer" + ], + "isolate_name": "telemetry_gpu_integration_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "context_lost_tests", + "should_retry_with_patch": false, + "swarming": { + "can_use_on_swarming_builders": true, + "containment_type": "AUTO", + "dimension_sets": [ + { + "gpu": "nvidia-quadro-p400-ubuntu-stable", + "os": "linux-nvidia-stable", + "pool": "Chrome-GPU" + } + ], + "idempotent": false + } + }, + { + "args": [ + "depth_capture", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --enable-features=VizDisplayCompositor,UseSkiaRenderer" + ], + "isolate_name": "telemetry_gpu_integration_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "depth_capture_tests", + "should_retry_with_patch": false, + "swarming": { + "can_use_on_swarming_builders": true, + "containment_type": "AUTO", + "dimension_sets": [ + { + "gpu": "nvidia-quadro-p400-ubuntu-stable", + "os": "linux-nvidia-stable", + "pool": "Chrome-GPU" + } + ], + "idempotent": false + } + }, + { + "args": [ + "gpu_process", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --enable-features=VizDisplayCompositor,UseSkiaRenderer" + ], + "isolate_name": "telemetry_gpu_integration_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "gpu_process_launch_tests", + "should_retry_with_patch": false, + "swarming": { + "can_use_on_swarming_builders": true, + "containment_type": "AUTO", + "dimension_sets": [ + { + "gpu": "nvidia-quadro-p400-ubuntu-stable", + "os": "linux-nvidia-stable", + "pool": "Chrome-GPU" + } + ], + "idempotent": false + } + }, + { + "args": [ + "hardware_accelerated_feature", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --enable-features=VizDisplayCompositor,UseSkiaRenderer" + ], + "isolate_name": "telemetry_gpu_integration_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "hardware_accelerated_feature_tests", + "should_retry_with_patch": false, + "swarming": { + "can_use_on_swarming_builders": true, + "containment_type": "AUTO", + "dimension_sets": [ + { + "gpu": "nvidia-quadro-p400-ubuntu-stable", + "os": "linux-nvidia-stable", + "pool": "Chrome-GPU" + } + ], + "idempotent": false + } + }, + { + "args": [ + "maps", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --enable-features=VizDisplayCompositor,UseSkiaRenderer", + "--dont-restore-color-profile-after-test", + "--os-type", + "linux", + "--build-revision", + "${got_revision}", + "--test-machine-name", + "${buildername}" + ], + "isolate_name": "telemetry_gpu_integration_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "maps_pixel_test", + "should_retry_with_patch": false, + "swarming": { + "can_use_on_swarming_builders": true, + "containment_type": "AUTO", + "dimension_sets": [ + { + "gpu": "nvidia-quadro-p400-ubuntu-stable", + "os": "linux-nvidia-stable", + "pool": "Chrome-GPU" + } + ], + "idempotent": false + } + }, + { + "args": [ + "screenshot_sync", + "--show-stdout", + "--browser=release", + "--passthrough", + "-v", + "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --enable-features=VizDisplayCompositor,UseSkiaRenderer", + "--dont-restore-color-profile-after-test" + ], + "isolate_name": "telemetry_gpu_integration_test", + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_isolated_script_merge.py" + }, + "name": "screenshot_sync_tests", + "should_retry_with_patch": false, + "swarming": { + "can_use_on_swarming_builders": true, + "containment_type": "AUTO", + "dimension_sets": [ + { + "gpu": "nvidia-quadro-p400-ubuntu-stable", + "os": "linux-nvidia-stable", + "pool": "Chrome-GPU" + } + ], + "idempotent": false + } + }, + { + "args": [ "--num-retries=3", "--additional-driver-flag=--enable-features=VizDisplayCompositor,UseSkiaRenderer", "--additional-driver-flag=--use-gl=any",
diff --git a/testing/buildbot/filters/navigation_loader_on_ui_browser_tests.filter b/testing/buildbot/filters/navigation_loader_on_ui_browser_tests.filter index 30cc29219..aff1fc06 100644 --- a/testing/buildbot/filters/navigation_loader_on_ui_browser_tests.filter +++ b/testing/buildbot/filters/navigation_loader_on_ui_browser_tests.filter
@@ -16,6 +16,10 @@ -InspectUITest.SharedWorker -ServiceWorkerTest.MimeHandlerView -SitePerProcessDebuggerExtensionApiTest.Debugger +-V4SafeBrowsingServiceJsRequestNoInterstitialTest.MalwareBlocked/0 +-V4SafeBrowsingServiceJsRequestNoInterstitialTest.MalwareBlocked/2 +-V4SafeBrowsingServiceJsRequestSafeTest.RequestNotBlocked/2 +-V4SafeBrowsingServiceJsRequestSafeTest.RequestNotBlocked/6 -VariationsHttpHeadersBrowserTest.SharedWorkerScript -WebViewTest.FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuestsAllow -WebViewTest.FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuestsDefaultAllow @@ -37,211 +41,6 @@ -DiceBrowserTest.SignoutMainAccount -DiceBrowserTest.SignoutSecondaryAccount -# http://crbug.com/824843 --MaybeSetMetadata/V4SafeBrowsingServiceMetadataTest.MalwareIFrame/0 --MaybeSetMetadata/V4SafeBrowsingServiceMetadataTest.MalwareIFrame/1 --MaybeSetMetadata/V4SafeBrowsingServiceMetadataTest.MalwareIFrame/2 --MaybeSetMetadata/V4SafeBrowsingServiceMetadataTest.MalwareMainFrame/0 --MaybeSetMetadata/V4SafeBrowsingServiceMetadataTest.MalwareMainFrame/1 --MaybeSetMetadata/V4SafeBrowsingServiceMetadataTest.MalwareMainFrame/2 --NoStatePrefetchBrowserTest.PrerenderSafeBrowsingTopLevel --PrerenderBrowserTest.PrerenderSafeBrowsingClientRedirect --PrerenderBrowserTest.PrerenderSafeBrowsingIframe --PrerenderBrowserTest.PrerenderSafeBrowsingServerRedirect --PrerenderBrowserTest.PrerenderSafeBrowsingTopLevel --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.CommittedInterstitialShows/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.CommittedInterstitialShows/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.CommittedInterstitialShows/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.CommittedInterstitialShows/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.CommittedInterstitialShows/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.CommittedInterstitialShows/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.DontProceed/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.DontProceed/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.DontProceed/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.DontProceed/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.DontProceed/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.DontProceed/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.HardcodedUrls/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.HardcodedUrls/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.HardcodedUrls/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.HardcodedUrls/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.HardcodedUrls/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.HardcodedUrls/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Histograms_DontProceed/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Histograms_DontProceed/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Histograms_DontProceed/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Histograms_DontProceed/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Histograms_DontProceed/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Histograms_DontProceed/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Histograms_Proceed/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Histograms_Proceed/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Histograms_Proceed/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Histograms_Proceed/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Histograms_Proceed/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Histograms_Proceed/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeDontProceed/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeDontProceed/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeDontProceed/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeDontProceed/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeDontProceed/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeDontProceed/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeOptInAndReportThreatDetails/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeOptInAndReportThreatDetails/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeOptInAndReportThreatDetails/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeOptInAndReportThreatDetails/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeOptInAndReportThreatDetails/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeOptInAndReportThreatDetails/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeProceed/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeProceed/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeProceed/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeProceed/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeProceed/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.IframeProceed/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.LearnMore/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.LearnMore/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.LearnMore/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.LearnMore/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.LearnMore/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.LearnMore/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.MainFrameBlockedShouldHaveNoDOMDetailsWhenDontProceed/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.MainFrameBlockedShouldHaveNoDOMDetailsWhenDontProceed/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.MainFrameBlockedShouldHaveNoDOMDetailsWhenDontProceed/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.MainFrameBlockedShouldHaveNoDOMDetailsWhenDontProceed/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.MainFrameBlockedShouldHaveNoDOMDetailsWhenDontProceed/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.MainFrameBlockedShouldHaveNoDOMDetailsWhenDontProceed/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.MainFrameBlockedShouldHaveNoDOMDetailsWhenProceeding/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.MainFrameBlockedShouldHaveNoDOMDetailsWhenProceeding/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.MainFrameBlockedShouldHaveNoDOMDetailsWhenProceeding/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.MainFrameBlockedShouldHaveNoDOMDetailsWhenProceeding/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.MainFrameBlockedShouldHaveNoDOMDetailsWhenProceeding/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.MainFrameBlockedShouldHaveNoDOMDetailsWhenProceeding/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.NoBackToSafety/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.NoBackToSafety/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.NoBackToSafety/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.NoBackToSafety/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.NoBackToSafety/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.NoBackToSafety/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Proceed/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Proceed/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Proceed/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Proceed/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Proceed/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.Proceed/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ProceedDisabled/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ProceedDisabled/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ProceedDisabled/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ProceedDisabled/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ProceedDisabled/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ProceedDisabled/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.RedirectCanceled/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.RedirectCanceled/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.RedirectCanceled/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.RedirectCanceled/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.RedirectCanceled/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.RedirectCanceled/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ReloadWhileInterstitialShowing/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ReloadWhileInterstitialShowing/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ReloadWhileInterstitialShowing/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ReloadWhileInterstitialShowing/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ReloadWhileInterstitialShowing/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ReloadWhileInterstitialShowing/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ReportingDisabledByPolicy/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ReportingDisabledByPolicy/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ReportingDisabledByPolicy/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ReportingDisabledByPolicy/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ReportingDisabledByPolicy/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.ReportingDisabledByPolicy/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateDowngradedForSubresourceInterstitial/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateDowngradedForSubresourceInterstitial/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateDowngradedForSubresourceInterstitial/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateDowngradedForSubresourceInterstitial/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateDowngradedForSubresourceInterstitial/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateDowngradedForSubresourceInterstitial/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateGoBack/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateGoBack/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateGoBack/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateGoBack/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateGoBack/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateGoBack/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateGoBackOnSubresourceInterstitial/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateGoBackOnSubresourceInterstitial/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateGoBackOnSubresourceInterstitial/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateGoBackOnSubresourceInterstitial/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateGoBackOnSubresourceInterstitial/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityStateGoBackOnSubresourceInterstitial/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_HTTP/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_HTTP/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_HTTP/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_HTTP/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_HTTP/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_HTTP/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_InvalidHTTPS/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_InvalidHTTPS/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_InvalidHTTPS/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_InvalidHTTPS/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_InvalidHTTPS/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_InvalidHTTPS/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_ValidHTTPS/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_ValidHTTPS/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_ValidHTTPS/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_ValidHTTPS/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_ValidHTTPS/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.SecurityState_ValidHTTPS/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportNotSentOnIncognito/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportNotSentOnIncognito/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportNotSentOnIncognito/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportNotSentOnIncognito/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportNotSentOnIncognito/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportNotSentOnIncognito/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportNotSentWithoutSBER/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportNotSentWithoutSBER/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportNotSentWithoutSBER/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportNotSentWithoutSBER/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportNotSentWithoutSBER/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportNotSentWithoutSBER/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportSentOnSBERAndNotIncognito/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportSentOnSBERAndNotIncognito/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportSentOnSBERAndNotIncognito/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportSentOnSBERAndNotIncognito/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportSentOnSBERAndNotIncognito/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VerifyHitReportSentOnSBERAndNotIncognito/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VisitWhitePaper/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VisitWhitePaper/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VisitWhitePaper/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VisitWhitePaper/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VisitWhitePaper/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.VisitWhitePaper/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistIframeRevisit/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistIframeRevisit/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistIframeRevisit/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistIframeRevisit/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistIframeRevisit/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistIframeRevisit/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistRevisit/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistRevisit/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistRevisit/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistRevisit/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistRevisit/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistRevisit/5 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistUnsaved/0 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistUnsaved/1 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistUnsaved/2 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistUnsaved/3 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistUnsaved/4 --SafeBrowsingBlockingPageBrowserTestWithThreatTypeAndIsolationSetting/SafeBrowsingBlockingPageBrowserTest.WhitelistUnsaved/5 --V4EmbeddedTestServerBrowserTest.SimpleTest --V4SafeBrowsingServiceJsRequestNoInterstitialTest.MalwareBlocked/0 --V4SafeBrowsingServiceJsRequestNoInterstitialTest.MalwareBlocked/1 --V4SafeBrowsingServiceJsRequestNoInterstitialTest.MalwareBlocked/2 --V4SafeBrowsingServiceJsRequestNoInterstitialTest.MalwareBlocked/3 --V4SafeBrowsingServiceJsRequestSafeTest.RequestNotBlocked/2 --V4SafeBrowsingServiceJsRequestSafeTest.RequestNotBlocked/3 --V4SafeBrowsingServiceJsRequestSafeTest.RequestNotBlocked/6 --V4SafeBrowsingServiceJsRequestSafeTest.RequestNotBlocked/7 --V4SafeBrowsingServiceTest.MainFrameHitWithReferrer --V4SafeBrowsingServiceTest.MalwareWithWhitelist --V4SafeBrowsingServiceTest.Prefetch - # http://crbug.com/824856 -NoStatePrefetchBrowserTest.AppCacheHtmlInitialized -NoStatePrefetchBrowserTest.AppCacheRegistered
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 45b80257..c3883de 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -3624,6 +3624,46 @@ }, 'telemetry_test_name': 'pixel', }, + 'context_lost': { + 'args': [ + '--extra-browser-args=--enable-features=VizDisplayCompositor,UseSkiaRenderer', + ], + }, + 'depth_capture': { + 'args': [ + '--extra-browser-args=--enable-features=VizDisplayCompositor,UseSkiaRenderer', + ], + }, + 'gpu_process': { + 'name': 'gpu_process_launch_tests', + 'args': [ + '--extra-browser-args=--enable-features=VizDisplayCompositor,UseSkiaRenderer', + ], + }, + 'hardware_accelerated_feature': { + 'args': [ + '--extra-browser-args=--enable-features=VizDisplayCompositor,UseSkiaRenderer', + ], + }, + 'maps': { + 'name': 'maps_pixel_test', + 'args': [ + '--dont-restore-color-profile-after-test', + '--os-type', + '${os_type}', + '--build-revision', + '${got_revision}', + '--test-machine-name', + '${buildername}', + '--extra-browser-args=--enable-features=VizDisplayCompositor,UseSkiaRenderer', + ], + }, + 'screenshot_sync': { + 'args': [ + '--dont-restore-color-profile-after-test', + '--extra-browser-args=--enable-features=VizDisplayCompositor,UseSkiaRenderer', + ], + }, }, 'gpu_skia_renderer_vulkan_gtests': { @@ -4206,6 +4246,30 @@ 'test': 'extensions_browsertests', }, }, + 'navigation_loader_on_ui_isolated_scripts': { + 'webkit_layout_tests': { + 'args': [ + '--additional-driver-flag=--enable-features=NavigationLoaderOnUI', + '--additional-expectations=../../third_party/blink/web_tests/FlagExpectations/enable-features=NavigationLoaderOnUI', + + # layout test failures are retried 3 times when '--test-list' is not + # passed, but 0 times when '--test-list' is passed. We want to always + # retry 3 times, so we explicitly specify it. + '--num-retries=3', + ], + 'isolate_name': 'blink_web_tests_exparchive', + 'merge': { + 'args': [ + '--verbose', + ], + 'script': '//third_party/blink/tools/merge_web_test_results.py', + }, + 'results_handler': 'layout tests', + 'swarming': { + 'shards': 12, + }, + }, + }, # These tests will be run on the main waterfall. 'network_service_android_gtests': {
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index d70c8b3..6c6b1f4f 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -1412,6 +1412,7 @@ ], 'test_suites': { 'gtest_tests': 'mojo_linux_gtests', + 'isolated_scripts': 'navigation_loader_on_ui_isolated_scripts', }, }, 'Mojo Windows': {
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 0df50616..fe09b748 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -5220,6 +5220,21 @@ ] } ], + "TabPersistentStoreTaskRunner": [ + { + "platforms": [ + "android" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "TabPersistentStoreTaskRunner" + ] + } + ] + } + ], "TabRanker": [ { "platforms": [
diff --git a/third_party/android_data_chart/OWNERS b/third_party/android_data_chart/OWNERS index 59295d78e..97bf407a 100644 --- a/third_party/android_data_chart/OWNERS +++ b/third_party/android_data_chart/OWNERS
@@ -1,2 +1,4 @@ tedchoc@chromium.org bengr@chromium.org +# COMPONENT: Internals>Network>DataProxy +# OS: Android
diff --git a/third_party/android_swipe_refresh/java/OWNERS b/third_party/android_swipe_refresh/java/OWNERS new file mode 100644 index 0000000..db445d4c --- /dev/null +++ b/third_party/android_swipe_refresh/java/OWNERS
@@ -0,0 +1,2 @@ +# COMPONENT: UI>Browser>Mobile +# OS: Android
diff --git a/third_party/auto/OWNERS b/third_party/auto/OWNERS index 80e6172..07f1a23 100644 --- a/third_party/auto/OWNERS +++ b/third_party/auto/OWNERS
@@ -1,3 +1,5 @@ agrieve@chromium.org nyquist@chromium.org wnwen@chromium.org +# COMPONENT: Test>Android +# TEAM: chromium-reviews@chromium.org
diff --git a/third_party/blink/renderer/core/dom/document_test.cc b/third_party/blink/renderer/core/dom/document_test.cc index 9b79e5c..d5e27c8 100644 --- a/third_party/blink/renderer/core/dom/document_test.cc +++ b/third_party/blink/renderer/core/dom/document_test.cc
@@ -54,7 +54,7 @@ #include "third_party/blink/renderer/core/html/forms/html_input_element.h" #include "third_party/blink/renderer/core/html/html_head_element.h" #include "third_party/blink/renderer/core/html/html_link_element.h" -#include "third_party/blink/renderer/core/loader/appcache/application_cache_host.h" +#include "third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.h" #include "third_party/blink/renderer/core/loader/document_loader.h" #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/page/validation_message_client.h" @@ -329,10 +329,12 @@ // ValidationMessageClient::trace(visitor); } }; -class MockApplicationCacheHost : public blink::ApplicationCacheHost { +class MockApplicationCacheHost final : public ApplicationCacheHostForFrame { public: MockApplicationCacheHost(DocumentLoader* loader) - : blink::ApplicationCacheHost(loader, nullptr, nullptr) {} + : ApplicationCacheHostForFrame(loader, + /*interface_broker=*/nullptr, + /*task_runner=*/nullptr) {} ~MockApplicationCacheHost() override = default; void SelectCacheWithoutManifest() override {
diff --git a/third_party/blink/renderer/core/exported/web_layer_test.cc b/third_party/blink/renderer/core/exported/web_layer_test.cc index 1bb3a3a..a165021a 100644 --- a/third_party/blink/renderer/core/exported/web_layer_test.cc +++ b/third_party/blink/renderer/core/exported/web_layer_test.cc
@@ -880,6 +880,52 @@ EXPECT_FALSE(inner_element_layer->subtree_property_changed()); } +// This test is similar to |LayerSubtreeClipPropertyChanged| but for cases when +// the clip node itself does not change but the clip node associated with a +// layer changes. +TEST_P(WebLayerListSimTest, LayerClipPropertyChanged) { + InitializeWithHTML(R"HTML( + <!DOCTYPE html> + <style> + #outer { + width: 100px; + height: 100px; + } + #inner { + width: 50px; + height: 200px; + backface-visibility: hidden; + background: lightblue; + } + </style> + <div id='outer' style='overflow: hidden;'> + <div id='inner'></div> + </div> + )HTML"); + + Compositor().BeginFrame(); + + auto* inner_element_layer = ContentLayerAt(ContentLayerCount() - 1); + EXPECT_FALSE(inner_element_layer->double_sided()); + + // Initially, no layer should have |subtree_property_changed| set. + EXPECT_FALSE(inner_element_layer->subtree_property_changed()); + + // Removing overflow: hidden on the outer div should set + // |subtree_property_changed| on the inner div's cc::Layer. + auto* outer_element = GetElementById("outer"); + outer_element->setAttribute(html_names::kStyleAttr, ""); + UpdateAllLifecyclePhases(); + + inner_element_layer = ContentLayerAt(ContentLayerCount() - 1); + EXPECT_FALSE(inner_element_layer->double_sided()); + EXPECT_TRUE(inner_element_layer->subtree_property_changed()); + + // After a frame the |subtree_property_changed| value should be reset. + Compositor().BeginFrame(); + EXPECT_FALSE(inner_element_layer->subtree_property_changed()); +} + TEST_P(WebLayerListSimTest, SafeOpaqueBackgroundColorGetsSet) { // TODO(crbug.com/765003): CAP may make different layerization decisions and // we cannot guarantee that both divs will be composited in this test. When
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc b/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc index 47778033..b88de758 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc +++ b/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc
@@ -82,11 +82,12 @@ void RecordInitiateEncodingTimeHistogram(ImageEncodingMimeType mime_type, base::TimeDelta elapsed_time) { + // TODO(crbug.com/983261) Change this to use UmaHistogramMicrosecondsTimes. if (mime_type == kMimeTypePng) { - UmaHistogramMicrosecondsTimes( + UmaHistogramMicrosecondsTimesUnderTenMilliseconds( "Blink.Canvas.ToBlob.InitiateEncodingDelay.PNG", elapsed_time); } else if (mime_type == kMimeTypeJpeg) { - UmaHistogramMicrosecondsTimes( + UmaHistogramMicrosecondsTimesUnderTenMilliseconds( "Blink.Canvas.ToBlob.InitiateEncodingDelay.JPEG", elapsed_time); } } @@ -94,10 +95,10 @@ void RecordCompleteEncodingTimeHistogram(ImageEncodingMimeType mime_type, base::TimeDelta elapsed_time) { if (mime_type == kMimeTypePng) { - UmaHistogramMicrosecondsTimes( + UmaHistogramMicrosecondsTimesUnderTenMilliseconds( "Blink.Canvas.ToBlob.CompleteEncodingDelay.PNG", elapsed_time); } else if (mime_type == kMimeTypeJpeg) { - UmaHistogramMicrosecondsTimes( + UmaHistogramMicrosecondsTimesUnderTenMilliseconds( "Blink.Canvas.ToBlob.CompleteEncodingDelay.JPEG", elapsed_time); } }
diff --git a/third_party/blink/renderer/core/inspector/browser_protocol.pdl b/third_party/blink/renderer/core/inspector/browser_protocol.pdl index d174271a..265590d 100644 --- a/third_party/blink/renderer/core/inspector/browser_protocol.pdl +++ b/third_party/blink/renderer/core/inspector/browser_protocol.pdl
@@ -4064,6 +4064,94 @@ # Cookie SameSite type. optional CookieSameSite sameSite + # Types of reasons why a cookie may not be stored from a response. + experimental type SetCookieBlockedReason extends string + enum + # The cookie had the "Secure" attribute but was not received over a secure connection. + SecureOnly + # The cookie had the "SameSite=Strict" attribute but came from a cross-origin response. + # This includes navigation requests intitiated by other origins. + SameSiteStrict + # The cookie had the "SameSite=Lax" attribute but came from a cross-origin response. + SameSiteLax + # The cookie had the "SameSite=Extended" attribute but came from a cross-origin response. + SameSiteExtended + # The cookie didn't specify a "SameSite" attribute and was defaulted to "SameSite=Lax" and + # broke the same rules specified in the SameSiteLax value. + SameSiteUnspecifiedTreatedAsLax + # The cookie had the "SameSite=None" attribute but did not specify the "Secure" attribute, + # which is required in order to use "SameSite=None". + SameSiteNoneInsecure + # The cookie was not stored due to user preferences. + UserPreferences + # The syntax of the Set-Cookie header of the response was invalid. + SyntaxError + # The scheme of the connection is not allowed to store cookies. + SchemeNotSupported + # The cookie was not sent over a secure connection and would have overwritten a cookie with + # the Secure attribute. + OverwriteSecure + # The cookie's domain attribute was invalid with regards to the current host url. + InvalidDomain + # The cookie used the "__Secure-" or "__Host-" prefix in its name and broke the additional + # rules applied to cookies with these prefixes as defined in + # https://tools.ietf.org/html/draft-west-cookie-prefixes-05 + InvalidPrefix + # An unknown error was encountered when trying to store this cookie. + UnknownError + + # Types of reasons why a cookie may not be sent with a request. + experimental type CookieBlockedReason extends string + enum + # The cookie had the "Secure" attribute and the connection was not secure. + SecureOnly + # The cookie's path was not within the request url's path. + NotOnPath + # The cookie's domain is not configured to match the request url's domain, even though they + # share a common TLD+1 (TLD+1 of foo.bar.example.com is example.com). + DomainMismatch + # The cookie had the "SameSite=Strict" attribute and the request was made on on a different + # site. This includes navigation requests initiated by other sites. + SameSiteStrict + # The cookie had the "SameSite=Lax" attribute and the request was made on a different site. + # This does not include navigation requests initiated by other sites. + SameSiteLax + # The cookie had the "SameSite=Extended" attribute and the request was made on a different + # site. The different site is outside of the cookie's trusted first-party set. + SameSiteExtended + # The cookie didn't specify a SameSite attribute when it was stored and was defaulted to + # "SameSite=Lax" and broke the same rules specified in the SameSiteLax value. The cookie had + # to have been set with "SameSite=None" to enable third-party usage. + SameSiteUnspecifiedTreatedAsLax + # The cookie had the "SameSite=None" attribute and the connection was not secure. Cookies + # without SameSite restrictions must be sent over a secure connection. + SameSiteNoneInsecure + # The cookie was not sent due to user preferences. + UserPreferences + # An unknown error was encountered when trying to send this cookie. + UnknownError + + # A cookie which was not stored from a response with the corresponding reason. + experimental type BlockedSetCookieWithReason extends object + properties + # The reason this cookie was blocked. + SetCookieBlockedReason blockedReason + # The string representing this individual cookie as it would appear in the header. + # This is not the entire "cookie" or "set-cookie" header which could have multiple cookies. + string cookieLine + # The cookie object which represents the cookie which was not stored. It is optional because + # sometimes complete cookie information is not available, such as in the case of parsing + # errors. + optional Cookie cookie + + # A cookie with was not sent with a request with the corresponding reason. + experimental type BlockedCookieWithReason extends object + properties + # The reason the cookie was blocked. + CookieBlockedReason blockedReason + # The cookie object representing the cookie which was not sent. + Cookie cookie + # Cookie parameter object type CookieParam extends object properties @@ -4699,6 +4787,37 @@ # WebSocket request data. WebSocketRequest request + # Fired when additional information about a requestWillBeSent event is available from the + # network stack. Not every requestWillBeSent event will have an additional + # requestWillBeSentExtraInfo fired for it, and there is no guarantee whether requestWillBeSent + # or requestWillBeSentExtraInfo will be fired first for the same request. + experimental event requestWillBeSentExtraInfo + parameters + # Request identifier. Used to match this information to an existing requestWillBeSent event. + RequestId requestId + # A list of cookies which will not be sent with this request along with corresponding reasons + # for blocking. + array of BlockedCookieWithReason blockedCookies + # Raw request headers as they will be sent over the wire. + Headers headers + + # Fired when additional information about a responseReceived event is available from the network + # stack. Not every responseReceived event will have an additional responseReceivedExtraInfo for + # it, and responseReceivedExtraInfo may be fired before or after responseReceived. + experimental event responseReceivedExtraInfo + parameters + # Request identifier. Used to match this information to another responseReceived event. + RequestId requestId + # A list of cookies which were not stored from the response along with the corresponding + # reasons for blocking. The cookies here may not be valid due to syntax errors, which + # are represented by the invalid cookie line string instead of a proper cookie. + array of BlockedSetCookieWithReason blockedCookies + # Raw response headers as they were received over the wire. + Headers headers + # Raw response header text as it was received over the wire. The raw text may not always be + # available, such as in the case of HTTP/2 or QUIC. + optional string headersText + # This domain provides various functionality related to drawing atop the inspected page. experimental domain Overlay depends on DOM
diff --git a/third_party/blink/renderer/core/layout/layout_image.cc b/third_party/blink/renderer/core/layout/layout_image.cc index 988c24d4..ac1eed1 100644 --- a/third_party/blink/renderer/core/layout/layout_image.cc +++ b/third_party/blink/renderer/core/layout/layout_image.cc
@@ -68,10 +68,6 @@ void LayoutImage::WillBeDestroyed() { DCHECK(image_resource_); image_resource_->Shutdown(); - if (RuntimeEnabledFeatures::ElementTimingEnabled(&GetDocument())) { - if (LocalDOMWindow* window = GetDocument().domWindow()) - ImageElementTiming::From(*window).NotifyWillBeDestroyed(this); - } LayoutReplaced::WillBeDestroyed(); }
diff --git a/third_party/blink/renderer/core/layout/layout_table_section.cc b/third_party/blink/renderer/core/layout/layout_table_section.cc index 622014c..bccd836 100644 --- a/third_party/blink/renderer/core/layout/layout_table_section.cc +++ b/third_party/blink/renderer/core/layout/layout_table_section.cc
@@ -1149,20 +1149,6 @@ return true; } -static bool ShouldFlexCellChild(const LayoutTableCell& cell, - LayoutObject* cell_descendant) { - if (!CellHasExplicitlySpecifiedHeight(cell)) - return false; - // TODO(dgrogan): Delete ShouldFlexCellChild. It's only called when - // CellHasExplicitlySpecifiedHeight is false. - NOTREACHED() << "This is dead code?"; - if (cell_descendant->StyleRef().OverflowY() == EOverflow::kVisible || - cell_descendant->StyleRef().OverflowY() == EOverflow::kHidden) - return true; - return cell_descendant->IsBox() && - ToLayoutBox(cell_descendant)->ShouldBeConsideredAsReplaced(); -} - void LayoutTableSection::LayoutRows() { #if DCHECK_IS_ON() SetLayoutNeededForbiddenScope layout_forbidden_scope(*this); @@ -1900,53 +1886,38 @@ void LayoutTableSection::RelayoutCellIfFlexed(LayoutTableCell& cell, int row_index, int row_height) { - // Force percent height children to lay themselves out again. - // This will cause these children to grow to fill the cell. + // Force percent height children to lay themselves out again now that the + // cell's final height is determined. // FIXME: There is still more work to do here to fully match WinIE (should // it become necessary to do so). In quirks mode, WinIE behaves like we // do, but it will clip the cells that spill out of the table section. // strict mode, Mozilla and WinIE both regrow the table to accommodate the // new height of the cell (thus letting the percentages cause growth one // time only). We may also not be handling row-spanning cells correctly. - // - // Note also the oddity where replaced elements always flex, and yet blocks/ - // tables do not necessarily flex. WinIE is crazy and inconsistent, and we - // can't hope to match the behavior perfectly, but we'll continue to refine it - // as we discover new bugs. :) - bool cell_children_flex = false; - bool flex_all_children = CellHasExplicitlySpecifiedHeight(cell) || - (!Table()->StyleRef().LogicalHeight().IsAuto() && - row_height != cell.LogicalHeight()); - for (LayoutObject* child = cell.FirstChild(); child; - child = child->NextSibling()) { - if (!child->IsText() && - child->StyleRef().LogicalHeight().IsPercentOrCalc() && - (flex_all_children || ShouldFlexCellChild(cell, child)) && - (!child->IsTable() || (!child->IsOutOfFlowPositioned() && - ToLayoutTable(child)->HasSections()))) { - cell_children_flex = true; - break; - } - } + if (!CellHasExplicitlySpecifiedHeight(cell) && + (Table()->StyleRef().LogicalHeight().IsAuto() || + row_height == cell.LogicalHeight())) + return; - if (!cell_children_flex) { - if (TrackedLayoutBoxListHashSet* percent_height_descendants = - cell.PercentHeightDescendants()) { - for (auto* descendant : *percent_height_descendants) { - if (flex_all_children || ShouldFlexCellChild(cell, descendant)) { - cell_children_flex = true; - break; - } + bool any_child_needs_relayout = cell.HasPercentHeightDescendants(); + + if (!any_child_needs_relayout) { + for (LayoutObject* child = cell.FirstChild(); child; + child = child->NextSibling()) { + if (!child->IsText() && + child->StyleRef().LogicalHeight().IsPercentOrCalc() && + (!child->IsTable() || (!child->IsOutOfFlowPositioned() && + ToLayoutTable(child)->HasSections()))) { + any_child_needs_relayout = true; + break; } } } - if (!cell_children_flex) + if (!any_child_needs_relayout) return; - // Alignment within a cell is based off the calculated height, which becomes - // irrelevant once the cell has been resized based off its percentage. cell.SetOverrideLogicalHeightFromRowHeight(LayoutUnit(row_height)); cell.ForceLayout();
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_image.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_image.cc index 6f2de06..9e47294 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_image.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_image.cc
@@ -56,11 +56,6 @@ void LayoutSVGImage::WillBeDestroyed() { image_resource_->Shutdown(); - if (RuntimeEnabledFeatures::ElementTimingEnabled(&GetDocument())) { - if (LocalDOMWindow* window = GetDocument().domWindow()) - ImageElementTiming::From(*window).NotifyWillBeDestroyed(this); - } - LayoutSVGModelObject::WillBeDestroyed(); }
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host.cc b/third_party/blink/renderer/core/loader/appcache/application_cache_host.cc index f71d8c8..e52f3cf 100644 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host.cc +++ b/third_party/blink/renderer/core/loader/appcache/application_cache_host.cc
@@ -370,29 +370,6 @@ } } -void ApplicationCacheHost::SelectCacheWithManifest(const KURL& manifest_url) { - DCHECK(document_loader_); - LocalFrame* frame = document_loader_->GetFrame(); - Document* document = frame->GetDocument(); - if (document->IsSandboxed(WebSandboxFlags::kOrigin)) { - // Prevent sandboxes from establishing application caches. - SelectCacheWithoutManifest(); - return; - } - if (document->IsSecureContext()) { - UseCounter::Count(document, - WebFeature::kApplicationCacheManifestSelectSecureOrigin); - } else { - Deprecation::CountDeprecation( - document, WebFeature::kApplicationCacheManifestSelectInsecureOrigin); - Deprecation::CountDeprecationCrossOriginIframe( - *document, WebFeature::kApplicationCacheManifestSelectInsecureOrigin); - HostsUsingFeatures::CountAnyWorld( - *document, HostsUsingFeatures::Feature:: - kApplicationCacheManifestSelectInsecureHost); - } -} - void ApplicationCacheHost::GetAssociatedCacheInfo( ApplicationCacheHost::CacheInfo* info) { if (!backend_host_.is_bound())
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host.h b/third_party/blink/renderer/core/loader/appcache/application_cache_host.h index bd25243..edc2f1c 100644 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host.h +++ b/third_party/blink/renderer/core/loader/appcache/application_cache_host.h
@@ -120,11 +120,14 @@ void SetSubresourceFactory( network::mojom::blink::URLLoaderFactoryPtr url_loader_factory) override {} + // TODO(nhiroki): Move these virtual functions into + // ApplicationCacheHostForFrame after making DocumentLoader own only + // ApplicationCacheHostForFrame (not own ApplicationCacheHostForSharedWorker). virtual void WillStartLoadingMainResource(DocumentLoader* loader, const KURL& url, const String& method); virtual void SelectCacheWithoutManifest() {} - virtual void SelectCacheWithManifest(const KURL& manifest_url); + virtual void SelectCacheWithManifest(const KURL& manifest_url) {} virtual void DidReceiveResponseForMainResource(const ResourceResponse&) {} virtual void Trace(blink::Visitor*);
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 f3ef859f..b94f0be 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
@@ -155,7 +155,25 @@ void ApplicationCacheHostForFrame::SelectCacheWithManifest( const KURL& manifest_url) { - ApplicationCacheHost::SelectCacheWithManifest(manifest_url); + LocalFrame* frame = GetDocumentLoader()->GetFrame(); + Document* document = frame->GetDocument(); + if (document->IsSandboxed(WebSandboxFlags::kOrigin)) { + // Prevent sandboxes from establishing application caches. + SelectCacheWithoutManifest(); + return; + } + if (document->IsSecureContext()) { + UseCounter::Count(document, + WebFeature::kApplicationCacheManifestSelectSecureOrigin); + } else { + Deprecation::CountDeprecation( + document, WebFeature::kApplicationCacheManifestSelectInsecureOrigin); + Deprecation::CountDeprecationCrossOriginIframe( + *document, WebFeature::kApplicationCacheManifestSelectInsecureOrigin); + HostsUsingFeatures::CountAnyWorld( + *document, HostsUsingFeatures::Feature:: + kApplicationCacheManifestSelectInsecureHost); + } if (!backend_host_.is_bound()) return;
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.h b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.h index fbd9b5d3..7918842 100644 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.h +++ b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_frame.h
@@ -5,13 +5,14 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_APPCACHE_APPLICATION_CACHE_HOST_FOR_FRAME_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_APPCACHE_APPLICATION_CACHE_HOST_FOR_FRAME_H_ +#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/loader/appcache/application_cache_host.h" namespace blink { class LocalFrame; -class ApplicationCacheHostForFrame final : public ApplicationCacheHost { +class CORE_EXPORT ApplicationCacheHostForFrame : public ApplicationCacheHost { public: ApplicationCacheHostForFrame( DocumentLoader* document_loader,
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.cc b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.cc index be9b26f..291fe2f6 100644 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.cc +++ b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.cc
@@ -39,4 +39,17 @@ void ApplicationCacheHostForSharedWorker::SetSubresourceFactory( network::mojom::blink::URLLoaderFactoryPtr url_loader_factory) {} +void ApplicationCacheHostForSharedWorker::SelectCacheWithoutManifest() { + // This can be called during WorkerShadowPage initialization. + // TODO(https://crbug.com/538751): Add NOTREACHED() here after + // WorkerShadowPage is removed. +} + +void ApplicationCacheHostForSharedWorker::SelectCacheWithManifest( + const KURL& manifest_url) { + // This can be called during WorkerShadowPage initialization. + // TODO(https://crbug.com/538751): Add NOTREACHED() here after + // WorkerShadowPage is removed. +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.h b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.h index 59e7c06..4cdc57f 100644 --- a/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.h +++ b/third_party/blink/renderer/core/loader/appcache/application_cache_host_for_shared_worker.h
@@ -23,6 +23,8 @@ const String& message) override; void SetSubresourceFactory( network::mojom::blink::URLLoaderFactoryPtr url_loader_factory) override; + void SelectCacheWithoutManifest() override; + void SelectCacheWithManifest(const KURL& manifest_url) override; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/paint/image_element_timing.cc b/third_party/blink/renderer/core/paint/image_element_timing.cc index 3b0650d..9541f0b7 100644 --- a/third_party/blink/renderer/core/paint/image_element_timing.cc +++ b/third_party/blink/renderer/core/paint/image_element_timing.cc
@@ -5,12 +5,9 @@ #include "third_party/blink/renderer/core/paint/image_element_timing.h" #include "third_party/blink/renderer/core/layout/layout_object.h" -#include "third_party/blink/renderer/core/layout/layout_replaced.h" -#include "third_party/blink/renderer/core/layout/layout_view.h" #include "third_party/blink/renderer/core/loader/resource/image_resource_content.h" #include "third_party/blink/renderer/core/page/chrome_client.h" #include "third_party/blink/renderer/core/paint/element_timing_utils.h" -#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" #include "third_party/blink/renderer/core/style/style_image.h" #include "third_party/blink/renderer/core/timing/dom_window_performance.h" #include "third_party/blink/renderer/core/timing/window_performance.h" @@ -77,7 +74,8 @@ if (!internal::IsExplicitlyRegisteredForTiming(layout_object)) return; - auto result = images_notified_.insert(layout_object); + auto result = + images_notified_.insert(std::make_pair(layout_object, cached_image)); if (result.is_new_entry && cached_image) { NotifyImagePaintedInternal(layout_object->GetNode(), *layout_object, *cached_image, current_paint_chunk_properties); @@ -182,8 +180,8 @@ if (!cached_image || !cached_image->IsLoaded()) return; - auto result = background_images_notified_.insert( - std::make_pair(layout_object, cached_image)); + auto result = + images_notified_.insert(std::make_pair(layout_object, cached_image)); if (result.is_new_entry) { NotifyImagePaintedInternal(node, *layout_object, *cached_image, current_paint_chunk_properties); @@ -206,13 +204,9 @@ element_timings_.clear(); } -void ImageElementTiming::NotifyWillBeDestroyed(const LayoutObject* image) { - images_notified_.erase(image); -} - void ImageElementTiming::NotifyImageRemoved(const LayoutObject* layout_object, const ImageResourceContent* image) { - background_images_notified_.erase(std::make_pair(layout_object, image)); + images_notified_.erase(std::make_pair(layout_object, image)); } void ImageElementTiming::Trace(blink::Visitor* visitor) {
diff --git a/third_party/blink/renderer/core/paint/image_element_timing.h b/third_party/blink/renderer/core/paint/image_element_timing.h index 468d4ef..ea5b0e57 100644 --- a/third_party/blink/renderer/core/paint/image_element_timing.h +++ b/third_party/blink/renderer/core/paint/image_element_timing.h
@@ -18,7 +18,6 @@ namespace blink { class ImageResourceContent; -class LayoutImage; class PropertyTreeState; class StyleImage; @@ -53,9 +52,6 @@ const StyleImage* background_image, const PropertyTreeState& current_paint_chunk_properties); - // Called when the LayoutImage will be destroyed. - void NotifyWillBeDestroyed(const LayoutObject*); - void NotifyImageRemoved(const LayoutObject*, const ImageResourceContent* image); @@ -111,12 +107,11 @@ // Vector containing the element timing infos that will be reported during the // next swap promise callback. HeapVector<Member<ElementTimingInfo>> element_timings_; - // Hashmap of LayoutObjects for which paint has already been notified. - WTF::HashSet<const LayoutObject*> images_notified_; - // Hashmap of pairs of elements, background images whose paint has been - // observed. + // Hashmap of pairs of elements, LayoutObjects (for the elements) and + // ImageResourceContent (for the src) which correspond to either images or + // background images whose paint has been observed. WTF::HashSet<std::pair<const LayoutObject*, const ImageResourceContent*>> - background_images_notified_; + images_notified_; DISALLOW_COPY_AND_ASSIGN(ImageElementTiming); };
diff --git a/third_party/blink/renderer/core/paint/image_element_timing_test.cc b/third_party/blink/renderer/core/paint/image_element_timing_test.cc index d658088..7ab9bc9 100644 --- a/third_party/blink/renderer/core/paint/image_element_timing_test.cc +++ b/third_party/blink/renderer/core/paint/image_element_timing_test.cc
@@ -55,7 +55,9 @@ return layout_image; } - const WTF::HashSet<const LayoutObject*>& GetImagesNotified() { + const WTF::HashSet< + std::pair<const LayoutObject*, const ImageResourceContent*>>& + GetImagesNotified() { return ImageElementTiming::From(*GetDoc()->domWindow()).images_notified_; } @@ -70,13 +72,6 @@ return GetDoc()->getElementById(id)->GetLayoutObject(); } - const WTF::HashSet< - std::pair<const LayoutObject*, const ImageResourceContent*>>& - GetBackgroundImagesNotified() { - return ImageElementTiming::From(*GetDoc()->domWindow()) - .background_images_notified_; - } - void UpdateAllLifecyclePhases() { web_view_helper_.GetWebView() ->MainFrameImpl() @@ -148,7 +143,8 @@ LayoutImage* layout_image = SetImageResource("target", 5, 5); ASSERT_TRUE(layout_image); UpdateAllLifecyclePhases(); - EXPECT_FALSE(GetImagesNotified().Contains(layout_image)); + EXPECT_FALSE(GetImagesNotified().Contains( + std::make_pair(layout_image, layout_image->CachedImage()))); } TEST_F(ImageElementTimingTest, ImageInsideSVG) { @@ -169,7 +165,8 @@ UpdateAllLifecyclePhases(); // |layout_image| should have had its paint notified to ImageElementTiming. - EXPECT_TRUE(GetImagesNotified().Contains(layout_image)); + EXPECT_TRUE(GetImagesNotified().Contains( + std::make_pair(layout_image, layout_image->CachedImage()))); } TEST_F(ImageElementTimingTest, ImageRemoved) { @@ -181,7 +178,8 @@ LayoutImage* layout_image = SetImageResource("target", 5, 5); ASSERT_TRUE(layout_image); UpdateAllLifecyclePhases(); - EXPECT_TRUE(GetImagesNotified().Contains(layout_image)); + EXPECT_TRUE(GetImagesNotified().Contains( + std::make_pair(layout_image, layout_image->CachedImage()))); GetDoc()->getElementById("target")->remove(); // |layout_image| should no longer be part of |images_notified| since it will @@ -200,7 +198,8 @@ LayoutSVGImage* layout_image = SetSVGImageResource("target", 5, 5); ASSERT_TRUE(layout_image); UpdateAllLifecyclePhases(); - EXPECT_TRUE(GetImagesNotified().Contains(layout_image)); + EXPECT_TRUE(GetImagesNotified().Contains(std::make_pair( + layout_image, layout_image->ImageResource()->CachedImage()))); GetDoc()->getElementById("target")->remove(); // |layout_image| should no longer be part of |images_notified| since it will @@ -225,12 +224,11 @@ ImageResourceContent* content = object->Style()->BackgroundLayers().GetImage()->CachedImage(); UpdateAllLifecyclePhases(); - EXPECT_EQ(GetBackgroundImagesNotified().size(), 1u); - EXPECT_TRUE( - GetBackgroundImagesNotified().Contains(std::make_pair(object, content))); + EXPECT_EQ(GetImagesNotified().size(), 1u); + EXPECT_TRUE(GetImagesNotified().Contains(std::make_pair(object, content))); GetDoc()->getElementById("target")->remove(); - EXPECT_TRUE(GetBackgroundImagesNotified().IsEmpty()); + EXPECT_TRUE(GetImagesNotified().IsEmpty()); } } // namespace blink
diff --git a/third_party/blink/renderer/core/script/resources/layered_api/elements/toast/index.mjs b/third_party/blink/renderer/core/script/resources/layered_api/elements/toast/index.mjs index 207e32b8..94222d1 100644 --- a/third_party/blink/renderer/core/script/resources/layered_api/elements/toast/index.mjs +++ b/third_party/blink/renderer/core/script/resources/layered_api/elements/toast/index.mjs
@@ -22,24 +22,21 @@ stylesheet.replaceSync(` :host { position: fixed; - bottom: 0; - right: 0; + bottom: 1em; + right: 1em; + border: solid; + padding: 1em; + background: white; + color: black; z-index: 1; - background-color: #FFFFFF; - color: #000000; - font-size: 20px; - border-color: #000000; - border-style: solid; - border-width: 2px; - border-radius: 2.5px; - padding: 10px; - margin: 10px; } :host(:not([open])) { display: none; } `); + // TODO(jacksteinberg): use offset-block-end: / offset-inline-end: over bottom: / right: + // when implemented https://bugs.chromium.org/p/chromium/issues/detail?id=538475 } return stylesheet; };
diff --git a/third_party/blink/renderer/core/svg/svg_element.cc b/third_party/blink/renderer/core/svg/svg_element.cc index 4105e7b6..20546983 100644 --- a/third_party/blink/renderer/core/svg/svg_element.cc +++ b/third_party/blink/renderer/core/svg/svg_element.cc
@@ -1328,4 +1328,9 @@ Element::Trace(visitor); } +void SVGElement::AccessKeyAction(bool send_mouse_events) { + DispatchSimulatedClick( + nullptr, send_mouse_events ? kSendMouseUpDownEvents : kSendNoEvents); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/svg/svg_element.h b/third_party/blink/renderer/core/svg/svg_element.h index c6e7689..60ed0c4 100644 --- a/third_party/blink/renderer/core/svg/svg_element.h +++ b/third_party/blink/renderer/core/svg/svg_element.h
@@ -264,6 +264,8 @@ void RemovedEventListener(const AtomicString& event_type, const RegisteredEventListener&) final; + void AccessKeyAction(bool send_mouse_events) override; + private: bool IsSVGElement() const = delete; // This will catch anyone doing an unnecessary check.
diff --git a/third_party/blink/renderer/devtools/front_end/audits/AuditsController.js b/third_party/blink/renderer/devtools/front_end/audits/AuditsController.js index a7406c29..a1c3600 100644 --- a/third_party/blink/renderer/devtools/front_end/audits/AuditsController.js +++ b/third_party/blink/renderer/devtools/front_end/audits/AuditsController.js
@@ -237,7 +237,9 @@ setting: Common.settings.createSetting('audits.device_type', 'mobile'), description: ls`Apply mobile emulation during auditing`, setFlags: (flags, value) => { - flags.emulatedFormFactor = value; + flags._devtoolsEmulationType = value; + // See Audits.AuditsPanel._setupEmulationAndProtocolConnection() + flags.emulatedFormFactor = 'none'; }, options: [ {label: ls`Mobile`, value: 'mobile'},
diff --git a/third_party/blink/renderer/devtools/front_end/audits/AuditsPanel.js b/third_party/blink/renderer/devtools/front_end/audits/AuditsPanel.js index c99e6ed3..5cfd286b 100644 --- a/third_party/blink/renderer/devtools/front_end/audits/AuditsPanel.js +++ b/third_party/blink/renderer/devtools/front_end/audits/AuditsPanel.js
@@ -244,6 +244,12 @@ this._renderStartView(); } + /** + * We set the device emulation on the DevTools-side for two reasons: + * 1. To workaround some odd device metrics emulation bugs like occuluding viewports + * 2. To get the attractive device outline + * flags.emulatedFormFactor is always set to none, so Lighthouse doesn't apply its own emulation. + */ async _setupEmulationAndProtocolConnection() { const flags = this._controller.getFlags(); @@ -252,11 +258,10 @@ this._emulationOutlineEnabledBefore = emulationModel.deviceOutlineSetting().get(); emulationModel.toolbarControlsEnabledSetting().set(false); - if (flags.emulatedFormFactor === 'desktop') { + if (flags._devtoolsEmulationType === 'desktop') { emulationModel.enabledSetting().set(false); - emulationModel.deviceOutlineSetting().set(false); emulationModel.emulate(Emulation.DeviceModeModel.Type.None, null, null); - } else { + } else if (flags._devtoolsEmulationType === 'mobile') { emulationModel.enabledSetting().set(true); emulationModel.deviceOutlineSetting().set(true);
diff --git a/third_party/blink/renderer/devtools/front_end/audits/AuditsStartView.js b/third_party/blink/renderer/devtools/front_end/audits/AuditsStartView.js index b17f92a3..a961b66 100644 --- a/third_party/blink/renderer/devtools/front_end/audits/AuditsStartView.js +++ b/third_party/blink/renderer/devtools/front_end/audits/AuditsStartView.js
@@ -18,15 +18,17 @@ /** * @param {string} settingName + * @param {string} label * @param {!Element} parentElement */ - _populateRuntimeSettingAsRadio(settingName, parentElement) { + _populateRuntimeSettingAsRadio(settingName, label, parentElement) { const runtimeSetting = Audits.RuntimeSettings.find(item => item.setting.name === settingName); if (!runtimeSetting || !runtimeSetting.options) throw new Error(`${settingName} is not a setting with options`); const control = new Audits.RadioSetting(runtimeSetting.options, runtimeSetting.setting, runtimeSetting.description); parentElement.appendChild(control.element); + UI.ARIAUtils.setAccessibleName(control.element, label); } /** @@ -49,7 +51,7 @@ _populateFormControls(fragment) { // Populate the device type const deviceTypeFormElements = fragment.$('device-type-form-elements'); - this._populateRuntimeSettingAsRadio('audits.device_type', deviceTypeFormElements); + this._populateRuntimeSettingAsRadio('audits.device_type', ls`Device`, deviceTypeFormElements); // Populate the audit categories const categoryFormElements = fragment.$('categories-form-elements'); @@ -63,7 +65,7 @@ // Populate the throttling const throttlingFormElements = fragment.$('throttling-form-elements'); - this._populateRuntimeSettingAsRadio('audits.throttling', throttlingFormElements); + this._populateRuntimeSettingAsRadio('audits.throttling', ls`Throttling`, throttlingFormElements); // Populate other settings
diff --git a/third_party/blink/renderer/devtools/front_end/audits/RadioSetting.js b/third_party/blink/renderer/devtools/front_end/audits/RadioSetting.js index 7d85dbd..ddc84f5 100644 --- a/third_party/blink/renderer/devtools/front_end/audits/RadioSetting.js +++ b/third_party/blink/renderer/devtools/front_end/audits/RadioSetting.js
@@ -15,6 +15,7 @@ this.element = createElement('div', 'audits-radio-group'); this.element.title = description; UI.ARIAUtils.setDescription(this.element, description); + UI.ARIAUtils.markAsRadioGroup(this.element); this._radioElements = []; for (const option of this._options) {
diff --git a/third_party/blink/renderer/devtools/front_end/audits/audits_strings.grdp b/third_party/blink/renderer/devtools/front_end/audits/audits_strings.grdp index 0827a92..70bb542 100644 --- a/third_party/blink/renderer/devtools/front_end/audits/audits_strings.grdp +++ b/third_party/blink/renderer/devtools/front_end/audits/audits_strings.grdp
@@ -51,7 +51,7 @@ <message name="IDS_DEVTOOLS_3ee3aab0791156ff1d5e0481ed4589b2" desc="Text in Audits Controller"> Applied Slow 4G, 4x CPU Slowdown </message> - <message name="IDS_DEVTOOLS_41fdb410354e76ef7674f98e1cc84c8f" desc="Text in Audits Start View"> + <message name="IDS_DEVTOOLS_41fdb410354e76ef7674f98e1cc84c8f" desc="Text in Audits Start View labeling throttling configration control group"> Throttling </message> <message name="IDS_DEVTOOLS_48d24d11c7c71282366fe2007d4cee3b" desc="Text in Audits Controller"> @@ -129,7 +129,7 @@ <message name="IDS_DEVTOOLS_deeacee140c7d3a451440dd0e206e256" desc="Text in Audits Start View"> Identify and fix common problems that affect your site's performance, accessibility, and user experience. </message> - <message name="IDS_DEVTOOLS_e0ac20adce6ffee48c7151b070aa5737" desc="Text in Audits Start View"> + <message name="IDS_DEVTOOLS_e0ac20adce6ffee48c7151b070aa5737" desc="Text in Audits Start View labeling device configration control group"> Device </message> <message name="IDS_DEVTOOLS_e499f5109f685235e6280179fe22beec" desc="Text that appears when user drag and drop something (for example, a file) in Audits Panel">
diff --git a/third_party/blink/renderer/devtools/front_end/axe_core_test_runner/AxeCoreTestRunner.js b/third_party/blink/renderer/devtools/front_end/axe_core_test_runner/AxeCoreTestRunner.js index 4d8316c..9f13497 100644 --- a/third_party/blink/renderer/devtools/front_end/axe_core_test_runner/AxeCoreTestRunner.js +++ b/third_party/blink/renderer/devtools/front_end/axe_core_test_runner/AxeCoreTestRunner.js
@@ -104,10 +104,10 @@ }; AxeCoreTestRunner.runValidation = async function(element, rules, config) { - axe.configure(Object.assign({}, DEFAULT_CONFIG, config)); + axe.configure({...DEFAULT_CONFIG, ...config}); try { - const results = await axe.run(element, {rules: Object.assign({}, DISABLED_RULES, rules)}); + const results = await axe.run(element, {rules: {...DISABLED_RULES, ...rules}}); const violations = AxeCoreTestRunner.processAxeResult(results.violations); TestRunner.addResult(`aXe violations: ${violations}\n`); } catch (e) {
diff --git a/third_party/blink/renderer/devtools/front_end/resources/BackgroundServiceView.js b/third_party/blink/renderer/devtools/front_end/resources/BackgroundServiceView.js index a1461d6..faf77f142 100644 --- a/third_party/blink/renderer/devtools/front_end/resources/BackgroundServiceView.js +++ b/third_party/blink/renderer/devtools/front_end/resources/BackgroundServiceView.js
@@ -295,9 +295,10 @@ recordKey.textContent = UI.shortcutRegistry.shortcutDescriptorsForAction('background-service.toggle-recording')[0].name; - centered.createChild('h2').appendChild(UI.formatLocalized( - 'Click the record button %s or hit %s to start recording.', - [UI.createInlineButton(landingRecordButton), recordKey])); + centered.createChild('div', 'empty-bold-text') + .appendChild(UI.formatLocalized( + 'Click the record button %s or hit %s to start recording.', + [UI.createInlineButton(landingRecordButton), recordKey])); } this._preview.show(this._previewPanel.contentElement);
diff --git a/third_party/blink/renderer/devtools/front_end/sdk/NetworkManager.js b/third_party/blink/renderer/devtools/front_end/sdk/NetworkManager.js index fa24c34..25f0c827 100644 --- a/third_party/blink/renderer/devtools/front_end/sdk/NetworkManager.js +++ b/third_party/blink/renderer/devtools/front_end/sdk/NetworkManager.js
@@ -767,6 +767,29 @@ } /** + * @override + * @param {!Protocol.Network.RequestId} requestId + * @param {!Array<!Protocol.Network.BlockedCookieWithReason>} blockedCookies + * @param {!Protocol.Network.Headers} headers + */ + requestWillBeSentExtraInfo(requestId, blockedCookies, headers) { + // TODO(http://crbug.com/868407): Populate request info with these new raw headers + // TODO(http://crbug.com/856777): Populate request info with blocked cookies + } + + /** + * @override + * @param {!Protocol.Network.RequestId} requestId + * @param {!Array<!Protocol.Network.BlockedSetCookieWithReason>} blockedCookies + * @param {!Protocol.Network.Headers} headers + * @param {string=} headersText + */ + responseReceivedExtraInfo(requestId, blockedCookies, headers, headersText) { + // TODO(http://crbug.com/868407): Populate request info with these new raw headers + // TODO(http://crbug.com/856777): Populate request info with blocked cookies + } + + /** * @param {!Protocol.Network.RequestId} requestId * @param {!Protocol.Network.MonotonicTime} time * @param {string} redirectURL
diff --git a/third_party/blink/renderer/devtools/front_end/settings/SettingsScreen.js b/third_party/blink/renderer/devtools/front_end/settings/SettingsScreen.js index 6b1f58345..bbcabfd 100644 --- a/third_party/blink/renderer/devtools/front_end/settings/SettingsScreen.js +++ b/third_party/blink/renderer/devtools/front_end/settings/SettingsScreen.js
@@ -71,7 +71,7 @@ /** @type {!Settings.SettingsScreen} */ (self.runtime.sharedInstance(Settings.SettingsScreen)); if (settingsScreen.isShowing()) return; - const dialog = new UI.Dialog(/* modal=*/ true); + const dialog = new UI.Dialog(); dialog.addCloseButton(); settingsScreen.show(dialog.contentElement); dialog.show();
diff --git a/third_party/blink/renderer/devtools/front_end/ui/Dialog.js b/third_party/blink/renderer/devtools/front_end/ui/Dialog.js index ba7e455..7b146fc6 100644 --- a/third_party/blink/renderer/devtools/front_end/ui/Dialog.js +++ b/third_party/blink/renderer/devtools/front_end/ui/Dialog.js
@@ -29,10 +29,8 @@ */ UI.Dialog = class extends UI.GlassPane { - /** - * @param {boolean=} modal - */ - constructor(modal) { + + constructor() { super(); this.registerRequiredCSS('ui/dialog.css'); this.contentElement.tabIndex = 0; @@ -44,7 +42,7 @@ this.hide(); event.consume(true); }); - UI.ARIAUtils.markAsDialog(this.contentElement, modal); + UI.ARIAUtils.markAsDialog(this.contentElement, true); /** @type {!Map<!HTMLElement, number>} */ this._tabIndexMap = new Map(); /** @type {?UI.WidgetFocusRestorer} */
diff --git a/third_party/blink/renderer/devtools/front_end/ui/EmptyWidget.js b/third_party/blink/renderer/devtools/front_end/ui/EmptyWidget.js index 9ac0493..4dee0946 100644 --- a/third_party/blink/renderer/devtools/front_end/ui/EmptyWidget.js +++ b/third_party/blink/renderer/devtools/front_end/ui/EmptyWidget.js
@@ -40,7 +40,7 @@ this.registerRequiredCSS('ui/emptyWidget.css'); this.element.classList.add('empty-view-scroller'); this._contentElement = this.element.createChild('div', 'empty-view'); - this._textElement = this._contentElement.createChild('h2'); + this._textElement = this._contentElement.createChild('div', 'empty-bold-text'); this._textElement.textContent = text; }
diff --git a/third_party/blink/renderer/devtools/front_end/ui/emptyWidget.css b/third_party/blink/renderer/devtools/front_end/ui/emptyWidget.css index 3a25315f..530bca8 100644 --- a/third_party/blink/renderer/devtools/front_end/ui/emptyWidget.css +++ b/third_party/blink/renderer/devtools/front_end/ui/emptyWidget.css
@@ -4,6 +4,13 @@ * found in the LICENSE file. */ + .empty-bold-text { + display: block; + font-size: 1.5em; + margin: .83em 0 .83em; + font-weight: bold; + } + .empty-view { color: hsla(0, 0%, 43%, 1); padding: 30px;
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc index 5ae69cd..d36cb8f 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.cc
@@ -1296,7 +1296,10 @@ } base::TimeDelta elapsed = base::TimeTicks::Now() - start_time; - base::UmaHistogramMicrosecondsTimes(duration_histogram_name, elapsed); + + // TODO(crbug.com/983261) Change this to use UmaHistogramMicrosecondsTimes. + base::UmaHistogramMicrosecondsTimesUnderTenMilliseconds( + duration_histogram_name, elapsed); float sqrt_pixels_float = std::sqrt(dst_rect.Width()) * std::sqrt(dst_rect.Height());
diff --git a/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.cc b/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.cc index 7bddf02..5f3a71d9 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.cc
@@ -187,6 +187,11 @@ } #endif + // The raster invalidator will only handle invalidations within a cc::Layer so + // we need this invalidation if the layer's properties have changed. + if (layer_state != layer_state_) + cc_picture_layer_->SetSubtreePropertyChanged(); + raster_invalidator_.Generate(paint_artifact, paint_chunks, layer_bounds, layer_state); layer_state_ = layer_state;
diff --git a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc index 3dab0c0b..a185a4bc 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc
@@ -992,7 +992,8 @@ // Calling |PropertyTreeStateChanged| for every pending layer is // O(|property nodes|^2) and could be optimized by caching the lookup of // nodes known to be changed/unchanged. - if (PropertyTreeStateChanged(property_state)) { + if (layer->subtree_property_changed() || + PropertyTreeStateChanged(property_state)) { layer->SetSubtreePropertyChanged(); root_layer_->SetNeedsCommit(); }
diff --git a/third_party/blink/renderer/platform/graphics/graphics_layer.cc b/third_party/blink/renderer/platform/graphics/graphics_layer.cc index 7deb617..ebeab54 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_layer.cc +++ b/third_party/blink/renderer/platform/graphics/graphics_layer.cc
@@ -1080,8 +1080,11 @@ std::make_unique<LayerState>(LayerState{layer_state, layer_offset}); } - if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) + if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) { + if (auto* layer = CcLayer()) + layer->SetSubtreePropertyChanged(); client_.GraphicsLayersDidChange(); + } } void GraphicsLayer::SetContentsLayerState(const PropertyTreeState& layer_state, @@ -1099,8 +1102,10 @@ std::make_unique<LayerState>(LayerState{layer_state, layer_offset}); } - if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) + if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) { + ContentsLayer()->SetSubtreePropertyChanged(); client_.GraphicsLayersDidChange(); + } } scoped_refptr<cc::DisplayItemList> GraphicsLayer::PaintContentsToDisplayList(
diff --git a/third_party/blink/web_tests/FlagExpectations/enable-features=NavigationLoaderOnUI b/third_party/blink/web_tests/FlagExpectations/enable-features=NavigationLoaderOnUI new file mode 100644 index 0000000..7fb29fe2 --- /dev/null +++ b/third_party/blink/web_tests/FlagExpectations/enable-features=NavigationLoaderOnUI
@@ -0,0 +1,39 @@ +# These tests currently fail when run with --enable-features=NavigationLoaderOnUI +# See https://crbug.com/824840 + +# service worker +Bug(none) external/wpt/service-workers/service-worker/appcache-ordering-main.https.html [ Failure ] +Bug(none) external/wpt/service-workers/service-worker/claim-fetch-with-appcache.https.html [ Failure ] +Bug(none) external/wpt/service-workers/service-worker/embed-and-object-are-not-intercepted.https.html [ Failure ] +Bug(none) virtual/blink-cors/external/wpt/service-workers/service-worker/appcache-ordering-main.https.html [ Failure ] +Bug(none) virtual/blink-cors/external/wpt/service-workers/service-worker/claim-fetch-with-appcache.https.html [ Failure ] +Bug(none) virtual/blink-cors/external/wpt/service-workers/service-worker/embed-and-object-are-not-intercepted.https.html [ Failure ] +Bug(none) virtual/cache-storage-sequence/external/wpt/service-workers/service-worker/appcache-ordering-main.https.html [ Failure ] +Bug(none) virtual/cache-storage-sequence/external/wpt/service-workers/service-worker/claim-fetch-with-appcache.https.html [ Failure ] +Bug(none) virtual/cache-storage-sequence/external/wpt/service-workers/service-worker/embed-and-object-are-not-intercepted.https.html [ Failure ] +Bug(none) virtual/not-omt-sw-fetch/external/wpt/service-workers/service-worker/appcache-ordering-main.https.html [ Failure ] +Bug(none) virtual/not-omt-sw-fetch/external/wpt/service-workers/service-worker/claim-fetch-with-appcache.https.html [ Failure ] +Bug(none) virtual/not-omt-sw-fetch/external/wpt/service-workers/service-worker/embed-and-object-are-not-intercepted.https.html [ Failure ] +Bug(none) http/tests/devtools/service-workers/service-workers-bypass-for-network-navigation.js [ Failure ] +Bug(none) virtual/omt-worker-fetch/external/wpt/service-workers/service-worker/appcache-ordering-main.https.html [ Failure ] +Bug(none) virtual/omt-worker-fetch/external/wpt/service-workers/service-worker/claim-fetch-with-appcache.https.html [ Failure ] +Bug(none) virtual/omt-worker-fetch/external/wpt/service-workers/service-worker/embed-and-object-are-not-intercepted.https.html [ Failure ] + +# signed exchange +Bug(none) external/wpt/signed-exchange [ Skip ] +Bug(none) virtual/sxg-subresource [ Skip ] +Bug(none) virtual/sxg-with-network-service [ Skip ] +Bug(none) http/tests/devtools/sxg [ Skip ] +Bug(none) http/tests/loading/sxg [ Skip ] + +# appcache +Bug(none) external/wpt/html/browsers/offline/appcache/appcache-iframe.https.html [ Timeout ] +Bug(none) http/tests/appcache/fallback.html [ Timeout ] +Bug(none) http/tests/appcache/main-resource-hash.html [ Timeout ] +Bug(none) http/tests/appcache/main-resource-redirect.html [ Timeout ] +Bug(none) http/tests/appcache/offline-access.html [ Timeout ] +Bug(none) http/tests/appcache/remove-cache.html [ Timeout ] +Bug(none) http/tests/appcache/top-frame-2.html [ Timeout ] +Bug(none) virtual/conditional-appcache-delay/http/tests/loading/appcache-delay/appcache-loads-subresource.html [ Failure ] + +Bug(none) http/tests/misc/xhtml.php [ Failure ]
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json index 78b77ff2..92e52163 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json
@@ -175626,9 +175626,6 @@ "webxr/resources/webxr_util.js": [ [] ], - "webxr/resources/xr-test-asserts.js": [ - [] - ], "workers/META.yml": [ [] ], @@ -198279,6 +198276,42 @@ {} ] ], + "css/css-align/parsing/place-content-invalid.html": [ + [ + "css/css-align/parsing/place-content-invalid.html", + {} + ] + ], + "css/css-align/parsing/place-content-valid.html": [ + [ + "css/css-align/parsing/place-content-valid.html", + {} + ] + ], + "css/css-align/parsing/place-items-invalid.html": [ + [ + "css/css-align/parsing/place-items-invalid.html", + {} + ] + ], + "css/css-align/parsing/place-items-valid.html": [ + [ + "css/css-align/parsing/place-items-valid.html", + {} + ] + ], + "css/css-align/parsing/place-self-invalid.html": [ + [ + "css/css-align/parsing/place-self-invalid.html", + {} + ] + ], + "css/css-align/parsing/place-self-valid.html": [ + [ + "css/css-align/parsing/place-self-valid.html", + {} + ] + ], "css/css-align/self-alignment/parse-align-self-001.html": [ [ "css/css-align/self-alignment/parse-align-self-001.html", @@ -252380,9 +252413,9 @@ } ] ], - "native-file-system/FileSystemBaseHandle-remove.tentative.window.js": [ + "native-file-system/FileSystemBaseHandle-remove.tentative.https.window.js": [ [ - "native-file-system/FileSystemBaseHandle-remove.tentative.window.html", + "native-file-system/FileSystemBaseHandle-remove.tentative.https.window.html", { "script_metadata": [ [ @@ -252393,9 +252426,9 @@ } ] ], - "native-file-system/FileSystemDirectoryHandle-getDirectory.tentative.window.js": [ + "native-file-system/FileSystemDirectoryHandle-getDirectory.tentative.https.window.js": [ [ - "native-file-system/FileSystemDirectoryHandle-getDirectory.tentative.window.html", + "native-file-system/FileSystemDirectoryHandle-getDirectory.tentative.https.window.html", { "script_metadata": [ [ @@ -252406,9 +252439,9 @@ } ] ], - "native-file-system/FileSystemDirectoryHandle-getFile.tentative.window.js": [ + "native-file-system/FileSystemDirectoryHandle-getFile.tentative.https.window.js": [ [ - "native-file-system/FileSystemDirectoryHandle-getFile.tentative.window.html", + "native-file-system/FileSystemDirectoryHandle-getFile.tentative.https.window.html", { "script_metadata": [ [ @@ -252419,9 +252452,9 @@ } ] ], - "native-file-system/FileSystemWriter.tentative.window.js": [ + "native-file-system/FileSystemWriter.tentative.https.window.js": [ [ - "native-file-system/FileSystemWriter.tentative.window.html", + "native-file-system/FileSystemWriter.tentative.https.window.html", { "script_metadata": [ [ @@ -252432,9 +252465,9 @@ } ] ], - "native-file-system/NativeFileSystemWritableFileStream.tentative.window.js": [ + "native-file-system/NativeFileSystemWritableFileStream.tentative.https.window.js": [ [ - "native-file-system/NativeFileSystemWritableFileStream.tentative.window.html", + "native-file-system/NativeFileSystemWritableFileStream.tentative.https.window.html", { "script_metadata": [ [ @@ -298186,12 +298219,48 @@ {} ] ], + "webxr/events_input_source_recreation.https.html": [ + [ + "webxr/events_input_source_recreation.https.html", + {} + ] + ], + "webxr/events_input_sources_change.https.html": [ + [ + "webxr/events_input_sources_change.https.html", + {} + ] + ], "webxr/events_referenceSpace_reset.https.html": [ [ "webxr/events_referenceSpace_reset.https.html", {} ] ], + "webxr/events_session_select.https.html": [ + [ + "webxr/events_session_select.https.html", + {} + ] + ], + "webxr/events_session_select_subframe.https.html": [ + [ + "webxr/events_session_select_subframe.https.html", + {} + ] + ], + "webxr/getInputPose_handedness.https.html": [ + [ + "webxr/getInputPose_handedness.https.html", + {} + ] + ], + "webxr/getInputPose_pointer.https.html": [ + [ + "webxr/getInputPose_pointer.https.html", + {} + ] + ], "webxr/idlharness.https.window.js": [ [ "webxr/idlharness.https.window.html", @@ -298305,6 +298374,24 @@ {} ] ], + "webxr/xrInputSource_add_remove.https.html": [ + [ + "webxr/xrInputSource_add_remove.https.html", + {} + ] + ], + "webxr/xrInputSource_gamepad_disconnect.https.html": [ + [ + "webxr/xrInputSource_gamepad_disconnect.https.html", + {} + ] + ], + "webxr/xrInputSource_gamepad_input_registered.https.html": [ + [ + "webxr/xrInputSource_gamepad_input_registered.https.html", + {} + ] + ], "webxr/xrRay_constructor.https.html": [ [ "webxr/xrRay_constructor.https.html", @@ -298317,6 +298404,18 @@ {} ] ], + "webxr/xrReferenceSpace_originOffset.https.html": [ + [ + "webxr/xrReferenceSpace_originOffset.https.html", + {} + ] + ], + "webxr/xrReferenceSpace_originOffsetBounded.https.html": [ + [ + "webxr/xrReferenceSpace_originOffsetBounded.https.html", + {} + ] + ], "webxr/xrRigidTransform_constructor.https.html": [ [ "webxr/xrRigidTransform_constructor.https.html", @@ -298353,6 +298452,12 @@ {} ] ], + "webxr/xrSession_input_events_end.https.html": [ + [ + "webxr/xrSession_input_events_end.https.html", + {} + ] + ], "webxr/xrSession_prevent_multiple_exclusive.https.html": [ [ "webxr/xrSession_prevent_multiple_exclusive.https.html", @@ -340088,6 +340193,30 @@ "1ee23af200f6300bc3a86f0a1b843c875c8c92a9", "testharness" ], + "css/css-align/parsing/place-content-invalid.html": [ + "3fcd9a8dbed1b488ed16a40945fcb1e48c4fe6b8", + "testharness" + ], + "css/css-align/parsing/place-content-valid.html": [ + "a83aa4cec86db72adb691c8ad1bb061bb793267e", + "testharness" + ], + "css/css-align/parsing/place-items-invalid.html": [ + "9468d30e2e745ddc576b4bee18923d6943286222", + "testharness" + ], + "css/css-align/parsing/place-items-valid.html": [ + "72179bf2db0dcc7b76c8e0bbe5fe42ee8d81f9f3", + "testharness" + ], + "css/css-align/parsing/place-self-invalid.html": [ + "8a7a2ab187f9a34593d46da69d5d29ff62a7d716", + "testharness" + ], + "css/css-align/parsing/place-self-valid.html": [ + "36a8bd5026eab2870307c223028b499c02c92099", + "testharness" + ], "css/css-align/reference/baseline-of-scrollable-1-ref.html": [ "422660aff6b6b486ce3288469b4769e1497b071e", "support" @@ -411313,7 +411442,7 @@ "testharness" ], "element-timing/cross-origin-element.sub.html": [ - "40a97056c2bfba92485f627117f61cd56a563d0b", + "eef69a1d423a96cc8acd6b00a35e0c344ce7b7da", "testharness" ], "element-timing/cross-origin-iframe-element.sub.html": [ @@ -411329,7 +411458,7 @@ "testharness" ], "element-timing/image-TAO.sub.html": [ - "83a7a5ca0a21e9b4fd32192b019b6a15603748c8", + "032ae6b12198b76107ab3dfcc2ab3b7f92b13c00", "testharness" ], "element-timing/image-carousel.html": [ @@ -411429,7 +411558,7 @@ "support" ], "element-timing/resources/element-timing-helpers.js": [ - "6c0aec80960ebab60979986434272a96ecc6c674", + "f98f9b21134e334e46510bb419a12291d23817bc", "support" ], "element-timing/resources/iframe-with-square-sends-entry.html": [ @@ -439829,15 +439958,15 @@ "testharness" ], "largest-contentful-paint/cross-origin-image.sub.html": [ - "fd4844d16b3a3b150ad98747184e4c3bb25c2f81", + "6e86f13b9ccccf5cecd1ca4bd02b6d0cd2007845", "testharness" ], "largest-contentful-paint/observe-image.html": [ - "a1ecbceb503a31c99ff070ff06146014f8c3fdf9", + "4d56cc2d8386e41e220097836755d1936185b41c", "testharness" ], "largest-contentful-paint/observe-text.html": [ - "58897907365d3156e838ca9e0a65db289ea4cfec", + "7dbfbe52f3dadf01524025a80fdcce4b64a60e19", "testharness" ], "layout-instability/buffer-layout-shift.html": [ @@ -441253,7 +441382,7 @@ "testharness" ], "media-source/mediasource-util.js": [ - "bb701e705245828143b8b8be45ebec2cffaf9c11", + "6b11210052d774fb6222602a0e7cfc3f0f2eea58", "support" ], "media-source/mp3/sound_5.mp3": [ @@ -444708,23 +444837,23 @@ "0d9137dc6fb91b1499d922e01d6ad96049f5757b", "testharness" ], - "native-file-system/FileSystemBaseHandle-remove.tentative.window.js": [ + "native-file-system/FileSystemBaseHandle-remove.tentative.https.window.js": [ "a4eb2871104f924347f9ec8791a6381313a54483", "testharness" ], - "native-file-system/FileSystemDirectoryHandle-getDirectory.tentative.window.js": [ + "native-file-system/FileSystemDirectoryHandle-getDirectory.tentative.https.window.js": [ "2064fc46f05f5e30c14f77c14c5751b411d1c5e0", "testharness" ], - "native-file-system/FileSystemDirectoryHandle-getFile.tentative.window.js": [ + "native-file-system/FileSystemDirectoryHandle-getFile.tentative.https.window.js": [ "473cad4c9c36660584c07d7b53dfc68c7f734cb4", "testharness" ], - "native-file-system/FileSystemWriter.tentative.window.js": [ + "native-file-system/FileSystemWriter.tentative.https.window.js": [ "f2c2fc82866b83953e2783f8dc56ceaa0803b097", "testharness" ], - "native-file-system/NativeFileSystemWritableFileStream.tentative.window.js": [ + "native-file-system/NativeFileSystemWritableFileStream.tentative.https.window.js": [ "1dbcb2b136220954c777b2cc3b0197039cf730be", "testharness" ], @@ -463873,7 +464002,7 @@ "support" ], "resources/chromium/webxr-test.js": [ - "88227cbf12326838d416470cdd9757052d66020d", + "16a859a8ef36727cbbaf5ea55329593c27d6f972", "support" ], "resources/chromium/webxr-test.js.headers": [ @@ -469449,23 +469578,23 @@ "testharness" ], "streams/piping/abort.any-expected.txt": [ - "9be5a3523a6e6762fc88e1df2842a7eed0a5dd99", + "d85fa6d704d972c59296336120755ac134aef6a3", "support" ], "streams/piping/abort.any.js": [ - "5064533d4defdf22a6a04b4a3f47beceee417f58", + "65c458aa2941ff64677ec976e05de5be264dda60", "testharness" ], "streams/piping/abort.any.serviceworker-expected.txt": [ - "9be5a3523a6e6762fc88e1df2842a7eed0a5dd99", + "d85fa6d704d972c59296336120755ac134aef6a3", "support" ], "streams/piping/abort.any.sharedworker-expected.txt": [ - "9be5a3523a6e6762fc88e1df2842a7eed0a5dd99", + "d85fa6d704d972c59296336120755ac134aef6a3", "support" ], "streams/piping/abort.any.worker-expected.txt": [ - "9be5a3523a6e6762fc88e1df2842a7eed0a5dd99", + "d85fa6d704d972c59296336120755ac134aef6a3", "support" ], "streams/piping/close-propagation-backward.any.js": [ @@ -478557,7 +478686,7 @@ "support" ], "wake-lock/wakelock-abortsignal.https.any.js": [ - "7961674fea6e42f2a6a2b34b23be486e4685ccea", + "671852f3c946716cf6cfb6dac6249a30bec1f701", "testharness" ], "wake-lock/wakelock-abortsignal.https.any.worker-expected.txt": [ @@ -487840,10 +487969,34 @@ "cb7f47252d5746f61f1c9df2d981d47ef35940c5", "support" ], + "webxr/events_input_source_recreation.https.html": [ + "ab78d9d8fda41b821e26976351a2a77a123b524b", + "testharness" + ], + "webxr/events_input_sources_change.https.html": [ + "bc2b2a95e40b0d700e8d18c9dc953b84ec9fbcde", + "testharness" + ], "webxr/events_referenceSpace_reset.https.html": [ "f15ffc52a8845b7e2cdd6ddb4a9b7f06c1c3e5e0", "testharness" ], + "webxr/events_session_select.https.html": [ + "b74d5ea02dbefa51311d592fbf26019f06790ec2", + "testharness" + ], + "webxr/events_session_select_subframe.https.html": [ + "0e2c23424c0893b6a563c2aa2fbd999e50b1cfef", + "testharness" + ], + "webxr/getInputPose_handedness.https.html": [ + "5a310c6dd77274631d0ef9e751c6f195def9c3d3", + "testharness" + ], + "webxr/getInputPose_pointer.https.html": [ + "c8545999080892701858b425d8141ae0d3b3c469", + "testharness" + ], "webxr/idlharness.https.window-expected.txt": [ "aeb7fdc1ff81dfa78f5353dccab2b919eec7f438", "support" @@ -487861,19 +488014,15 @@ "support" ], "webxr/resources/webxr_test_asserts.js": [ - "2253ffc2d39d268142711fca7f81dda3fc6a318c", + "36524211d01980283124c0e2c7fcefd67a7b8b04", "support" ], "webxr/resources/webxr_test_constants.js": [ - "fd6d0fb184237e0092f499950e2562dddda695d7", + "a0b0e278a87401702aabf1fd375f3100f20dd7d7", "support" ], "webxr/resources/webxr_util.js": [ - "54a91c85c86a311b382c293c3e53fa92c0182b81", - "support" - ], - "webxr/resources/xr-test-asserts.js": [ - "2253ffc2d39d268142711fca7f81dda3fc6a318c", + "3a6a6c96fe0c419c1ff7ed7c5ab347cbc6978c13", "support" ], "webxr/webGLCanvasContext_create_xrcompatible.https.html": [ @@ -487893,7 +488042,7 @@ "testharness" ], "webxr/xrBoundedReferenceSpace_updates.https.html": [ - "e2920b176567774984e115b2998e89edf95362e6", + "2f84d6453672adfaa066a8c199b47333bdebb5d1", "testharness" ], "webxr/xrDevice_disconnect_ends.https.html": [ @@ -487933,13 +488082,25 @@ "testharness" ], "webxr/xrFrame_getPose.https.html": [ - "50e8abf145b98730f4859c5ccd2ded4eb38d57ba", + "2c791269a598ecc3d32f5dcfbd6c838795750959", "testharness" ], "webxr/xrFrame_lifetime.https.html": [ "c7af792c7bb45155c1a24e177ed3be05875872d6", "testharness" ], + "webxr/xrInputSource_add_remove.https.html": [ + "4c50670c70ec87754a777cc0bcfe8272e794ca07", + "testharness" + ], + "webxr/xrInputSource_gamepad_disconnect.https.html": [ + "a43bdaae0f924b6c89144e59aa43896349e2b0a0", + "testharness" + ], + "webxr/xrInputSource_gamepad_input_registered.https.html": [ + "f3e0c75a128781e275aaadbfcb46ebe81ae64cac", + "testharness" + ], "webxr/xrRay_constructor.https.html": [ "b955db4509c2f60facee570e6011a1441297e3dd", "testharness" @@ -487948,6 +488109,14 @@ "83a1050d6b169d28ad6b9d4417f06895e53bcfc6", "testharness" ], + "webxr/xrReferenceSpace_originOffset.https.html": [ + "b4e1c8e5c97cfaf8cc09ae718118c40986010ef1", + "testharness" + ], + "webxr/xrReferenceSpace_originOffsetBounded.https.html": [ + "f76c3c430e084709a73f6b419fba659667cd53a5", + "testharness" + ], "webxr/xrRigidTransform_constructor.https.html": [ "6a54fff808d93ac4423364b9c8b9d528a7e520c0", "testharness" @@ -487972,6 +488141,10 @@ "b91a5b977cab3d2fbb5c4989246f45b0c9b2024b", "testharness" ], + "webxr/xrSession_input_events_end.https.html": [ + "37e020605a7e88320c42e054f867f611955c5713", + "testharness" + ], "webxr/xrSession_prevent_multiple_exclusive.https.html": [ "cd140703784961911586f8b63cebd52b356facd5", "testharness" @@ -487985,7 +488158,7 @@ "testharness" ], "webxr/xrSession_requestAnimationFrame_getViewerPose.https.html": [ - "f8587796a229ec7f0aa5ab4fcde573737c2e7eca", + "bdb5edda566704c4d1434b328d3adbe46d3501ba", "testharness" ], "webxr/xrSession_requestReferenceSpace.https.html": [ @@ -487997,15 +488170,15 @@ "testharness" ], "webxr/xrStationaryReferenceSpace_floorlevel_updates.https.html": [ - "06a256698165e5bc592256a4ce24ddce12de74f8", + "aa3c1b85c5d8ef550b9a835d384c67f602e290e9", "testharness" ], "webxr/xrView_eyes.https.html": [ - "4ff22ff618d96d53c7a9e8cc573608bb0ea7919e", + "956edba98365d90eb180ad3c9697dae098bd25db", "testharness" ], "webxr/xrWebGLLayer_viewports.https.html": [ - "247e3b779d6105f4a9e57fd39c5dcf06ca737950", + "9553a445e43153b716d55c7f2be606dd548b808e", "testharness" ], "workers/META.yml": [
diff --git a/third_party/blink/web_tests/external/wpt/element-timing/image-src-change.html b/third_party/blink/web_tests/external/wpt/element-timing/image-src-change.html new file mode 100644 index 0000000..89b8e1d3 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/element-timing/image-src-change.html
@@ -0,0 +1,48 @@ +<!DOCTYPE HTML> +<meta charset=utf-8> +<title>Element Timing: src change triggers new entry</title> +<body> +<style> +body { + margin: 0; +} +</style> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/element-timing-helpers.js"></script> +<img src='resources/square100.png' elementtiming='my_image' id='my_id'/> +<script> + async_test(function (t) { + if (!window.PerformanceElementTiming) { + assert_unreached("PerformanceElementTiming is not implemented"); + } + let beforeRender = performance.now(); + const img = document.getElementById('my_id'); + let firstCallback = true; + const observer = new PerformanceObserver( + t.step_func(entryList => { + assert_equals(entryList.getEntries().length, 1); + const entry = entryList.getEntries()[0]; + if (firstCallback) { + const pathname = window.location.origin + '/element-timing/resources/square100.png'; + checkElement(entry, pathname, 'my_image', 'my_id', beforeRender, img); + checkRect(entry, [0, 100, 0, 100]); + checkNaturalSize(entry, 100, 100); + + // Set the src to trigger another entry. + img.src = '/images/black-rectangle.png'; + beforeRender = performance.now(); + firstCallback = false; + return; + } + const pathname = window.location.origin + '/images/black-rectangle.png'; + checkElement(entry, pathname, 'my_image', 'my_id', beforeRender, img); + checkRect(entry, [0, 100, 0, 50]); + checkNaturalSize(entry, 100, 50); + t.done(); + })); + observer.observe({type: 'element', buffered: true}); + }, 'Element Timing: changing src causes a new entry to be dispatched.'); +</script> + +</body>
diff --git a/third_party/blink/web_tests/external/wpt/event-timing/buffered-flag.html b/third_party/blink/web_tests/external/wpt/event-timing/buffered-flag.html new file mode 100644 index 0000000..8b56ad7 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/event-timing/buffered-flag.html
@@ -0,0 +1,45 @@ +<!DOCTYPE html> +<html> +<meta charset=utf-8 /> +<title>Event Timing: PerformanceObserver sees entries with buffered flag</title> +<button id='button'>Generate a 'click' event</button> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=/resources/testdriver.js></script> +<script src=/resources/testdriver-vendor.js></script> +<script src=resources/event-timing-test-utils.js></script> +<script> + let firstInputSeen = false; + let eventSeen = false; + async_test(t => { + const validateEntry = t.step_func(entry => { + if (entry.entryType === 'first-input') + firstInputSeen = true; + else if (entry.entryType === 'event') + eventSeen = true; + else + assert_unreached('Should only observe Event Timing entries!'); + }); + // First observer creates second in callback to ensure the entry has been dispatched by the time + // the second observer begins observing. + new PerformanceObserver((list, obs) => { + list.getEntries().forEach(validateEntry); + if (!firstInputSeen || !eventSeen) + return; + + obs.disconnect(); + firstInputSeen = false; + eventSeen = false; + // Second observer requires 'buffered: true' to see entries. + const bufferedObserver = new PerformanceObserver(entryList => { + entryList.getEntries().forEach(validateEntry); + if (firstInputSeen && eventSeen) + t.done(); + }); + bufferedObserver.observe({type: "event", buffered: true}); + bufferedObserver.observe({type: 'first-input', buffered: true}); + }).observe({entryTypes: ['event', 'first-input']}); + clickAndBlockMain('button'); + }, "PerformanceObserver with buffered flag sees previous Event Timing entries"); +</script> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/largest-contentful-paint/image-src-change.html b/third_party/blink/web_tests/external/wpt/largest-contentful-paint/image-src-change.html new file mode 100644 index 0000000..3e083625 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/largest-contentful-paint/image-src-change.html
@@ -0,0 +1,50 @@ +<!DOCTYPE HTML> +<meta charset=utf-8> +<title>Largest Contentful Paint: src change triggers new entry.</title> +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<img src='/images/blue.png' id='image_id'/> +<script> + async_test(function (t) { + if (!window.LargestContentfulPaint) { + assert_unreached("LargestContentfulPaint is not implemented"); + } + let beforeRender = performance.now(); + let firstCallback = true; + const observer = new PerformanceObserver( + t.step_func_done(function(entryList) { + assert_equals(entryList.getEntries().length, 1); + const entry = entryList.getEntries()[0]; + assert_equals(entry.entryType, 'largest-contentful-paint'); + assert_greater_than_equal(entry.renderTime, beforeRender, + 'The rendering timestamp should occur after script starts running.'); + assert_greater_than_equal(performance.now(), entry.renderTime, + 'The rendering timestamp should occur before the entry is dispatched to the observer.'); + assert_equals(entry.startTime, 0); + assert_equals(entry.duration, 0); + if (firstCallback) { + // blue.png is 133 x 106. + assert_equals(entry.size, 14098); + assert_equals(entry.id, 'image_id'); + const pathname = window.location.origin + '/images/blue.png'; + assert_equals(entry.url, pathname); + + // Set the src to trigger another entry. + const img = document.getElementById('image_id'); + img.src = '/images/black-rectangle.png'; + beforeRender = performance.now(); + firstCallback =false; + return; + } + // black-rectangle.png is 100 x 50. + assert_equals(entry.size, 5000); + assert_equals(entry.id, 'image_id'); + const pathname = window.location.origin + '/images/black-rectangle.png'; + assert_equals(entry.url, pathname); + }) + ); + observer.observe({type: 'largest-contentful-paint', buffered: true}); + }, 'Largest Contentful Paint: changing src causes a new entry to be dispatched.'); +</script> +</body>
diff --git a/third_party/blink/web_tests/external/wpt/layout-instability/buffered-flag.html b/third_party/blink/web_tests/external/wpt/layout-instability/buffered-flag.html new file mode 100644 index 0000000..6a8c937e --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/layout-instability/buffered-flag.html
@@ -0,0 +1,32 @@ +<!DOCTYPE HTML> +<meta charset=utf-8> +<title>Layout Instability: PerformanceObserver sees entries with buffered flag</title> +<body> +<style> +#myDiv { position: relative; width: 300px; height: 100px; } +</style> +<div id='myDiv'></div> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +async_test(t => { + const startTime = performance.now(); + // First observer creates second in callback to ensure the entry has been dispatched by the time + // the second observer begins observing. + new PerformanceObserver(() => { + const endTime = performance.now(); + // Second observer requires 'buffered: true' to see entries. + new PerformanceObserver(t.step_func_done(list => { + assert_equals(list.getEntries().length, 1); + const entry = list.getEntries()[0]; + assert_equals(entry.entryType, "layout-shift"); + assert_greater_than_equal(entry.startTime, startTime) + assert_less_than_equal(entry.startTime, endTime) + assert_equals(entry.duration, 0.0); + })).observe({'type': 'layout-shift', buffered: true}); + }).observe({type: 'layout-shift'}); + // Modify the position of the div to cause a layout-shift entry. + document.getElementById('myDiv').style = "top: 60px"; +}, 'PerformanceObserver with buffered flag sees previous layout-shift entry.'); +</script> +</body>
diff --git a/third_party/blink/web_tests/external/wpt/media-source/mediasource-util.js b/third_party/blink/web_tests/external/wpt/media-source/mediasource-util.js index bb701e7..6b11210 100644 --- a/third_party/blink/web_tests/external/wpt/media-source/mediasource-util.js +++ b/third_party/blink/web_tests/external/wpt/media-source/mediasource-util.js
@@ -323,7 +323,9 @@ test.done = function() { if (test.status == test.PASS) { - assert_false(test.eventExpectations_.expectingEvents(), "No pending event expectations."); + test.step(function() { + assert_false(test.eventExpectations_.expectingEvents(), "No pending event expectations."); + }); } oldTestDone(); };
diff --git a/third_party/blink/web_tests/external/wpt/std-toast/resources/helpers.js b/third_party/blink/web_tests/external/wpt/std-toast/resources/helpers.js index 62deb42..256f0c8 100644 --- a/third_party/blink/web_tests/external/wpt/std-toast/resources/helpers.js +++ b/third_party/blink/web_tests/external/wpt/std-toast/resources/helpers.js
@@ -70,6 +70,20 @@ assert_equals(action, toast.querySelector('button')); }; +export const assertComputedStyleMapsEqual = (element1, element2) => { + assert_greater_than(element1.computedStyleMap().size, 0); + for (const [styleProperty, baseStyleValues] of element1.computedStyleMap()) { + const refStyleValues = element2.computedStyleMap().getAll(styleProperty); + assert_equals(baseStyleValues.length, refStyleValues.length, `${styleProperty} length`); + + for (let i = 0; i < baseStyleValues.length; ++i) { + const baseStyleValue = baseStyleValues[i]; + const refStyleValue = refStyleValues[i]; + assert_equals(baseStyleValue.toString(), refStyleValue.toString(), `diff at value ${styleProperty}`); + } + } +} + export class EventCollector { events = [];
diff --git a/third_party/blink/web_tests/external/wpt/std-toast/styles.html b/third_party/blink/web_tests/external/wpt/std-toast/styles.html new file mode 100644 index 0000000..98e6723 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/std-toast/styles.html
@@ -0,0 +1,64 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Toast: style tests</title> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<main> +</main> + +<script type="module"> +import { testToastElement, assertComputedStyleMapsEqual } from './resources/helpers.js'; + +testToastElement((toast) => { + toast.open = true; + + const mockToast = document.createElement('span'); + mockToast.id = 'mock-toast-open'; + mockToast.textContent = 'Message'; + + const mockStyler = document.createElement('style'); + mockStyler.textContent = ` + #mock-toast-open { + position: fixed; + bottom: 1em; + right: 1em; + border: solid; + padding: 1em; + background: white; + color: black; + z-index: 1; + }`; + + document.querySelector('main').appendChild(mockStyler); + document.querySelector('main').appendChild(mockToast); + + assertComputedStyleMapsEqual(toast, mockToast); +}, 'the computed style map of an open unstyled toast is the same as a span given toast defaults'); + +testToastElement((toast) => { + const mockToast = document.createElement('span'); + mockToast.id = 'mock-toast-hidden'; + mockToast.textContent = 'Message'; + + const mockStyler = document.createElement('style'); + mockStyler.textContent = ` + #mock-toast-hidden { + position: fixed; + bottom: 1em; + right: 1em; + border: solid; + padding: 1em; + background: white; + color: black; + z-index: 1; + display: none; + }`; + + document.querySelector('main').appendChild(mockStyler); + document.querySelector('main').appendChild(mockToast); + + assertComputedStyleMapsEqual(toast, mockToast); +}, 'the computed style map of a closed unstyled toast is the same as a span given toast defaults'); +</script> \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/streams/piping/abort.any-expected.txt b/third_party/blink/web_tests/external/wpt/streams/piping/abort.any-expected.txt index 9be5a352..d85fa6d 100644 --- a/third_party/blink/web_tests/external/wpt/streams/piping/abort.any-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/piping/abort.any-expected.txt
@@ -8,6 +8,7 @@ FAIL all the AbortError objects should be the same object promise_test: Unhandled rejection with value: "failed to abort" FAIL preventCancel should prevent canceling the readable assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object FAIL preventAbort should prevent aborting the readable assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object +FAIL preventCancel and preventAbort should prevent canceling the readable and aborting the readable assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object FAIL abort should prevent further reads assert_unreached: Should have rejected: pipeTo should reject Reached unreachable code FAIL all pending writes should complete on abort assert_unreached: Should have rejected: pipeTo should reject Reached unreachable code FAIL a rejection from underlyingSource.cancel() should be returned by pipeTo() assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object
diff --git a/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.js b/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.js index 5064533d..65c458a 100644 --- a/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.js +++ b/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.js
@@ -101,6 +101,21 @@ }, 'preventAbort should prevent aborting the readable'); promise_test(t => { + const rs = recordingReadableStream(errorOnPull, hwm0); + const ws = recordingWritableStream(); + const abortController = new AbortController(); + const signal = abortController.signal; + abortController.abort(); + return promise_rejects(t, 'AbortError', rs.pipeTo(ws, { signal, preventCancel: true, preventAbort: true }), + 'pipeTo should reject') + .then(() => { + assert_equals(rs.events.length, 0, 'cancel should not be called'); + assert_equals(ws.events.length, 0, 'writable should not have been aborted'); + return ws.getWriter().ready; + }); +}, 'preventCancel and preventAbort should prevent canceling the readable and aborting the readable'); + +promise_test(t => { const rs = new ReadableStream({ start(controller) { controller.enqueue('a');
diff --git a/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.serviceworker-expected.txt index 9be5a352..d85fa6d 100644 --- a/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.serviceworker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.serviceworker-expected.txt
@@ -8,6 +8,7 @@ FAIL all the AbortError objects should be the same object promise_test: Unhandled rejection with value: "failed to abort" FAIL preventCancel should prevent canceling the readable assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object FAIL preventAbort should prevent aborting the readable assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object +FAIL preventCancel and preventAbort should prevent canceling the readable and aborting the readable assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object FAIL abort should prevent further reads assert_unreached: Should have rejected: pipeTo should reject Reached unreachable code FAIL all pending writes should complete on abort assert_unreached: Should have rejected: pipeTo should reject Reached unreachable code FAIL a rejection from underlyingSource.cancel() should be returned by pipeTo() assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object
diff --git a/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.sharedworker-expected.txt index 9be5a352..d85fa6d 100644 --- a/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.sharedworker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.sharedworker-expected.txt
@@ -8,6 +8,7 @@ FAIL all the AbortError objects should be the same object promise_test: Unhandled rejection with value: "failed to abort" FAIL preventCancel should prevent canceling the readable assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object FAIL preventAbort should prevent aborting the readable assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object +FAIL preventCancel and preventAbort should prevent canceling the readable and aborting the readable assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object FAIL abort should prevent further reads assert_unreached: Should have rejected: pipeTo should reject Reached unreachable code FAIL all pending writes should complete on abort assert_unreached: Should have rejected: pipeTo should reject Reached unreachable code FAIL a rejection from underlyingSource.cancel() should be returned by pipeTo() assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object
diff --git a/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.worker-expected.txt index 9be5a352..d85fa6d 100644 --- a/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/streams/piping/abort.any.worker-expected.txt
@@ -8,6 +8,7 @@ FAIL all the AbortError objects should be the same object promise_test: Unhandled rejection with value: "failed to abort" FAIL preventCancel should prevent canceling the readable assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object FAIL preventAbort should prevent aborting the readable assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object +FAIL preventCancel and preventAbort should prevent canceling the readable and aborting the readable assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object FAIL abort should prevent further reads assert_unreached: Should have rejected: pipeTo should reject Reached unreachable code FAIL all pending writes should complete on abort assert_unreached: Should have rejected: pipeTo should reject Reached unreachable code FAIL a rejection from underlyingSource.cancel() should be returned by pipeTo() assert_throws: pipeTo should reject function "function() { throw e }" threw "failed to abort" with type "string", not an object
diff --git a/third_party/blink/web_tests/http/tests/devtools/a11y-axe-core/audits-start-view-a11y-test-expected.txt b/third_party/blink/web_tests/http/tests/devtools/a11y-axe-core/audits-start-view-a11y-test-expected.txt new file mode 100644 index 0000000..27578c0b --- /dev/null +++ b/third_party/blink/web_tests/http/tests/devtools/a11y-axe-core/audits-start-view-a11y-test-expected.txt
@@ -0,0 +1,5 @@ +Tests accessibility in the audits start view using the axe-core linter. + +aXe violations: [] + +
diff --git a/third_party/blink/web_tests/http/tests/devtools/a11y-axe-core/audits-start-view-a11y-test.js b/third_party/blink/web_tests/http/tests/devtools/a11y-axe-core/audits-start-view-a11y-test.js new file mode 100644 index 0000000..3c71ba8 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/devtools/a11y-axe-core/audits-start-view-a11y-test.js
@@ -0,0 +1,12 @@ +// 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. + +(async function () { + TestRunner.addResult('Tests accessibility in the audits start view using the axe-core linter.\n'); + await TestRunner.loadModule('axe_core_test_runner'); + await TestRunner.loadModule('audits_test_runner'); + await TestRunner.showPanel('audits'); + await AxeCoreTestRunner.runValidation(AuditsTestRunner.getContainerElement()); + TestRunner.completeTest(); +})();
diff --git a/third_party/blink/web_tests/http/tests/devtools/audits/audits-flags-run-expected.txt b/third_party/blink/web_tests/http/tests/devtools/audits/audits-flags-run-expected.txt index bc3824a..f02153e0 100644 --- a/third_party/blink/web_tests/http/tests/devtools/audits/audits-flags-run-expected.txt +++ b/third_party/blink/web_tests/http/tests/devtools/audits/audits-flags-run-expected.txt
@@ -11,7 +11,7 @@ Run audits: enabled visible =============== Lighthouse Results =============== -emulatedFormFactor: desktop +emulatedFormFactor: none disableStorageReset: false throttlingMethod: provided
diff --git a/third_party/blink/web_tests/http/tests/devtools/audits/audits-successful-run-expected.txt b/third_party/blink/web_tests/http/tests/devtools/audits/audits-successful-run-expected.txt index 42879893..8411fb5 100644 --- a/third_party/blink/web_tests/http/tests/devtools/audits/audits-successful-run-expected.txt +++ b/third_party/blink/web_tests/http/tests/devtools/audits/audits-successful-run-expected.txt
@@ -298,7 +298,7 @@ bypass: notApplicable canonical: notApplicable color-contrast: notApplicable -content-width: fail +content-width: notApplicable critical-request-chains: notApplicable custom-controls-labels: manual custom-controls-roles: manual @@ -321,7 +321,7 @@ focus-traps: manual focusable-controls: manual font-display: pass -font-size: fail +font-size: notApplicable frame-title: notApplicable geolocation-on-start: pass heading-levels: manual @@ -381,7 +381,7 @@ splash-screen: fail structured-data: manual tabindex: notApplicable -tap-targets: fail +tap-targets: notApplicable td-headers-attr: notApplicable th-has-data-cells: notApplicable themed-omnibox: fail
diff --git a/third_party/closure_compiler/closure_args.gni b/third_party/closure_compiler/closure_args.gni index eac6aa9..20f16556 100644 --- a/third_party/closure_compiler/closure_args.gni +++ b/third_party/closure_compiler/closure_args.gni
@@ -7,11 +7,6 @@ "extra_annotation_name=attribute", "extra_annotation_name=demo", "extra_annotation_name=element", - "extra_annotation_name=group", - "extra_annotation_name=hero", - "extra_annotation_name=homepage", - "extra_annotation_name=status", - "extra_annotation_name=submodule", ] strict_error_checking_closure_args = [
diff --git a/third_party/errorprone/OWNERS b/third_party/errorprone/OWNERS index e4f73890..24368e88 100644 --- a/third_party/errorprone/OWNERS +++ b/third_party/errorprone/OWNERS
@@ -2,3 +2,5 @@ jbudorick@chromium.org nyquist@chromium.org wnwen@chromium.org +# COMPONENT: Test>Android +# TEAM: chromium-reviews@chromium.org
diff --git a/third_party/fontconfig/OWNERS b/third_party/fontconfig/OWNERS index 17f42ca..280b07e 100644 --- a/third_party/fontconfig/OWNERS +++ b/third_party/fontconfig/OWNERS
@@ -1,3 +1,4 @@ spang@chromium.org dnicoara@chromium.org thomasanderson@chromium.org +# COMPONENT: Blink>Fonts
diff --git a/third_party/gif_player/OWNERS b/third_party/gif_player/OWNERS index d3930d9..cfc797d 100644 --- a/third_party/gif_player/OWNERS +++ b/third_party/gif_player/OWNERS
@@ -1 +1,3 @@ tedchoc@chromium.org +# COMPONENT: UI>Browser>NewTabPage +# OS: Android
diff --git a/third_party/khronos/EGL/OWNERS b/third_party/khronos/EGL/OWNERS new file mode 100644 index 0000000..f0c3f3f6 --- /dev/null +++ b/third_party/khronos/EGL/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: Internals>GPU>Internals
diff --git a/third_party/khronos/GLES2/OWNERS b/third_party/khronos/GLES2/OWNERS new file mode 100644 index 0000000..f0c3f3f6 --- /dev/null +++ b/third_party/khronos/GLES2/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: Internals>GPU>Internals
diff --git a/third_party/khronos/GLES3/OWNERS b/third_party/khronos/GLES3/OWNERS new file mode 100644 index 0000000..f0c3f3f6 --- /dev/null +++ b/third_party/khronos/GLES3/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: Internals>GPU>Internals
diff --git a/third_party/khronos/KHR/OWNERS b/third_party/khronos/KHR/OWNERS new file mode 100644 index 0000000..f0c3f3f6 --- /dev/null +++ b/third_party/khronos/KHR/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: Internals>GPU>Internals
diff --git a/third_party/khronos/OWNERS b/third_party/khronos/OWNERS index b66635a..bcb2ab2 100644 --- a/third_party/khronos/OWNERS +++ b/third_party/khronos/OWNERS
@@ -1,3 +1,5 @@ kbr@chromium.org piman@chromium.org zmo@chromium.org +# COMPONENT: Internals>GPU>Internals +# TEAM: graphics-dev@chromium.org
diff --git a/third_party/khronos/noninclude/OWNERS b/third_party/khronos/noninclude/OWNERS new file mode 100644 index 0000000..f0c3f3f6 --- /dev/null +++ b/third_party/khronos/noninclude/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: Internals>GPU>Internals
diff --git a/third_party/libvpx/OWNERS b/third_party/libvpx/OWNERS index 6524678..94c24159 100644 --- a/third_party/libvpx/OWNERS +++ b/third_party/libvpx/OWNERS
@@ -2,3 +2,4 @@ johannkoenig@google.com jzern@chromium.org jzern@google.com +# COMPONENT: Internals>Media>Video
diff --git a/third_party/markdown/OWNERS b/third_party/markdown/OWNERS index 3977817..8a94c5d 100644 --- a/third_party/markdown/OWNERS +++ b/third_party/markdown/OWNERS
@@ -1,2 +1,3 @@ hukun@chromium.org rockot@google.com +# COMPONENT: Tools
diff --git a/third_party/mesa_headers/OWNERS b/third_party/mesa_headers/OWNERS index cba5084..3861233 100644 --- a/third_party/mesa_headers/OWNERS +++ b/third_party/mesa_headers/OWNERS
@@ -3,3 +3,4 @@ senorblanco@chromium.org piman@chromium.org +# COMPONENT: Internals>GPU>Internals
diff --git a/third_party/motemplate/OWNERS b/third_party/motemplate/OWNERS index e06924a..03dd10d 100644 --- a/third_party/motemplate/OWNERS +++ b/third_party/motemplate/OWNERS
@@ -1 +1,2 @@ rockot@google.com +# COMPONENT: Internals
diff --git a/third_party/nvml/OWNERS b/third_party/nvml/OWNERS index 84f8217..18ed4a5 100644 --- a/third_party/nvml/OWNERS +++ b/third_party/nvml/OWNERS
@@ -1,2 +1,4 @@ kbr@chromium.org zmo@chromium.org +# COMPONENT: Internals>GPU>Internals +# TEAM: graphics-dev@chromium.org
diff --git a/third_party/simplejson/OWNERS b/third_party/simplejson/OWNERS index e06924a..7e98ba1 100644 --- a/third_party/simplejson/OWNERS +++ b/third_party/simplejson/OWNERS
@@ -1 +1,2 @@ rockot@google.com +# COMPONENT: Tools
diff --git a/third_party/sqlite/BUILD.gn b/third_party/sqlite/BUILD.gn index a766730..c69fca8 100644 --- a/third_party/sqlite/BUILD.gn +++ b/third_party/sqlite/BUILD.gn
@@ -20,6 +20,10 @@ # https://www.sqlite.org/compile.html config("chromium_sqlite3_compile_options") { defines = [ + # Skip writing transaction rollback journals on f2fs. + # f2fs tends to be used on Android, and may be used on ChromeOS. + "SQLITE_ENABLE_BATCH_ATOMIC_WRITE", + "SQLITE_ENABLE_FTS3", # New unicode61 tokenizer with built-in tables.
diff --git a/tools/mb/mb.py b/tools/mb/mb.py index 77b12f3..db31cb4 100755 --- a/tools/mb/mb.py +++ b/tools/mb/mb.py
@@ -123,6 +123,8 @@ subp.add_argument('output_path', help='path to a file containing the output arguments ' 'as a JSON object.') + subp.add_argument('--json_output', + help='Write errors to json.output') subp.set_defaults(func=self.CmdAnalyze) subp = subps.add_parser('export', @@ -141,6 +143,8 @@ subp.add_argument('--swarming-targets-file', help='save runtime dependencies for targets listed ' 'in file.') + subp.add_argument('--json_output', + help='Write errors to json.output') subp.add_argument('path', help='path to generate build into') subp.set_defaults(func=self.CmdGen) @@ -828,8 +832,11 @@ self.WriteFile(gn_runtime_deps_path, '\n'.join(labels) + '\n') cmd.append('--runtime-deps-list-file=%s' % gn_runtime_deps_path) - ret, _, _ = self.Run(cmd) + ret, output, _ = self.Run(cmd) if ret: + if getattr(self.args, 'json_output', None) and output: + # write errors to json.output + self.WriteJSON({'output': output}, self.args.json_output) # If `gn gen` failed, we should exit early rather than trying to # generate isolates. Run() will have already logged any error output. self.Print('GN gen failed: %d' % ret) @@ -1554,6 +1561,7 @@ if ret: self.Print(' -> returned %d' % ret) if out: + # This is the error seen on the logs self.Print(out, end='') if err: self.Print(err, end='', file=sys.stderr)
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index cd80e899..f0d30d3 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -202,12 +202,11 @@ 'chromium.fyi': { 'Afl Upload Linux ASan': 'afl_asan_shared_release_bot', - 'Android Builder (dbg) Goma Canary': 'android_debug_static_bot_vrdata', - 'Android Builder (dbg) Goma Latest Client': 'android_debug_static_bot_vrdata', - + 'Android Builder (dbg) Goma Canary': 'android_without_codecs_debug_bot', + 'Android Builder (dbg) Goma Latest Client': 'android_without_codecs_debug_bot', 'android-code-coverage': 'android_debug_static_bot_arm64_minimal_symbols_coverage', - 'chromeos-amd64-generic-rel-goma-canary': 'cros_chrome_sdk', - 'chromeos-amd64-generic-rel-goma-latest': 'cros_chrome_sdk', + 'chromeos-amd64-generic-rel-goma-canary': 'cros_chrome_sdk_headless_ozone', + 'chromeos-amd64-generic-rel-goma-latest': 'cros_chrome_sdk_headless_ozone', 'chromeos-amd64-generic-rel-vm-tests': 'cros_chrome_sdk_headless_ozone_dcheck_always_on', 'chromeos-kevin-rel-hw-tests': 'cros_chrome_sdk_headless_ozone', 'chromeos-vm-code-coverage': 'cros_chrome_sdk_headless_ozone_coverage', @@ -216,8 +215,8 @@ 'linux-fieldtrial-rel': 'release_bot_minimal_symbols', 'linux-wpt-fyi-rel': 'release_bot_minimal_symbols', - 'Linux Builder Goma Canary': 'release_bot', - 'Linux Builder Goma Latest Client': 'release_bot', + 'Linux Builder Goma Canary': 'gpu_tests_release_bot', + 'Linux Builder Goma Latest Client': 'gpu_tests_release_bot', 'Linux x64 Goma Canary (clobber)': 'release_bot', 'Linux x64 Goma Canary LocalOutputCache': 'release_bot', 'Linux x64 Goma Latest Client (clobber)': 'release_bot', @@ -225,10 +224,10 @@ 'mac-hermetic-upgrade-rel': 'release_bot', - 'Mac Builder (dbg) Goma Canary (clobber)': 'debug_bot', - 'Mac Builder (dbg) Goma Canary': 'debug_bot', - 'Mac Builder (dbg) Goma Latest Client (clobber)': 'debug_bot', - 'Mac Builder (dbg) Goma Latest Client': 'debug_bot', + 'Mac Builder (dbg) Goma Canary (clobber)': 'gpu_tests_debug_bot', + 'Mac Builder (dbg) Goma Canary': 'gpu_tests_debug_bot', + 'Mac Builder (dbg) Goma Latest Client (clobber)': 'gpu_tests_debug_bot', + 'Mac Builder (dbg) Goma Latest Client': 'gpu_tests_debug_bot', 'Mac Builder Goma Canary': 'gpu_tests_release_bot_minimal_symbols', 'Mac Builder Goma Latest Client': 'gpu_tests_release_bot_minimal_symbols', 'Mac Goma Canary (clobber)': 'release_bot_mac_strip_minimal_symbols', @@ -236,18 +235,19 @@ 'Mac Goma Latest Client (clobber)': 'release_bot_mac_strip_minimal_symbols', 'Mac Goma Latest Client LocalOutputCache': 'release_bot_mac_strip_minimal_symbols', - 'Win7 Builder (dbg) Goma Canary': 'debug_trybot_x86', - 'Win7 Builder (dbg) Goma Latest Client': 'debug_trybot_x86', - 'Win7 Builder Goma Canary': 'release_bot_x86_minimal_symbols', - 'Win7 Builder Goma Latest Client': 'release_bot_x86_minimal_symbols', - 'Win Builder (dbg) Goma Canary': 'debug_bot_x86', - 'Win Builder (dbg) Goma Latest Client': 'debug_bot_x86', - 'Win Builder Goma Canary': 'release_bot_x86_minimal_symbols', - 'Win Builder Goma Latest Client': 'release_bot_x86_minimal_symbols', - 'Win cl.exe Goma Canary LocalOutputCache': 'release_bot_x86_minimal_symbols_no_clang', - 'Win cl.exe Goma Latest Client LocalOutputCache': 'release_bot_x86_minimal_symbols_no_clang', - 'Win Goma Canary LocalOutputCache': 'release_bot_x86_minimal_symbols', - 'Win Goma Latest Client LocalOutputCache': 'release_bot_x86_minimal_symbols', + 'Win7 Builder (dbg) Goma Canary': 'gpu_tests_debug_bot_x86', + 'Win7 Builder (dbg) Goma Latest Client': 'gpu_tests_debug_bot_x86', + 'Win7 Builder Goma Canary': 'gpu_tests_release_bot_x86_minimal_symbols', + 'Win7 Builder Goma Latest Client': 'gpu_tests_release_bot_x86_minimal_symbols', + 'Win Builder (dbg) Goma Canary': 'gpu_tests_debug_bot_x86', + 'Win Builder (dbg) Goma Latest Client': 'gpu_tests_debug_bot_x86', + 'Win Builder Goma Canary': 'gpu_tests_release_bot_x86_minimal_symbols', + 'Win Builder Goma Latest Client': 'gpu_tests_release_bot_x86_minimal_symbols', + # TODO(yyanagisawa): deprecate cl.exe. + 'Win cl.exe Goma Canary LocalOutputCache': 'release_bot_x86_minimal_symbols_enable_archive_compression_no_clang', + 'Win cl.exe Goma Latest Client LocalOutputCache': 'release_bot_x86_minimal_symbols_enable_archive_compression_no_clang', + 'Win Goma Canary LocalOutputCache': 'release_bot_x86_minimal_symbols_enable_archive_compression', + 'Win Goma Latest Client LocalOutputCache': 'release_bot_x86_minimal_symbols_enable_archive_compression', 'WinMSVC64 Goma Canary': 'win_msvc_release_bot', 'WinMSVC64 Goma Latest Client': 'win_msvc_release_bot', @@ -987,10 +987,6 @@ 'android', 'debug_static_bot', ], - 'android_debug_static_bot_vrdata': [ - 'android', 'debug_static_bot', 'include_vr_data', - ], - 'android_debug_static_bot_arm64': [ 'android', 'debug_static_bot', 'arm64', ], @@ -1792,6 +1788,11 @@ 'release_bot', 'x86', 'minimal_symbols', 'enable_archive_compression' ], + 'release_bot_x86_minimal_symbols_enable_archive_compression_no_clang': [ + 'no_clang', + 'release_bot', 'x86', 'minimal_symbols', 'enable_archive_compression', + ], + 'release_bot_x86_minimal_symbols_no_com_init_hooks_with_codecs': [ 'release_bot', 'x86', 'minimal_symbols', 'no_com_init_hooks', 'chrome_with_codecs' ], @@ -1836,10 +1837,6 @@ 'release_trybot', 'x86', ], - 'release_bot_x86_minimal_symbols_no_clang': [ - 'release_bot', 'x86', 'minimal_symbols', 'no_clang', - ], - 'release_bot_x86_minimal_symbols_no_clang_cxx11': [ 'release_bot', 'x86', 'minimal_symbols', 'no_clang', 'use_cxx11', ], @@ -2163,10 +2160,6 @@ 'mixins': ['disable_nacl'], }, - 'include_vr_data': { - 'gn_args': 'include_vr_data=true', - }, - 'incremental': { 'gn_args': 'disable_incremental_isolated_processes=true incremental_apk_by_default=true', },
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index 23dc95a..f4cd2b4 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -889,6 +889,7 @@ <action name="Accel_Restore_Tab"> <owner>mpearson@chromium.org</owner> <owner>chrisha@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> Emitted when the Ash window manager hotkey handler handles the "Ctrl-Shift-T" shortcut that causes the most recently closed tab @@ -909,6 +910,9 @@ regardless of the number of tabs. This is not emitted during session restore that occurs as part of startup. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> @@ -1683,8 +1687,12 @@ <action name="Android.Download.InfoBar.LinkClicked.OpenDownload"> <owner>shaktisahu@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> User tapped on the infobar link to open the downloaded file. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> @@ -1763,8 +1771,12 @@ <action name="Android.DownloadManager.List.View.Action"> <owner>dtrainor@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> User triggered actions on an offline item in download home. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> @@ -1894,24 +1906,36 @@ <action name="Android.HistoryPage.OpenItem"> <owner>twellington@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> User opened an item on the native Android history page. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="Android.HistoryPage.OpenSelected"> <owner>twellington@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> User opened one or more selected items in new tabs on the native Android history page. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="Android.HistoryPage.OpenSelectedIncognito"> <owner>twellington@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> User opened one or more selected items in new incognito tabs on the native Android history page. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> @@ -1954,24 +1978,36 @@ <action name="Android.HistoryPage.Search.OpenItem"> <owner>twellington@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> User opened an item while searching on the native Android history page. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="Android.HistoryPage.Search.OpenSelected"> <owner>twellington@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> User opened one or more selected items in new tabs while searching on the native Android history page. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="Android.HistoryPage.Search.OpenSelectedIncognito"> <owner>twellington@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> User opened one or more selected items in new incognito tabs while searching on the native Android history page. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> @@ -3288,29 +3324,41 @@ <action name="BookmarkBar_ContextMenu_OpenAll"> <owner>dfried@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> The user opened one or more bookmarks in the Bookmarks Bar using the context menu. Distinguished from launching from e.g. the application menu or the bookmark manager. This is for opening bookmarks normally (in the same window). + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="BookmarkBar_ContextMenu_OpenAllIncognito"> <owner>dfried@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> The user opened one or more bookmarks in the Bookmarks Bar using the context menu. Distinguished from launching from e.g. the application menu or the bookmark manager. This is for opening bookmarks in an incognito window. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="BookmarkBar_ContextMenu_OpenAllInNewWindow"> <owner>dfried@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> The user opened one or more bookmarks in the Bookmarks Bar using the context menu. Distinguished from launching from e.g. the application menu or the bookmark manager. This is for opening bookmarks in a new window. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> @@ -4229,11 +4277,15 @@ </action> <action name="ClickedBookmarkBarURLButton"> + <owner>chrome-analysis-team@google.com</owner> <owner>dfried@chromium.org</owner> <description> User clicks a bookmark to open it, either in the bookmarks bar or in a bookmarks bar folder or overflow menu. (Changed in M75 to include non-top-level bookmarks.) + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> @@ -5484,13 +5536,18 @@ <action name="Downloads_OpenUrlOfDownloadedItem"> <owner>xingliu@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> Records clicks on the URL of download items in chrome://downloads page. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="Downloads_OpenUrlOfDownloadedItemFromContextMenu"> <owner>xingliu@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> Records open a URL of download items in chrome://downloads page from context menu. @@ -5498,6 +5555,9 @@ As of M-76, "Save link as...", "Copy link address", and "Copy link text" context menu actions no longer log this action (this was accidentally the case before M-76). + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> @@ -5579,9 +5639,13 @@ <action name="ExploreSites.ContextMenu"> <owner>chili@chromium.org</owner> <owner>dewittj@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> Android: user used the context menu on a suggested item in the explore sites native page UI. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> @@ -6249,13 +6313,30 @@ </action> <action name="HistoryPage_EntryLinkClick"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> - <description>Please enter the description of this user action.</description> + <owner>mpearson@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> + <description> + On desktop, user clicked a link to a URL from history on the + chrome://history page to navigate to the URL. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. + </description> </action> <action name="HistoryPage_EntryLinkRightClick"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> - <description>Please enter the description of this user action.</description> + <owner>mpearson@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> + <description> + On desktop, user right-clicked a link to a URL from history on the + chrome://history page. This causes the context menu to be displayed. + Sometimes the user will select an "open in" action, which would + cause a navigation. Selections such as "save link as" or + "copy link address" will not cause a navigation. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. + </description> </action> <action name="HistoryPage_EntryMenuRemoveFromHistory"> @@ -11315,10 +11396,14 @@ <action name="MobileBookmarkManagerEntryOpened"> <owner>ianwen@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> A bookmark was opened from the bookmark manager. Bookmarks opened directly from the NTP will not be counted. Instead those will be counted in the NewTabPage.ContentSuggestions.* histograms. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> @@ -11745,13 +11830,25 @@ <action name="MobileHistoryPage_EntryLinkOpenNewIncognitoTab"> <owner>sczs@chromium.org</owner> <owner>rohitrao@chromium.org</owner> - <description>User opened a History entry in a new Incognito Tab.</description> + <owner>chrome-analysis-team@google.com</owner> + <description> + User opened a History entry in a new Incognito Tab. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. + </description> </action> <action name="MobileHistoryPage_EntryLinkOpenNewTab"> <owner>sczs@chromium.org</owner> <owner>rohitrao@chromium.org</owner> - <description>User opened a History entry in a new Tab.</description> + <owner>chrome-analysis-team@google.com</owner> + <description> + User opened a History entry in a new Tab. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. + </description> </action> <action name="MobileMenuAddToBookmarks"> @@ -12561,7 +12658,13 @@ <action name="MobileReadingListOpen"> <owner>gambard@chromium.org</owner> - <description>User opened a ReadingList entry.</description> + <owner>chrome-analysis-team@google.com</owner> + <description> + User opened a ReadingList entry. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. + </description> </action> <action name="MobileReceivedExternalIntent"> @@ -12594,26 +12697,38 @@ <action name="MobileRecentTabManagerOpenAllTabsFromOtherDevice"> <owner>sczs@chromium.org</owner> <owner>edchin@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> The user has selected to Open all tabs from other device in Recent Tabs. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="MobileRecentTabManagerRecentTabOpened"> <owner>finkm@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> A recently closed tab was opened from the recent tabs manager. Recently closed tabs opened directly from the NTP will not be counted. Instead those will be counted in the NewTabPage.ContentSuggestions.* histograms. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="MobileRecentTabManagerTabFromOtherDeviceOpened"> <owner>finkm@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> A tab from another device was opened from the recent tabs manager. Tabs from another device opened directly from the NTP will not be counted. Instead those will be counted in the NewTabPage.ContentSuggestions.* histograms. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> @@ -13363,8 +13478,12 @@ <action name="MostVisited_ClickedFromContextMenu"> <owner>dbeam@chromium.org</owner> <owner>kristipark@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> An NTP tile was opened from the context menu. Desktop only. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> @@ -13743,12 +13862,16 @@ <action name="NTP_LinkOpenedFromContextMenu"> <owner>kmilka@chromium.org</owner> <owner>ramyan@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> Recorded when a link on the New Tab Page is opened via the context menu. This can include: Middle-slot promos, Doodles, the One Google Bar, and custom background image attributions, but *not* shortcuts. For shortcuts see MostVisited_Clicked. Logged only when Google is the default search provider, as these elements only appear on the Google NTP. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> @@ -17033,6 +17156,7 @@ <action name="RestoreTab"> <owner>mpearson@chromium.org</owner> <owner>chrisha@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> Emitted anytime the most recently closed tab is restored via browser/ui/browser_tab_restorer.cc. This occurs either via the @@ -17051,6 +17175,9 @@ regardless of the number of tabs. This is not emitted during session restore that occurs as part of startup. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> @@ -20527,7 +20654,13 @@ <action name="Suggestions.Content.Opened"> <owner>finkm@chromium.org</owner> <owner>dgn@chromium.org</owner> - <description>User opened a content suggestion.</description> + <owner>chrome-analysis-team@google.com</owner> + <description> + User opened a content suggestion. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. + </description> </action> <action name="Suggestions.ContextMenu"> @@ -21326,28 +21459,40 @@ <action name="TopMenu_Bookmarks_LaunchURL"> <owner>dfried@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> The user opened a bookmark from the application menu at the top of the - screen on macOS. Distinguished from launching from the wrench/app menu or - the bookmarks bar. + screen on, for example, MacOS. Distinguished from launching from the + wrench/app menu or the bookmarks bar. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="TopMenu_History_RecentlyClosed"> <owner>dfried@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> The user opened a link from the Recently Closed section in the application menu at the top of the screen on macOS. Distinguished from launching from the wrench/app menu. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="TopMenu_History_RecentlyVisited"> <owner>dfried@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> The user opened a link from the Recently Visited section in the application menu at the top of the screen on macOS. Distinguished from launching from the wrench/app menu. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> @@ -22228,52 +22373,76 @@ <action name="WrenchMenu_Bookmarks_ContextMenu_OpenAll"> <owner>dfried@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> The user opened one or more bookmarks in the Bookmarks Bar using the context menu. Distinguished from launching from e.g. the application menu or the bookmark manager. This is for opening bookmarks normally (in the same window). + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="WrenchMenu_Bookmarks_ContextMenu_OpenAllIncognito"> <owner>dfried@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> The user opened one or more bookmarks in the Bookmarks Bar using the context menu. Distinguished from launching from e.g. the application menu or the bookmark manager. This is for opening bookmarks in an incognito window. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="WrenchMenu_Bookmarks_ContextMenu_OpenAllInNewWindow"> <owner>dfried@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> The user opened one or more bookmarks in the Bookmarks Bar using the context menu. Distinguished from launching from e.g. the application menu or the bookmark manager. This is for opening bookmarks in a new window. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="WrenchMenu_Bookmarks_LaunchURL"> <owner>dfried@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> The user opened a bookmark from the wrench/application/three-dot menu. Distinguished from launching from e.g. the bookmarks bar or bookmark manager. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="WrenchMenu_OpenRecentTabFromDevice"> <owner>jwd@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> Hot Dog Menu: Recent Tabs: Open a recent tab from a device. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action> <action name="WrenchMenu_OpenRecentTabFromLocal"> <owner>jwd@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <description> Hot Dog Menu: Recent Tabs: Open a recent tab link from local. + + This user action is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </description> </action>
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 6ef008f7..0662657c 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -2386,11 +2386,8 @@ </enum> <enum name="ArcIntentHandlerAction"> - <obsolete> - Deprecated as of 9/2018 (M71). - </obsolete> <summary>Defines Arc intent handler actions</summary> - <int value="0" label="Error"/> + <int value="0" label="Error after showing picker"/> <int value="1" label="Dialog deactivated"/> <int value="2" label="DEPRECATED: Always"/> <int value="3" label="DEPRECATED: Just once"/> @@ -2400,6 +2397,7 @@ <int value="7" label="ARC app pressed"/> <int value="8" label="ARC app preferred and pressed"/> <int value="9" label="Progressive web app pressed"/> + <int value="10" label="Error before showing picker"/> </enum> <enum name="ArcIntentHandlerDestinationPlatform"> @@ -14706,6 +14704,7 @@ <int value="8" label="POTENTIALLY_UNWANTED"/> <int value="9" label="WHITELISTED_BY_POLICY"/> <int value="10" label="ASYNC_SCANNING"/> + <int value="11" label="BLOCKED_PASSWORD_PROTECTED"/> </enum> <enum name="DownloadLocationDialogResult"> @@ -14793,6 +14792,9 @@ </enum> <enum name="DownloadNotificationLaunchType"> + <obsolete> + Deprecated in July 2019. + </obsolete> <int value="0" label="LAUNCH"/> <int value="1" label="RELAUNCH"/> </enum> @@ -28840,6 +28842,13 @@ gpu_info.can_lose_context=True"/> </enum> +<enum name="GridTabSwitcherThumbnailFetchingResult"> + <summary>The result of thumbnail fetching in the Grid Tab Switcher.</summary> + <int value="0" label="Got JPEG thumbnail"/> + <int value="1" label="Got ETC1 thumbnail"/> + <int value="2" label="Got nothing"/> +</enum> + <enum name="GsaAccountChangeNotificationSource"> <int value="0" label="Service"/> <int value="1" label="Broadcast"/> @@ -34224,7 +34233,6 @@ <int value="-1288130734" label="OpenVR:disabled"/> <int value="-1287511172" label="OmniboxUIExperimentHideSteadyStateUrlSchemeAndSubdomains:disabled"/> - <int value="-1285293181" label="SiteSettings:enabled"/> <int value="-1285021473" label="save-page-as-mhtml"/> <int value="-1284637134" label="pull-to-refresh"/> <int value="-1282992935" @@ -35157,7 +35165,6 @@ <int value="43951968" label="DesktopPWAsCustomTabUI:enabled"/> <int value="44088203" label="ExpensiveBackgroundTimerThrottling:enabled"/> <int value="48159177" label="reduced-referrer-granularity"/> - <int value="48223610" label="SiteSettings:disabled"/> <int value="49113130" label="OmniboxOnDeviceHeadProvider:disabled"/> <int value="51793504" label="protect-sync-credential-on-reauth:disabled"/> <int value="52368742" label="enable-pixel-canvas-recording:disabled"/> @@ -51278,6 +51285,7 @@ <int value="26" label="SAMPLED_UNSUPPORTED_FILE"/> <int value="27" label="VERDICT_UNKNOWN"/> <int value="28" label="DOWNLOAD_DESTROYED"/> + <int value="29" label="BLOCKED_PASSWORD_PROTECTED"/> </enum> <enum name="SBClientDownloadCheckResult"> @@ -51289,6 +51297,7 @@ <int value="5" label="POTENTIALLY_UNWANTED"/> <int value="6" label="WHITELISTED_BY_POLICY"/> <int value="7" label="ASYNC_SCANNING"/> + <int value="8" label="BLOCKED_PASSWORD_PROTECTED"/> </enum> <enum name="SBClientDownloadExtensions">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 4e0fe20..2f58aa1e 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -1952,7 +1952,9 @@ </histogram> <histogram name="Android.DownloadManager.ForegroundServiceLifecycle" - enum="DownloadNotificationForegroundLifecycle" expires_after="M77"> + enum="DownloadNotificationForegroundLifecycle" expires_after="never"> +<!-- expires-never: Download foreground notification stability metric. --> + <owner>xingliu@chromium.org</owner> <owner>clank-downloads@google.com</owner> <summary> @@ -2042,7 +2044,10 @@ </histogram> <histogram name="Android.DownloadManager.NotificationLaunch" - enum="DownloadNotificationLaunchType" expires_after="M77"> + enum="DownloadNotificationLaunchType"> + <obsolete> + Deprecated July 2019. The relaunch rarely happens. + </obsolete> <owner>xingliu@chromium.org</owner> <owner>clank-downloads@google.com</owner> <summary> @@ -2054,6 +2059,9 @@ <histogram name="Android.DownloadManager.NotificationsCount.ForegroundDisabled" units="notifications"> + <obsolete> + Deprecated July 2019. + </obsolete> <owner>xingliu@chromium.org</owner> <owner>clank-downloads@google.com</owner> <summary> @@ -2065,7 +2073,10 @@ </histogram> <histogram name="Android.DownloadManager.NotificationsCount.ForegroundEnabled" - units="notifications" expires_after="M77"> + units="notifications"> + <obsolete> + Deprecated July 2019. + </obsolete> <owner>xingliu@chromium.org</owner> <owner>clank-downloads@google.com</owner> <summary> @@ -2131,9 +2142,11 @@ </histogram> <histogram name="Android.DownloadManager.ServiceStopped.DownloadForeground" - enum="DownloadNotificationServiceStopped" expires_after="M77"> + enum="DownloadNotificationServiceStopped" expires_after="never"> <owner>xingliu@chromium.org</owner> <owner>clank-downloads@google.com</owner> +<!-- expires-never: Download foreground notification stability metric. --> + <summary> Records instances of DownloadForegroundService stops. The number of expected stops (stopped) and unexpected stops (task removed, low memory, etc) can be @@ -15987,8 +16000,12 @@ </summary> </histogram> -<histogram name="BookmarkManager.CommandExecuted" enum="BookmarkManagerCommand"> +<histogram name="BookmarkManager.CommandExecuted" enum="BookmarkManagerCommand" + expires_after="never"> +<!-- expires-never: part of top-line metric (internal: go/chrome-browser-nsm) --> + <owner>calamity@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <summary> Logs when a user action triggers a command in the bookmark manager. Commands can be triggered by keyboard shortcuts, menu items or other buttons in the @@ -15996,6 +16013,9 @@ Revised in M-76 when the "Open (double click/enter)" bucket was split into two separate buckets, one for bookmarks and one for folders. + + This histogram is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </summary> </histogram> @@ -21857,15 +21877,21 @@ </histogram> <histogram base="true" name="ContextMenu.SelectedOptionAndroid" - enum="ContextMenuOptionAndroid" expires_after="2020-06-30"> + enum="ContextMenuOptionAndroid" expires_after="never"> +<!-- expires-never: part of top-line metric (internal: go/chrome-browser-nsm) --> + <owner>avi@chromium.org</owner> <owner>mpearson@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <summary> The option that the user selected from a context menu on Android. This is logged on Android only; check out ContextMenu.SelectedOptionIOS for iOS, and ContextMenu.SelectedOptionDesktop for desktop. Note that if a menu is invoked on mixed content, only one of the submetrics receives the log; read the code to determine which one. + + This histogram is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </summary> </histogram> @@ -21883,15 +21909,21 @@ </histogram> <histogram base="true" name="ContextMenu.SelectedOptionIOS" - enum="ContextMenuOptionIOS" expires_after="2020-06-30"> + enum="ContextMenuOptionIOS" expires_after="never"> +<!-- expires-never: part of top-line metric (internal: go/chrome-browser-nsm) --> + <owner>avi@chromium.org</owner> <owner>mpearson@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <summary> The option that the user selected from a context menu on iOS. This is logged on iOS only; check out ContextMenu.SelectedOptionAndroid for Android, and ContextMenu.SelectedOptionDesktop for desktop. Note that if a menu is invoked on mixed content, only one of the submetrics receives the log; read the code to determine which one. + + This histogram is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </summary> </histogram> @@ -31051,12 +31083,18 @@ </histogram> <histogram name="Download.OpenMethod" enum="DownloadOpenMethod" - expires_after="M77"> + expires_after="never"> +<!-- expires-never: part of top-line metric (internal: go/chrome-browser-nsm) --> + <owner>dtrainor@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <summary> Invocation count for methods of opening a download. For some file types, Chrome defaults to opening the file in the browser instead of invoking the system handler. The user has the option of overriding this behavior. + + This histogram is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </summary> </histogram> @@ -37808,12 +37846,19 @@ </summary> </histogram> -<histogram name="ExploreSites.CategoryClick" enum="ExploreSitesCategories"> +<histogram name="ExploreSites.CategoryClick" enum="ExploreSitesCategories" + expires_after="never"> +<!-- expires-never: part of top-line metric (internal: go/chrome-browser-nsm) --> + <owner>dewittj@chromium.org</owner> <owner>petewil@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <summary> The number of times the user clicked on a site in a category with the selected type on the Explore Sites page. + + This histogram is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </summary> </histogram> @@ -47783,7 +47828,7 @@ </summary> </histogram> -<histogram name="GridTabSwitcher.DirtySpan" units="ms" +<histogram base="true" name="GridTabSwitcher.DirtySpan" units="ms" expires_after="2020-01-01"> <owner>yusufo@chromium.org</owner> <owner>wychen@chromium.org</owner> @@ -47794,7 +47839,7 @@ </summary> </histogram> -<histogram name="GridTabSwitcher.FramePerSecond" units="frame/sec" +<histogram base="true" name="GridTabSwitcher.FramePerSecond" units="frame/sec" expires_after="2020-01-01"> <owner>yusufo@chromium.org</owner> <owner>wychen@chromium.org</owner> @@ -47804,7 +47849,7 @@ </summary> </histogram> -<histogram name="GridTabSwitcher.MaxFrameInterval" units="ms" +<histogram base="true" name="GridTabSwitcher.MaxFrameInterval" units="ms" expires_after="2020-01-01"> <owner>yusufo@chromium.org</owner> <owner>wychen@chromium.org</owner> @@ -47814,6 +47859,16 @@ </summary> </histogram> +<histogram name="GridTabSwitcher.ThumbnailFetchingResult" + enum="GridTabSwitcherThumbnailFetchingResult" expires_after="2020-01-01"> + <owner>yusufo@chromium.org</owner> + <owner>wychen@chromium.org</owner> + <summary> + This histogram records the result of thumbnail fetching in the Grid Tab + Switcher. + </summary> +</histogram> + <histogram base="true" name="GwpAsan.AllocatorOom.Malloc" units="allocations" expires_after="M80"> <owner>vtsyrklevich@chromium.org</owner> @@ -48969,13 +49024,20 @@ </summary> </histogram> -<histogram name="HistoryPage.OtherDevicesMenu" enum="OtherSessionsActions"> +<histogram name="HistoryPage.OtherDevicesMenu" enum="OtherSessionsActions" + expires_after="never"> +<!-- expires-never: part of top-line metric (internal: go/chrome-browser-nsm) --> + <owner>rpop@google.com</owner> + <owner>chrome-analysis-team@google.com</owner> <summary> Histogram for usage of the section in the history page that allows the user to access tabs from other devices. OtherSessionsActions.OPENED_LINK_VIA_CONTEXT_MENU was added for M-76. + + This histogram is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </summary> </histogram> @@ -60153,8 +60215,9 @@ </histogram> <histogram name="Media.VTVDA.HardwareAccelerated" - enum="BooleanHardwareAccelerated" expires_after="M78"> + enum="BooleanHardwareAccelerated" expires_after="2020-12-31"> <owner>sandersd@chromium.org</owner> + <owner>media-dev@chromium.org</owner> <summary> Whether a VTDecompressionSession is internally using hardware accelerated decoding. @@ -64088,11 +64151,17 @@ </histogram> <histogram name="Mobile.SystemNotification.Content.Click" - enum="SystemNotificationType"> + enum="SystemNotificationType" expires_after="never"> +<!-- expires-never: part of top-line metric (internal: go/chrome-browser-nsm) --> + <owner>xingliu@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <summary> Records the type of notification when the user clicks the body of Android notification. This does not include clicks on notification action buttons. + + This histogram is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </summary> </histogram> @@ -66516,15 +66585,21 @@ </histogram> <histogram name="Navigation.Home.IsChromeInternal" enum="Boolean" - expires_after="2020-05-08"> + expires_after="never"> +<!-- expires-never: part of top-line metric (internal: go/chrome-browser-nsm) --> + <owner>mpearson@chromium.org</owner> <owner>amaralp@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <summary> Emitted every time a user uses a Home button to go to their home page. Records whether the page is chrome-internal (most likely the New Tab Page or about:blank) or not (most likely an actual web site). For the purpose of this histogram, about:, chrome: and chrome-native: are considered chrome-internal; everything else is not. + + This histogram is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </summary> </histogram> @@ -81777,13 +81852,19 @@ </histogram> <histogram name="NewTabPage.CustomizeAction" enum="NTPCustomizeAction" - expires_after="M90"> + expires_after="never"> +<!-- expires-never: part of top-line metric (internal: go/chrome-browser-nsm) --> + <owner>dbeam@chromium.org</owner> <owner>yyushkina@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <summary> Customization actions performed by the user on the New Tab Page; logged as each interaction occurs. This may indicate popularity of a particular customization type. + + This histogram is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </summary> </histogram> @@ -82011,11 +82092,17 @@ </histogram> <histogram name="NewTabPage.LogoClick" enum="NewTabPageLogoClick" - expires_after="M81"> + expires_after="never"> +<!-- expires-never: part of top-line metric (internal: go/chrome-browser-nsm) --> + <owner>dbeam@chromium.org</owner> <owner>yyushkina@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <summary> The number of clicks on the static/call-to-action/animated logo on the NTP. + + This histogram is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </summary> </histogram> @@ -82105,12 +82192,18 @@ <histogram name="NewTabPage.MostVisited" enum="MostVisitedTileIndex" expires_after="never"> +<!-- expires-never: part of top-line metric (internal: go/chrome-browser-nsm) --> + <owner>justincohen@chromium.org</owner> <owner>mastiz@chromium.org</owner> <owner>dbeam@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <summary> Histogram for user clicks of the most visited tile. The value is equal to the index of the tile. + + This histogram is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </summary> </histogram> @@ -82384,11 +82477,17 @@ </histogram> <histogram name="NewTabPage.Promos.LinkClicked" units="count" - expires_after="M82"> + expires_after="never"> +<!-- expires-never: part of top-line metric (internal: go/chrome-browser-nsm) --> + <owner>dbeam@chromium.org</owner> <owner>yyushkina@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <summary> Emitted each time a promo linked is clicked on the local NTP. + + This histogram is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </summary> </histogram> @@ -82519,11 +82618,18 @@ </summary> </histogram> -<histogram name="NewTabPage.SearchSuggestions.IndexClicked" expires_after="M82"> +<histogram name="NewTabPage.SearchSuggestions.IndexClicked" + expires_after="never"> +<!-- expires-never: part of top-line metric (internal: go/chrome-browser-nsm) --> + <owner>dbeam@chromium.org</owner> <owner>yyushkina@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <summary> The index of the search suggestion tile that was clicked on the local NTP. + + This histogram is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </summary> </histogram> @@ -109574,11 +109680,18 @@ <summary>Count of renderer view context menu items shown.</summary> </histogram> -<histogram name="RenderViewContextMenu.Used" enum="RenderViewContextMenuItem"> +<histogram name="RenderViewContextMenu.Used" enum="RenderViewContextMenuItem" + expires_after="never"> +<!-- expires-never: part of top-line metric (internal: go/chrome-browser-nsm) --> + <owner>avi@chromium.org</owner> <owner>mpearson@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <summary> Count of renderer view context menu items (Only commands now) used. + + This histogram is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </summary> </histogram> @@ -117570,11 +117683,17 @@ expires_after="never"> <!-- expires-never: dashboard metric (internal: go/cs-metrics-dashboard) --> +<!-- expires-never: part of top-line metric (internal: go/chrome-browser-nsm) --> + <owner>donnd@chromium.org</owner> <owner>twellington@chromium.org</owner> + <owner>chrome-analysis-team@google.com</owner> <summary> Records whether the user opened the panel when it was shown. Recorded for all gestures for all users when the UX is hidden. Implemented for Android. + + This histogram is of special interest to the chrome-analysis-team@. Do not + change its semantics or retire it without talking to them first. </summary> </histogram> @@ -136543,6 +136662,17 @@ </summary> </histogram> +<histogram name="Tabs.IndependentTabCountInSwitcher" units="tabs" + expires_after="2020-07-31"> + <owner>mattsimmons@chromium.org</owner> + <owner>memex-team@google.com</owner> + <summary>The number of entries/cards shown in the grid tab switcher.</summary> + <details> + When the user is shown the grid tab switcher, logs the number of entries + (tabs or tab groups) open in the grid tab switcher. + </details> +</histogram> + <histogram name="Tabs.iOS_PostRedirectPLT" units="ms"> <owner>pauljensen@chromium.org</owner> <summary> @@ -136960,6 +137090,33 @@ </summary> </histogram> +<histogram name="Tabs.TabCountInSwitcher" units="tabs" + expires_after="2020-07-31"> + <owner>mattsimmons@chromium.org</owner> + <owner>memex-team@google.com</owner> + <summary> + The number of tabs open when the grid tab switcher is shown. + </summary> + <details> + When the user is shown the tab switcher, logs the total number of individual + open tabs. Android only. + </details> +</histogram> + +<histogram name="Tabs.TabCountOnStartScreenShown" units="tabs" + expires_after="2020-07-31"> + <owner>mattsimmons@chromium.org</owner> + <owner>memex-team@google.com</owner> + <summary> + The number of tabs open when the user is returned to the tab switcher on + start. + </summary> + <details> + When the user is returned to the tab switcher on starting Chrome due to + inactivity, logs the overall number of tabs open. Android only. + </details> +</histogram> + <histogram name="Tabs.TabCountPerLoad" units="tabs"> <owner>sbirch@google.com</owner> <summary> @@ -137020,7 +137177,7 @@ </histogram> <histogram name="Tabs.Tasks.DuplicatedTab.DuplicatedTabCount" units="tabs" - expires_after="2019-06-01"> + expires_after="2020-06-01"> <owner>yusufo@chromium.org</owner> <owner>wychen@chromium.org</owner> <summary> @@ -137035,7 +137192,7 @@ </histogram> <histogram name="Tabs.Tasks.DuplicatedTab.DuplicatedTabRatio" units="%" - expires_after="2019-06-01"> + expires_after="2020-06-01"> <owner>yusufo@chromium.org</owner> <owner>wychen@chromium.org</owner> <summary> @@ -137050,7 +137207,7 @@ </histogram> <histogram name="Tabs.Tasks.HubAndSpokeNavigationUsage" units="spokes" - expires_after="2019-06-01"> + expires_after="2020-06-01"> <!-- Name completed by histogram_suffixes name="HubAndSpokeNavigationUsageType" --> <owner>yusufo@chromium.org</owner> @@ -137066,7 +137223,7 @@ </histogram> <histogram base="true" name="Tabs.Tasks.TabCreated.Count" units="tabs" - expires_after="2019-06-30"> + expires_after="2020-06-30"> <!-- Name completed by histogram_suffixes name="TabCreatedReason" --> <owner>yusufo@chromium.org</owner> @@ -137079,7 +137236,7 @@ </histogram> <histogram base="true" name="Tabs.Tasks.TabCreated.Percent" units="%" - expires_after="2019-06-30"> + expires_after="2020-06-30"> <!-- Name completed by histogram_suffixes name="TabCreatedReason" --> <owner>yusufo@chromium.org</owner> @@ -156094,6 +156251,8 @@ label="The user clicked through and recovered the download."/> <suffix name="Shown" label="The user was shown the prompt."/> <affected-histogram name="Download.DownloadDangerPrompt.AsyncScanning"/> + <affected-histogram + name="Download.DownloadDangerPrompt.BlockedPasswordProtected"/> <affected-histogram name="Download.DownloadDangerPrompt.DangerousContent"/> <affected-histogram name="Download.DownloadDangerPrompt.DangerousFile"/> <affected-histogram name="Download.DownloadDangerPrompt.DangerousHost"/> @@ -156104,6 +156263,8 @@ <histogram_suffixes name="DownloadDangerPromptType" separator="."> <suffix name="AsyncScanning" label="File marked ASYNC_SCANNING"/> + <suffix name="BlockedPasswordProtected" + label="File marked BLOCKED_PASSWORD_PROTECTED"/> <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/perf/benchmarks/rendering.py b/tools/perf/benchmarks/rendering.py index db6823f..b9666a5d 100644 --- a/tools/perf/benchmarks/rendering.py +++ b/tools/perf/benchmarks/rendering.py
@@ -74,6 +74,10 @@ def SetExtraBrowserOptions(self, options): options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') options.AppendExtraBrowserArgs('--touch-events=enabled') + # Disable locking the controls as visible for a minimum duration. This + # allows controls to unlock after page load, rather than in the middle of a + # story. + options.AppendExtraBrowserArgs('--disable-minimum-show-duration') def CreateCoreTimelineBasedMeasurementOptions(self): category_filter = chrome_trace_category_filter.CreateLowOverheadFilter()
diff --git a/tools/perf/expectations.config b/tools/perf/expectations.config index bb3c912..89564cc 100644 --- a/tools/perf/expectations.config +++ b/tools/perf/expectations.config
@@ -277,6 +277,7 @@ # Benchmark: system_health.common_desktop crbug.com/984599 [ Linux ] system_health.common_desktop/browse:social:tumblr_infinite_scroll:2018 [ Skip ] +crbug.com/984599 [ Win_10 ] system_health.common_desktop/browse:social:tumblr_infinite_scroll:2018 [ Skip ] crbug.com/773084 [ Mac ] system_health.common_desktop/browse:tools:maps [ Skip ] crbug.com/903417 [ Mac ] system_health.common_desktop/long_running:tools:gmail-foreground [ Skip ] crbug.com/903417 [ Win ] system_health.common_desktop/long_running:tools:gmail-foreground [ Skip ] @@ -304,6 +305,8 @@ # Benchmark: system_health.memory_desktop crbug.com/984599 [ Linux ] system_health.memory_desktop/long_running:tools:gmail-foreground [ Skip ] +crbug.com/984599 [ Mac ] system_health.memory_desktop/long_running:tools:gmail-background [ Skip ] +crbug.com/984599 [ Mac ] system_health.memory_desktop/long_running:tools:gmail-foreground [ Skip ] crbug.com/649392 [ All ] system_health.memory_desktop/play:media:google_play_music [ Skip ] crbug.com/742475 [ Mac ] system_health.memory_desktop/multitab:misc:typical24 [ Skip ] crbug.com/946495 [ Mac ] system_health.memory_desktop/multitab:misc:typical24:2018 [ Skip ]
diff --git a/tools/perf/process_perf_results.py b/tools/perf/process_perf_results.py index aa7bab4f..0e32cca 100755 --- a/tools/perf/process_perf_results.py +++ b/tools/perf/process_perf_results.py
@@ -211,11 +211,13 @@ # we have a non-zero exit code if we error out? logging.error('Failed to obtain test results for %s: %s', benchmark_name, e) + continue if not enabled: # We don't upload disabled benchmarks or tests that are run # as a smoke test - print 'Benchmark %s disabled' % benchmark_name - benchmark_enabled_map[benchmark_name] = enabled + print 'Benchmark %s ran no tests on at least one shard' % benchmark_name + continue + benchmark_enabled_map[benchmark_name] = True end_time = time.time() print_duration('Analyzing perf json test results', begin_time, end_time)
diff --git a/tools/perf/process_perf_results_unittest.py b/tools/perf/process_perf_results_unittest.py index a0f04ca9..7c99f5ef 100755 --- a/tools/perf/process_perf_results_unittest.py +++ b/tools/perf/process_perf_results_unittest.py
@@ -241,6 +241,29 @@ self.assertEqual(test_results_list, []) @decorators.Disabled('chromeos') # crbug.com/956178 + def test_last_shard_has_no_tests(self): + benchmark_name = 'benchmark.example' + temp_parent_dir = tempfile.mkdtemp(suffix='test_results_outdir') + try: + shard1_dir = os.path.join(temp_parent_dir, 'shard1') + os.mkdir(shard1_dir) + shard2_dir = os.path.join(temp_parent_dir, 'shard2') + os.mkdir(shard2_dir) + with open(os.path.join(shard1_dir, 'test_results.json'), 'w') as fh: + fh.write( + '{"version": 3, "tests":{"v8.browsing_desktop-future": "blah"}}') + with open(os.path.join(shard2_dir, 'test_results.json'), 'w') as fh: + fh.write('{"version": 3,"tests":{}}') + directory_map = { + benchmark_name: [shard1_dir, shard2_dir]} + benchmark_enabled_map = ppr_module._handle_perf_json_test_results( + directory_map, []) + self.assertTrue(benchmark_enabled_map[benchmark_name], + 'Regression test for crbug.com/984565') + finally: + shutil.rmtree(temp_parent_dir) + + @decorators.Disabled('chromeos') # crbug.com/956178 def test_merge_perf_results_IOError(self): results_filename = None directories = ['directory_that_does_not_exist']
diff --git a/ui/file_manager/file_manager/foreground/css/file_manager.css b/ui/file_manager/file_manager/foreground/css/file_manager.css index 02d2157..dc4726a 100644 --- a/ui/file_manager/file_manager/foreground/css/file_manager.css +++ b/ui/file_manager/file_manager/foreground/css/file_manager.css
@@ -187,6 +187,10 @@ width: 100%; } +#directory-tree [renaming] .root-eject { + display: none; +} + #directory-tree [renaming] > .tree-row > .label { display: none; }
diff --git a/ui/file_manager/file_manager/foreground/js/directory_tree_naming_controller.js b/ui/file_manager/file_manager/foreground/js/directory_tree_naming_controller.js index 6a218e3..c62588e 100644 --- a/ui/file_manager/file_manager/foreground/js/directory_tree_naming_controller.js +++ b/ui/file_manager/file_manager/foreground/js/directory_tree_naming_controller.js
@@ -92,7 +92,6 @@ 'rename-placeholder'); if (this.isRemovableRoot_ && renameInputElementPlaceholder.length === 1) { - // TODO(crbug.com/984427): this removable volume case has no test. renameInputElementPlaceholder[0].appendChild(this.inputElement_); } else { const label = this.getLabelElement_();
diff --git a/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js b/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js index 7747487..99f6d357 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js +++ b/ui/file_manager/file_manager/foreground/js/ui/directory_tree.js
@@ -633,12 +633,18 @@ } /** - * Set up eject button if needed. - * @param {HTMLElement} rowElement The parent element for eject button. + * Set up eject button. It is placed as the last element of the elements that + * compose the tree row content. + * @param {!HTMLElement} rowElement Tree row element. * @private */ setupEjectButton_(rowElement) { const ejectButton = cr.doc.createElement('button'); + + ejectButton.className = 'root-eject align-right-icon'; + ejectButton.setAttribute('aria-label', str('UNMOUNT_DEVICE_BUTTON_LABEL')); + ejectButton.setAttribute('tabindex', '0'); + // Block other mouse handlers. ejectButton.addEventListener('mouseup', (event) => { event.stopPropagation(); @@ -652,19 +658,21 @@ ejectButton.addEventListener('down', (event) => { event.stopPropagation(); }); - ejectButton.className = 'root-eject align-right-icon'; - ejectButton.setAttribute('aria-label', str('UNMOUNT_DEVICE_BUTTON_LABEL')); - ejectButton.setAttribute('tabindex', '0'); ejectButton.addEventListener('click', (event) => { event.stopPropagation(); const command = cr.doc.querySelector('command#unmount'); - // Let's make sure 'canExecute' state of the command is properly set for - // the root before executing it. + // Ensure 'canExecute' state of the command is properly setup for the + // root before executing it. command.canExecuteChange(this); command.execute(this); }); - rowElement.appendChild(ejectButton); - // Mark the row as ejectable (for CSS styling positioning). + + // Add the eject button as the last element of the tree row content. + const contentParent = rowElement.querySelector('.label').parentElement; + assert(contentParent); + contentParent.appendChild(ejectButton); + + // Mark the tree row element with CSS class .ejectable. rowElement.classList.add('ejectable'); // Disable paper-ripple on this rowElement, crbug.com/965382. @@ -672,6 +680,7 @@ if (rowRipple) { rowRipple.setAttribute('style', 'visibility:hidden'); } + // Add paper-ripple effect on the eject button. const ripple = cr.doc.createElement('paper-ripple'); ripple.setAttribute('fit', ''); @@ -1063,14 +1072,16 @@ } /** - * Set up rename input textbox placeholder if needed. - * @param {HTMLElement} rowElement The parent element for placeholder. + * Set up rename input textbox placeholder element. Place it just after the + * tree row '.label' class element. + * @param {!HTMLElement} rowElement Tree row element. * @private */ setupRenamePlaceholder_(rowElement) { const placeholder = cr.doc.createElement('span'); placeholder.className = 'rename-placeholder'; - rowElement.appendChild(placeholder); + rowElement.querySelector('.label').insertAdjacentElement( + 'afterend', placeholder); } /**
diff --git a/ui/file_manager/integration_tests/file_manager/directory_tree_context_menu.js b/ui/file_manager/integration_tests/file_manager/directory_tree_context_menu.js index d6e9acaa..5fe7c74 100644 --- a/ui/file_manager/integration_tests/file_manager/directory_tree_context_menu.js +++ b/ui/file_manager/integration_tests/file_manager/directory_tree_context_menu.js
@@ -583,6 +583,125 @@ }; /** + * Tests renaming removable volume with the keyboard. + */ + testcase.dirRenameRemovableWithKeyboard = async () => { + // Open Files app on local downloads. + const appId = await setupAndWaitUntilReady(RootPath.DOWNLOADS); + + // Mount a single partition NTFS USB volume: they can be renamed. + await sendTestMessage({name: 'mountFakeUsb', filesystem: 'ntfs'}); + + // Wait for the USB mount and click the USB volume. + const usbVolume = '#directory-tree [volume-type-icon="removable"]'; + await remoteCall.waitAndClickElement(appId, usbVolume); + + // Check: the USB should be the current directory tree selection. + const usbVolumeSelected = + '#directory-tree .tree-row[selected] [volume-type-icon="removable"]'; + await remoteCall.waitForElement(appId, usbVolumeSelected); + + // Focus the directory tree. + await remoteCall.callRemoteTestUtil('focus', appId, ['#directory-tree']); + + // Check: the USB volume is still the current directory tree selection. + await remoteCall.waitForElement(appId, usbVolumeSelected); + + // Press rename <Ctrl>-Enter keyboard shortcut on the USB. + const renameKey = + ['#directory-tree .tree-row[selected]', 'Enter', true, false, false]; + await remoteCall.callRemoteTestUtil('fakeKeyDown', appId, renameKey); + + // Check: the renaming text input element should appear. + const textInput = '#directory-tree .tree-row[selected] input'; + await remoteCall.waitForElement(appId, textInput); + + // Enter the new name for the USB volume. + await remoteCall.callRemoteTestUtil( + 'inputText', appId, [textInput, 'usb-was-renamed']); + + // Press Enter key to end text input. + const enterKey = [textInput, 'Enter', false, false, false]; + await remoteCall.callRemoteTestUtil('fakeKeyDown', appId, enterKey); + + // Wait for the renaming input element to disappear. + await remoteCall.waitForElementLost(appId, textInput); + + // Check: the USB volume .label text should be the new name. + const element = await remoteCall.waitForElement( + appId, '#directory-tree:focus .tree-row[selected] .label'); + chrome.test.assertEq('usb-was-renamed', element.text); + + // Even though the Files app rename flow worked, the background.js page + // console errors about not being able to 'mount' the older volume name + // due to a disk_mount_manager.cc error: user/fake-usb not found. + return IGNORE_APP_ERRORS; + }; + + /** + * Tests renaming removable volume with the context menu. + */ + testcase.dirRenameRemovableWithContentMenu = async () => { + // Open Files app on local downloads. + const appId = await setupAndWaitUntilReady(RootPath.DOWNLOADS); + + // Mount a single partition NTFS USB volume: they can be renamed. + await sendTestMessage({name: 'mountFakeUsb', filesystem: 'ntfs'}); + + // Wait for the USB mount and click the USB volume. + const usbVolume = '#directory-tree [volume-type-icon="removable"]'; + await remoteCall.waitAndClickElement(appId, usbVolume); + + // Check: the USB should be the current directory tree selection. + const usbVolumeSelected = + '#directory-tree .tree-row[selected] [volume-type-icon="removable"]'; + await remoteCall.waitForElement(appId, usbVolumeSelected); + + // Focus the directory tree. + await remoteCall.callRemoteTestUtil('focus', appId, ['#directory-tree']); + + // Check: the USB volume is still the current directory tree selection. + await remoteCall.waitForElement(appId, usbVolumeSelected); + + // Right-click the USB volume. + const usb = '#directory-tree:focus .tree-row[selected]'; + await remoteCall.callRemoteTestUtil('fakeMouseRightClick', appId, [usb]); + + // Check: a context menu with a 'rename' item should appear. + const renameItem = + 'cr-menu-item[command="#rename"]:not([hidden]):not([disabled])'; + await remoteCall.waitForElement(appId, renameItem); + + // Click the context menu 'rename' item. + await remoteCall.callRemoteTestUtil('fakeMouseClick', appId, [renameItem]); + + // Check: the renaming text input element should appear. + const textInput = '#directory-tree .tree-row[selected] input'; + await remoteCall.waitForElement(appId, textInput); + + // Enter the new name for the USB volume. + await remoteCall.callRemoteTestUtil( + 'inputText', appId, [textInput, 'usb-was-renamed']); + + // Press Enter key to end text input. + const enterKey = [textInput, 'Enter', false, false, false]; + await remoteCall.callRemoteTestUtil('fakeKeyDown', appId, enterKey); + + // Wait for the renaming input element to disappear. + await remoteCall.waitForElementLost(appId, textInput); + + // Check: the USB volume .label text should be the new name. + const element = await remoteCall.waitForElement( + appId, '#directory-tree:focus .tree-row[selected] .label'); + chrome.test.assertEq('usb-was-renamed', element.text); + + // Even though the Files app rename flow worked, the background.js page + // console errors about not being able to 'mount' the older volume name + // due to a disk_mount_manager.cc error: user/fake-usb not found. + return IGNORE_APP_ERRORS; + }; + + /** * Tests creating a folder with the context menu. */ testcase.dirCreateWithContextMenu = () => { @@ -1506,12 +1625,12 @@ const appId = await setupAndWaitUntilReady(RootPath.DOWNLOADS, [ENTRIES.photos], []); - // Right-click /My files/Downloads in the directory tree. + // Wait for /My files/Downloads to appear in the directory tree. const query = '#directory-tree [entry-label="My files"] [entry-label="Downloads"]'; await remoteCall.waitForElement(appId, query); - // Right-click the selected file. + // Right-click the /My files/Downloads tree row. chrome.test.assertTrue(!!await remoteCall.callRemoteTestUtil( 'fakeMouseRightClick', appId, [query]));
diff --git a/ui/file_manager/integration_tests/file_manager/drive_specific.js b/ui/file_manager/integration_tests/file_manager/drive_specific.js index 78a6aa4..1dae563b1 100644 --- a/ui/file_manager/integration_tests/file_manager/drive_specific.js +++ b/ui/file_manager/integration_tests/file_manager/drive_specific.js
@@ -547,3 +547,103 @@ // Check that "Available Offline" is shown in the menu. await remoteCall.waitForElement(appId, pinnedMenuQuery); }; + +/** + * Tests following links to folders. + */ +testcase.driveLinkToDirectory = async () => { + const appId = await setupAndWaitUntilReady( + RootPath.DRIVE, [], BASIC_DRIVE_ENTRY_SET.concat([ + ENTRIES.directoryA, + ENTRIES.directoryB, + ENTRIES.directoryC, + ENTRIES.deeplyBurriedSmallJpeg, + ENTRIES.linkGtoB, + ENTRIES.linkHtoFile, + ENTRIES.linkTtoTransitiveDirectory, + ])); + + // Select the link + chrome.test.assertTrue( + !!await remoteCall.callRemoteTestUtil('selectFile', appId, ['G']), + 'selectFile failed'); + await remoteCall.waitForElement(appId, '.table-row[selected]'); + + // Open the link + chrome.test.assertTrue( + await remoteCall.callRemoteTestUtil('openFile', appId, ['G'])); + + // Check the contents of current directory. + await remoteCall.waitForFiles(appId, [ENTRIES.directoryC.getExpectedRow()]); +}; + +/** + * Tests opening files through folder links. + */ +testcase.driveLinkOpenFileThroughLinkedDirectory = async () => { + const appId = await setupAndWaitUntilReady( + RootPath.DRIVE, [], BASIC_DRIVE_ENTRY_SET.concat([ + ENTRIES.directoryA, + ENTRIES.directoryB, + ENTRIES.directoryC, + ENTRIES.deeplyBurriedSmallJpeg, + ENTRIES.linkGtoB, + ENTRIES.linkHtoFile, + ENTRIES.linkTtoTransitiveDirectory, + ])); + + // Navigate through link. + chrome.test.assertTrue( + await remoteCall.callRemoteTestUtil('openFile', appId, ['G'])); + await remoteCall.waitForFiles(appId, [ENTRIES.directoryC.getExpectedRow()]); + chrome.test.assertTrue( + await remoteCall.callRemoteTestUtil('openFile', appId, ['C'])); + await remoteCall.waitForFiles( + appId, [ENTRIES.deeplyBurriedSmallJpeg.getExpectedRow()]); + + await sendTestMessage( + {name: 'expectFileTask', fileNames: ['deep.jpg'], openType: 'launch'}); + chrome.test.assertTrue( + await remoteCall.callRemoteTestUtil('openFile', appId, ['deep.jpg'])); + + // The Gallery window should open with the image in it. + const galleryAppId = await galleryApp.waitForWindow('gallery.html'); + await galleryApp.waitForSlideImage(galleryAppId, 100, 100, 'deep'); + chrome.test.assertTrue( + await galleryApp.closeWindowAndWait(galleryAppId), + 'Failed to close Gallery window'); +}; + +/** + * Tests opening files through transitive links. + */ +testcase.driveLinkOpenFileThroughTransitiveLink = async () => { + const appId = await setupAndWaitUntilReady( + RootPath.DRIVE, [], BASIC_DRIVE_ENTRY_SET.concat([ + ENTRIES.directoryA, + ENTRIES.directoryB, + ENTRIES.directoryC, + ENTRIES.deeplyBurriedSmallJpeg, + ENTRIES.linkGtoB, + ENTRIES.linkHtoFile, + ENTRIES.linkTtoTransitiveDirectory, + ])); + + // Navigate through link. + chrome.test.assertTrue( + await remoteCall.callRemoteTestUtil('openFile', appId, ['T'])); + await remoteCall.waitForFiles( + appId, [ENTRIES.deeplyBurriedSmallJpeg.getExpectedRow()]); + + await sendTestMessage( + {name: 'expectFileTask', fileNames: ['deep.jpg'], openType: 'launch'}); + chrome.test.assertTrue( + await remoteCall.callRemoteTestUtil('openFile', appId, ['deep.jpg'])); + + // The Gallery window should open with the image in it. + const galleryAppId = await galleryApp.waitForWindow('gallery.html'); + await galleryApp.waitForSlideImage(galleryAppId, 100, 100, 'deep'); + chrome.test.assertTrue( + await galleryApp.closeWindowAndWait(galleryAppId), + 'Failed to close Gallery window'); +};
diff --git a/ui/file_manager/integration_tests/test_util.js b/ui/file_manager/integration_tests/test_util.js index 29e0aae..2278b780 100644 --- a/ui/file_manager/integration_tests/test_util.js +++ b/ui/file_manager/integration_tests/test_util.js
@@ -292,6 +292,7 @@ var EntryType = Object.freeze({ FILE: 'file', DIRECTORY: 'directory', + LINK: 'link', SHARED_DRIVE: 'team_drive', COMPUTER: 'Computer' }); @@ -803,6 +804,48 @@ typeText: 'Folder' }), + deeplyBurriedSmallJpeg: new TestEntryInfo({ + type: EntryType.FILE, + targetPath: 'A/B/C/deep.jpg', + sourceFileName: 'small.jpg', + mimeType: 'image/jpeg', + lastModifiedTime: 'Jan 18, 2038, 1:02 AM', + nameText: 'deep.jpg', + sizeText: '886 bytes', + typeText: 'JPEG image' + }), + + linkGtoB: new TestEntryInfo({ + type: EntryType.LINK, + targetPath: 'G', + sourceFileName: 'A/B', + lastModifiedTime: 'Jan 1, 2000, 1:00 AM', + nameText: 'G', + sizeText: '--', + typeText: 'Folder' + }), + + linkHtoFile: new TestEntryInfo({ + type: EntryType.LINK, + targetPath: 'H.jpg', + sourceFileName: 'A/B/C/deep.jpg', + mimeType: 'image/jpeg', + lastModifiedTime: 'Jan 18, 2038, 1:02 AM', + nameText: 'H.jpg', + sizeText: '886 bytes', + typeText: 'JPEG image' + }), + + linkTtoTransitiveDirectory: new TestEntryInfo({ + type: EntryType.LINK, + targetPath: 'T', + sourceFileName: 'G/C', + lastModifiedTime: 'Jan 1, 2000, 1:00 AM', + nameText: 'T', + sizeText: '--', + typeText: 'Folder' + }), + zipArchive: new TestEntryInfo({ type: EntryType.FILE, sourceFileName: 'archive.zip',
diff --git a/ui/gl/OWNERS b/ui/gl/OWNERS index de6fcfc9..15521e8 100644 --- a/ui/gl/OWNERS +++ b/ui/gl/OWNERS
@@ -9,3 +9,4 @@ per-file *_ozone*=spang@chromium.org # COMPONENT: Internals>GPU>Internals +# TEAM: graphics-dev@chromium.org
diff --git a/ui/ozone/platform/scenic/scenic_window.cc b/ui/ozone/platform/scenic/scenic_window.cc index 41337d1..f1f02b9e 100644 --- a/ui/ozone/platform/scenic/scenic_window.cc +++ b/ui/ozone/platform/scenic/scenic_window.cc
@@ -32,7 +32,6 @@ scenic_session_(manager_->GetScenic()), view_(&scenic_session_, std::move(view_token.value), "chromium window"), node_(&scenic_session_), - input_node_(&scenic_session_), render_node_(&scenic_session_) { scenic_session_.set_error_handler( fit::bind_member(this, &ScenicWindow::OnScenicError)); @@ -44,9 +43,6 @@ // get the device pixel ratio for the screen. node_.SetEventMask(fuchsia::ui::gfx::kMetricsEventMask); - // Add input shape. - node_.AddChild(input_node_); - // Add rendering subtree. Hit testing is disabled to prevent GPU process from // receiving input. render_node_.SetHitTestBehavior(fuchsia::ui::gfx::HitTestBehavior::kSuppress); @@ -186,10 +182,6 @@ // Scale the render node so that surface rect can always be 1x1. render_node_.SetScale(size_dips_.width(), size_dips_.height(), 1.f); - // Resize input node to cover the whole surface. - input_node_.SetShape(scenic::Rectangle(&scenic_session_, size_dips_.width(), - size_dips_.height())); - // This is necessary when using vulkan because ImagePipes are presented // separately and we need to make sure our sizes change is committed. scenic_session_.Present(
diff --git a/ui/ozone/platform/scenic/scenic_window.h b/ui/ozone/platform/scenic/scenic_window.h index c2d39c73..5f547b9 100644 --- a/ui/ozone/platform/scenic/scenic_window.h +++ b/ui/ozone/platform/scenic/scenic_window.h
@@ -99,9 +99,6 @@ // Entity node for the |view_|. scenic::EntityNode node_; - // Node in |scenic_session_| for receiving input that hits within our View. - scenic::ShapeNode input_node_; - // Node in |scenic_session_| for rendering (hit testing disabled). scenic::EntityNode render_node_;
diff --git a/ui/webui/resources/cr_elements/shared_vars_css.html b/ui/webui/resources/cr_elements/shared_vars_css.html index a6f8496c..110a897 100644 --- a/ui/webui/resources/cr_elements/shared_vars_css.html +++ b/ui/webui/resources/cr_elements/shared_vars_css.html
@@ -154,11 +154,6 @@ margin-inline-start: var(--cr-icon-button-margin-start); } - --cr-primary-text: { - color: var(--cr-primary-text-color); - line-height: 154%; /* 20px. */ - } - --cr-secondary-text: { color: var(--cr-secondary-text-color); font-weight: 400;
diff --git a/url/OWNERS b/url/OWNERS index 7badfe93..05cb46e 100644 --- a/url/OWNERS +++ b/url/OWNERS
@@ -2,3 +2,4 @@ dcheng@chromium.org mkwst@chromium.org palmer@chromium.org +# COMPONENT: Internals>Core
diff --git a/url/android/OWNERS b/url/android/OWNERS new file mode 100644 index 0000000..3605f481 --- /dev/null +++ b/url/android/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: Internals>Core
diff --git a/url/ipc/OWNERS b/url/ipc/OWNERS index 146c3c3c..ac0d8dd 100644 --- a/url/ipc/OWNERS +++ b/url/ipc/OWNERS
@@ -1,2 +1,3 @@ per-file *_param_traits*.*=set noparent per-file *_param_traits*.*=file://ipc/SECURITY_OWNERS +# COMPONENT: Internals>Core \ No newline at end of file
diff --git a/url/mojom/OWNERS b/url/mojom/OWNERS index ae29a36aa..ff78c432a 100644 --- a/url/mojom/OWNERS +++ b/url/mojom/OWNERS
@@ -4,3 +4,4 @@ per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS per-file *.typemap=set noparent per-file *.typemap=file://ipc/SECURITY_OWNERS +# COMPONENT: Internals>Mojo
diff --git a/url/third_party/mozilla/OWNERS b/url/third_party/mozilla/OWNERS new file mode 100644 index 0000000..3605f481 --- /dev/null +++ b/url/third_party/mozilla/OWNERS
@@ -0,0 +1 @@ +# COMPONENT: Internals>Core