diff --git a/DEPS b/DEPS index 3951ec3..0a86db3 100644 --- a/DEPS +++ b/DEPS
@@ -181,7 +181,7 @@ # 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': 'bfb72113a7a84fde3189254fefb93ac7c6500a32', + 'skia_revision': 'edae1b3e044e5755a7b05a9776525fc6a00f0f7b', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -193,7 +193,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': 'c6ff255b602138b0f2f879e0fb5a764e4bb2c640', + 'angle_revision': '54d0d539593317eee954eaec1b4aca003032a360', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -236,7 +236,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling HarfBuzz # and whatever else without interference from each other. - 'harfbuzz_revision': '64a45be5198f6e22c91454bda7bd9a9294552dff', + 'harfbuzz_revision': '82545c5e2ba2067f2eb117c7358ed6d5b50ca942', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Emoji Segmenter # and whatever else without interference from each other. @@ -244,7 +244,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': '49cfb9bdc27751547fe992ba55d67cb1eb084044', + 'catapult_revision': '25614ff33a6262865cd487ca40ddab809bf9b681', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -252,7 +252,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': '3cd66dcf894a99faceb1c8809393ad33c78440b2', + 'devtools_frontend_revision': '395b69e99301f102f90dc01938cee016c53a074c', # 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. @@ -296,7 +296,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'spv_tools_revision': '18b3b94567a9251a6f8491a6d07c4422abadd22c', + 'spv_tools_revision': '8013d477aeac6b596216b0c68134d11561f8b05f', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -904,7 +904,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'a1266b63b566ad7632c542526018b73cba0eb8ff', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '59a3b2fd5d0ef813c51821a9012a9d91da86843b', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), @@ -1297,7 +1297,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '9640b3df9526d49e113507e8880f78a5fe89fab3', + Var('android_git') + '/platform/external/perfetto.git' + '@' + 'eac62c294ee1c23bc76059efaf8e16859ed58866', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3',
diff --git a/android_webview/lib/BUILD.gn b/android_webview/lib/BUILD.gn index 7ae4858..a8149c3 100644 --- a/android_webview/lib/BUILD.gn +++ b/android_webview/lib/BUILD.gn
@@ -59,9 +59,7 @@ ":lib", "//base", ] - sources = [ - "webview_entry_point.cc", - ] + sources = [ "webview_entry_point.cc" ] if (webview_includes_weblayer) { defines = [ "WEBVIEW_INCLUDES_WEBLAYER" ]
diff --git a/android_webview/renderer/BUILD.gn b/android_webview/renderer/BUILD.gn index c88f68f..6ceb223 100644 --- a/android_webview/renderer/BUILD.gn +++ b/android_webview/renderer/BUILD.gn
@@ -47,6 +47,7 @@ "//components/page_load_metrics/renderer", "//components/printing/common", "//components/printing/renderer", + "//components/resources", "//components/safe_browsing/content/renderer:throttles", "//components/safe_browsing/core:features", "//components/safe_browsing/core/common", @@ -55,6 +56,7 @@ "//components/security_interstitials/core/common/mojom", "//components/spellcheck:buildflags", "//components/spellcheck/renderer", + "//components/strings", "//components/visitedlink/renderer", "//content/public/child", "//content/public/common",
diff --git a/android_webview/renderer/DEPS b/android_webview/renderer/DEPS index 79803c2..4694021f 100644 --- a/android_webview/renderer/DEPS +++ b/android_webview/renderer/DEPS
@@ -7,6 +7,7 @@ "+components/autofill/content/renderer", "+components/cdm/renderer", "+components/page_load_metrics/renderer", + "+components/grit", "+components/printing/common", "+components/printing/renderer", "+components/safe_browsing/core/common", @@ -15,6 +16,7 @@ "+components/security_interstitials/core", "+components/security_interstitials/content/renderer", "+components/spellcheck/renderer", + "+components/strings", "+components/visitedlink/renderer", "+content/public/child",
diff --git a/android_webview/renderer/aw_content_renderer_client.cc b/android_webview/renderer/aw_content_renderer_client.cc index 82caaab..c4981454 100644 --- a/android_webview/renderer/aw_content_renderer_client.cc +++ b/android_webview/renderer/aw_content_renderer_client.cc
@@ -10,8 +10,6 @@ #include "android_webview/common/aw_switches.h" #include "android_webview/common/render_view_messages.h" #include "android_webview/common/url_constants.h" -#include "android_webview/grit/aw_resources.h" -#include "android_webview/grit/aw_strings.h" #include "android_webview/renderer/aw_content_settings_client.h" #include "android_webview/renderer/aw_key_systems.h" #include "android_webview/renderer/aw_print_render_frame_helper_delegate.h" @@ -28,8 +26,10 @@ #include "base/metrics/histogram_macros.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "components/grit/components_resources.h" #include "components/page_load_metrics/renderer/metrics_render_frame_observer.h" #include "components/printing/renderer/print_render_frame_helper.h" +#include "components/strings/grit/components_strings.h" #include "components/visitedlink/renderer/visitedlink_reader.h" #include "content/public/child/child_thread.h" #include "content/public/common/url_constants.h" @@ -229,22 +229,22 @@ // Create the error page based on the error reason. GURL gurl(error.url()); std::string url_string = gurl.possibly_invalid_spec(); - int reason_id = IDS_AW_WEBPAGE_CAN_NOT_BE_LOADED; + int reason_id = IDS_ANDROID_ERROR_PAGE_WEBPAGE_CAN_NOT_BE_LOADED; if (err.empty()) - reason_id = IDS_AW_WEBPAGE_TEMPORARILY_DOWN; + reason_id = IDS_ANDROID_ERROR_PAGE_WEBPAGE_TEMPORARILY_DOWN; std::string escaped_url = net::EscapeForHTML(url_string); std::vector<std::string> replacements; replacements.push_back( - l10n_util::GetStringUTF8(IDS_AW_WEBPAGE_NOT_AVAILABLE)); + l10n_util::GetStringUTF8(IDS_ANDROID_ERROR_PAGE_WEBPAGE_NOT_AVAILABLE)); replacements.push_back( l10n_util::GetStringFUTF8(reason_id, base::UTF8ToUTF16(escaped_url))); // Having chosen the base reason, chose what extra information to add. - if (reason_id == IDS_AW_WEBPAGE_TEMPORARILY_DOWN) { - replacements.push_back( - l10n_util::GetStringUTF8(IDS_AW_WEBPAGE_TEMPORARILY_DOWN_SUGGESTIONS)); + if (reason_id == IDS_ANDROID_ERROR_PAGE_WEBPAGE_TEMPORARILY_DOWN) { + replacements.push_back(l10n_util::GetStringUTF8( + IDS_ANDROID_ERROR_PAGE_WEBPAGE_TEMPORARILY_DOWN_SUGGESTIONS)); } else { replacements.push_back(err); } @@ -254,7 +254,7 @@ replacements.push_back(""); *error_html = base::ReplaceStringPlaceholders( ui::ResourceBundle::GetSharedInstance().LoadDataResourceString( - IDR_AW_LOAD_ERROR_HTML), + IDR_ANDROID_ERROR_PAGE_LOAD_ERROR_HTML), replacements, nullptr); }
diff --git a/android_webview/ui/aw_resources.grd b/android_webview/ui/aw_resources.grd index 61a0389..ef60b32 100644 --- a/android_webview/ui/aw_resources.grd +++ b/android_webview/ui/aw_resources.grd
@@ -6,9 +6,4 @@ </output> <output filename="aw_resources.pak" type="data_package" /> </outputs> - <release seq="1"> - <includes> - <include name="IDR_AW_LOAD_ERROR_HTML" file="resources\load_error.html" flattenhtml="true" type="BINDATA" compress="gzip" /> - </includes> - </release> </grit>
diff --git a/android_webview/ui/aw_strings.grd b/android_webview/ui/aw_strings.grd index 1a7115f..2b5e969a 100644 --- a/android_webview/ui/aw_strings.grd +++ b/android_webview/ui/aw_strings.grd
@@ -168,19 +168,4 @@ <file path="translations/aw_strings_zh-TW.xtb" lang="zh-TW" /> <file path="translations/aw_strings_zu.xtb" lang="zu" /> </translations> - <release seq="1"> - <messages fallback_to_english="true"> - <message name="IDS_AW_WEBPAGE_NOT_AVAILABLE" desc="The title of the webpage shown when the requested URL in unavailable"> - Webpage not available - </message> - <message name="IDS_AW_WEBPAGE_CAN_NOT_BE_LOADED" desc="Message informing the user that the page can not be loaded"> - The webpage at <ph name="PAGE"><strong>$1</strong><ex>page.html</ex></ph> could not be loaded because: - </message> - <message name="IDS_AW_WEBPAGE_TEMPORARILY_DOWN" desc="Message informing the user that it is not possible to contact the server"> - The webpage at <ph name="PAGE"><strong>$1</strong><ex>page.html</ex></ph> might be temporarily down or it may have moved permanently to a new web address. - </message> - <message name="IDS_AW_WEBPAGE_TEMPORARILY_DOWN_SUGGESTIONS" desc="Suggestions provided to the user when it is not possible to contact the server"><ph name="MARKUP_1"><strong><ex>_</ex></ph>Suggestions:<ph name="MARKUP_2"></strong><ul><li><ex>_</ex></ph>Make sure you have a data connection<ph name="MARKUP_3"></li><li><ex>_</ex></ph>Reload this webpage later<ph name="MARKUP_4"></li><li><ex>_</ex></ph>Check the address you entered<ph name="MARKUP_5"></li></ul><ex>_</ex></ph> - </message> - </messages> - </release> </grit>
diff --git a/android_webview/ui/grit_resources_whitelist.txt b/android_webview/ui/grit_resources_whitelist.txt index 9471450..39072e6 100644 --- a/android_webview/ui/grit_resources_whitelist.txt +++ b/android_webview/ui/grit_resources_whitelist.txt
@@ -1,3 +1,4 @@ +IDR_ANDROID_ERROR_PAGE_LOAD_ERROR_HTML IDR_ABOUT_UI_CREDITS_HTML IDR_WEBUI_JS_LOAD_TIME_DATA IDR_WEBUI_JSTEMPLATE_JS
diff --git a/android_webview/ui/grit_strings_whitelist.txt b/android_webview/ui/grit_strings_whitelist.txt index c3ed0e9..2f003d2 100644 --- a/android_webview/ui/grit_strings_whitelist.txt +++ b/android_webview/ui/grit_strings_whitelist.txt
@@ -1,3 +1,7 @@ +IDS_ANDROID_ERROR_PAGE_WEBPAGE_CAN_NOT_BE_LOADED +IDS_ANDROID_ERROR_PAGE_WEBPAGE_NOT_AVAILABLE +IDS_ANDROID_ERROR_PAGE_WEBPAGE_TEMPORARILY_DOWN +IDS_ANDROID_ERROR_PAGE_WEBPAGE_TEMPORARILY_DOWN_SUGGESTIONS IDS_POLICY_LIST_ENTRY_ERROR IDS_POLICY_SCHEMA_VALIDATION_ERROR IDS_POLICY_TYPE_ERROR
diff --git a/base/json/json_parser.cc b/base/json/json_parser.cc index 65a4b7d..357e6cb7 100644 --- a/base/json/json_parser.cc +++ b/base/json/json_parser.cc
@@ -667,6 +667,7 @@ return Value(num_double); } + ReportError(JSONReader::JSON_UNREPRESENTABLE_NUMBER, 1); return nullopt; }
diff --git a/base/json/json_reader.cc b/base/json/json_reader.cc index 43f6641..0956bf5 100644 --- a/base/json/json_reader.cc +++ b/base/json/json_reader.cc
@@ -35,6 +35,8 @@ "Dictionary keys must be quoted."; const char JSONReader::kInputTooLarge[] = "Input string is too large (>2GB)."; +const char JSONReader::kUnrepresentableNumber[] = + "Number cannot be represented."; JSONReader::ValueWithError::ValueWithError() = default; @@ -127,6 +129,8 @@ return kUnquotedDictionaryKey; case JSON_TOO_LARGE: return kInputTooLarge; + case JSON_UNREPRESENTABLE_NUMBER: + return kUnrepresentableNumber; case JSON_PARSE_ERROR_COUNT: break; }
diff --git a/base/json/json_reader.h b/base/json/json_reader.h index 3eee07c..d0dbb64 100644 --- a/base/json/json_reader.h +++ b/base/json/json_reader.h
@@ -71,6 +71,7 @@ JSON_UNSUPPORTED_ENCODING, JSON_UNQUOTED_DICTIONARY_KEY, JSON_TOO_LARGE, + JSON_UNREPRESENTABLE_NUMBER, JSON_PARSE_ERROR_COUNT }; @@ -102,6 +103,7 @@ static const char kUnsupportedEncoding[]; static const char kUnquotedDictionaryKey[]; static const char kInputTooLarge[]; + static const char kUnrepresentableNumber[]; // Constructs a reader. JSONReader(int options = JSON_PARSE_RFC,
diff --git a/base/json/json_reader_fuzzer.cc b/base/json/json_reader_fuzzer.cc index 6be408c7..68b4dc0 100644 --- a/base/json/json_reader_fuzzer.cc +++ b/base/json/json_reader_fuzzer.cc
@@ -24,6 +24,8 @@ JSONReader::ValueWithError json_val = JSONReader::ReadAndReturnValueWithError(input_string, options); + CHECK((json_val.error_code == JSONReader::JSON_NO_ERROR) == + json_val.value.has_value()); if (json_val.value) { // Check that the value can be serialized and deserialized back to an
diff --git a/base/json/json_reader_unittest.cc b/base/json/json_reader_unittest.cc index 186a6f1..c41b8a8 100644 --- a/base/json/json_reader_unittest.cc +++ b/base/json/json_reader_unittest.cc
@@ -165,6 +165,12 @@ double_val = 0.0; EXPECT_TRUE(root->GetAsDouble(&double_val)); EXPECT_DOUBLE_EQ(1.0, double_val); + + // This is syntaxtically valid, but out of range of a double. + auto value_with_error = + JSONReader::ReadAndReturnValueWithError("1e1000", JSON_PARSE_RFC); + ASSERT_FALSE(value_with_error.value); + ASSERT_NE(value_with_error.error_code, JSONReader::JSON_NO_ERROR); } TEST(JSONReaderTest, FractionalNumbers) {
diff --git a/base/util/type_safety/BUILD.gn b/base/util/type_safety/BUILD.gn index a335cc22..88c98b4 100644 --- a/base/util/type_safety/BUILD.gn +++ b/base/util/type_safety/BUILD.gn
@@ -32,9 +32,7 @@ if (enable_nocompile_tests) { nocompile_test("type_safety_nocompile_tests") { - sources = [ - "pass_key_unittest.nc", - ] + sources = [ "pass_key_unittest.nc" ] deps = [ ":type_safety",
diff --git a/base/util/values/BUILD.gn b/base/util/values/BUILD.gn index f3927a9..5048d86 100644 --- a/base/util/values/BUILD.gn +++ b/base/util/values/BUILD.gn
@@ -8,16 +8,12 @@ "values_util.h", ] - deps = [ - "//base:base", - ] + deps = [ "//base:base" ] } source_set("unittests") { testonly = true - sources = [ - "values_util_unittest.cc", - ] + sources = [ "values_util_unittest.cc" ] deps = [ ":values_util",
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 8583327..3eb5145 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -8891348586925471088 \ No newline at end of file +8891306328353316688 \ No newline at end of file
diff --git a/cc/tiles/checker_image_tracker.cc b/cc/tiles/checker_image_tracker.cc index 7fa79ed8..86129ac 100644 --- a/cc/tiles/checker_image_tracker.cc +++ b/cc/tiles/checker_image_tracker.cc
@@ -11,34 +11,26 @@ namespace cc { namespace { -// The enum for recording checker-imaging decision UMA metric. Keep this -// consistent with the ordering in CheckerImagingDecision in enums.xml. -// Note that this enum is used to back a UMA histogram so should be treated as -// append only. enum class CheckerImagingDecision { - kCanChecker = 0, + kCanChecker, // Animation State vetoes. - kVetoedAnimatedImage = 1, - kVetoedVideoFrame = 2, - // TODO(vmpstr): 3 used to be kVetoedAnimationUnknown, remove it somehow? - kVetoedMultipartImage = 4, + kVetoedAnimatedImage, + kVetoedVideoFrame, + kVetoedMultipartImage, // Load state vetoes. - kVetoedPartiallyLoadedImage = 5, - // TODO(vmpstr): 6 used to be kVetoedLoadStateUnknown, remove it somehow? + kVetoedPartiallyLoadedImage, // Size associated vetoes. - kVetoedSmallerThanCheckeringSize = 7, - kVetoedLargerThanCacheSize = 8, + kVetoedSmallerThanCheckeringSize, + kVetoedLargerThanCacheSize, // Vetoed because checkering of images has been disabled. - kVetoedForceDisable = 9, - - // 10 used to be kVetoedNotRequiredForActivation. + kVetoedForceDisable, // Sync was requested by the embedder. - kVetoedSyncRequested = 11, + kVetoedSyncRequested, kCheckerImagingDecisionCount }; @@ -311,11 +303,6 @@ auto it = insert_result.first; if (insert_result.second) { CheckerImagingDecision decision = CheckerImagingDecision::kCanChecker; - // If the mode is sync, then don't checker this image. - // TODO(vmpstr): Figure out if we should do something different in other - // cases. - if (decoding_mode_hint == PaintImage::DecodingMode::kSync) - decision = CheckerImagingDecision::kVetoedSyncRequested; // The following conditions must be true for an image to be checkerable: // @@ -350,10 +337,6 @@ ? DecodePolicy::ASYNC : DecodePolicy::SYNC; - UMA_HISTOGRAM_ENUMERATION( - "Compositing.Renderer.CheckerImagingDecision", decision, - CheckerImagingDecision::kCheckerImagingDecisionCount); - TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug"), "CheckerImageTracker::CheckerImagingDecision", "image_params", ToString(image_id, decision));
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn index 1ad3b178..94ab9d6 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn
@@ -64,12 +64,8 @@ # See comment in chrome_dll.gypi in the hardlink_to_output # target for why this cannot be 'initial' like the DLL. - inputs = [ - "$root_out_dir/initialexe/chrome.exe", - ] - outputs = [ - "$root_out_dir/chrome.exe", - ] + inputs = [ "$root_out_dir/initialexe/chrome.exe" ] + outputs = [ "$root_out_dir/chrome.exe" ] if (symbol_level != 0) { outputs += [ "$root_out_dir/chrome.exe.pdb" ] } @@ -81,9 +77,7 @@ "-a", current_cpu, ] - deps = [ - ":chrome_initial", - ] + deps = [ ":chrome_initial" ] } if (!is_multi_dll_chrome) { @@ -93,9 +87,7 @@ action("remove_chrome_child_artifacts") { script = "//build/rm.py" stamp = "$target_gen_dir/chrome_child_clean_up_stamp" - outputs = [ - stamp, - ] + outputs = [ stamp ] args = [ "--stamp", rebase_path(stamp, root_build_dir), @@ -136,12 +128,8 @@ if (!is_android && !is_mac) { group("chrome") { - public_deps = [ - ":chrome_initial", - ] - data_deps = [ - ":chrome_initial", - ] + public_deps = [ ":chrome_initial" ] + data_deps = [ ":chrome_initial" ] if (is_win) { public_deps += [ ":reorder_imports" ] data_deps += [ ":reorder_imports" ] @@ -171,22 +159,14 @@ # Because the sources list varies so significantly per-platform, generally # each platform lists its own files rather than relying on filtering or # removing unused files. - sources = [ - "app/chrome_exe_resource.h", - ] + sources = [ "app/chrome_exe_resource.h" ] defines = [] public_deps = [] - deps = [ - "//printing/buildflags", - ] + deps = [ "//printing/buildflags" ] - data = [ - "$root_out_dir/resources.pak", - ] + data = [ "$root_out_dir/resources.pak" ] if (is_linux || is_win) { - data_deps = [ - "//chrome:packed_resources", - ] + data_deps = [ "//chrome:packed_resources" ] } data_deps = [] @@ -312,9 +292,7 @@ if (is_desktop_linux && !is_component_build && !using_sanitizer) { version_script = "//build/linux/chrome.map" - inputs = [ - version_script, - ] + inputs = [ version_script ] ldflags += [ "-Wl,--version-script=" + rebase_path(version_script, root_build_dir) ] } @@ -372,15 +350,11 @@ # This target is a forwarding target to compile the necessary DLLs used # by Chrome. group("chrome_dll") { - data_deps = [ - ":main_dll", - ] + data_deps = [ ":main_dll" ] if (is_multi_dll_chrome) { data_deps += [ ":chrome_child" ] } else { - deps = [ - ":remove_chrome_child_artifacts", - ] + deps = [ ":remove_chrome_child_artifacts" ] } } @@ -467,9 +441,7 @@ if (is_multi_dll_chrome) { # This manifest matches what GYP produced. It may not even be necessary. windows_manifest("chrome_child_manifest") { - sources = [ - as_invoker_manifest, - ] + sources = [ as_invoker_manifest ] } shared_library("chrome_child") { @@ -513,12 +485,8 @@ } } copy("copy_first_run") { - sources = [ - "app/FirstRun", - ] - outputs = [ - "$root_out_dir/First Run", - ] + sources = [ "app/FirstRun" ] + outputs = [ "$root_out_dir/First Run" ] } } else if (is_mac) { chrome_helper_name = chrome_product_full_name + " Helper" @@ -526,13 +494,9 @@ chrome_framework_version = chrome_version_full group("chrome") { - deps = [ - ":chrome_app", - ] + deps = [ ":chrome_app" ] - data_deps = [ - ":chrome_app", - ] + data_deps = [ ":chrome_app" ] if (debug_devtools) { deps += [ ":devtools_debug_resources" ] @@ -547,13 +511,9 @@ } bundle_data("chrome_framework_services") { - sources = [ - "$root_out_dir/AlertNotificationService.xpc", - ] + sources = [ "$root_out_dir/AlertNotificationService.xpc" ] - outputs = [ - "{{bundle_contents_dir}}/XPCServices/{{source_file_part}}", - ] + outputs = [ "{{bundle_contents_dir}}/XPCServices/{{source_file_part}}" ] public_deps = [ "//chrome/browser/ui/cocoa/notifications:alert_notification_xpc_service", @@ -584,9 +544,7 @@ "CHROMIUM_CREATOR=$chrome_mac_creator_code", ] - sources = [ - "app/chrome_exe_main_mac.cc", - ] + sources = [ "app/chrome_exe_main_mac.cc" ] extra_configs = [ "//build/config/compiler:wexit_time_destructors" ] @@ -614,18 +572,14 @@ # those dependent libraries runtime dependencies of the .app bundle. # This is a bit of a hack, since GN deliberately terminates its search # for runtime_deps at create_bundle nodes (https://crbug.com/1010347). - data_deps = [ - ":chrome_framework", - ] + data_deps = [ ":chrome_framework" ] } } compiled_action("chrome_app_strings") { tool = "//chrome/tools/build/mac:infoplist_strings_tool" - inputs = [ - chrome_version_file, - ] + inputs = [ chrome_version_file ] outputs = [] @@ -660,13 +614,9 @@ ] + locales if (is_chrome_branded) { - deps = [ - "//chrome/app:google_chrome_strings", - ] + deps = [ "//chrome/app:google_chrome_strings" ] } else { - deps = [ - "//chrome/app:chromium_strings", - ] + deps = [ "//chrome/app:chromium_strings" ] } } @@ -675,12 +625,9 @@ sources = [ "$target_gen_dir/app_infoplist_strings/$locale.lproj/InfoPlist.strings", ] - outputs = [ - "{{bundle_resources_dir}}/$locale.lproj/{{source_file_part}}", - ] - public_deps = [ - ":chrome_app_strings", - ] + outputs = + [ "{{bundle_resources_dir}}/$locale.lproj/{{source_file_part}}" ] + public_deps = [ ":chrome_app_strings" ] } } group("chrome_app_strings_bundle_data") { @@ -697,9 +644,7 @@ "app/theme/$branding_path_component/mac/document.icns", "browser/ui/cocoa/applescript/scripting.sdef", ] - outputs = [ - "{{bundle_resources_dir}}/{{source_file_part}}", - ] + outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] public_deps = [ ":chrome_app_strings", "//components/policy:chrome_manifest_bundle", @@ -707,12 +652,8 @@ } bundle_data("chrome_versioned_bundle_data") { - sources = [ - "$root_out_dir/$chrome_framework_name.framework", - ] - outputs = [ - "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}", - ] + sources = [ "$root_out_dir/$chrome_framework_name.framework" ] + outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ] public_deps = [ # Before bundling the versioned app components, delete any existing # versions. @@ -738,9 +679,7 @@ _stamp_file = "$root_gen_dir/run_$target_name.stamp" - outputs = [ - _stamp_file, - ] + outputs = [ _stamp_file ] _old_versions_dir = "$root_out_dir/$chrome_product_full_name.app/Contents/Versions" @@ -794,9 +733,7 @@ "CHROMIUM_HELPER_BUNDLE_ID_SUFFIX=${invoker.helper_bundle_id_suffix}", ] - sources = [ - "app/chrome_exe_main_mac.cc", - ] + sources = [ "app/chrome_exe_main_mac.cc" ] extra_configs = [ "//build/config/compiler:wexit_time_destructors" ] @@ -845,9 +782,7 @@ "$root_out_dir/chrome_crashpad_handler", ] - outputs = [ - "{{bundle_contents_dir}}/Helpers/{{source_file_part}}", - ] + outputs = [ "{{bundle_contents_dir}}/Helpers/{{source_file_part}}" ] public_deps = [ "//chrome/app_shim:app_mode_loader", @@ -880,9 +815,7 @@ "browser/mac/install.sh", ] - outputs = [ - "{{bundle_resources_dir}}/{{source_file_part}}", - ] + outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] public_deps = [ ":packed_resources", @@ -921,9 +854,7 @@ action("devtools_debug_resources") { _stamp = "$target_out_dir/run_${target_name}.stamp" - outputs = [ - _stamp, - ] + outputs = [ _stamp ] script = "//build/symlink.py" @@ -954,9 +885,8 @@ if (enable_nacl) { bundle_data("chrome_framework_plugins") { sources = [] - outputs = [ - "{{bundle_contents_dir}}/Internet Plug-Ins/{{source_file_part}}", - ] + outputs = + [ "{{bundle_contents_dir}}/Internet Plug-Ins/{{source_file_part}}" ] public_deps = [] if (enable_nacl) { @@ -983,12 +913,8 @@ "$root_out_dir/egl_intermediates/libEGL.dylib", "$root_out_dir/egl_intermediates/libGLESv2.dylib", ] - outputs = [ - "{{bundle_contents_dir}}/Libraries/{{source_file_part}}", - ] - public_deps = [ - "//ui/gl:angle_library_copy", - ] + outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ] + public_deps = [ "//ui/gl:angle_library_copy" ] } # Add the SwiftShader .dylibs in the MODULE_DIR of Chromium.app @@ -997,46 +923,32 @@ "$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib", "$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.dylib", ] - outputs = [ - "{{bundle_contents_dir}}/Libraries/{{source_file_part}}", - ] - public_deps = [ - "//ui/gl:swiftshader_library_copy", - ] + outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ] + public_deps = [ "//ui/gl:swiftshader_library_copy" ] } } group("angle_library") { if (bundle_egl_libraries) { - deps = [ - ":angle_binaries", - ] + deps = [ ":angle_binaries" ] } } group("swiftshader_library") { if (bundle_egl_libraries) { - deps = [ - ":swiftshader_binaries", - ] + deps = [ ":swiftshader_binaries" ] } } if (bundle_widevine_cdm) { bundle_data("widevine_cdm_library_binaries") { - sources = [ - "$root_out_dir/$widevine_cdm_path/libwidevinecdm.dylib", - ] + sources = [ "$root_out_dir/$widevine_cdm_path/libwidevinecdm.dylib" ] if (enable_widevine_cdm_host_verification) { sources += [ "$root_out_dir/$widevine_cdm_path/libwidevinecdm.dylib.sig" ] } - outputs = [ - "{{bundle_contents_dir}}/Libraries/$widevine_cdm_path/{{source_file_part}}", - ] - public_deps = [ - "//third_party/widevine/cdm", - ] + outputs = [ "{{bundle_contents_dir}}/Libraries/$widevine_cdm_path/{{source_file_part}}" ] + public_deps = [ "//third_party/widevine/cdm" ] } bundle_data("widevine_cdm_library_manifest_and_license_files") { @@ -1047,9 +959,7 @@ outputs = [ "{{bundle_contents_dir}}/Libraries/WidevineCdm/{{source_file_part}}", ] - public_deps = [ - "//third_party/widevine/cdm", - ] + public_deps = [ "//third_party/widevine/cdm" ] } } @@ -1067,35 +977,23 @@ file = "$root_out_dir/$chrome_framework_name.framework/Versions/$chrome_framework_version/$chrome_framework_name" flags = 1 signature_file = "$root_out_dir/$chrome_framework_name.sig" - deps = [ - ":chrome_framework", - ] + deps = [ ":chrome_framework" ] } copy("chrome_framework_widevine_signature") { - deps = [ - ":sign_chrome_framework_for_widevine", - ] + deps = [ ":sign_chrome_framework_for_widevine" ] - sources = [ - "$root_out_dir/$chrome_framework_name.sig", - ] + sources = [ "$root_out_dir/$chrome_framework_name.sig" ] - outputs = [ - "$root_out_dir/$chrome_framework_name.framework/Resources/{{source_file_part}}", - ] + outputs = [ "$root_out_dir/$chrome_framework_name.framework/Resources/{{source_file_part}}" ] } } if (is_chrome_branded && enable_keystone_registration_framework) { bundle_data("keystone_registration_framework") { - sources = [ - "//third_party/googlemac/Releases/Keystone/KeystoneRegistration.framework", - ] + sources = [ "//third_party/googlemac/Releases/Keystone/KeystoneRegistration.framework" ] - outputs = [ - "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}", - ] + outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ] } } else { group("keystone_registration_framework") { @@ -1199,9 +1097,7 @@ "CHROMIUM_SHORT_NAME=$chrome_product_short_name", ] - public_deps = [ - ":chrome_dll", - ] + public_deps = [ ":chrome_dll" ] deps = [ ":angle_library", @@ -1236,9 +1132,7 @@ "-Wl,-reexport_library,libchrome_dll.dylib", ] - data_deps = [ - ":chrome_dll", - ] + data_deps = [ ":chrome_dll" ] } } @@ -1263,18 +1157,12 @@ rebase_path(_framework_binary_path, root_out_dir), mac_bin_path, ] - outputs = [ - stamp_file, - ] - public_deps = [ - ":chrome_framework", - ] + outputs = [ stamp_file ] + public_deps = [ ":chrome_framework" ] } } else { group("verify_chrome_framework_order") { - public_deps = [ - ":chrome_framework", - ] + public_deps = [ ":chrome_framework" ] } } @@ -1305,9 +1193,8 @@ sources = _chrome_symbols_sources - outputs = [ - "$root_out_dir/{{source_file_part}}-$chrome_version_full.breakpad", - ] + outputs = + [ "$root_out_dir/{{source_file_part}}-$chrome_version_full.breakpad" ] # Use an absolute path to dump_syms in case a user has it in their path. args = rebase_path(outputs, root_out_dir) + [ @@ -1369,9 +1256,7 @@ _output = "$root_out_dir/$chrome_product_full_name.dSYM.tar.bz2" - outputs = [ - _output, - ] + outputs = [ _output ] args = [ rebase_path(_output, root_out_dir) ] + rebase_path(_dsyms, root_out_dir) @@ -1463,16 +1348,12 @@ if (is_win) { process_version_rc_template("chrome_exe_version") { - sources = [ - "app/chrome_exe.ver", - ] + sources = [ "app/chrome_exe.ver" ] output = "$target_gen_dir/chrome_exe_version.rc" } process_version_rc_template("chrome_dll_version") { - sources = [ - "app/chrome_dll.ver", - ] + sources = [ "app/chrome_dll.ver" ] output = "$target_gen_dir/chrome_dll_version.rc" } @@ -1485,16 +1366,12 @@ } process_version_rc_template("nacl64_exe_version") { - sources = [ - "app/nacl64_exe.ver", - ] + sources = [ "app/nacl64_exe.ver" ] output = "$target_gen_dir/nacl64_exe_version.rc" } process_version_rc_template("other_version") { - sources = [ - "app/other.ver", - ] + sources = [ "app/other.ver" ] output = "$target_gen_dir/other_version.rc" } } @@ -1517,9 +1394,7 @@ ] } - outputs = [ - "$root_out_dir/{{source_file_part}}", - ] + outputs = [ "$root_out_dir/{{source_file_part}}" ] } group("resources") { @@ -1603,13 +1478,9 @@ ] if (!is_mac) { - outputs = [ - "$root_out_dir/default_apps/{{source_file_part}}", - ] + outputs = [ "$root_out_dir/default_apps/{{source_file_part}}" ] } else { - outputs = [ - "{{bundle_contents_dir}}/Default Apps/{{source_file_part}}", - ] + outputs = [ "{{bundle_contents_dir}}/Default Apps/{{source_file_part}}" ] } # Force anybody that depends on this to get the default apps as data files. @@ -1628,27 +1499,19 @@ if (enable_resource_whitelist_generation) { repack_whitelist = chrome_resource_whitelist - deps = [ - "//chrome:resource_whitelist", - ] + deps = [ "//chrome:resource_whitelist" ] } if (is_chrome_branded && !is_mac) { - public_deps = [ - ":default_apps", - ] + public_deps = [ ":default_apps" ] } } } repack("browser_tests_pak") { - sources = [ - "$root_gen_dir/chrome/webui_test_resources.pak", - ] + sources = [ "$root_gen_dir/chrome/webui_test_resources.pak" ] output = "$root_out_dir/browser_tests.pak" - deps = [ - "//chrome/test/data:webui_test_resources", - ] + deps = [ "//chrome/test/data:webui_test_resources" ] } group("strings") { @@ -1662,9 +1525,8 @@ if (is_android) { java_cpp_enum("content_setting_javagen") { - sources = [ - "../components/content_settings/core/common/content_settings.h", - ] + sources = + [ "../components/content_settings/core/common/content_settings.h" ] } java_cpp_enum("content_settings_type_javagen") { @@ -1674,9 +1536,7 @@ } java_cpp_enum("credit_card_javagen") { - sources = [ - "../components/autofill/core/browser/data_model/credit_card.h", - ] + sources = [ "../components/autofill/core/browser/data_model/credit_card.h" ] } java_cpp_enum("assist_ranker_prediction_enum_javagen") { @@ -1686,39 +1546,27 @@ } java_cpp_enum("page_info_connection_type_javagen") { - sources = [ - "browser/ui/android/page_info/page_info_controller_android.h", - ] + sources = [ "browser/ui/android/page_info/page_info_controller_android.h" ] } java_cpp_enum("page_info_action_javagen") { - sources = [ - "browser/ui/page_info/page_info.h", - ] + sources = [ "browser/ui/page_info/page_info.h" ] } java_cpp_enum("partner_bookmarks_javagen") { - sources = [ - "browser/android/bookmarks/partner_bookmarks_reader.h", - ] + sources = [ "browser/android/bookmarks/partner_bookmarks_reader.h" ] } java_cpp_enum("payments_journey_logger_enum_javagen") { - sources = [ - "../components/payments/core/journey_logger.h", - ] + sources = [ "../components/payments/core/journey_logger.h" ] } java_cpp_enum("quick_action_category_enum_javagen") { - sources = [ - "browser/android/contextualsearch/resolved_search_term.h", - ] + sources = [ "browser/android/contextualsearch/resolved_search_term.h" ] } java_cpp_enum("offline_pages_enum_javagen") { - sources = [ - "browser/offline_pages/offline_page_utils.h", - ] + sources = [ "browser/offline_pages/offline_page_utils.h" ] } java_cpp_enum("download_enum_javagen") { @@ -1729,15 +1577,11 @@ } java_cpp_enum("instant_apps_reasons_enum_javagen") { - sources = [ - "browser/android/instantapps/instant_apps_settings.cc", - ] + sources = [ "browser/android/instantapps/instant_apps_settings.cc" ] } java_cpp_enum("supervised_user_url_filter_enum_javagen") { - sources = [ - "browser/supervised_user/supervised_user_url_filter.h", - ] + sources = [ "browser/supervised_user/supervised_user_url_filter.h" ] } source_set("chrome_android_core") { @@ -1802,19 +1646,11 @@ if (enable_resource_whitelist_generation) { generate_resource_whitelist("resource_whitelist") { if (is_android) { - deps = [ - "//chrome/android:libchrome", - ] - inputs = [ - "$root_out_dir/lib.unstripped/libchrome$shlib_extension", - ] + deps = [ "//chrome/android:libchrome" ] + inputs = [ "$root_out_dir/lib.unstripped/libchrome$shlib_extension" ] } else if (is_win) { - deps = [ - ":main_dll", - ] - inputs = [ - "$root_out_dir/chrome.dll.pdb", - ] + deps = [ ":main_dll" ] + inputs = [ "$root_out_dir/chrome.dll.pdb" ] if (is_multi_dll_chrome) { deps += [ ":chrome_child" ] inputs += [ "$root_out_dir/chrome_child.dll.pdb" ] @@ -1848,9 +1684,7 @@ symbol_file = "$root_out_dir/chrome.breakpad.$current_cpu" } - deps = [ - ":chrome", - ] + deps = [ ":chrome" ] } extract_symbols("crashpad_symbols") { binary = "$root_out_dir/crashpad_handler" @@ -1862,9 +1696,7 @@ symbol_file = "$root_out_dir/crashpad.breakpad.$current_cpu" } - deps = [ - "//third_party/crashpad/crashpad/handler:crashpad_handler", - ] + deps = [ "//third_party/crashpad/crashpad/handler:crashpad_handler" ] } extract_symbols("swiftshader_egl_symbols") { binary = "$root_out_dir/swiftshader/libEGL.so" @@ -1876,9 +1708,8 @@ symbol_file = "$root_out_dir/swiftshader_libegl.breakpad.$current_cpu" } - deps = [ - "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL", - ] + deps = + [ "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL" ] } extract_symbols("swiftshader_gles_symbols") { binary = "$root_out_dir/swiftshader/libGLESv2.so" @@ -1904,9 +1735,7 @@ symbol_file = "$root_out_dir/angle_libegl.breakpad.$current_cpu" } - deps = [ - "//third_party/angle:libEGL", - ] + deps = [ "//third_party/angle:libEGL" ] } extract_symbols("angle_gles_symbols") { binary = "$root_out_dir/libGLESv2.so" @@ -1918,9 +1747,7 @@ symbol_file = "$root_out_dir/angle_libgles.breakpad.$current_cpu" } - deps = [ - "//third_party/angle:libGLESv2", - ] + deps = [ "//third_party/angle:libGLESv2" ] } } @@ -1932,8 +1759,6 @@ "//third_party/xdg-utils/scripts/xdg-mime", "//third_party/xdg-utils/scripts/xdg-settings", ] - outputs = [ - "$root_out_dir/{{source_file_part}}", - ] + outputs = [ "$root_out_dir/{{source_file_part}}" ] } }
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index c5cbee99..fe65a56 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -2757,6 +2757,7 @@ "java/src/org/chromium/chrome/browser/infobar/TranslateCompactInfoBar.java", "java/src/org/chromium/chrome/browser/infobar/UpdatePasswordInfoBar.java", "java/src/org/chromium/chrome/browser/init/NativeStartupBridge.java", + "java/src/org/chromium/chrome/browser/installedapp/PackageHash.java", "java/src/org/chromium/chrome/browser/instantapps/InstantAppsSettings.java", "java/src/org/chromium/chrome/browser/jsdialog/JavascriptTabModalDialog.java", "java/src/org/chromium/chrome/browser/locale/LocaleManager.java",
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomSheetContent.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomSheetContent.java index 882af02..1078798 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomSheetContent.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomSheetContent.java
@@ -101,7 +101,7 @@ @Override public boolean hideOnScroll() { - return true; + return false; } @Override
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTestUtil.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTestUtil.java index 41acc0c..06321c8ff 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTestUtil.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTestUtil.java
@@ -360,6 +360,7 @@ testRule.startCustomTabActivityWithIntent(CustomTabsTestUtils.createMinimalCustomTabIntent( InstrumentationRegistry.getTargetContext(), "about:blank")); } + /** * Starts Autofill Assistant on the given {@code activity} and injects the given {@code * testService}.
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacade.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacade.java index 11fa6ec..5bfbf8f 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacade.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantFacade.java
@@ -5,6 +5,7 @@ package org.chromium.chrome.browser.autofill_assistant; import android.content.Context; +import android.content.Intent; import android.os.Bundle; import androidx.annotation.Nullable; @@ -67,16 +68,33 @@ private static final String EXPERIMENTS_SYNTHETIC_TRIAL = "AutofillAssistantExperimentsTrial"; /** Returns true if conditions are satisfied to attempt to start Autofill Assistant. */ - public static boolean isConfigured(@Nullable Bundle intentExtras) { + private static boolean isConfigured(@Nullable Bundle intentExtras) { return getBooleanParameter(intentExtras, PARAMETER_ENABLED); } - /** Starts Autofill Assistant on the given {@code activity}. */ + /** + * Starts Autofill Assistant. + * @param activity {@link ChromeActivity} the activity on which the Autofill Assistant is being + * started. This must be a launch activity holding the correct intent for starting. + */ public static void start(ChromeActivity activity) { + start(activity, activity.getInitialIntent().getExtras(), + activity.getInitialIntent().getDataString()); + } + + /** + * Starts Autofill Assistant. + * @param activity {@link ChromeActivity} the activity on which the Autofill Assistant is being + * started. + * @param bundleExtras {@link Bundle} the extras which were used to start the Autofill + * Assistant. + * @param initialUrl the initial URL the Autofill Assistant should be started on. + */ + public static void start(ChromeActivity activity, Bundle bundleExtras, String initialUrl) { // Register synthetic trial as soon as possible. UmaSessionStats.registerSyntheticFieldTrial(TRIGGERED_SYNTHETIC_TRIAL, ENABLED_GROUP); // Synthetic trial for experiments. - String experimentIds = getExperimentIds(activity.getInitialIntent().getExtras()); + String experimentIds = getExperimentIds(bundleExtras); if (!experimentIds.isEmpty()) { for (String experimentId : experimentIds.split(",")) { UmaSessionStats.registerSyntheticFieldTrial( @@ -95,13 +113,11 @@ return; } - Bundle bundleExtras = activity.getInitialIntent().getExtras(); Map<String, String> parameters = extractParameters(bundleExtras); parameters.remove(PARAMETER_ENABLED); - String initialUrl = activity.getInitialIntent().getDataString(); moduleEntry.start(tab, tab.getWebContents(), !AutofillAssistantPreferencesUtil.getShowOnboarding(), initialUrl, - parameters, experimentIds, activity.getInitialIntent().getExtras()); + parameters, experimentIds, bundleExtras); }); }); } @@ -203,4 +219,18 @@ } }); } + + public static boolean isAutofillAssistantEnabled(Intent intent) { + // Check for configuration first for early return to prevent test failures on checking + // feature flags. + return AutofillAssistantFacade.isConfigured(intent.getExtras()) + && ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ASSISTANT); + } + + public static boolean isAutofillAssistantByIntentTriggeringEnabled(Intent intent) { + // Check for configuration first for early return to prevent test failures on checking + // feature flags. + return AutofillAssistantFacade.isAutofillAssistantEnabled(intent) + && ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ASSISTANT_CHROME_ENTRY); + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java index ed8b77da..34aed1b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
@@ -178,6 +178,7 @@ public static final String ANDROID_SITE_SETTINGS_UI_REFRESH = "AndroidSiteSettingsUIRefresh"; public static final String APP_NOTIFICATION_STATUS_MESSAGING = "AppNotificationStatusMessaging"; public static final String AUTOFILL_ASSISTANT = "AutofillAssistant"; + public static final String AUTOFILL_ASSISTANT_CHROME_ENTRY = "AutofillAssistantChromeEntry"; public static final String AUTOFILL_ASSISTANT_DIRECT_ACTIONS = "AutofillAssistantDirectActions"; public static final String AUTOFILL_MANUAL_FALLBACK_ANDROID = "AutofillManualFallbackAndroid"; public static final String AUTOFILL_REFRESH_STYLE_ANDROID = "AutofillRefreshStyleAndroid";
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java index bc534aa..2ef57e85 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
@@ -218,7 +218,7 @@ // We start the Autofill Assistant after the call to super.finishNativeInitialization() as // this will initialize the BottomSheet that is used to embed the Autofill Assistant bottom // bar. - if (isAutofillAssistantEnabled()) { + if (AutofillAssistantFacade.isAutofillAssistantEnabled(getInitialIntent())) { AutofillAssistantFacade.start(this); } } @@ -461,9 +461,4 @@ return component; } - - private boolean isAutofillAssistantEnabled() { - return ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ASSISTANT) - && AutofillAssistantFacade.isConfigured(getInitialIntent().getExtras()); - } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java index 44f7d061..34fad78 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
@@ -1207,6 +1207,9 @@ mNativeDownloadManagerService, DownloadManagerService.this); } + @Override + public void onProfileDestroyed(Profile profile) {} + @CalledByNative void onResumptionFailed(String downloadGuid) { mDownloadNotifier.notifyDownloadFailed(new DownloadInfo.Builder()
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java index 8d15c19c..e91fc8ba 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
@@ -30,6 +30,7 @@ import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.IntentHandler; +import org.chromium.chrome.browser.autofill_assistant.AutofillAssistantFacade; import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider.LaunchSourceType; import org.chromium.chrome.browser.instantapps.InstantAppsHandler; import org.chromium.chrome.browser.tab.Tab; @@ -150,6 +151,15 @@ String browserFallbackUrl = IntentUtils.safeGetStringExtra(targetIntent, EXTRA_BROWSER_FALLBACK_URL); + // TOOD(b/145195894): This is temporary workaround. The fallback URL should be configured + // in the intent directly on the SRP page. This is here for testing purposes and will be + // removed as soon as the SRP intents are updated. + if (browserFallbackUrl == null + && AutofillAssistantFacade.isAutofillAssistantByIntentTriggeringEnabled( + targetIntent) + && mDelegate.isSerpReferrer()) { + browserFallbackUrl = targetIntent.getDataString(); + } if (browserFallbackUrl != null && !UrlUtilities.isValidForIntentFallbackNavigation(browserFallbackUrl)) { browserFallbackUrl = null; @@ -724,6 +734,22 @@ return true; } + private boolean handleWithAutofillAssistant( + ExternalNavigationParams params, Intent targetIntent, String browserFallbackUrl) { + if (browserFallbackUrl != null && !params.isIncognito() + && AutofillAssistantFacade.isAutofillAssistantByIntentTriggeringEnabled( + targetIntent) + && mDelegate.isSerpReferrer()) { + if (params.getTab() != null) { + AutofillAssistantFacade.start(((TabImpl) params.getTab()).getActivity(), + targetIntent.getExtras(), browserFallbackUrl); + } + if (DEBUG) Log.i(TAG, "Handling with Assistant"); + return true; + } + return false; + } + private @OverrideUrlLoadingResult int shouldOverrideUrlLoadingInternal( ExternalNavigationParams params, Intent targetIntent, @Nullable String browserFallbackUrl) { @@ -734,6 +760,10 @@ return OverrideUrlLoadingResult.NO_OVERRIDE; } + if (handleWithAutofillAssistant(params, targetIntent, browserFallbackUrl)) { + return OverrideUrlLoadingResult.NO_OVERRIDE; + } + boolean isExternalProtocol = !UrlUtilities.isAcceptedScheme(params.getUrl()); if (isInternalPdfDownload(isExternalProtocol, params)) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/StartupTabPreloader.java b/chrome/android/java/src/org/chromium/chrome/browser/init/StartupTabPreloader.java index cb2ee74..1713bbe 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/init/StartupTabPreloader.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/init/StartupTabPreloader.java
@@ -133,6 +133,9 @@ } } + @Override + public void onProfileDestroyed(Profile profile) {} + /** * @returns True if based on the intent we should load the tab, returns false otherwise. */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/installedapp/InstalledAppProviderImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/installedapp/InstalledAppProviderImpl.java index fefa637..fef01ccf 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/installedapp/InstalledAppProviderImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/installedapp/InstalledAppProviderImpl.java
@@ -205,9 +205,7 @@ // add significant noise to the time taken to check whether this app is installed and // related. Otherwise, it would be possible to tell whether a non-related app is installed, // based on the time this operation takes. - // - // Generate a 16-bit hash based on a unique device ID + the package name. - short hash = PackageHash.hashForPackage(packageName); + short hash = PackageHash.hashForPackage(packageName, mFrameUrlDelegate.isIncognito()); // The time delay is the low 10 bits of the hash in 100ths of a ms (between 0 and 10ms). int delayHundredthsOfMs = hash & 0x3ff;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/installedapp/PackageHash.java b/chrome/android/java/src/org/chromium/chrome/browser/installedapp/PackageHash.java index 5e22246..1207f50 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/installedapp/PackageHash.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/installedapp/PackageHash.java
@@ -7,7 +7,10 @@ import androidx.annotation.VisibleForTesting; import org.chromium.base.ApiCompatibilityUtils; +import org.chromium.base.annotations.CalledByNative; import org.chromium.chrome.browser.crypto.ByteArrayGenerator; +import org.chromium.chrome.browser.profiles.Profile; +import org.chromium.chrome.browser.profiles.ProfileManager; import java.io.IOException; import java.security.GeneralSecurityException; @@ -33,18 +36,66 @@ * However, it does need to change periodically: because installing or uninstalling the app creates * a noticeable change to the timing of the operation, we need to occasionally change the salt to * create plausible deniability (the attacker can't tell the difference between the salt changing - * and the app being installed/uninstalled). + * and the app being installed/uninstalled). The salt is also updated whenever the cookies are + * cleared. */ class PackageHash { - // Global salt string for the life of the browser process. A unique salt is generated for - // each run of the browser process that will be stable for its lifetime. - private static byte[] sSalt; + static class Salt implements ProfileManager.Observer { + private static Salt sInstance; + + private byte[] mProfileSalt; + private byte[] mIncognitoSalt; + + private Salt() { + reset(false); + ProfileManager.addObserver(this); + } + + void reset(boolean onlyIncognito) { + try { + if (!onlyIncognito) { + mProfileSalt = new ByteArrayGenerator().getBytes(20); + } + mIncognitoSalt = new ByteArrayGenerator().getBytes(20); + } catch (IOException | GeneralSecurityException e) { + // If this happens, the crypto source is messed up and we want the browser to crash. + throw new RuntimeException(e); + } + } + + public static Salt getInstance() { + if (sInstance == null) { + sInstance = new Salt(); + } + return sInstance; + } + + public byte[] getSaltBytes(boolean isIncognito) { + return isIncognito ? mIncognitoSalt : mProfileSalt; + } + + @Override + public void onProfileAdded(Profile profile) {} + + @Override + public void onProfileDestroyed(Profile profile) { + if (profile.isOffTheRecord()) { + reset(true); + } + } + + @VisibleForTesting + public static void setGlobalSaltForTesting(byte[] salt) { + sInstance.mProfileSalt = salt.clone(); + sInstance.mIncognitoSalt = salt.clone(); + } + } /** * Returns a SHA-256 hash of the package name, truncated to a 16-bit integer. */ - public static short hashForPackage(String packageName) { - byte[] salt = getGlobalSalt(); + public static short hashForPackage(String packageName, boolean isIncognito) { + byte[] salt = Salt.getInstance().getSaltBytes(isIncognito); Mac hasher; try { hasher = Mac.getInstance("HmacSHA256"); @@ -68,26 +119,12 @@ return (short) hash; } - /** - * Gets the global salt for the current browser session. - * - * If one does not exist, generates one using a PRNG and caches it, then returns it. - */ - private static byte[] getGlobalSalt() { - if (sSalt == null) { - try { - sSalt = new ByteArrayGenerator().getBytes(20); - } catch (IOException | GeneralSecurityException e) { - // If this happens, the crypto source is messed up and we want the browser to crash. - throw new RuntimeException(e); - } + @CalledByNative + public static void onCookiesDeleted() { + if (Salt.sInstance == null) { + // Singleton is uninitialized. No need to reset the salt. + return; } - - return sSalt; - } - - @VisibleForTesting - public static void setGlobalSaltForTesting(byte[] salt) { - sSalt = salt; + Salt.getInstance().reset(false); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/nfc/NfcSystemLevelPrompt.java b/chrome/android/java/src/org/chromium/chrome/browser/nfc/NfcSystemLevelPrompt.java index 6803c29..e86fb89 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/nfc/NfcSystemLevelPrompt.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/nfc/NfcSystemLevelPrompt.java
@@ -71,7 +71,7 @@ .with(ModalDialogProperties.POSITIVE_BUTTON_TEXT, resources, R.string.nfc_prompt_turn_on) .with(ModalDialogProperties.NEGATIVE_BUTTON_TEXT, resources, - R.string.no_thanks) + R.string.cancel) .with(ModalDialogProperties.CONTENT_DESCRIPTION, resources, R.string.nfc_disabled_on_device_message) .with(ModalDialogProperties.FILTER_TOUCH_FOR_SECURITY, true)
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/top/StartSurfaceToolbarCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/top/StartSurfaceToolbarCoordinator.java index 6117aed..41154771 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/top/StartSurfaceToolbarCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/top/StartSurfaceToolbarCoordinator.java
@@ -9,6 +9,7 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior; +import org.chromium.chrome.browser.incognito.IncognitoUtils; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.toolbar.IncognitoStateProvider; import org.chromium.chrome.browser.ui.appmenu.AppMenuButtonHelper; @@ -122,7 +123,9 @@ PropertyModelChangeProcessor.create( mPropertyModel, mView, StartSurfaceToolbarViewBinder::bind); - mIncognitoSwitchCoordinator = new IncognitoSwitchCoordinator(mView, mTabModelSelector); + if (IncognitoUtils.isIncognitoModeEnabled()) { + mIncognitoSwitchCoordinator = new IncognitoSwitchCoordinator(mView, mTabModelSelector); + } } private boolean isInflated() {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java index ac3c682..c3377f22 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java
@@ -44,6 +44,7 @@ import org.chromium.chrome.browser.tab.TabRedirectHandler; import org.chromium.chrome.browser.webapps.WebappInfo; import org.chromium.chrome.browser.webapps.WebappScopePolicy; +import org.chromium.chrome.test.util.browser.Features; import org.chromium.chrome.test.util.browser.webapps.WebappTestHelper; import org.chromium.content_public.browser.test.NativeLibraryTestRule; import org.chromium.ui.base.PageTransition; @@ -51,7 +52,6 @@ import java.net.URISyntaxException; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.regex.Pattern; @@ -59,12 +59,19 @@ * Instrumentation tests for {@link ExternalNavigationHandler}. */ @RunWith(BaseJUnit4ClassRunner.class) +// clang-format off @DisableIf.Build(message = "Flaky on K - see https://crbug.com/851444", sdk_is_less_than = Build.VERSION_CODES.LOLLIPOP) +@Features.EnableFeatures({ChromeFeatureList.CCT_EXTERNAL_LINK_HANDLING, + ChromeFeatureList.INTENT_BLOCK_EXTERNAL_FORM_REDIRECT_NO_GESTURE}) public class ExternalNavigationHandlerTest { + // clang-format on @Rule public final NativeLibraryTestRule mNativeLibraryTestRule = new NativeLibraryTestRule(); + @Rule + public Features.JUnitProcessor processor = new Features.JUnitProcessor(); + // Expectations private static final int IGNORE = 0x0; private static final int START_INCOGNITO = 0x1; @@ -123,6 +130,12 @@ "com.google.android.instantapps.START", "com.google.android.instantapps.nmr1.INSTALL", "com.google.android.instantapps.nmr1.VIEW"}; + private static final String AUTOFILL_ASSISTANT_INTENT_URL = + "intent://www.example.com#Intent;scheme=https;" + + "B.org.chromium.chrome.browser.autofill_assistant.ENABLED=true;" + + "S." + ExternalNavigationHandler.EXTRA_BROWSER_FALLBACK_URL + "=" + + Uri.encode("https://www.example.com") + ";end"; + private Context mContext; private final TestExternalNavigationDelegate mDelegate; private ExternalNavigationHandler mUrlHandler; @@ -138,11 +151,6 @@ mContext = new TestContext(InstrumentationRegistry.getTargetContext(), mDelegate); ContextUtils.initApplicationContextForTests(mContext); - HashMap<String, Boolean> features = new HashMap<String, Boolean>(); - features.put(ChromeFeatureList.CCT_EXTERNAL_LINK_HANDLING, true); - features.put(ChromeFeatureList.INTENT_BLOCK_EXTERNAL_FORM_REDIRECT_NO_GESTURE, true); - ChromeFeatureList.setTestFeatures(features); - mNativeLibraryTestRule.loadNativeLibraryNoBrowserProcess(); } @@ -1591,6 +1599,69 @@ Assert.assertTrue(mDelegate.startIncognitoIntentCalled); } + @Test + @SmallTest + @Features.EnableFeatures({ChromeFeatureList.AUTOFILL_ASSISTANT, + ChromeFeatureList.AUTOFILL_ASSISTANT_CHROME_ENTRY}) + public void + testAssistantAutofillIntent_catchNavigationFromGoogleSearch() { + mDelegate.setIsSerpReferrer(true); + + checkUrl(AUTOFILL_ASSISTANT_INTENT_URL) + .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_CLOBBERING_TAB, IGNORE); + + Assert.assertNull(mDelegate.startActivityIntent); + } + + @Test + @SmallTest + @Features.EnableFeatures({ChromeFeatureList.AUTOFILL_ASSISTANT, + ChromeFeatureList.AUTOFILL_ASSISTANT_CHROME_ENTRY}) + public void + testAssistantAutofillIntent_doNotCatchNavigationInIncognito() { + mDelegate.setIsSerpReferrer(true); + + checkUrl(AUTOFILL_ASSISTANT_INTENT_URL) + .withIsIncognito(true) + .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT, + START_OTHER_ACTIVITY); + + Assert.assertNotNull(mDelegate.startActivityIntent); + Assert.assertTrue(mDelegate.startActivityIntent.getScheme().startsWith("https")); + } + + @Test + @SmallTest + @Features.EnableFeatures({ChromeFeatureList.AUTOFILL_ASSISTANT, + ChromeFeatureList.AUTOFILL_ASSISTANT_CHROME_ENTRY}) + public void + testAssistantAutofillIntent_doNotCatchNavigationFromDifferentOrigin() { + mDelegate.setIsSerpReferrer(false); + + checkUrl(AUTOFILL_ASSISTANT_INTENT_URL) + .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT, + START_OTHER_ACTIVITY); + + Assert.assertNotNull(mDelegate.startActivityIntent); + Assert.assertTrue(mDelegate.startActivityIntent.getScheme().startsWith("https")); + } + + @Test + @SmallTest + @Features.DisableFeatures({ChromeFeatureList.AUTOFILL_ASSISTANT, + ChromeFeatureList.AUTOFILL_ASSISTANT_CHROME_ENTRY}) + public void + testAssistantAutofillIntent_doNotCatchNavigationForNonEnabledFeature() { + mDelegate.setIsSerpReferrer(true); + + checkUrl(AUTOFILL_ASSISTANT_INTENT_URL) + .expecting(OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT, + START_OTHER_ACTIVITY); + + Assert.assertNotNull(mDelegate.startActivityIntent); + Assert.assertTrue(mDelegate.startActivityIntent.getScheme().startsWith("https")); + } + private static ResolveInfo newResolveInfo(String packageName) { ActivityInfo ai = new ActivityInfo(); ai.packageName = packageName;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/gesturenav/NavigationHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/gesturenav/NavigationHandlerTest.java index e66db6d..68172cf 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/gesturenav/NavigationHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/gesturenav/NavigationHandlerTest.java
@@ -21,6 +21,7 @@ import org.chromium.base.ActivityState; import org.chromium.base.ApplicationStatus; import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.base.test.util.FlakyTest; import org.chromium.base.test.util.RetryOnFailure; import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.compositor.animation.CompositorAnimationHandler; @@ -134,6 +135,7 @@ @Test @SmallTest @RetryOnFailure + @FlakyTest(message = "crbug.com/1041233") public void testLeftSwipeNavigateBackOnRenderedPage() { mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); ChromeTabUtils.fullyLoadUrlInNewTab(InstrumentationRegistry.getInstrumentation(),
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tasks/ReturnToChromeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tasks/ReturnToChromeTest.java index 68b2cffb..a9691e1 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tasks/ReturnToChromeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tasks/ReturnToChromeTest.java
@@ -24,6 +24,7 @@ import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; +import org.chromium.base.test.util.FlakyTest; import org.chromium.base.test.util.Restriction; import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.ChromeSwitches; @@ -97,6 +98,7 @@ @SmallTest @Feature({"ReturnToChrome"}) @CommandLineFlags.Add({BASE_PARAMS + "/" + TAB_SWITCHER_ON_RETURN_MS + "/0"}) + @FlakyTest(message = "crbug.com/1040895") public void testTabSwitcherModeTriggeredBeyondThreshold() throws Exception { TabUiTestHelper.prepareTabsWithThumbnail(mActivityTestRule, 2, 0, mUrl); ApplicationTestUtils.finishActivity(mActivityTestRule.getActivity()); @@ -148,6 +150,7 @@ @MediumTest @Feature({"ReturnToChrome"}) @CommandLineFlags.Add({BASE_PARAMS + "/" + TAB_SWITCHER_ON_RETURN_MS + "/0"}) + @FlakyTest(message = "crbug.com/1040896") public void testTabSwitcherModeTriggeredBeyondThreshold_WarmStart() throws Exception { testTabSwitcherModeTriggeredBeyondThreshold();
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/installedapp/PackageHashTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/installedapp/PackageHashTest.java index 2c2d6d2..77c5ff6 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/installedapp/PackageHashTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/installedapp/PackageHashTest.java
@@ -5,32 +5,56 @@ package org.chromium.chrome.browser.installedapp; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.BlockJUnit4ClassRunner; import org.chromium.base.test.util.Feature; +import java.util.Arrays; + /** * Tests that PackageHash generates correct hashes. */ @RunWith(BlockJUnit4ClassRunner.class) public class PackageHashTest { + @Before + public void setUp() { + // Initialize the Singleton. + PackageHash.Salt.getInstance(); + } + @Test @Feature({"InstalledApp"}) public void testPackageHash() { byte[] salt = {0x64, 0x09, -0x68, -0x25, 0x70, 0x11, 0x25, 0x24, 0x68, -0x1a, 0x08, 0x79, -0x12, -0x50, 0x3b, -0x57, -0x17, -0x4d, 0x46, 0x02}; - PackageHash.setGlobalSaltForTesting(salt); + PackageHash.Salt.setGlobalSaltForTesting(salt); // These expectations are based on the salt + ':' + packageName, encoded in UTF-8, hashed // with SHA-256, and looking at the first two bytes of the result. - Assert.assertEquals((short) 0x0d4d, PackageHash.hashForPackage("com.example.test1")); - Assert.assertEquals((short) 0xfa6f, PackageHash.hashForPackage("com.example.t\u00e9st2")); + Assert.assertEquals((short) 0x0d4d, PackageHash.hashForPackage("com.example.test1", false)); + Assert.assertEquals( + (short) 0xfa6f, PackageHash.hashForPackage("com.example.t\u00e9st2", false)); byte[] salt2 = {-0x10, 0x38, -0x28, 0x1f, 0x59, 0x2d, -0x2d, -0x4a, 0x23, 0x76, 0x6d, -0x54, 0x27, -0x2d, -0x3f, -0x59, -0x2e, -0x0e, 0x67, 0x7a}; - PackageHash.setGlobalSaltForTesting(salt2); - Assert.assertEquals((short) 0xd6d6, PackageHash.hashForPackage("com.example.test1")); - Assert.assertEquals((short) 0x5193, PackageHash.hashForPackage("com.example.t\u00e9st2")); + PackageHash.Salt.setGlobalSaltForTesting(salt2); + Assert.assertEquals((short) 0xd6d6, PackageHash.hashForPackage("com.example.test1", false)); + Assert.assertEquals( + (short) 0x5193, PackageHash.hashForPackage("com.example.t\u00e9st2", false)); + } + + @Test + @Feature({"InstalledApp"}) + public void testSaltResets() { + PackageHash.Salt salt = PackageHash.Salt.getInstance(); + byte[] firstSalt = salt.getSaltBytes(/* isIncognito= */ true); + + PackageHash.onCookiesDeleted(); + byte[] postDeletionSalt = salt.getSaltBytes(/* isIncognito= */ true); + + // The salt should have been updated after cookies were deleted. + Assert.assertFalse(Arrays.equals(firstSalt, postDeletionSalt)); } }
diff --git a/chrome/android/native_java_unittests/src/org/chromium/chrome/browser/installedapp/InstalledAppProviderTest.java b/chrome/android/native_java_unittests/src/org/chromium/chrome/browser/installedapp/InstalledAppProviderTest.java index b0dcc35..186ffb8 100644 --- a/chrome/android/native_java_unittests/src/org/chromium/chrome/browser/installedapp/InstalledAppProviderTest.java +++ b/chrome/android/native_java_unittests/src/org/chromium/chrome/browser/installedapp/InstalledAppProviderTest.java
@@ -838,7 +838,7 @@ public void testArtificialDelay() throws Exception { byte[] salt = {0x64, 0x09, -0x68, -0x25, 0x70, 0x11, 0x25, 0x24, 0x68, -0x1a, 0x08, 0x79, -0x12, -0x50, 0x3b, -0x57, -0x17, -0x4d, 0x46, 0x02}; - PackageHash.setGlobalSaltForTesting(salt); + PackageHash.Salt.setGlobalSaltForTesting(salt); setAssetStatement(PACKAGE_NAME_1, NAMESPACE_WEB, RELATION_HANDLE_ALL_URLS, ORIGIN); // Installed app.
diff --git a/chrome/android/public/profiles/java/src/org/chromium/chrome/browser/profiles/Profile.java b/chrome/android/public/profiles/java/src/org/chromium/chrome/browser/profiles/Profile.java index b17413d..731be05 100644 --- a/chrome/android/public/profiles/java/src/org/chromium/chrome/browser/profiles/Profile.java +++ b/chrome/android/public/profiles/java/src/org/chromium/chrome/browser/profiles/Profile.java
@@ -26,12 +26,28 @@ mIsOffTheRecord = ProfileJni.get().isOffTheRecord(mNativeProfileAndroid, Profile.this); } + /** + * Returns the original profile, even if it is called in an incognito context. + * + * https://crbug.com/1041781: Remove after auditing and replacing all usecases. + * + * @deprecated use {@link #getMainProfile()} instead. + */ + @Deprecated public static Profile getLastUsedProfile() { + return getMainProfile(); + } + + /** + * Returns the main profile. Note that it returns the original profile even + * if it is called in an incognito context. + */ + public static Profile getMainProfile() { // TODO(crbug.com/704025): turn this into an assert once the bug is fixed if (!ProfileManager.isInitialized()) { throw new IllegalStateException("Browser hasn't finished initialization yet!"); } - return (Profile) ProfileJni.get().getLastUsedProfile(); + return (Profile) ProfileJni.get().getMainProfile(); } /** @@ -106,6 +122,8 @@ if (mIsOffTheRecord) { CookiesFetcher.deleteCookiesIfNecessary(); } + + ProfileManager.onProfileDestroyed(this); } @CalledByNative @@ -115,7 +133,7 @@ @NativeMethods interface Natives { - Object getLastUsedProfile(); + Object getMainProfile(); Object fromWebContents(WebContents webContents); void destroyWhenAppropriate(long nativeProfileAndroid, Profile caller); Object getOriginalProfile(long nativeProfileAndroid, Profile caller);
diff --git a/chrome/android/public/profiles/java/src/org/chromium/chrome/browser/profiles/ProfileManager.java b/chrome/android/public/profiles/java/src/org/chromium/chrome/browser/profiles/ProfileManager.java index 95085df..fc8bc31e 100644 --- a/chrome/android/public/profiles/java/src/org/chromium/chrome/browser/profiles/ProfileManager.java +++ b/chrome/android/public/profiles/java/src/org/chromium/chrome/browser/profiles/ProfileManager.java
@@ -21,6 +21,12 @@ * @param profile The profile that has just been created. */ public void onProfileAdded(Profile profile); + + /** + * Called whenever a profile is destroyed. + * @param profile The profile that has just been created. + */ + public void onProfileDestroyed(Profile profile); } /** @@ -52,4 +58,10 @@ observer.onProfileAdded(profile); } } + + static void onProfileDestroyed(Profile profile) { + for (Observer observer : sObservers) { + observer.onProfileDestroyed(profile); + } + } }
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index 9c099eae..fe547dcb 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -4157,6 +4157,9 @@ <message name="IDS_SETTINGS_ADD_FINGERPRINT_DIALOG_INSTRUCTION_LOCATE_SCANNER_KEYBOARD" desc="Text in the add fingerprint dialog telling users to place finger on the sensor on the keyboard."> Touch the fingerprint sensor with your finger </message> + <message name="IDS_SETTINGS_ADD_FINGERPRINT_DIALOG_INSTRUCTION_LOCATE_SCANNER_KEYBOARD_BOTTOM_LEFT_ARIA_LABEL" desc="Aria label in the add fingerprint dialog telling users that the fingerprint sensor is in the bottom left corner of the keyboard. Only visible by screen reader software."> + The fingerprint sensor is the bottom left-hand key on your keyboard. Touch it lightly with any finger. + </message> <message name="IDS_SETTINGS_ADD_FINGERPRINT_DIALOG_INSTRUCTION_LOCATE_SCANNER_KEYBOARD_BOTTOM_RIGHT_ARIA_LABEL" desc="Aria label in the add fingerprint dialog telling users that the fingerprint sensor is in the bottom right corner of the keyboard. Only visible by screen reader software."> The fingerprint sensor is the bottom right-hand key on your keyboard. Touch it lightly with any finger. </message>
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_ADD_FINGERPRINT_DIALOG_INSTRUCTION_LOCATE_SCANNER_KEYBOARD_BOTTOM_LEFT_ARIA_LABEL.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_ADD_FINGERPRINT_DIALOG_INSTRUCTION_LOCATE_SCANNER_KEYBOARD_BOTTOM_LEFT_ARIA_LABEL.png.sha1 new file mode 100644 index 0000000..1c271261 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_ADD_FINGERPRINT_DIALOG_INSTRUCTION_LOCATE_SCANNER_KEYBOARD_BOTTOM_LEFT_ARIA_LABEL.png.sha1
@@ -0,0 +1 @@ +d3e75f6088ff4785b7f95d3043cd2a8356f5a4f7 \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index d1410e6..553c2b2 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -1462,6 +1462,8 @@ "push_messaging/push_messaging_app_identifier.h", "push_messaging/push_messaging_constants.cc", "push_messaging/push_messaging_constants.h", + "push_messaging/push_messaging_features.cc", + "push_messaging/push_messaging_features.h", "push_messaging/push_messaging_notification_manager.cc", "push_messaging/push_messaging_notification_manager.h", "push_messaging/push_messaging_service_factory.cc", @@ -1707,8 +1709,6 @@ "ssl/insecure_sensitive_input_driver_factory.h", "ssl/known_interception_disclosure_infobar_delegate.cc", "ssl/known_interception_disclosure_infobar_delegate.h", - "ssl/mitm_software_blocking_page.cc", - "ssl/mitm_software_blocking_page.h", "ssl/secure_origin_policy_handler.cc", "ssl/secure_origin_policy_handler.h", "ssl/secure_origin_prefs_observer.cc",
diff --git a/chrome/browser/android/autofill_assistant/client_android.cc b/chrome/browser/android/autofill_assistant/client_android.cc index cf56f20d..35b0b088 100644 --- a/chrome/browser/android/autofill_assistant/client_android.cc +++ b/chrome/browser/android/autofill_assistant/client_android.cc
@@ -129,8 +129,8 @@ const JavaParamRef<jobject>& jcaller, const JavaParamRef<jstring>& jinitial_url, const JavaParamRef<jstring>& jexperiment_ids, - const JavaParamRef<jobjectArray>& parameter_names, - const JavaParamRef<jobjectArray>& parameter_values, + const JavaParamRef<jobjectArray>& jparameter_names, + const JavaParamRef<jobjectArray>& jparameter_values, const JavaParamRef<jobject>& jonboarding_coordinator, jboolean jonboarding_shown, jlong jservice) { @@ -150,12 +150,27 @@ AttachUI(jonboarding_coordinator); } - std::unique_ptr<TriggerContextImpl> trigger_context = CreateTriggerContext( - env, jexperiment_ids, parameter_names, parameter_values); + GURL initial_url(base::android::ConvertJavaStringToUTF8(env, jinitial_url)); + auto trigger_context = CreateTriggerContext( + env, jexperiment_ids, jparameter_names, jparameter_values); trigger_context->SetCCT(true); trigger_context->SetOnboardingShown(jonboarding_shown); - GURL initial_url(base::android::ConvertJavaStringToUTF8(env, jinitial_url)); + if (VLOG_IS_ON(2)) { + std::string experiment_ids = + base::android::ConvertJavaStringToUTF8(env, jexperiment_ids); + std::map<std::string, std::string> parameters; + FillStringMapFromJava(env, jparameter_names, jparameter_values, + ¶meters); + + DVLOG(2) << "Starting autofill assistant with parameters:"; + DVLOG(2) << "\tinitial_url: " << initial_url; + DVLOG(2) << "\texperiment_ids: " << experiment_ids; + DVLOG(2) << "\tparameters:"; + for (const auto& param : parameters) { + DVLOG(2) << "\t\t" << param.first << ": " << param.second; + } + } return controller_->Start(initial_url, std::move(trigger_context)); } @@ -216,16 +231,16 @@ JNIEnv* env, const base::android::JavaParamRef<jobject>& jcaller, const base::android::JavaParamRef<jstring>& jexperiment_ids, - const base::android::JavaParamRef<jobjectArray>& jargument_names, - const base::android::JavaParamRef<jobjectArray>& jargument_values, + const base::android::JavaParamRef<jobjectArray>& jparameter_names, + const base::android::JavaParamRef<jobjectArray>& jparameter_values, const base::android::JavaParamRef<jobject>& jcallback) { if (!controller_) CreateController(nullptr); base::android::ScopedJavaGlobalRef<jobject> scoped_jcallback(env, jcallback); controller_->Track( - CreateTriggerContext(env, jexperiment_ids, jargument_names, - jargument_values), + CreateTriggerContext(env, jexperiment_ids, jparameter_names, + jparameter_values), base::BindOnce(&ClientAndroid::OnFetchWebsiteActions, weak_ptr_factory_.GetWeakPtr(), scoped_jcallback)); } @@ -334,17 +349,18 @@ const base::android::JavaParamRef<jobject>& jcaller, const base::android::JavaParamRef<jstring>& jaction_name, const base::android::JavaParamRef<jstring>& jexperiment_ids, - const base::android::JavaParamRef<jobjectArray>& jargument_names, - const base::android::JavaParamRef<jobjectArray>& jargument_values, + const base::android::JavaParamRef<jobjectArray>& jparameter_names, + const base::android::JavaParamRef<jobjectArray>& jparameter_values, const base::android::JavaParamRef<jobject>& jonboarding_coordinator) { std::string action_name = base::android::ConvertJavaStringToUTF8(env, jaction_name); int action_index = FindDirectAction(action_name); - std::unique_ptr<TriggerContextImpl> trigger_context = CreateTriggerContext( - env, jexperiment_ids, jargument_names, jargument_values); + auto trigger_context = CreateTriggerContext( + env, jexperiment_ids, jparameter_names, jparameter_values); trigger_context->SetDirectAction(true); + // Cancel through the UI if it is up. This allows the user to undo. This is // always available, even if no action was found and action_index == -1. if (action_name == kCancelActionName && ui_controller_android_) {
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc index 6afc993..47c700ca 100644 --- a/chrome/browser/android/chrome_feature_list.cc +++ b/chrome/browser/android/chrome_feature_list.cc
@@ -66,6 +66,7 @@ &autofill::features::kAutofillRefreshStyleAndroid, &autofill::features::kAutofillEnableCompanyName, &autofill_assistant::features::kAutofillAssistant, + &autofill_assistant::features::kAutofillAssistantChromeEntry, &autofill_assistant::features::kAutofillAssistantDirectActions, &autofill::features::kAutofillTouchToFill, &content_settings::kImprovedCookieControlsForThirdPartyCookieBlocking,
diff --git a/chrome/browser/apps/BUILD.gn b/chrome/browser/apps/BUILD.gn index 52efd75..12729a527 100644 --- a/chrome/browser/apps/BUILD.gn +++ b/chrome/browser/apps/BUILD.gn
@@ -13,9 +13,7 @@ "apps_launch.h", ] - deps = [ - "//chrome/browser/apps/platform_apps", - ] + deps = [ "//chrome/browser/apps/platform_apps" ] configs += [ "//build/config/compiler:wexit_time_destructors" ] }
diff --git a/chrome/browser/apps/platform_apps/api/BUILD.gn b/chrome/browser/apps/platform_apps/api/BUILD.gn index de34653..2e47c26 100644 --- a/chrome/browser/apps/platform_apps/api/BUILD.gn +++ b/chrome/browser/apps/platform_apps/api/BUILD.gn
@@ -59,9 +59,8 @@ "//extensions/browser", ] - public_deps = [ - "//chrome/browser/apps/platform_apps/api/music_manager_private", - ] + public_deps = + [ "//chrome/browser/apps/platform_apps/api/music_manager_private" ] if (is_chromeos) { sources += [
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc index f3e896b9..ab0f64b 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
@@ -114,6 +114,7 @@ #include "net/http/http_transaction_factory.h" #if defined(OS_ANDROID) +#include "chrome/android/chrome_jni_headers/PackageHash_jni.h" #include "chrome/browser/android/customtabs/origin_verifier.h" #include "chrome/browser/android/explore_sites/explore_sites_service_factory.h" #include "chrome/browser/android/feed/feed_lifecycle_bridge.h" @@ -701,7 +702,13 @@ } } - MediaDeviceIDSalt::Reset(profile_->GetPrefs()); + if (filter_builder->GetMode() == BrowsingDataFilterBuilder::BLACKLIST) { + MediaDeviceIDSalt::Reset(profile_->GetPrefs()); + +#if defined(OS_ANDROID) + Java_PackageHash_onCookiesDeleted(base::android::AttachCurrentThread()); +#endif + } } //////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler.cc b/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler.cc index dc4b75af..c88c3671 100644 --- a/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler.cc +++ b/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler.cc
@@ -146,11 +146,15 @@ for (const std::string& mime_type : request->mime_types) { std::vector<base::FilePath::StringType> extensions; net::GetExtensionsForMimeType(mime_type, &extensions); - if (extensions.empty()) { - // Allow the user to select all files if MIME type conversion fails. + file_type_info->extensions.push_back(extensions); + + // Enable "Select from all files" option if GetExtensionsForMimeType + // can't find any matching extensions or specified MIME type contains an + // asterisk. This is because some extensions used in Android (e.g. .DNG) are + // not covered by GetExtensionsForMimeType. (crbug.com/1034874) + if (extensions.empty() || + base::EndsWith(mime_type, "/*", base::CompareCase::SENSITIVE)) { file_type_info->include_all_files = true; - } else { - file_type_info->extensions.push_back(extensions); } } }
diff --git a/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler_unittest.cc b/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler_unittest.cc index 3759008..651b9ca 100644 --- a/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler_unittest.cc +++ b/chrome/browser/chromeos/arc/fileapi/arc_select_files_handler_unittest.cc
@@ -38,6 +38,7 @@ MATCHER_P(FileTypeInfoMatcher, expected, "") { EXPECT_EQ(expected.extensions, arg.extensions); + EXPECT_EQ(expected.include_all_files, arg.include_all_files); return true; } @@ -210,6 +211,33 @@ arc_select_files_handler_->SelectFiles(request, callback.Get()); } +TEST_F(ArcSelectFilesHandlerTest, SelectFiles_FileTypeInfo_Asterisk) { + SelectFilesRequestPtr request = SelectFilesRequest::New(); + request->action_type = SelectFilesActionType::OPEN_DOCUMENT; + request->mime_types.push_back("multipart/*"); + request->task_id = 1234; + + SelectFileDialog::FileTypeInfo expected_file_type_info; + expected_file_type_info.allowed_paths = + SelectFileDialog::FileTypeInfo::ANY_PATH; + std::vector<base::FilePath::StringType> extensions; + extensions.push_back("mhtml"); + extensions.push_back("mht"); + // include_all_files should be enabled when MIME type contains an asterisk. + expected_file_type_info.include_all_files = true; + expected_file_type_info.extensions.push_back(extensions); + + EXPECT_CALL( + *mock_dialog_holder_, + SelectFile(_, _, + testing::Pointee(FileTypeInfoMatcher(expected_file_type_info)), + 1234, _)) + .Times(1); + + base::MockCallback<SelectFilesCallback> callback; + arc_select_files_handler_->SelectFiles(request, callback.Get()); +} + TEST_F(ArcSelectFilesHandlerTest, SelectFiles_InitialDocumentPath) { SelectFilesRequestPtr request = SelectFilesRequest::New(); request->action_type = SelectFilesActionType::OPEN_DOCUMENT;
diff --git a/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc b/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc index 95edb568..b48ad37 100644 --- a/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc +++ b/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.cc
@@ -126,6 +126,8 @@ cl->GetSwitchValueASCII(switches::kFingerprintSensorLocation); if (location_info == "power-button-top-left") return FingerprintLocation::TABLET_POWER_BUTTON; + if (location_info == "keyboard-bottom-left") + return FingerprintLocation::KEYBOARD_BOTTOM_LEFT; if (location_info == "keyboard-bottom-right") return FingerprintLocation::KEYBOARD_BOTTOM_RIGHT; if (location_info == "keyboard-top-right")
diff --git a/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h b/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h index c81e766..45a4005 100644 --- a/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h +++ b/chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h
@@ -30,8 +30,9 @@ // Enumeration specifying the possible fingerprint sensor locations. enum class FingerprintLocation { TABLET_POWER_BUTTON = 0, - KEYBOARD_TOP_RIGHT = 1, + KEYBOARD_BOTTOM_LEFT = 1, KEYBOARD_BOTTOM_RIGHT = 2, + KEYBOARD_TOP_RIGHT = 3, }; base::TimeDelta PasswordConfirmationFrequencyToTimeDelta(
diff --git a/chrome/browser/net/profile_network_context_service_browsertest.cc b/chrome/browser/net/profile_network_context_service_browsertest.cc index 54f6dffa..2dcb983 100644 --- a/chrome/browser/net/profile_network_context_service_browsertest.cc +++ b/chrome/browser/net/profile_network_context_service_browsertest.cc
@@ -191,8 +191,9 @@ base::HistogramTester histograms_; }; +// TODO(https://crbug.com/1041810): flaky IN_PROC_BROWSER_TEST_F(ProfileNetworkContextServiceCacheSameBrowsertest, - TestCacheResetParameter) { + DISABLED_TestCacheResetParameter) { // At this point, we have already called the initialization once on startup. // Verify that we have the correct values in the local_state. PrefService* local_state = g_browser_process->local_state(); @@ -227,8 +228,9 @@ base::HistogramTester histograms_; }; +// TODO(https://crbug.com/1041810): flaky IN_PROC_BROWSER_TEST_F(ProfileNetworkContextServiceCacheChangeBrowsertest, - TestCacheResetParameter) { + DISABLED_TestCacheResetParameter) { // At this point, we have already called the initialization once on startup. // Verify that we have the correct values in the local_state. PrefService* local_state = g_browser_process->local_state();
diff --git a/chrome/browser/notifications/BUILD.gn b/chrome/browser/notifications/BUILD.gn index 1390b7f..2ebbde7 100644 --- a/chrome/browser/notifications/BUILD.gn +++ b/chrome/browser/notifications/BUILD.gn
@@ -11,7 +11,5 @@ group("unit_tests") { testonly = true - deps = [ - "//chrome/browser/notifications/scheduler:unit_tests", - ] + deps = [ "//chrome/browser/notifications/scheduler:unit_tests" ] }
diff --git a/chrome/browser/profiles/profile_android.cc b/chrome/browser/profiles/profile_android.cc index ac94f1f7..a18ff5583 100644 --- a/chrome/browser/profiles/profile_android.cc +++ b/chrome/browser/profiles/profile_android.cc
@@ -50,7 +50,7 @@ } // static -ScopedJavaLocalRef<jobject> ProfileAndroid::GetLastUsedProfile(JNIEnv* env) { +ScopedJavaLocalRef<jobject> ProfileAndroid::GetMainProfile(JNIEnv* env) { Profile* profile = ProfileManager::GetLastUsedProfile(); if (profile == NULL) { NOTREACHED() << "Profile not found."; @@ -122,8 +122,8 @@ } // static -ScopedJavaLocalRef<jobject> JNI_Profile_GetLastUsedProfile(JNIEnv* env) { - return ProfileAndroid::GetLastUsedProfile(env); +ScopedJavaLocalRef<jobject> JNI_Profile_GetMainProfile(JNIEnv* env) { + return ProfileAndroid::GetMainProfile(env); } // static
diff --git a/chrome/browser/profiles/profile_android.h b/chrome/browser/profiles/profile_android.h index 50221463..e7a62a2 100644 --- a/chrome/browser/profiles/profile_android.h +++ b/chrome/browser/profiles/profile_android.h
@@ -21,8 +21,7 @@ static Profile* FromProfileAndroid( const base::android::JavaRef<jobject>& obj); - static base::android::ScopedJavaLocalRef<jobject> GetLastUsedProfile( - JNIEnv* env); + static base::android::ScopedJavaLocalRef<jobject> GetMainProfile(JNIEnv* env); // Destroys this Profile when possible. void DestroyWhenAppropriate(JNIEnv* env,
diff --git a/chrome/browser/push_messaging/BUILD.gn b/chrome/browser/push_messaging/BUILD.gn index 7f63e2f1..01e95127 100644 --- a/chrome/browser/push_messaging/BUILD.gn +++ b/chrome/browser/push_messaging/BUILD.gn
@@ -5,7 +5,5 @@ import("//third_party/protobuf/proto_library.gni") proto_library("budget_proto") { - sources = [ - "budget.proto", - ] + sources = [ "budget.proto" ] }
diff --git a/chrome/browser/push_messaging/push_messaging_browsertest.cc b/chrome/browser/push_messaging/push_messaging_browsertest.cc index 083e9e88..2f420f6 100644 --- a/chrome/browser/push_messaging/push_messaging_browsertest.cc +++ b/chrome/browser/push_messaging/push_messaging_browsertest.cc
@@ -33,6 +33,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/push_messaging/push_messaging_app_identifier.h" #include "chrome/browser/push_messaging/push_messaging_constants.h" +#include "chrome/browser/push_messaging/push_messaging_features.h" #include "chrome/browser/push_messaging/push_messaging_service_factory.h" #include "chrome/browser/push_messaging/push_messaging_service_impl.h" #include "chrome/browser/ui/browser.h" @@ -2590,7 +2591,7 @@ class PushMessagingIncognitoBrowserTest : public PushMessagingBrowserTest { public: - ~PushMessagingIncognitoBrowserTest() override {} + ~PushMessagingIncognitoBrowserTest() override = default; // PushMessagingBrowserTest: void SetUpOnMainThread() override { @@ -2619,3 +2620,41 @@ ASSERT_TRUE(RunScript("hasSubscription()", &script_result)); ASSERT_EQ("false - not subscribed", script_result); } + +class PushMessagingDisallowSenderIdsBrowserTest + : public PushMessagingBrowserTest { + public: + PushMessagingDisallowSenderIdsBrowserTest() { + scoped_feature_list_.InitAndEnableFeature(kPushMessagingDisallowSenderIDs); + } + + ~PushMessagingDisallowSenderIdsBrowserTest() override = default; + + private: + base::test::ScopedFeatureList scoped_feature_list_; +}; + +IN_PROC_BROWSER_TEST_F(PushMessagingDisallowSenderIdsBrowserTest, + SubscriptionWithSenderIdFails) { + std::string script_result; + + ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); + ASSERT_EQ("ok - service worker registered", script_result); + + ASSERT_NO_FATAL_FAILURE(RequestAndAcceptPermission()); + + LoadTestPage(); // Reload to become controlled. + + ASSERT_TRUE(RunScript("isControlled()", &script_result)); + ASSERT_EQ("true - is controlled", script_result); + + // Attempt to create a subscription with a GCM Sender ID ("numeric key"), + // which should fail because the kPushMessagingDisallowSenderIDs feature has + // been enabled for this test. + ASSERT_TRUE( + RunScript("documentSubscribePushWithNumericKey()", &script_result)); + EXPECT_EQ( + "AbortError - Registration failed - GCM Sender IDs are no longer " + "supported, please upgrade to VAPID authentication instead", + script_result); +}
diff --git a/chrome/browser/push_messaging/push_messaging_features.cc b/chrome/browser/push_messaging/push_messaging_features.cc new file mode 100644 index 0000000..644b543c --- /dev/null +++ b/chrome/browser/push_messaging/push_messaging_features.cc
@@ -0,0 +1,8 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/push_messaging/push_messaging_features.h" + +const base::Feature kPushMessagingDisallowSenderIDs{ + "PushMessagingDisallowSenderIDs", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/browser/push_messaging/push_messaging_features.h b/chrome/browser/push_messaging/push_messaging_features.h new file mode 100644 index 0000000..1dc1384 --- /dev/null +++ b/chrome/browser/push_messaging/push_messaging_features.h
@@ -0,0 +1,13 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_FEATURES_H_ +#define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_FEATURES_H_ + +#include "base/feature_list.h" + +// Feature flag to disallow creation of push messages with GCM Sender IDs. +extern const base::Feature kPushMessagingDisallowSenderIDs; + +#endif // CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_FEATURES_H_
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.cc b/chrome/browser/push_messaging/push_messaging_service_impl.cc index e89c2b9..9f984289 100644 --- a/chrome/browser/push_messaging/push_messaging_service_impl.cc +++ b/chrome/browser/push_messaging/push_messaging_service_impl.cc
@@ -29,6 +29,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/push_messaging/push_messaging_app_identifier.h" #include "chrome/browser/push_messaging/push_messaging_constants.h" +#include "chrome/browser/push_messaging/push_messaging_features.h" #include "chrome/browser/push_messaging/push_messaging_service_factory.h" #include "chrome/browser/ui/chrome_pages.h" #include "chrome/common/buildflags.h" @@ -86,6 +87,20 @@ "pushManager.subscribe({userVisibleOnly: true}) instead. See " "https://goo.gl/yqv4Q4 for more details."; +// Message displayed in the console (as an error) when a GCM Sender ID is used +// to create a subscription, which is unsupported. The subscription request will +// have been blocked, and an exception will be thrown as well. +const char kSenderIdRegistrationDisallowedMessage[] = + "The provided application server key is not a VAPID key. Only VAPID keys " + "are supported. For more information check https://crbug.com/979235."; + +// Message displayed in the console (as a warning) when a GCM Sender ID is used +// to create a subscription, which will soon be unsupported. +const char kSenderIdRegistrationDeprecatedMessage[] = + "The provided application server key is not a VAPID key. Only VAPID keys " + "will be supported in the future. For more information check " + "https://crbug.com/979235."; + void RecordDeliveryStatus(blink::mojom::PushDeliveryStatus status) { UMA_HISTOGRAM_ENUMERATION("PushMessaging.DeliveryStatus", status); } @@ -151,6 +166,21 @@ "Push message received" /* event_name */, message_id, event_metadata); } +content::RenderFrameHost* GetMainFrameForRenderFrameHost( + content::RenderFrameHost* render_frame_host) { + content::WebContents* web_contents = + content::WebContents::FromRenderFrameHost(render_frame_host); + + return web_contents ? web_contents->GetMainFrame() : nullptr; +} + +bool IsVapidKey(const std::string& application_server_key) { + // VAPID keys are NIST P-256 public keys in uncompressed format (64 bytes), + // verified through its length and the 0x04 prefix. + return application_server_key.size() == 65 && + application_server_key[0] == 0x04; +} + } // namespace // static @@ -502,7 +532,7 @@ void PushMessagingServiceImpl::SubscribeFromDocument( const GURL& requesting_origin, int64_t service_worker_registration_id, - int renderer_id, + int render_process_id, int render_frame_id, blink::mojom::PushSubscriptionOptionsPtr options, bool user_gesture, @@ -526,16 +556,16 @@ } content::RenderFrameHost* render_frame_host = - content::RenderFrameHost::FromID(renderer_id, render_frame_id); - content::WebContents* web_contents = - content::WebContents::FromRenderFrameHost(render_frame_host); - if (!web_contents) - return; + content::RenderFrameHost::FromID(render_process_id, render_frame_id); if (!options->user_visible_only) { - web_contents->GetMainFrame()->AddMessageToConsole( - blink::mojom::ConsoleMessageLevel::kError, - kSilentPushUnsupportedMessage); + content::RenderFrameHost* main_frame = + GetMainFrameForRenderFrameHost(render_frame_host); + + if (main_frame) { + main_frame->AddMessageToConsole(blink::mojom::ConsoleMessageLevel::kError, + kSilentPushUnsupportedMessage); + } SubscribeEndWithError( std::move(callback), @@ -549,7 +579,8 @@ user_gesture, base::BindOnce(&PushMessagingServiceImpl::DoSubscribe, weak_factory_.GetWeakPtr(), app_identifier, - std::move(options), std::move(callback))); + std::move(options), std::move(callback), render_process_id, + render_frame_id)); } void PushMessagingServiceImpl::SubscribeFromWorker( @@ -586,6 +617,7 @@ } DoSubscribe(app_identifier, std::move(options), std::move(register_callback), + /* render_process_id= */ -1, /* render_frame_id= */ -1, CONTENT_SETTING_ALLOW); } @@ -613,6 +645,8 @@ const PushMessagingAppIdentifier& app_identifier, blink::mojom::PushSubscriptionOptionsPtr options, RegisterCallback register_callback, + int render_process_id, + int render_frame_id, ContentSetting content_setting) { if (content_setting != CONTENT_SETTING_ALLOW) { SubscribeEndWithError( @@ -621,11 +655,38 @@ return; } - IncreasePushSubscriptionCount(1, true /* is_pending */); - std::string application_server_key_string( options->application_server_key.begin(), options->application_server_key.end()); + + // TODO(peter): Move this check to the renderer process & Mojo message + // validation once the flag is always enabled, and remove the + // |render_process_id| and |render_frame_id| parameters from this method. + if (!IsVapidKey(application_server_key_string)) { + content::RenderFrameHost* render_frame_host = + content::RenderFrameHost::FromID(render_process_id, render_frame_id); + content::RenderFrameHost* main_frame = + GetMainFrameForRenderFrameHost(render_frame_host); + + if (base::FeatureList::IsEnabled(kPushMessagingDisallowSenderIDs)) { + if (main_frame) { + main_frame->AddMessageToConsole( + blink::mojom::ConsoleMessageLevel::kError, + kSenderIdRegistrationDisallowedMessage); + } + SubscribeEndWithError( + std::move(register_callback), + blink::mojom::PushRegistrationStatus::UNSUPPORTED_GCM_SENDER_ID); + return; + } else if (main_frame) { + main_frame->AddMessageToConsole( + blink::mojom::ConsoleMessageLevel::kWarning, + kSenderIdRegistrationDeprecatedMessage); + } + } + + IncreasePushSubscriptionCount(1, true /* is_pending */); + GetInstanceIDDriver() ->GetInstanceID(app_identifier.app_id()) ->GetToken(NormalizeSenderInfo(application_server_key_string), kGCMScope, @@ -1106,10 +1167,7 @@ std::string PushMessagingServiceImpl::NormalizeSenderInfo( const std::string& application_server_key) const { - // Only encode the |application_server_key| when it is a NIST P-256 public key - // in uncompressed format, verified through its length and the 0x04 prefix - // byte. - if (application_server_key.size() != 65 || application_server_key[0] != 0x04) + if (!IsVapidKey(application_server_key)) return application_server_key; std::string encoded_application_server_key;
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.h b/chrome/browser/push_messaging/push_messaging_service_impl.h index 3644830..70a809e 100644 --- a/chrome/browser/push_messaging/push_messaging_service_impl.h +++ b/chrome/browser/push_messaging/push_messaging_service_impl.h
@@ -92,7 +92,7 @@ // content::PushMessagingService implementation: void SubscribeFromDocument(const GURL& requesting_origin, int64_t service_worker_registration_id, - int renderer_id, + int render_process_id, int render_frame_id, blink::mojom::PushSubscriptionOptionsPtr options, bool user_gesture, @@ -168,6 +168,8 @@ void DoSubscribe(const PushMessagingAppIdentifier& app_identifier, blink::mojom::PushSubscriptionOptionsPtr options, RegisterCallback callback, + int render_process_id, + int render_frame_id, ContentSetting permission_status); void SubscribeEnd(RegisterCallback callback,
diff --git a/chrome/browser/resource_coordinator/tab_ranker/BUILD.gn b/chrome/browser/resource_coordinator/tab_ranker/BUILD.gn index 23125cc..e53fa7a3 100644 --- a/chrome/browser/resource_coordinator/tab_ranker/BUILD.gn +++ b/chrome/browser/resource_coordinator/tab_ranker/BUILD.gn
@@ -41,7 +41,5 @@ "tab_features_test_helper.h", ] - deps = [ - ":tab_ranker", - ] + deps = [ ":tab_ranker" ] }
diff --git a/chrome/browser/resources/app_management/BUILD.gn b/chrome/browser/resources/app_management/BUILD.gn index 05147eec..2efc3a96 100644 --- a/chrome/browser/resources/app_management/BUILD.gn +++ b/chrome/browser/resources/app_management/BUILD.gn
@@ -178,9 +178,7 @@ } js_library("permission_toggle") { - deps = [ - ":util", - ] + deps = [ ":util" ] } js_library("permission_view_header") { @@ -261,9 +259,7 @@ } js_library("types") { - deps = [ - "//chrome/browser/ui/webui/app_management:mojo_bindings_js_library_for_compile", - ] + deps = [ "//chrome/browser/ui/webui/app_management:mojo_bindings_js_library_for_compile" ] } js_library("util") {
diff --git a/chrome/browser/resources/browser_switch/BUILD.gn b/chrome/browser/resources/browser_switch/BUILD.gn index 7b25cc5..6e61ba0 100644 --- a/chrome/browser/resources/browser_switch/BUILD.gn +++ b/chrome/browser/resources/browser_switch/BUILD.gn
@@ -23,9 +23,7 @@ } js_library("browser_switch_proxy") { - deps = [ - "//ui/webui/resources/js:cr.m", - ] + deps = [ "//ui/webui/resources/js:cr.m" ] } polymer_modulizer("app") {
diff --git a/chrome/browser/resources/browser_switch/internals/BUILD.gn b/chrome/browser/resources/browser_switch/internals/BUILD.gn index 5b05c30..570cc867 100644 --- a/chrome/browser/resources/browser_switch/internals/BUILD.gn +++ b/chrome/browser/resources/browser_switch/internals/BUILD.gn
@@ -6,9 +6,7 @@ js_type_check("closure_compile") { uses_js_modules = true - deps = [ - ":browser_switch_internals", - ] + deps = [ ":browser_switch_internals" ] } js_library("browser_switch_internals") {
diff --git a/chrome/browser/resources/chromeos/camera/BUILD.gn b/chrome/browser/resources/chromeos/camera/BUILD.gn index 0746688..9993bc8 100644 --- a/chrome/browser/resources/chromeos/camera/BUILD.gn +++ b/chrome/browser/resources/chromeos/camera/BUILD.gn
@@ -104,7 +104,6 @@ "src/js/intent.js", "src/js/main.js", "src/js/metrics.js", - "src/js/namespace.js", "src/js/nav.js", "src/js/perf.js", "src/js/sound.js",
diff --git a/chrome/browser/resources/chromeos/camera/camera_resources.grd b/chrome/browser/resources/chromeos/camera/camera_resources.grd index 27aaf45..df2c5512 100644 --- a/chrome/browser/resources/chromeos/camera/camera_resources.grd +++ b/chrome/browser/resources/chromeos/camera/camera_resources.grd
@@ -37,7 +37,6 @@ <structure name="IDR_CAMERA_MANIFEST" file="manifest.json" type="chrome_html" /> <structure name="IDR_CAMERA_METRICS_JS" file="src/js/metrics.js" type="chrome_html" /> <structure name="IDR_CAMERA_MODES_JS" file="src/js/views/camera/modes.js" type="chrome_html" /> - <structure name="IDR_CAMERA_NAMESPACE_JS" file="src/js/namespace.js" type="chrome_html" /> <structure name="IDR_CAMERA_NAV_JS" file="src/js/nav.js" type="chrome_html" /> <structure name="IDR_CAMERA_OPTIONS_JS" file="src/js/views/camera/options.js" type="chrome_html" /> <structure name="IDR_CAMERA_PERF_JS" file="src/js/perf.js" type="chrome_html" />
diff --git a/chrome/browser/resources/chromeos/camera/src/js/BUILD.gn b/chrome/browser/resources/chromeos/camera/src/js/BUILD.gn index c9dc892..59b7224 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/BUILD.gn +++ b/chrome/browser/resources/chromeos/camera/src/js/BUILD.gn
@@ -24,7 +24,6 @@ ":intent", ":main", ":metrics", - ":namespace", ":nav", ":perf", ":sound", @@ -37,7 +36,6 @@ } js_library("chrome_util") { - deps = [ ":namespace" ] } js_library("intent") { @@ -72,7 +70,6 @@ } js_library("type") { - deps = [ ":namespace" ] } js_library("main") { @@ -105,7 +102,6 @@ js_library("state") { deps = [ - ":namespace", ":perf", ":type", "views:view", @@ -127,12 +123,8 @@ ] } -js_library("namespace") { -} - js_library("toast") { deps = [ - ":namespace", ":util", ] } @@ -140,13 +132,11 @@ js_library("tooltip") { deps = [ ":chrome_util", - ":namespace", ] } js_library("util") { deps = [ - ":namespace", ":tooltip", ":type", "browser_proxy:browser_proxy",
diff --git a/chrome/browser/resources/chromeos/camera/src/js/background_ops.js b/chrome/browser/resources/chromeos/camera/src/js/background_ops.js index e167946..2f1f30b7 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/background_ops.js +++ b/chrome/browser/resources/chromeos/camera/src/js/background_ops.js
@@ -63,8 +63,3 @@ */ notifySuspension() {} } - -/** @const */ -cca.bg.ForegroundOps = ForegroundOps; -/** @const */ -cca.bg.BackgroundOps = BackgroundOps;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/BUILD.gn b/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/BUILD.gn index 19c763c..597ea082 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/BUILD.gn +++ b/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/BUILD.gn
@@ -14,6 +14,5 @@ "browser_proxy_interface.js", "webui_browser_proxy.js", ] - deps = [ "..:namespace" ] externs_list = [ "$externs_path/chrome_extensions.js" ] }
diff --git a/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/browser_proxy.js b/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/browser_proxy.js index 1f5b70c..be7fb329 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/browser_proxy.js +++ b/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/browser_proxy.js
@@ -37,8 +37,3 @@ } export const browserProxy = new ChromeAppBrowserProxy(); - -/** - * @type {!BrowserProxy} - */ -cca.proxy.browserProxy = browserProxy;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/webui_browser_proxy.js b/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/webui_browser_proxy.js index 1c3bd64..26ddccb 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/webui_browser_proxy.js +++ b/chrome/browser/resources/chromeos/camera/src/js/browser_proxy/webui_browser_proxy.js
@@ -79,8 +79,3 @@ export const browserProxy = new WebUIBrowserProxy(); /* eslint-enable new-cap */ - -/** - * @type {!BrowserProxy} - */ -cca.proxy.browserProxy = browserProxy;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/chrome_util.js b/chrome/browser/resources/chromeos/camera/src/js/chrome_util.js index 25db378..e717f28e 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/chrome_util.js +++ b/chrome/browser/resources/chromeos/camera/src/js/chrome_util.js
@@ -99,14 +99,3 @@ } return /** @type {boolean} */ (value); } - -/** @const */ -cca.assert = assert; -/** @const */ -cca.assertNotReached = assertNotReached; -/** @const */ -cca.assertInstanceof = assertInstanceof; -/** @const */ -cca.assertString = assertString; -/** @const */ -cca.assertBoolean = assertBoolean;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/device/camera3_device_info.js b/chrome/browser/resources/chromeos/camera/src/js/device/camera3_device_info.js index e11c3588..7e52987 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/device/camera3_device_info.js +++ b/chrome/browser/resources/chromeos/camera/src/js/device/camera3_device_info.js
@@ -92,6 +92,3 @@ deviceInfo, facing, photoResolution, videoConfigs, supportedFpsRanges); } } - -/** @const */ -cca.device.Camera3DeviceInfo = Camera3DeviceInfo;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/device/constraints_preferrer.js b/chrome/browser/resources/chromeos/camera/src/js/device/constraints_preferrer.js index d3ccbafe..e2a73a8a 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/device/constraints_preferrer.js +++ b/chrome/browser/resources/chromeos/camera/src/js/device/constraints_preferrer.js
@@ -601,12 +601,3 @@ .sort(sortPrefResol); } } - -/** @const */ -cca.CaptureCandidate = CaptureCandidate; -/** @const */ -cca.device.ConstraintsPreferrer = ConstraintsPreferrer; -/** @const */ -cca.device.VideoConstraintsPreferrer = VideoConstraintsPreferrer; -/** @const */ -cca.device.PhotoConstraintsPreferrer = PhotoConstraintsPreferrer;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/device/device_info_updater.js b/chrome/browser/resources/chromeos/camera/src/js/device/device_info_updater.js index fc77b9d3..bcf580b 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/device/device_info_updater.js +++ b/chrome/browser/resources/chromeos/camera/src/js/device/device_info_updater.js
@@ -241,6 +241,3 @@ return {photo: info.photoResols, video: info.videoResols}; } } - -/** @const */ -cca.device.DeviceInfoUpdater = DeviceInfoUpdater;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/device/error.js b/chrome/browser/resources/chromeos/camera/src/js/device/error.js index 3736fa6c..f1600107 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/device/error.js +++ b/chrome/browser/resources/chromeos/camera/src/js/device/error.js
@@ -18,6 +18,3 @@ this.name = this.constructor.name; } } - -/** @const */ -cca.device.LegacyVCDError = LegacyVCDError;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/gallerybutton.js b/chrome/browser/resources/chromeos/camera/src/js/gallerybutton.js index 27d3b4c..4e39342 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/gallerybutton.js +++ b/chrome/browser/resources/chromeos/camera/src/js/gallerybutton.js
@@ -98,7 +98,7 @@ */ this.directory_ = null; - this.button_.addEventListener('click', async (event) => { + this.button_.addEventListener('click', async () => { // Check if the last picture serving as cover photo still exists before // opening it in the gallery. // TODO(yuli): Remove this workaround for unable watching changed-files. @@ -228,8 +228,3 @@ await this.updateCover_(file); } } - -/** - * @typedef {GalleryButton} - */ -cca.GalleryButton = GalleryButton;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/intent.js b/chrome/browser/resources/chromeos/camera/src/js/intent.js index 4dfb7f3..09d89ff 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/intent.js +++ b/chrome/browser/resources/chromeos/camera/src/js/intent.js
@@ -171,6 +171,3 @@ getBool('shouldDownScale'), getBool('isSecure')); } } - -/** @const */ -cca.intent.Intent = Intent;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/main.js b/chrome/browser/resources/chromeos/camera/src/js/main.js index 4c15305..f7299d04 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/main.js +++ b/chrome/browser/resources/chromeos/camera/src/js/main.js
@@ -184,7 +184,7 @@ ackMigrate = true; }); }) - .then((external) => { + .then(() => { const externalDir = filesystem.getExternalDirectory(); assert(externalDir !== null); this.galleryButton_.initialize(externalDir);
diff --git a/chrome/browser/resources/chromeos/camera/src/js/metrics.js b/chrome/browser/resources/chromeos/camera/src/js/metrics.js index aebc0813..b034c82 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/metrics.js +++ b/chrome/browser/resources/chromeos/camera/src/js/metrics.js
@@ -171,10 +171,3 @@ export function log(type, ...args) { ga.then((tracker) => tracker.send(type(...args))); } - -/** const */ -cca.metrics.IntentResultType = IntentResultType; -/** const */ -cca.metrics.Type = Type; -/** const */ -cca.metrics.log = log;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/models/BUILD.gn b/chrome/browser/resources/chromeos/camera/src/js/models/BUILD.gn index f3e706a4..6f1abb1 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/models/BUILD.gn +++ b/chrome/browser/resources/chromeos/camera/src/js/models/BUILD.gn
@@ -14,7 +14,6 @@ } js_library("filenamer") { - deps = [ "..:namespace" ] } js_library("filesystem") {
diff --git a/chrome/browser/resources/chromeos/camera/src/js/models/file_video_saver.js b/chrome/browser/resources/chromeos/camera/src/js/models/file_video_saver.js index 694b9a8..0e22423 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/models/file_video_saver.js +++ b/chrome/browser/resources/chromeos/camera/src/js/models/file_video_saver.js
@@ -74,6 +74,3 @@ return new FileVideoSaver(file, writer); } } - -/** @const */ -cca.models.FileVideoSaver = FileVideoSaver;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/models/filenamer.js b/chrome/browser/resources/chromeos/camera/src/js/models/filenamer.js index bece4ad..ecb8df1a 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/models/filenamer.js +++ b/chrome/browser/resources/chromeos/camera/src/js/models/filenamer.js
@@ -102,10 +102,3 @@ return imageName.replace(/\.[^/.]+$/, '.json'); } } - -/** @const */ -cca.models.Filenamer = Filenamer; -/** @const */ -cca.models.Filenamer.IMAGE_PREFIX = IMAGE_PREFIX; -/** @const */ -cca.models.Filenamer.VIDEO_PREFIX = VIDEO_PREFIX;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/models/filesystem.js b/chrome/browser/resources/chromeos/camera/src/js/models/filesystem.js index 67bfc39..f7099123 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/models/filesystem.js +++ b/chrome/browser/resources/chromeos/camera/src/js/models/filesystem.js
@@ -514,26 +514,3 @@ } }); } - -/** @const */ -cca.models.FileSystem.hasVideoPrefix = hasVideoPrefix; -/** @const */ -cca.models.FileSystem.getExternalDirectory = getExternalDirectory; -/** @const */ -cca.models.FileSystem.initialize = initialize; -/** @const */ -cca.models.FileSystem.saveBlob = saveBlob; -/** @const */ -cca.models.FileSystem.getMetadata = getMetadata; -/** @const */ -cca.models.FileSystem.createTempVideoFile = createTempVideoFile; -/** @const */ -cca.models.FileSystem.createPrivateTempVideoFile = createPrivateTempVideoFile; -/** @const */ -cca.models.FileSystem.saveVideo = saveVideo; -/** @const */ -cca.models.FileSystem.getFile = getFile; -/** @const */ -cca.models.FileSystem.getEntries = getEntries; -/** @const */ -cca.models.FileSystem.pictureURL = pictureURL;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/models/intent_video_saver.js b/chrome/browser/resources/chromeos/camera/src/js/models/intent_video_saver.js index 28097ff..b5e4e3c 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/models/intent_video_saver.js +++ b/chrome/browser/resources/chromeos/camera/src/js/models/intent_video_saver.js
@@ -47,6 +47,3 @@ return new IntentVideoSaver(intent, tmpFile, writer); } } - -/** @const */ -cca.models.IntentVideoSaver = IntentVideoSaver;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/models/result_saver.js b/chrome/browser/resources/chromeos/camera/src/js/models/result_saver.js index c1fd4eaa4..509ec377 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/models/result_saver.js +++ b/chrome/browser/resources/chromeos/camera/src/js/models/result_saver.js
@@ -33,6 +33,3 @@ */ async finishSaveVideo(video, name) {} } - -/** @const */ -cca.models.ResultSaver = ResultSaver;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/models/video_saver_interface.js b/chrome/browser/resources/chromeos/camera/src/js/models/video_saver_interface.js index e52cba8..94a50f9 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/models/video_saver_interface.js +++ b/chrome/browser/resources/chromeos/camera/src/js/models/video_saver_interface.js
@@ -20,6 +20,3 @@ */ async endWrite() {} } - -/** @const */ -cca.models.VideoSaver = VideoSaver;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/mojo/BUILD.gn b/chrome/browser/resources/chromeos/camera/src/js/mojo/BUILD.gn index 9297a071..6526457 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/mojo/BUILD.gn +++ b/chrome/browser/resources/chromeos/camera/src/js/mojo/BUILD.gn
@@ -14,7 +14,6 @@ js_library("chrome_helper") { deps = [ - "..:namespace", "//components/arc/mojom:camera_intent_js_library_for_compile", "//components/chromeos_camera/common:camera_app_helper_js_library_for_compile", ] @@ -23,7 +22,6 @@ js_library("device_operator") { deps = [ - "..:namespace", "..:type", "//media/capture/video/chromeos/mojom:cros_camera_js_library_for_compile", ]
diff --git a/chrome/browser/resources/chromeos/camera/src/js/mojo/chrome_helper.js b/chrome/browser/resources/chromeos/camera/src/js/mojo/chrome_helper.js index 46502298..3efbc57b 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/mojo/chrome_helper.js +++ b/chrome/browser/resources/chromeos/camera/src/js/mojo/chrome_helper.js
@@ -136,6 +136,3 @@ return instance; } } - -/** @const */ -cca.mojo.ChromeHelper = ChromeHelper;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/mojo/device_operator.js b/chrome/browser/resources/chromeos/camera/src/js/mojo/device_operator.js index a51dd8e..e6fead9 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/mojo/device_operator.js +++ b/chrome/browser/resources/chromeos/camera/src/js/mojo/device_operator.js
@@ -2,8 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {Resolution, - ResolutionList, // eslint-disable-line no-unused-vars +import { + FpsRangeList, // eslint-disable-line no-unused-vars + Resolution, + ResolutionList, // eslint-disable-line no-unused-vars + VideoConfig, // eslint-disable-line no-unused-vars } from '../type.js'; /** @@ -161,7 +164,7 @@ * Gets supported video configurations for specific camera. * @param {string} deviceId The renderer-facing device id of the target camera * which could be retrieved from MediaDeviceInfo.deviceId. - * @return {!Promise<!Array<cca.VideoConfig>>} Promise of supported video + * @return {!Promise<!Array<VideoConfig>>} Promise of supported video * configurations. * @throws {Error} Thrown when fail to parse the metadata or the device * operation is not supported. @@ -217,7 +220,7 @@ * Gets supported fps ranges for specific camera. * @param {string} deviceId The renderer-facing device id of the target camera * which could be retrieved from MediaDeviceInfo.deviceId. - * @return {!Promise<!cca.FpsRangeList>} Promise of supported fps ranges. + * @return {!Promise<!FpsRangeList>} Promise of supported fps ranges. * Each range is represented as [min, max]. * @throws {Error} Thrown when fail to parse the metadata or the device * operation is not supported. @@ -239,7 +242,7 @@ throw new Error('Unexpected length of available fps range configs'); } - const /** !cca.FpsRangeList */ supportedFpsRanges = []; + const /** !FpsRangeList */ supportedFpsRanges = []; for (let i = 0; i < availableFpsRanges.length; i += numElementPerEntry) { const [minFps, maxFps] = availableFpsRanges.slice(i, i + numElementPerEntry); @@ -462,8 +465,3 @@ return await this.getInstance() !== null; } } - -/** @const */ -cca.mojo.DeviceOperator = DeviceOperator; -/** @const */ -cca.mojo.parseMetadata = parseMetadata;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/mojo/image_capture.js b/chrome/browser/resources/chromeos/camera/src/js/mojo/image_capture.js index 559c687..a593b401 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/mojo/image_capture.js +++ b/chrome/browser/resources/chromeos/camera/src/js/mojo/image_capture.js
@@ -113,6 +113,3 @@ } } } - -/** @const */ -cca.mojo.ImageCapture = CrosImageCapture;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/namespace.js b/chrome/browser/resources/chromeos/camera/src/js/namespace.js deleted file mode 100644 index f56e587..0000000 --- a/chrome/browser/resources/chromeos/camera/src/js/namespace.js +++ /dev/null
@@ -1,33 +0,0 @@ -// Copyright (c) 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. - -/** - * @fileoverview Prepare CCA namespaces exporting symbols from es6 module to - * non-es6 module scripts. - */ - -// eslint-disable-next-line no-unused-vars -const cca = { - bg: {}, - device: {}, - intent: {}, - metrics: {}, - models: { - FileSystem: {}, - }, - mojo: {}, - nav: {}, - perf: {}, - proxy: {}, - sound: {}, - state: {}, - toast: {}, - tooltip: {}, - util: {}, - views: { - camera: { - timertick: {}, - }, - }, -};
diff --git a/chrome/browser/resources/chromeos/camera/src/js/nav.js b/chrome/browser/resources/chromeos/camera/src/js/nav.js index 959b594..2919d92 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/nav.js +++ b/chrome/browser/resources/chromeos/camera/src/js/nav.js
@@ -221,14 +221,3 @@ } } } - -/** @const */ -cca.nav.setup = setup; -/** @const */ -cca.nav.open = open; -/** @const */ -cca.nav.close = close; -/** @const */ -cca.nav.onKeyPressed = onKeyPressed; -/** @const */ -cca.nav.onWindowResized = onWindowResized;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/perf.js b/chrome/browser/resources/chromeos/camera/src/js/perf.js index f1da0e2..289d637 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/perf.js +++ b/chrome/browser/resources/chromeos/camera/src/js/perf.js
@@ -145,8 +145,3 @@ this.interruptedTime_ = performance.now(); } } - -/** @const */ -cca.perf.PerfEvent = PerfEvent; -/** @const */ -cca.perf.PerfLogger = PerfLogger;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/sound.js b/chrome/browser/resources/chromeos/camera/src/js/sound.js index 36c5255c..1bcc080 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/sound.js +++ b/chrome/browser/resources/chromeos/camera/src/js/sound.js
@@ -25,6 +25,3 @@ p.cancel = cancel; return p; } - -/** @const */ -cca.sound.play = play;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/state.js b/chrome/browser/resources/chromeos/camera/src/js/state.js index 52b3c643..4bc316d 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/state.js +++ b/chrome/browser/resources/chromeos/camera/src/js/state.js
@@ -5,6 +5,8 @@ import {assert} from './chrome_util.js'; import {PerfEvent} from './perf.js'; import {Mode} from './type.js'; +// eslint-disable-next-line no-unused-vars +import {PerfInformation} from './type.js'; import {ViewName} from './views/view.js'; /** @@ -72,7 +74,7 @@ } /** - * @typedef {function(boolean, cca.PerfInformation=)} + * @typedef {function(boolean, PerfInformation=)} */ let StateObserver; // eslint-disable-line no-unused-vars @@ -125,7 +127,7 @@ * performance measurement. * @param {StateUnion} state State to be set. * @param {boolean} val True to set the state on, false otherwise. - * @param {cca.PerfInformation=} perfInfo Optional information of this state + * @param {PerfInformation=} perfInfo Optional information of this state * for performance measurement. */ export function set(state, val, perfInfo = {}) { @@ -138,18 +140,3 @@ const observers = allObservers.get(state) || []; observers.forEach((f) => f(val, perfInfo)); } - -/** @const */ -cca.state.State = State; -/** @const */ -cca.state.StateUnion = StateUnion; -/** @const */ -cca.state.addObserver = addObserver; -/** @const */ -cca.state.removeObserver = removeObserver; -/** @const */ -cca.state.get = get; -/** @const */ -cca.state.set = set; -/** @const */ -cca.state.assertState = assertState;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/toast.js b/chrome/browser/resources/chromeos/camera/src/js/toast.js index 5696c72..2720abeb 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/toast.js +++ b/chrome/browser/resources/chromeos/camera/src/js/toast.js
@@ -38,8 +38,3 @@ export function speak(message) { update(message, true); } - -/** @const */ -cca.toast.show = show; -/** @const */ -cca.toast.speak = speak;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/tooltip.js b/chrome/browser/resources/chromeos/camera/src/js/tooltip.js index aa8487a0..fdd190b 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/tooltip.js +++ b/chrome/browser/resources/chromeos/camera/src/js/tooltip.js
@@ -87,8 +87,3 @@ }); return elements; } - -/** @const */ -cca.tooltip.hide = hide; -/** @const */ -cca.tooltip.setup = setup;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/type.js b/chrome/browser/resources/chromeos/camera/src/js/type.js index 435fb201..6d91ff2 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/type.js +++ b/chrome/browser/resources/chromeos/camera/src/js/type.js
@@ -137,20 +137,3 @@ * @typedef {Array<!FpsRange>} */ export let FpsRangeList; - -/** @const */ -cca.Resolution = Resolution; -/** @const */ -cca.Mode = Mode; -/** @const */ -cca.PerfInformation = PerfInformation; -/** @const */ -cca.VideoConfig = VideoConfig; -/** @const */ -cca.FpsRange = FpsRange; -/** @const */ -cca.ResolutionList = ResolutionList; -/** @const */ -cca.MaxFpsInfo = MaxFpsInfo; -/** @const */ -cca.FpsRangeList = FpsRangeList;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/util.js b/chrome/browser/resources/chromeos/camera/src/js/util.js index 5fbcd7e..64e922d 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/util.js +++ b/chrome/browser/resources/chromeos/camera/src/js/util.js
@@ -434,30 +434,3 @@ Object.assign(inner, {width, height, minWidth: width, minHeight: height}); }); } - -/** @const */ -cca.util.orientPhoto = orientPhoto; -/** @const */ -cca.util.animateCancel = animateCancel; -/** @const */ -cca.util.animateOnce = animateOnce; -/** @const */ -cca.util.getShortcutIdentifier = getShortcutIdentifier; -/** @const */ -cca.util.makeUnfocusableByMouse = makeUnfocusableByMouse; -/** @const */ -cca.util.isWindowFullSize = isWindowFullSize; -/** @const */ -cca.util.openHelp = openHelp; -/** @const */ -cca.util.setupI18nElements = setupI18nElements; -/** @const */ -cca.util.blobToImage = blobToImage; -/** @const */ -cca.util.getDefaultFacing = getDefaultFacing; -/** @const */ -cca.util.scalePicture = scalePicture; -/** @const */ -cca.util.toggleChecked = toggleChecked; -/** @const */ -cca.util.fitWindow = fitWindow;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera.js b/chrome/browser/resources/chromeos/camera/src/js/views/camera.js index 32650458..fa6d45c 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/camera.js +++ b/chrome/browser/resources/chromeos/camera/src/js/views/camera.js
@@ -482,6 +482,3 @@ } } } - -/** @const */ -cca.views.Camera = Camera;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/layout.js b/chrome/browser/resources/chromeos/camera/src/js/views/camera/layout.js index bfd11b1..b903cd3 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/camera/layout.js +++ b/chrome/browser/resources/chromeos/camera/src/js/views/camera/layout.js
@@ -138,6 +138,3 @@ } } } - -/** @const */ -cca.views.camera.Layout = Layout;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/modes.js b/chrome/browser/resources/chromeos/camera/src/js/views/camera/modes.js index 9e82bf1..e05c505 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/camera/modes.js +++ b/chrome/browser/resources/chromeos/camera/src/js/views/camera/modes.js
@@ -1039,20 +1039,3 @@ PerfEvent.PORTRAIT_MODE_CAPTURE_POST_PROCESSING, false, {hasError}); } } - -/** @const */ -cca.views.camera.VideoResult = VideoResult; -/** @const */ -cca.views.camera.PhotoResult = PhotoResult; -/** @const */ -cca.views.camera.DoSwitchMode = DoSwitchMode; -/** @const */ -cca.views.camera.DoSavePhoto = DoSavePhoto; -/** @const */ -cca.views.camera.CreateVideoSaver = CreateVideoSaver; -/** @const */ -cca.views.camera.DoSaveVideo = DoSaveVideo; -/** @const */ -cca.views.camera.PlayShutterEffect = PlayShutterEffect; -/** @const */ -cca.views.camera.Modes = Modes;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/options.js b/chrome/browser/resources/chromeos/camera/src/js/views/camera/options.js index 671e645f..c4399d6 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/camera/options.js +++ b/chrome/browser/resources/chromeos/camera/src/js/views/camera/options.js
@@ -265,6 +265,3 @@ return sorted; } } - -/** @const */ -cca.views.camera.Options = Options;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/preview.js b/chrome/browser/resources/chromeos/camera/src/js/views/camera/preview.js index 9d63a39..f34aa676 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/camera/preview.js +++ b/chrome/browser/resources/chromeos/camera/src/js/views/camera/preview.js
@@ -461,6 +461,3 @@ document.querySelector('#preview-focus-aim').hidden = true; } } - -/** @const */ -cca.views.camera.Preview = Preview;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/recordtime.js b/chrome/browser/resources/chromeos/camera/src/js/views/camera/recordtime.js index 50b6b23..fd08e07 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/camera/recordtime.js +++ b/chrome/browser/resources/chromeos/camera/src/js/views/camera/recordtime.js
@@ -84,6 +84,3 @@ return mins; } } - -/** @const */ -cca.views.camera.RecordTime = RecordTime;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/review_result.js b/chrome/browser/resources/chromeos/camera/src/js/views/camera/review_result.js index 3d1b807..d645a106 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/camera/review_result.js +++ b/chrome/browser/resources/chromeos/camera/src/js/views/camera/review_result.js
@@ -145,6 +145,3 @@ }); } } - -/** @const */ -cca.views.camera.ReviewResult = ReviewResult;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera/timertick.js b/chrome/browser/resources/chromeos/camera/src/js/views/camera/timertick.js index 8ba1b71..bd91c7d 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/camera/timertick.js +++ b/chrome/browser/resources/chromeos/camera/src/js/views/camera/timertick.js
@@ -69,8 +69,3 @@ doCancel = null; } } - -/** @const */ -cca.views.camera.timertick.start = start; -/** @const */ -cca.views.camera.timertick.cancel = cancel;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/camera_intent.js b/chrome/browser/resources/chromeos/camera/src/js/views/camera_intent.js index a788da93..0db7d2d 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/camera_intent.js +++ b/chrome/browser/resources/chromeos/camera/src/js/views/camera_intent.js
@@ -178,6 +178,3 @@ return this.startWithMode_(deviceId, this.defaultMode_); } } - -/** @const */ -cca.views.CameraIntent = CameraIntent;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/dialog.js b/chrome/browser/resources/chromeos/camera/src/js/views/dialog.js index a58bb44..5eb031f6 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/dialog.js +++ b/chrome/browser/resources/chromeos/camera/src/js/views/dialog.js
@@ -62,6 +62,3 @@ this.positiveButton_.focus(); } } - -/** @const */ -cca.views.Dialog = Dialog;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/settings.js b/chrome/browser/resources/chromeos/camera/src/js/views/settings.js index 87fbfbb..2e4647f 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/settings.js +++ b/chrome/browser/resources/chromeos/camera/src/js/views/settings.js
@@ -633,10 +633,3 @@ }); } } - -/** @const */ -cca.views.BaseSettings = BaseSettings; -/** @const */ -cca.views.MasterSettings = MasterSettings; -/** @const */ -cca.views.ResolutionSettings = ResolutionSettings;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/view.js b/chrome/browser/resources/chromeos/camera/src/js/views/view.js index a144bc62..f259bb8 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/view.js +++ b/chrome/browser/resources/chromeos/camera/src/js/views/view.js
@@ -189,8 +189,3 @@ return false; } } - -/** @const */ -cca.views.ViewName = ViewName; -/** @const */ -cca.views.View = View;
diff --git a/chrome/browser/resources/chromeos/camera/src/js/views/warning.js b/chrome/browser/resources/chromeos/camera/src/js/views/warning.js index aee8c7b..cae6837 100644 --- a/chrome/browser/resources/chromeos/camera/src/js/views/warning.js +++ b/chrome/browser/resources/chromeos/camera/src/js/views/warning.js
@@ -80,6 +80,3 @@ return true; } } - -/** @const */ -cca.views.Warning = Warning;
diff --git a/chrome/browser/resources/chromeos/camera/src/views/background.html b/chrome/browser/resources/chromeos/camera/src/views/background.html index 521725a2..f932251 100644 --- a/chrome/browser/resources/chromeos/camera/src/views/background.html +++ b/chrome/browser/resources/chromeos/camera/src/views/background.html
@@ -7,7 +7,6 @@ <script src="../js/mojo/mojo_bindings_lite.js"></script> <script src="../js/mojo/camera_intent.mojom-lite.js"></script> <script src="../js/mojo/camera_app_helper.mojom-lite.js"></script> - <script src="../js/namespace.js"></script> <script type="module" src="../js/background.js"></script> </head> </html>
diff --git a/chrome/browser/resources/chromeos/camera/src/views/main.html b/chrome/browser/resources/chromeos/camera/src/views/main.html index e5d02b3..702dab6 100644 --- a/chrome/browser/resources/chromeos/camera/src/views/main.html +++ b/chrome/browser/resources/chromeos/camera/src/views/main.html
@@ -9,7 +9,6 @@ <title></title> <meta charset="utf-8"> <link rel="stylesheet" href="../css/main.css"> - <script src="../js/namespace.js"></script> <script src="../js/google-analytics-bundle.js"></script> <script src="../js/mojo/mojo_bindings_lite.js"></script> <script src="../js/mojo/camera_metadata_tags.mojom-lite.js"></script>
diff --git a/chrome/browser/resources/new_tab_page/app.html b/chrome/browser/resources/new_tab_page/app.html index 4e12821d..10471e8f 100644 --- a/chrome/browser/resources/new_tab_page/app.html +++ b/chrome/browser/resources/new_tab_page/app.html
@@ -32,10 +32,16 @@ :host-context([dir='rtl']) #customizeButton { left: 16px; } + + ntp-most-visited[dark] { + --icon-button-color-active: var(--google-grey-refresh-300); + --icon-button-color: white; + --tile-hover-color: rgba(255, 255, 255, .1); + } </style> <div id="background" style="background-color: [[rgbOrInherit_(theme_.backgroundColor)]];"> - <ntp-most-visited + <ntp-most-visited dark$="[[theme_.isDark]]" style="--icon-background-color: [[rgbOrInherit_(theme_.shortcutBackgroundColor)]]; --tile-title-color:
diff --git a/chrome/browser/resources/new_tab_page/most_visited.html b/chrome/browser/resources/new_tab_page/most_visited.html index 663a5c6..2ccce131 100644 --- a/chrome/browser/resources/new_tab_page/most_visited.html +++ b/chrome/browser/resources/new_tab_page/most_visited.html
@@ -6,7 +6,7 @@ --icon-background-color: rgb(229, 231, 232); --icon-button-color: var(--google-grey-600); --icon-button-color-active: var(--google-grey-refresh-700); - --tile-hover-color: rgba(var(--google-grey-900-rgb), .06); + --tile-hover-color: rgba(var(--google-grey-900-rgb), .1); --tile-title-color: var(--google-grey-800); }
diff --git a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_export_import.js b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_export_import.js index e68578d1..17c5dc8 100644 --- a/chrome/browser/resources/settings/chromeos/crostini_page/crostini_export_import.js +++ b/chrome/browser/resources/settings/chromeos/crostini_page/crostini_export_import.js
@@ -27,17 +27,37 @@ */ enableButtons_: { type: Boolean, + computed: 'setEnableButtons_(installerShowing_, exportImportInProgress_)', + }, + + /** @private */ + installerShowing_: { + type: Boolean, value: false, }, + + /** @private */ + exportImportInProgress_: { + type: Boolean, + value: false, + }, + }, attached() { this.addWebUIListener( 'crostini-export-import-operation-status-changed', inProgress => { - this.enableButtons_ = !inProgress; + this.exportImportInProgress_ = inProgress; }); + this.addWebUIListener( + 'crostini-installer-status-changed', installerShowing => { + this.installerShowing_ = installerShowing; + }); + settings.CrostiniBrowserProxyImpl.getInstance() .requestCrostiniExportImportOperationStatus(); + settings.CrostiniBrowserProxyImpl.getInstance() + .requestCrostiniInstallerStatus(); }, /** @private */ @@ -54,4 +74,9 @@ onImportConfirmationDialogClose_() { this.showImportConfirmationDialog_ = false; }, + + /** @private */ + setEnableButtons_: function(installerShowing, exportImportInProgress) { + return !(installerShowing || exportImportInProgress); + }, });
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_apps_page/BUILD.gn index 06d37cd..58e18ad 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/BUILD.gn
@@ -13,9 +13,7 @@ } js_library("android_apps_browser_proxy") { - deps = [ - "//ui/webui/resources/js:cr", - ] + deps = [ "//ui/webui/resources/js:cr" ] } js_library("android_apps_subpage") {
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn index 0cfdcea..db9d59b 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/BUILD.gn
@@ -191,9 +191,7 @@ } js_library("types") { - deps = [ - "//chrome/browser/ui/webui/app_management:mojo_bindings_js_library_for_compile", - ] + deps = [ "//chrome/browser/ui/webui/app_management:mojo_bindings_js_library_for_compile" ] } js_library("uninstall_button") {
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/setup_fingerprint_dialog.html b/chrome/browser/resources/settings/chromeos/os_people_page/setup_fingerprint_dialog.html index dc34987..0345541 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/setup_fingerprint_dialog.html +++ b/chrome/browser/resources/settings/chromeos/os_people_page/setup_fingerprint_dialog.html
@@ -18,6 +18,11 @@ width: 500px; } + .fingerprint-scanner-laptop-bottom-left { + background: + url(chrome://theme/IDR_LOGIN_FINGERPRINT_SCANNER_LAPTOP_BOTTOM_LEFT_ANIMATION); + } + .fingerprint-scanner-laptop-bottom-right { background: url(chrome://theme/IDR_LOGIN_FINGERPRINT_SCANNER_LAPTOP_BOTTOM_RIGHT_ANIMATION);
diff --git a/chrome/browser/resources/settings/chromeos/os_people_page/setup_fingerprint_dialog.js b/chrome/browser/resources/settings/chromeos/os_people_page/setup_fingerprint_dialog.js index d3a6e64e..5e1763c2 100644 --- a/chrome/browser/resources/settings/chromeos/os_people_page/setup_fingerprint_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_people_page/setup_fingerprint_dialog.js
@@ -2,38 +2,43 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -cr.exportPath('settings'); +cr.define('settings', function() { + /** + * The steps in the fingerprint setup flow. + * @enum {number} + */ + const FingerprintSetupStep = { + LOCATE_SCANNER: 1, // The user needs to locate the scanner. + MOVE_FINGER: 2, // The user needs to move finger around the scanner. + READY: 3 // The scanner has read the fingerprint successfully. + }; -/** - * The steps in the fingerprint setup flow. - * @enum {number} - */ -settings.FingerprintSetupStep = { - LOCATE_SCANNER: 1, // The user needs to locate the scanner. - MOVE_FINGER: 2, // The user needs to move finger around the scanner. - READY: 3 // The scanner has read the fingerprint successfully. -}; + /** + * Fingerprint sensor locations corresponding to the FingerprintLocation + * enumerators in + * /chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h + * @enum {number} + */ + const FingerprintLocation = { + TABLET_POWER_BUTTON: 0, + KEYBOARD_BOTTOM_LEFT: 1, + KEYBOARD_BOTTOM_RIGHT: 2, + KEYBOARD_TOP_RIGHT: 3, + }; -/** - * Fingerprint sensor locations corresponding to the FingerprintLocation - * enumerators in - * /chrome/browser/chromeos/login/quick_unlock/quick_unlock_utils.h - * @enum {number} - */ -settings.FingerprintLocation = { - TABLET_POWER_BUTTON: 0, - KEYBOARD_TOP_RIGHT: 1, - KEYBOARD_BOTTOM_RIGHT: 2, -}; + /** + * The amount of milliseconds after a successful but not completed scan before + * a message shows up telling the user to scan their finger again. + * @type {number} + */ + const SHOW_TAP_SENSOR_MESSAGE_DELAY_MS = 2000; -(function() { - -/** - * The amount of milliseconds after a successful but not completed scan before a - * message shows up telling the user to scan their finger again. - * @type {number} - */ -const SHOW_TAP_SENSOR_MESSAGE_DELAY_MS = 2000; + return { + FingerprintSetupStep, + FingerprintLocation, + SHOW_TAP_SENSOR_MESSAGE_DELAY_MS + }; +}); Polymer({ is: 'settings-setup-fingerprint-dialog', @@ -102,10 +107,12 @@ switch (fingerprintLocation) { case settings.FingerprintLocation.TABLET_POWER_BUTTON: return ''; - case settings.FingerprintLocation.KEYBOARD_TOP_RIGHT: - return 'fingerprint-scanner-laptop-top-right'; + case settings.FingerprintLocation.KEYBOARD_BOTTOM_LEFT: + return 'fingerprint-scanner-laptop-bottom-left'; case settings.FingerprintLocation.KEYBOARD_BOTTOM_RIGHT: return 'fingerprint-scanner-laptop-bottom-right'; + case settings.FingerprintLocation.KEYBOARD_TOP_RIGHT: + return 'fingerprint-scanner-laptop-top-right'; } assertNotReached(); }, @@ -269,7 +276,7 @@ this.problemMessage_ = ''; this.tapSensorMessageTimeoutId_ = setTimeout(() => { this.problemMessage_ = this.i18n('configureFingerprintLiftFinger'); - }, SHOW_TAP_SENSOR_MESSAGE_DELAY_MS); + }, settings.SHOW_TAP_SENSOR_MESSAGE_DELAY_MS); break; case settings.FingerprintResultType.PARTIAL: case settings.FingerprintResultType.INSUFFICIENT: @@ -367,4 +374,3 @@ this.$.arc.setProgress(oldValue, newValue, newValue === 100); }, }); -})();
diff --git a/chrome/browser/safe_browsing/chrome_password_protection_service.cc b/chrome/browser/safe_browsing/chrome_password_protection_service.cc index a970f873..ffb2d953 100644 --- a/chrome/browser/safe_browsing/chrome_password_protection_service.cc +++ b/chrome/browser/safe_browsing/chrome_password_protection_service.cc
@@ -1668,8 +1668,8 @@ const base::Time& receive_time) { if (!CanGetReputationOfURL(url) || IsIncognito()) return; - cache_manager_->CachePhishGuardVerdict(url, trigger_type, password_type, - verdict, receive_time); + cache_manager_->CachePhishGuardVerdict(trigger_type, password_type, verdict, + receive_time); } // Looks up |settings| to find the cached verdict response. If verdict is not
diff --git a/chrome/browser/ssl/chrome_security_blocking_page_factory.cc b/chrome/browser/ssl/chrome_security_blocking_page_factory.cc index 80d0d38..178ab7fe 100644 --- a/chrome/browser/ssl/chrome_security_blocking_page_factory.cc +++ b/chrome/browser/ssl/chrome_security_blocking_page_factory.cc
@@ -99,6 +99,19 @@ return metrics_helper; } +std::unique_ptr<ChromeMetricsHelper> CreateMitmSoftwareMetricsHelper( + content::WebContents* web_contents, + const GURL& request_url) { + // Set up the metrics helper for the MITMSoftwareUI. + security_interstitials::MetricsHelper::ReportDetails reporting_info; + reporting_info.metric_prefix = "mitm_software"; + std::unique_ptr<ChromeMetricsHelper> metrics_helper = + std::make_unique<ChromeMetricsHelper>(web_contents, request_url, + reporting_info); + metrics_helper.get()->StartRecordingCaptivePortalMetrics(false); + return metrics_helper; +} + } // namespace // static @@ -207,6 +220,27 @@ } // static +MITMSoftwareBlockingPage* +ChromeSecurityBlockingPageFactory::CreateMITMSoftwareBlockingPage( + content::WebContents* web_contents, + int cert_error, + const GURL& request_url, + std::unique_ptr<SSLCertReporter> ssl_cert_reporter, + const net::SSLInfo& ssl_info, + const std::string& mitm_software_name, + bool is_enterprise_managed) { + auto page = std::make_unique<MITMSoftwareBlockingPage>( + web_contents, cert_error, request_url, std::move(ssl_cert_reporter), + ssl_info, mitm_software_name, is_enterprise_managed, + std::make_unique<SSLErrorControllerClient>( + web_contents, ssl_info, cert_error, request_url, + CreateMitmSoftwareMetricsHelper(web_contents, request_url))); + + DoChromeSpecificSetup(page.get()); + return page.release(); +} + +// static void ChromeSecurityBlockingPageFactory::DoChromeSpecificSetup( SSLBlockingPageBase* page) { page->set_renderer_pref_callback(
diff --git a/chrome/browser/ssl/chrome_security_blocking_page_factory.h b/chrome/browser/ssl/chrome_security_blocking_page_factory.h index c875e81..6fec88e 100644 --- a/chrome/browser/ssl/chrome_security_blocking_page_factory.h +++ b/chrome/browser/ssl/chrome_security_blocking_page_factory.h
@@ -8,6 +8,7 @@ #include "base/macros.h" #include "components/security_interstitials/content/bad_clock_blocking_page.h" #include "components/security_interstitials/content/captive_portal_blocking_page.h" +#include "components/security_interstitials/content/mitm_software_blocking_page.h" #include "components/security_interstitials/content/ssl_blocking_page.h" #include "components/security_interstitials/content/ssl_blocking_page_base.h" @@ -49,6 +50,17 @@ ssl_errors::ClockState clock_state, std::unique_ptr<SSLCertReporter> ssl_cert_reporter); + // Creates a man-in-the-middle software blocking page. The caller is + // responsible for ownership of the returned object. + static MITMSoftwareBlockingPage* CreateMITMSoftwareBlockingPage( + content::WebContents* web_contents, + int cert_error, + const GURL& request_url, + std::unique_ptr<SSLCertReporter> ssl_cert_reporter, + const net::SSLInfo& ssl_info, + const std::string& mitm_software_name, + bool is_enterprise_managed); + // Does setup on |page| that is specific to the client (Chrome). static void DoChromeSpecificSetup(SSLBlockingPageBase* page);
diff --git a/chrome/browser/ssl/ssl_browsertest.cc b/chrome/browser/ssl/ssl_browsertest.cc index 04c4576..a52a2de 100644 --- a/chrome/browser/ssl/ssl_browsertest.cc +++ b/chrome/browser/ssl/ssl_browsertest.cc
@@ -56,7 +56,6 @@ #include "chrome/browser/ssl/certificate_reporting_test_utils.h" #include "chrome/browser/ssl/chrome_security_blocking_page_factory.h" #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" -#include "chrome/browser/ssl/mitm_software_blocking_page.h" #include "chrome/browser/ssl/security_state_tab_helper.h" #include "chrome/browser/ssl/ssl_browsertest_util.h" #include "chrome/browser/ssl/ssl_error_assistant.h" @@ -95,6 +94,7 @@ #include "components/security_interstitials/content/captive_portal_blocking_page.h" #include "components/security_interstitials/content/cert_report_helper.h" #include "components/security_interstitials/content/common_name_mismatch_handler.h" +#include "components/security_interstitials/content/mitm_software_blocking_page.h" #include "components/security_interstitials/content/security_interstitial_controller_client.h" #include "components/security_interstitials/content/security_interstitial_tab_helper.h" #include "components/security_interstitials/content/ssl_blocking_page.h"
diff --git a/chrome/browser/ssl/ssl_error_handler.cc b/chrome/browser/ssl/ssl_error_handler.cc index f72ba0dc..9e3d3391 100644 --- a/chrome/browser/ssl/ssl_error_handler.cc +++ b/chrome/browser/ssl/ssl_error_handler.cc
@@ -29,7 +29,6 @@ #include "chrome/browser/ssl/blocked_interception_blocking_page.h" #include "chrome/browser/ssl/captive_portal_helper.h" #include "chrome/browser/ssl/chrome_security_blocking_page_factory.h" -#include "chrome/browser/ssl/mitm_software_blocking_page.h" #include "chrome/browser/ssl/ssl_error_assistant.h" #include "chrome/common/buildflags.h" #include "chrome/common/pref_names.h" @@ -37,6 +36,7 @@ #include "components/prefs/pref_service.h" #include "components/security_interstitials/content/bad_clock_blocking_page.h" #include "components/security_interstitials/content/captive_portal_blocking_page.h" +#include "components/security_interstitials/content/mitm_software_blocking_page.h" #include "components/security_interstitials/content/security_interstitial_page.h" #include "components/security_interstitials/content/ssl_blocking_page.h" #include "components/security_interstitials/content/ssl_cert_reporter.h" @@ -526,9 +526,11 @@ const std::string& mitm_software_name, bool is_enterprise_managed) { // Show MITM software blocking page. The interstitial owns the blocking page. - OnBlockingPageReady(new MITMSoftwareBlockingPage( - web_contents_, cert_error_, request_url_, std::move(ssl_cert_reporter_), - ssl_info_, mitm_software_name, is_enterprise_managed)); + OnBlockingPageReady( + ChromeSecurityBlockingPageFactory::CreateMITMSoftwareBlockingPage( + web_contents_, cert_error_, request_url_, + std::move(ssl_cert_reporter_), ssl_info_, mitm_software_name, + is_enterprise_managed)); } void SSLErrorHandlerDelegateImpl::ShowSSLInterstitial(const GURL& support_url) {
diff --git a/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc b/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc index 1c03c3b..1ae3f60b 100644 --- a/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc
@@ -886,7 +886,7 @@ originator_client_item_id)); EXPECT_EQ(1, histogram_tester.GetBucketCount("Sync.BookmarkGUIDSource2", - /*kLeftEmpty=*/2)); + /*kInferred=*/3)); } IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest, @@ -921,6 +921,8 @@ /*kValidOCII=*/1)); EXPECT_EQ(0, histogram_tester.GetBucketCount("Sync.BookmarkGUIDSource2", /*kLeftEmpty=*/2)); + EXPECT_EQ(0, histogram_tester.GetBucketCount("Sync.BookmarkGUIDSource2", + /*kInferred=*/3)); } IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest, @@ -959,6 +961,8 @@ /*kValidOCII=*/1)); EXPECT_EQ(0, histogram_tester.GetBucketCount("Sync.BookmarkGUIDSource2", /*kLeftEmpty=*/2)); + EXPECT_EQ(0, histogram_tester.GetBucketCount("Sync.BookmarkGUIDSource2", + /*kInferred=*/3)); } IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest, @@ -996,55 +1000,10 @@ /*kSpecifics=*/0)); EXPECT_EQ(0, histogram_tester.GetBucketCount("Sync.BookmarkGUIDSource2", /*kValidOCII=*/1)); - EXPECT_EQ(1, histogram_tester.GetBucketCount("Sync.BookmarkGUIDSource2", + EXPECT_EQ(0, histogram_tester.GetBucketCount("Sync.BookmarkGUIDSource2", /*kLeftEmpty=*/2)); -} - -IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest, - ApplyRemoteUpdateWithValidGUID) { - // Create a bookmark. - const GURL url = GURL("https://foo.com"); - fake_server::EntityBuilderFactory entity_builder_factory; - fake_server::BookmarkEntityBuilder bookmark_builder = - entity_builder_factory.NewBookmarkEntityBuilder("Seattle Sounders FC"); - - // Issue remote creation. - std::unique_ptr<syncer::LoopbackServerEntity> bookmark = - bookmark_builder.BuildBookmark(url, /*is_legacy=*/false); - const std::string old_guid = bookmark.get()->GetSpecifics().bookmark().guid(); - fake_server_->InjectEntity(std::move(bookmark)); - SCOPED_TRACE(std::string("old_guid=") + old_guid); - - // Start syncing. - DisableVerifier(); - ASSERT_TRUE(SetupSync()); - - // Created bookmark should be in the model. - ASSERT_TRUE(BookmarksUrlChecker(kSingleProfileIndex, url, 1).Wait()); - ASSERT_EQ(1u, GetBookmarkBarNode(kSingleProfileIndex)->children().size()); - ASSERT_EQ( - old_guid, - GetBookmarkBarNode(kSingleProfileIndex)->children()[0].get()->guid()); - - // Change bookmark GUID in the server to simulate an update from another - // client that has a differente GUID assigned to this bookmark. This can - // happen because every client assigns GUIDs independently when the GUID is - // missing, and the values should eventually be consistent across clients. - std::vector<sync_pb::SyncEntity> server_bookmarks = - GetFakeServer()->GetSyncEntitiesByModelType(syncer::BOOKMARKS); - ASSERT_EQ(1ul, server_bookmarks.size()); - sync_pb::EntitySpecifics specifics = server_bookmarks[0].specifics(); - const std::string new_guid = base::GenerateGUID(); - specifics.mutable_bookmark()->set_guid(new_guid); - ASSERT_TRUE(GetFakeServer()->ModifyEntitySpecifics( - /*entity_id=*/server_bookmarks[0].id_string(), specifics)); - - // The bookmark GUID should have been updated with the corresponding value. - EXPECT_TRUE(BookmarksGUIDChecker(kSingleProfileIndex, new_guid).Wait()); - EXPECT_EQ(1u, GetBookmarkBarNode(kSingleProfileIndex)->children().size()); - EXPECT_EQ( - new_guid, - GetBookmarkBarNode(kSingleProfileIndex)->children()[0].get()->guid()); + EXPECT_EQ(1, histogram_tester.GetBucketCount("Sync.BookmarkGUIDSource2", + /*kInferred=*/3)); } IN_PROC_BROWSER_TEST_P(SingleClientBookmarksSyncTest,
diff --git a/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc b/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc index fa0f2985..c8e36e3 100644 --- a/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc
@@ -229,6 +229,7 @@ bookmarks_helper::FROM_UI); ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait()); + bookmark0 = GetUniqueNodeByURL(0, page_url); SetFavicon(0, bookmark0, icon_url2, CreateFavicon(SK_ColorGREEN), bookmarks_helper::FROM_UI); ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait()); @@ -333,6 +334,7 @@ bookmarks_helper::FROM_UI); ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait()); + bookmark0 = GetUniqueNodeByURL(0, page_url); DeleteFaviconMappings(0, bookmark0, bookmarks_helper::FROM_UI); ASSERT_TRUE(BookmarksMatchVerifierChecker().Wait());
diff --git a/chrome/browser/ui/webui/app_management/BUILD.gn b/chrome/browser/ui/webui/app_management/BUILD.gn index 4395a4ca..6db2265 100644 --- a/chrome/browser/ui/webui/app_management/BUILD.gn +++ b/chrome/browser/ui/webui/app_management/BUILD.gn
@@ -5,11 +5,7 @@ import("//mojo/public/tools/bindings/mojom.gni") mojom("mojo_bindings") { - sources = [ - "app_management.mojom", - ] + sources = [ "app_management.mojom" ] - public_deps = [ - "//chrome/services/app_service/public/mojom", - ] + public_deps = [ "//chrome/services/app_service/public/mojom" ] }
diff --git a/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.cc index b00443f..14d58280b 100644 --- a/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/fingerprint_setup_screen_handler.cc
@@ -92,6 +92,7 @@ description_id = IDS_OOBE_FINGERPINT_SETUP_SCREEN_SENSOR_POWER_BUTTON_DESCRIPTION; break; + case quick_unlock::FingerprintLocation::KEYBOARD_BOTTOM_LEFT: case quick_unlock::FingerprintLocation::KEYBOARD_BOTTOM_RIGHT: case quick_unlock::FingerprintLocation::KEYBOARD_TOP_RIGHT: description_id =
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc index 535993c8..2b7baf7 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
@@ -198,6 +198,9 @@ is_lottie_animation = true; animation_id = IDR_LOGIN_FINGER_PRINT_TABLET_ANIMATION; break; + case quick_unlock::FingerprintLocation::KEYBOARD_BOTTOM_LEFT: + animation_id = IDR_LOGIN_FINGERPRINT_SCANNER_LAPTOP_BOTTOM_LEFT_ANIMATION; + break; case quick_unlock::FingerprintLocation::KEYBOARD_BOTTOM_RIGHT: animation_id = IDR_LOGIN_FINGERPRINT_SCANNER_LAPTOP_BOTTOM_RIGHT_ANIMATION;
diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc index 0d40268..3c3e749 100644 --- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc +++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
@@ -21,12 +21,12 @@ #include "chrome/browser/safe_browsing/ui_manager.h" #include "chrome/browser/ssl/blocked_interception_blocking_page.h" #include "chrome/browser/ssl/chrome_security_blocking_page_factory.h" -#include "chrome/browser/ssl/mitm_software_blocking_page.h" #include "chrome/common/buildflags.h" #include "chrome/common/url_constants.h" #include "components/grit/dev_ui_components_resources.h" #include "components/safe_browsing/core/db/database_manager.h" #include "components/security_interstitials/content/bad_clock_blocking_page.h" +#include "components/security_interstitials/content/mitm_software_blocking_page.h" #include "components/security_interstitials/content/origin_policy_ui.h" #include "components/security_interstitials/core/ssl_error_options_mask.h" #include "components/security_interstitials/core/ssl_error_ui.h" @@ -173,9 +173,9 @@ net::SSLInfo ssl_info; ssl_info.cert = ssl_info.unverified_cert = CreateFakeCert(); - return new MITMSoftwareBlockingPage(web_contents, cert_error, request_url, - nullptr, ssl_info, mitm_software_name, - is_enterprise_managed); + return ChromeSecurityBlockingPageFactory::CreateMITMSoftwareBlockingPage( + web_contents, cert_error, request_url, nullptr, ssl_info, + mitm_software_name, is_enterprise_managed); } BlockedInterceptionBlockingPage* CreateBlockedInterceptionBlockingPage(
diff --git a/chrome/browser/ui/webui/new_tab_page/new_tab_page.mojom b/chrome/browser/ui/webui/new_tab_page/new_tab_page.mojom index 9dbe446..687e152 100644 --- a/chrome/browser/ui/webui/new_tab_page/new_tab_page.mojom +++ b/chrome/browser/ui/webui/new_tab_page/new_tab_page.mojom
@@ -68,6 +68,8 @@ skia.mojom.SkColor background_color; skia.mojom.SkColor shortcut_background_color; skia.mojom.SkColor shortcut_text_color; + // True if the theme is dark (e.g. NTP background color is dark). + bool is_dark; // TODO(crbug.com/1040682): Additional info about the theme depending on the // type. That should be optional since only some themes require it. However, // making this field optional crashes JS.
diff --git a/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc b/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc index 02997606..f80cccc 100644 --- a/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc +++ b/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc
@@ -16,6 +16,7 @@ #include "chrome/common/search/instant_types.h" #include "chrome/common/themes/autogenerated_theme_util.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/gfx/color_utils.h" namespace { @@ -50,6 +51,7 @@ theme->background_color = ntp_theme.background_color; theme->shortcut_background_color = ntp_theme.shortcut_color; theme->shortcut_text_color = ntp_theme.text_color; + theme->is_dark = !color_utils::IsDark(ntp_theme.text_color); return theme; }
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 70fc251..115d1a2 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -1474,11 +1474,11 @@ aria_label_id = IDS_SETTINGS_ADD_FINGERPRINT_DIALOG_INSTRUCTION_LOCATE_SCANNER_POWER_BUTTON_ARIA_LABEL; break; - case FingerprintLocation::KEYBOARD_TOP_RIGHT: + case FingerprintLocation::KEYBOARD_BOTTOM_LEFT: instruction_id = IDS_SETTINGS_ADD_FINGERPRINT_DIALOG_INSTRUCTION_LOCATE_SCANNER_KEYBOARD; aria_label_id = - IDS_SETTINGS_ADD_FINGERPRINT_DIALOG_INSTRUCTION_LOCATE_SCANNER_KEYBOARD_TOP_RIGHT_ARIA_LABEL; + IDS_SETTINGS_ADD_FINGERPRINT_DIALOG_INSTRUCTION_LOCATE_SCANNER_KEYBOARD_BOTTOM_LEFT_ARIA_LABEL; break; case FingerprintLocation::KEYBOARD_BOTTOM_RIGHT: instruction_id = @@ -1486,6 +1486,12 @@ aria_label_id = IDS_SETTINGS_ADD_FINGERPRINT_DIALOG_INSTRUCTION_LOCATE_SCANNER_KEYBOARD_BOTTOM_RIGHT_ARIA_LABEL; break; + case FingerprintLocation::KEYBOARD_TOP_RIGHT: + instruction_id = + IDS_SETTINGS_ADD_FINGERPRINT_DIALOG_INSTRUCTION_LOCATE_SCANNER_KEYBOARD; + aria_label_id = + IDS_SETTINGS_ADD_FINGERPRINT_DIALOG_INSTRUCTION_LOCATE_SCANNER_KEYBOARD_TOP_RIGHT_ARIA_LABEL; + break; } html_source->AddLocalizedString( "configureFingerprintInstructionLocateScannerStep", instruction_id);
diff --git a/chrome/browser/vr/BUILD.gn b/chrome/browser/vr/BUILD.gn index 6189d79..4028d207 100644 --- a/chrome/browser/vr/BUILD.gn +++ b/chrome/browser/vr/BUILD.gn
@@ -455,18 +455,12 @@ } source_set("vr_gl_bindings") { - sources = [ - "gl_bindings.h", - ] + sources = [ "gl_bindings.h" ] public_configs = [ ":vr_gl_mode" ] if (use_command_buffer) { - public_deps = [ - "//gpu/command_buffer/client:gles2_c_lib", - ] + public_deps = [ "//gpu/command_buffer/client:gles2_c_lib" ] } else { - public_deps = [ - "//ui/gl", - ] + public_deps = [ "//ui/gl" ] } } @@ -568,9 +562,7 @@ } # Needed for isolate script to execute - data_deps = [ - "//testing:run_perf_test", - ] + data_deps = [ "//testing:run_perf_test" ] } source_set("vr_test_support") { @@ -619,9 +611,7 @@ # doesn't propagate to individual test executable targets. ] - data_deps = [ - ":vr_test_pak", - ] + data_deps = [ ":vr_test_pak" ] } source_set("vr_gl_test_support") { @@ -746,9 +736,7 @@ } fuzzer_test("vr_omnibox_formatting_fuzzer") { - sources = [ - "elements/omnibox_formatting_fuzzer.cc", - ] + sources = [ "elements/omnibox_formatting_fuzzer.cc" ] deps = [ ":vr_common", ":vr_ui",
diff --git a/chrome/browser/vr/testapp/BUILD.gn b/chrome/browser/vr/testapp/BUILD.gn index 9e4bfdb..9034b01 100644 --- a/chrome/browser/vr/testapp/BUILD.gn +++ b/chrome/browser/vr/testapp/BUILD.gn
@@ -40,15 +40,11 @@ "//ui/ozone", "//ui/platform_window", ] - data_deps = [ - ":vr_testapp_pak", - ] + data_deps = [ ":vr_testapp_pak" ] } process_version("assets_component_version_header") { - sources = [ - "../../resources/vr/assets/VERSION", - ] + sources = [ "../../resources/vr/assets/VERSION" ] template_file = "assets_component_version.h.in" output = "$target_gen_dir/assets_component_version.h" }
diff --git a/chrome/browser/web_applications/BUILD.gn b/chrome/browser/web_applications/BUILD.gn index da730126..6f07a92 100644 --- a/chrome/browser/web_applications/BUILD.gn +++ b/chrome/browser/web_applications/BUILD.gn
@@ -75,9 +75,7 @@ } } - public_deps = [ - "//chrome/browser/web_applications/proto", - ] + public_deps = [ "//chrome/browser/web_applications/proto" ] } # This test_support library doesn't use extensions.
diff --git a/chrome/browser/web_applications/components/install_finalizer.cc b/chrome/browser/web_applications/components/install_finalizer.cc index 859957c..7b54f71e 100644 --- a/chrome/browser/web_applications/components/install_finalizer.cc +++ b/chrome/browser/web_applications/components/install_finalizer.cc
@@ -4,13 +4,34 @@ #include "chrome/browser/web_applications/components/install_finalizer.h" +#include "base/bind.h" +#include "base/callback.h" #include "base/logging.h" +#include "base/optional.h" +#include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/web_applications/components/app_registrar.h" #include "chrome/browser/web_applications/components/web_app_constants.h" #include "chrome/browser/web_applications/components/web_app_ui_manager.h" namespace web_app { +void InstallFinalizer::UninstallExternalWebAppByUrl( + const GURL& app_url, + ExternalInstallSource external_install_source, + UninstallWebAppCallback callback) { + base::Optional<AppId> app_id = registrar().LookupExternalAppId(app_url); + if (!app_id.has_value()) { + LOG(WARNING) << "Couldn't uninstall web app with url " << app_url + << "; No corresponding web app for url."; + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), /*uninstalled=*/false)); + return; + } + + UninstallExternalWebApp(app_id.value(), external_install_source, + std::move(callback)); +} + void InstallFinalizer::SetSubsystems(AppRegistrar* registrar, WebAppUiManager* ui_manager) { registrar_ = registrar;
diff --git a/chrome/browser/web_applications/components/install_finalizer.h b/chrome/browser/web_applications/components/install_finalizer.h index e3abe5b..81d0a9c 100644 --- a/chrome/browser/web_applications/components/install_finalizer.h +++ b/chrome/browser/web_applications/components/install_finalizer.h
@@ -56,12 +56,19 @@ virtual void FinalizeUpdate(const WebApplicationInfo& web_app_info, InstallFinalizedCallback callback) = 0; + // Removes |external_install_source| from |app_id|. If no more interested + // sources left, deletes the app from disk and registrar. + virtual void UninstallExternalWebApp( + const AppId& app_id, + ExternalInstallSource external_install_source, + UninstallWebAppCallback callback) = 0; + // Removes the external app for |app_url| from disk and registrar. Fails if - // there is no installed external app for |app_url|. + // there is no installed external app for |app_url|. Virtual for testing. virtual void UninstallExternalWebAppByUrl( const GURL& app_url, ExternalInstallSource external_install_source, - UninstallWebAppCallback) = 0; + UninstallWebAppCallback callback); virtual bool CanUserUninstallFromSync(const AppId& app_id) const = 0; virtual void UninstallWebAppFromSyncByUser(const AppId& app_id,
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.cc b/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.cc index 43e8b1d..889485b0 100644 --- a/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.cc +++ b/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.cc
@@ -157,23 +157,13 @@ crx_installer->InstallWebApp(web_app_info); } -void BookmarkAppInstallFinalizer::UninstallExternalWebAppByUrl( - const GURL& app_url, +void BookmarkAppInstallFinalizer::UninstallExternalWebApp( + const web_app::AppId& app_id, web_app::ExternalInstallSource external_install_source, UninstallWebAppCallback callback) { // Bookmark apps don't support app installation from different sources. // |external_install_source| is ignored here. - base::Optional<web_app::AppId> app_id = - externally_installed_app_prefs_.LookupAppId(app_url); - if (!app_id.has_value()) { - LOG(WARNING) << "Couldn't uninstall app with url " << app_url - << "; No corresponding extension for url."; - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), false)); - return; - } - - UninstallExtension(*app_id, std::move(callback)); + UninstallExtension(app_id, std::move(callback)); } bool BookmarkAppInstallFinalizer::CanUserUninstallFromSync(
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.h b/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.h index 0fe6deb..101bebd4 100644 --- a/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.h +++ b/chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.h
@@ -42,8 +42,8 @@ UninstallWebAppCallback callback) override; void FinalizeUpdate(const WebApplicationInfo& web_app_info, InstallFinalizedCallback callback) override; - void UninstallExternalWebAppByUrl( - const GURL& app_url, + void UninstallExternalWebApp( + const web_app::AppId& app_id, web_app::ExternalInstallSource external_install_source, UninstallWebAppCallback callback) override; bool CanUserUninstallFromSync(const web_app::AppId& app_id) const override;
diff --git a/chrome/browser/web_applications/extensions/pending_app_install_task_unittest.cc b/chrome/browser/web_applications/extensions/pending_app_install_task_unittest.cc index 85ad9fa5..85631c0 100644 --- a/chrome/browser/web_applications/extensions/pending_app_install_task_unittest.cc +++ b/chrome/browser/web_applications/extensions/pending_app_install_task_unittest.cc
@@ -178,6 +178,15 @@ NOTREACHED(); } + void UninstallExternalWebApp(const AppId& app_id, + ExternalInstallSource external_install_source, + UninstallWebAppCallback callback) override { + registrar_->RemoveExternalApp(app_id); + + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), /*uninstalled=*/true)); + } + void UninstallExternalWebAppByUrl( const GURL& app_url, ExternalInstallSource external_install_source,
diff --git a/chrome/browser/web_applications/proto/BUILD.gn b/chrome/browser/web_applications/proto/BUILD.gn index 1a55541..8a7d8458 100644 --- a/chrome/browser/web_applications/proto/BUILD.gn +++ b/chrome/browser/web_applications/proto/BUILD.gn
@@ -6,8 +6,6 @@ proto_library("proto") { import_dirs = [ "//components/sync/protocol" ] - sources = [ - "web_app.proto", - ] + sources = [ "web_app.proto" ] link_deps = [ "//components/sync/protocol" ] }
diff --git a/chrome/browser/web_applications/test/test_install_finalizer.cc b/chrome/browser/web_applications/test/test_install_finalizer.cc index 1dce858e..e423df7 100644 --- a/chrome/browser/web_applications/test/test_install_finalizer.cc +++ b/chrome/browser/web_applications/test/test_install_finalizer.cc
@@ -7,6 +7,7 @@ #include "chrome/browser/web_applications/test/test_install_finalizer.h" #include "base/callback.h" +#include "base/logging.h" #include "base/test/bind_test_util.h" #include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/web_applications/components/web_app_constants.h" @@ -53,6 +54,15 @@ NOTREACHED(); } +void TestInstallFinalizer::UninstallExternalWebApp( + const AppId& app_id, + ExternalInstallSource external_install_source, + UninstallWebAppCallback callback) { + user_uninstalled_external_apps_.erase(app_id); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), /*uninstalled=*/true)); +} + void TestInstallFinalizer::UninstallExternalWebAppByUrl( const GURL& app_url, ExternalInstallSource external_install_source,
diff --git a/chrome/browser/web_applications/test/test_install_finalizer.h b/chrome/browser/web_applications/test/test_install_finalizer.h index 27de94ad..9dbd0597 100644 --- a/chrome/browser/web_applications/test/test_install_finalizer.h +++ b/chrome/browser/web_applications/test/test_install_finalizer.h
@@ -36,6 +36,9 @@ UninstallWebAppCallback callback) override; void FinalizeUpdate(const WebApplicationInfo& web_app_info, InstallFinalizedCallback callback) override; + void UninstallExternalWebApp(const AppId& app_id, + ExternalInstallSource external_install_source, + UninstallWebAppCallback callback) override; void UninstallExternalWebAppByUrl( const GURL& app_url, ExternalInstallSource external_install_source,
diff --git a/chrome/browser/web_applications/web_app_install_finalizer.cc b/chrome/browser/web_applications/web_app_install_finalizer.cc index 84282e2..f3ce3de6 100644 --- a/chrome/browser/web_applications/web_app_install_finalizer.cc +++ b/chrome/browser/web_applications/web_app_install_finalizer.cc
@@ -231,23 +231,13 @@ std::move(callback))); } -void WebAppInstallFinalizer::UninstallExternalWebAppByUrl( - const GURL& app_url, +void WebAppInstallFinalizer::UninstallExternalWebApp( + const AppId& app_id, ExternalInstallSource external_install_source, UninstallWebAppCallback callback) { - base::Optional<web_app::AppId> app_id = - registrar().LookupExternalAppId(app_url); - if (!app_id.has_value()) { - LOG(WARNING) << "Couldn't uninstall app with url " << app_url - << "; No corresponding web app for url."; - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(std::move(callback), /*uninstalled=*/false)); - return; - } - Source::Type source = InferSourceFromExternalInstallSource(external_install_source); - UninstallWebAppOrRemoveSource(*app_id, source, std::move(callback)); + UninstallWebAppOrRemoveSource(app_id, source, std::move(callback)); } bool WebAppInstallFinalizer::CanUserUninstallFromSync(
diff --git a/chrome/browser/web_applications/web_app_install_finalizer.h b/chrome/browser/web_applications/web_app_install_finalizer.h index d15ec36..60cfec4 100644 --- a/chrome/browser/web_applications/web_app_install_finalizer.h +++ b/chrome/browser/web_applications/web_app_install_finalizer.h
@@ -40,10 +40,9 @@ UninstallWebAppCallback callback) override; void FinalizeUpdate(const WebApplicationInfo& web_app_info, InstallFinalizedCallback callback) override; - void UninstallExternalWebAppByUrl( - const GURL& app_url, - ExternalInstallSource external_install_source, - UninstallWebAppCallback callback) override; + void UninstallExternalWebApp(const AppId& app_id, + ExternalInstallSource external_install_source, + UninstallWebAppCallback callback) override; bool CanUserUninstallFromSync(const AppId& app_id) const override; void UninstallWebAppFromSyncByUser(const AppId& app_id, UninstallWebAppCallback callback) override;
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_base.cc b/chrome/credential_provider/gaiacp/gaia_credential_base.cc index 1c06c52..382d0bc2 100644 --- a/chrome/credential_provider/gaiacp/gaia_credential_base.cc +++ b/chrome/credential_provider/gaiacp/gaia_credential_base.cc
@@ -1177,8 +1177,10 @@ if (hr == S_OK) { hr = manager->ChangeUserPassword(domain_, username_, current_windows_password_, password_); + if (FAILED(hr)) { if (hr != HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED)) { + SetErrorMessageInPasswordField(hr); LOGFN(ERROR) << "ChangeUserPassword hr=" << putHR(hr); return hr; } @@ -1246,6 +1248,36 @@ return S_OK; } +// Sets message ids corresponding to appropriate password change error response +// codes. +void CGaiaCredentialBase::SetErrorMessageInPasswordField(HRESULT hr) { + UINT password_message_id; + switch (hr) { + case HRESULT_FROM_WIN32(ERROR_INVALID_PASSWORD): + password_message_id = IDS_INVALID_PASSWORD_BASE; + break; + case HRESULT_FROM_WIN32(NERR_InvalidComputer): + // This condition should never be invoked. + password_message_id = IDS_INVALID_COMPUTER_NAME_ERROR_BASE; + break; + case HRESULT_FROM_WIN32(NERR_NotPrimary): + password_message_id = IDS_AD_PASSWORD_CHANGE_DENIED_BASE; + break; + case HRESULT_FROM_WIN32(NERR_UserNotFound): + // This condition should never be invoked. + password_message_id = IDS_USER_NOT_FOUND_PASSWORD_ERROR_BASE; + break; + case HRESULT_FROM_WIN32(NERR_PasswordTooShort): + password_message_id = IDS_PASSWORD_COMPLEXITY_ERROR_BASE; + break; + default: + // This condition should never be invoked. + password_message_id = IDS_UNKNOWN_PASSWORD_ERROR_BASE; + break; + } + DisplayPasswordField(password_message_id); +} + // static void CGaiaCredentialBase::TellOmahaDidRun() { #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_base.h b/chrome/credential_provider/gaiacp/gaia_credential_base.h index 7976bf8..0a5660d7 100644 --- a/chrome/credential_provider/gaiacp/gaia_credential_base.h +++ b/chrome/credential_provider/gaiacp/gaia_credential_base.h
@@ -277,6 +277,9 @@ BSTR* error_text); HRESULT RecoverWindowsPasswordIfPossible(base::string16* recovered_password); + // Sets the error message in the password field based on the HRESULT returned + // by NetUserChangePassword win32 function. + void SetErrorMessageInPasswordField(HRESULT hr); Microsoft::WRL::ComPtr<ICredentialProviderCredentialEvents> events_; Microsoft::WRL::ComPtr<IGaiaCredentialProvider> provider_;
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_base_unittests.cc b/chrome/credential_provider/gaiacp/gaia_credential_base_unittests.cc index cbdcf396..a9d41f1 100644 --- a/chrome/credential_provider/gaiacp/gaia_credential_base_unittests.cc +++ b/chrome/credential_provider/gaiacp/gaia_credential_base_unittests.cc
@@ -2281,6 +2281,161 @@ ::testing::Values(0, 1, 2), ::testing::Values(0, 1, 2))); +// Tests failures in NetUserChangePassword attempt after password is +// successfully retrieved. +// 1. int - Password change attempt fails due to multiple reasons. Values are +// 0 - ERROR_INVALID_PASSWORD, 1 - NERR_InvalidComputer, +// 2 - NERR_NotPrimary, 3 - NERR_UserNotFound, 4 - +// NERR_PasswordTooShort, 5 - UnknownStatus +class GcpGaiaCredentialBasePasswordChangeFailureTest + : public GcpGaiaCredentialBaseTest, + public ::testing::WithParamInterface<int> {}; + +TEST_P(GcpGaiaCredentialBasePasswordChangeFailureTest, Fail) { + // Enable standard escrow service features in non-Chrome builds so that + // the escrow service code can be tested by the build machines. + GoogleMdmEscrowServiceEnablerForTesting escrow_service_enabler; + USES_CONVERSION; + + int failure_reason = GetParam(); + + ASSERT_EQ(S_OK, SetGlobalFlagForTesting(kRegMdmUrl, L"https://mdm.com")); + ASSERT_EQ(S_OK, SetGlobalFlagForTesting(kRegEscrowServiceServerUrl, + L"https://escrow.com")); + ASSERT_EQ(S_OK, SetGlobalFlagForTesting(kRegMdmAllowConsumerAccounts, 1)); + ASSERT_EQ(S_OK, SetGlobalFlagForTesting(kRegMdmSupportsMultiUser, 0)); + + GoogleMdmEnrolledStatusForTesting force_success(true); + + // Create a fake user associated to a gaia id. + CComBSTR sid; + constexpr wchar_t kOldPassword[] = L"password"; + ASSERT_EQ(S_OK, + fake_os_user_manager()->CreateTestOSUser( + kDefaultUsername, kOldPassword, L"Full Name", L"comment", + base::UTF8ToUTF16(kDefaultGaiaId), base::string16(), &sid)); + + // Change token response to an invalid one. + SetDefaultTokenHandleResponse(kDefaultInvalidTokenHandleResponse); + + // Make a dummy response for successful public key generation and private key + // retrieval. + std::string generate_success_response = + fake_password_recovery_manager()->MakeGenerateKeyPairResponseForTesting( + kTestPublicKey, kFakeResourceId); + + std::string get_key_success_response = + fake_password_recovery_manager()->MakeGetPrivateKeyResponseForTesting( + kTestPrivateKey); + + fake_http_url_fetcher_factory()->SetFakeResponse( + fake_password_recovery_manager()->GetEscrowServiceGenerateKeyPairUrl(), + FakeWinHttpUrlFetcher::Headers(), generate_success_response, + INVALID_HANDLE_VALUE); + + fake_http_url_fetcher_factory()->SetFakeResponse( + fake_password_recovery_manager()->GetEscrowServiceGetPrivateKeyUrl( + kFakeResourceId), + FakeWinHttpUrlFetcher::Headers(), get_key_success_response, + INVALID_HANDLE_VALUE); + + // Sign on once to store the password in the LSA + { + // Create provider and start logon. + Microsoft::WRL::ComPtr<ICredentialProviderCredential> cred; + + ASSERT_EQ(S_OK, InitializeProviderAndGetCredential(0, &cred)); + + ASSERT_EQ(S_OK, StartLogonProcessAndWait()); + + // Finish logon successfully to propagate password recovery information to + // LSA. + ASSERT_EQ(S_OK, FinishLogonProcess(true, true, 0)); + + ASSERT_EQ(S_OK, ReleaseProvider()); + } + + constexpr char kNewPassword[] = "password2"; + + // Sign in a second time with a different password and see if it is updated + // automatically. + { + HRESULT net_api_status; + base::string16 expected_error_msg; + switch (failure_reason) { + case 0: + net_api_status = HRESULT_FROM_WIN32(ERROR_INVALID_PASSWORD); + expected_error_msg = GetStringResource(IDS_INVALID_PASSWORD_BASE); + break; + case 1: + net_api_status = HRESULT_FROM_WIN32(NERR_InvalidComputer); + expected_error_msg = + GetStringResource(IDS_INVALID_COMPUTER_NAME_ERROR_BASE); + break; + case 2: + net_api_status = HRESULT_FROM_WIN32(NERR_NotPrimary); + expected_error_msg = + GetStringResource(IDS_AD_PASSWORD_CHANGE_DENIED_BASE); + break; + case 3: + net_api_status = HRESULT_FROM_WIN32(NERR_UserNotFound); + expected_error_msg = + GetStringResource(IDS_USER_NOT_FOUND_PASSWORD_ERROR_BASE); + break; + case 4: + net_api_status = HRESULT_FROM_WIN32(NERR_PasswordTooShort); + expected_error_msg = + GetStringResource(IDS_PASSWORD_COMPLEXITY_ERROR_BASE); + break; + default: + net_api_status = E_FAIL; + expected_error_msg = GetStringResource(IDS_UNKNOWN_PASSWORD_ERROR_BASE); + break; + } + + // Set reason for failing the password change attempt. + fake_os_user_manager()->ShouldFailChangePassword(true, net_api_status); + + // Create provider and start logon. + Microsoft::WRL::ComPtr<ICredentialProviderCredential> cred; + + ASSERT_EQ(S_OK, InitializeProviderAndGetCredential(0, &cred)); + + Microsoft::WRL::ComPtr<ITestCredential> test; + ASSERT_EQ(S_OK, cred.As(&test)); + + // Send back a different gaia password to force a password update. + ASSERT_EQ(S_OK, test->SetGlsGaiaPassword(kNewPassword)); + + // Don't send a forced e-mail. It will be sent from the user that was + // updated during the last sign in. + ASSERT_EQ(S_OK, test->SetGlsEmailAddress(std::string())); + + ASSERT_EQ(S_OK, StartLogonProcessAndWait()); + + Microsoft::WRL::ComPtr<ITestCredentialProvider> test_provider; + ASSERT_EQ(S_OK, created_provider().As(&test_provider)); + + ASSERT_EQ(net_api_status, FinishLogonProcess(true, true, 0)); + + // Make sure password textbox is shown due to password change failure. + ASSERT_EQ(CPFS_DISPLAY_IN_SELECTED_TILE, + fake_credential_provider_credential_events()->GetFieldState( + cred.Get(), FID_CURRENT_PASSWORD_FIELD)); + + // Make sure password textbox is shown due to passwor change failure. + EXPECT_STREQ(expected_error_msg.c_str(), + fake_credential_provider_credential_events()->GetFieldString( + cred.Get(), FID_DESCRIPTION)); + + ASSERT_EQ(S_OK, ReleaseProvider()); + } +} + +INSTANTIATE_TEST_SUITE_P(All, + GcpGaiaCredentialBasePasswordChangeFailureTest, + ::testing::Values(0, 1, 2, 3, 4, 5)); + // Test password recovery system being disabled by registry settings. // Parameter is a pointer to an escrow service url. Can be empty or nullptr. class GcpGaiaCredentialBasePasswordRecoveryDisablingTest
diff --git a/chrome/credential_provider/gaiacp/gaia_resources.grd b/chrome/credential_provider/gaiacp/gaia_resources.grd index 7f95f799..82c7c50f 100644 --- a/chrome/credential_provider/gaiacp/gaia_resources.grd +++ b/chrome/credential_provider/gaiacp/gaia_resources.grd
@@ -97,6 +97,21 @@ <message name="IDS_INVALID_PASSWORD" desc=""> You entered an incorrect Windows password. Please try again. </message> + <message name="IDS_AD_PASSWORD_CHANGE_DENIED" desc=""> + Password change only allowed on domain controller. Please contact your administrator. + </message> + <message name="IDS_PASSWORD_COMPLEXITY_ERROR" desc=""> + Current password doesn't meet password complexity requirements. Please contact your administrator. + </message> + <message name="IDS_INVALID_COMPUTER_NAME_ERROR" desc=""> + Invalid computer name provided during password change attempt. Please contact your administrator. + </message> + <message name="IDS_USER_NOT_FOUND_PASSWORD_ERROR" desc=""> + Password change attempted on invalid user. Please contact your administrator. + </message> + <message name="IDS_UNKNOWN_PASSWORD_ERROR" desc=""> + Attempt to change password failed. Please contact your administrator. + </message> <message name="IDS_INTERNAL_ERROR" desc=""> An internal error occurred. </message>
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_AD_PASSWORD_CHANGE_DENIED.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_AD_PASSWORD_CHANGE_DENIED.png.sha1 new file mode 100644 index 0000000..70998a59 --- /dev/null +++ b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_AD_PASSWORD_CHANGE_DENIED.png.sha1
@@ -0,0 +1 @@ +77a15def4fd24246b7be370e71ddf2c45bf15673 \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_INVALID_COMPUTER_NAME_ERROR.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_INVALID_COMPUTER_NAME_ERROR.png.sha1 new file mode 100644 index 0000000..70998a59 --- /dev/null +++ b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_INVALID_COMPUTER_NAME_ERROR.png.sha1
@@ -0,0 +1 @@ +77a15def4fd24246b7be370e71ddf2c45bf15673 \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_INVALID_PASSWORD.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_INVALID_PASSWORD.png.sha1 index 5ea7ed6..70998a59 100644 --- a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_INVALID_PASSWORD.png.sha1 +++ b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_INVALID_PASSWORD.png.sha1
@@ -1 +1 @@ -c2fcfcfd16d9478b7f9445d4fe49d71a256cbe2a \ No newline at end of file +77a15def4fd24246b7be370e71ddf2c45bf15673 \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_PASSWORD_COMPLEXITY_ERROR.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_PASSWORD_COMPLEXITY_ERROR.png.sha1 new file mode 100644 index 0000000..70998a59 --- /dev/null +++ b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_PASSWORD_COMPLEXITY_ERROR.png.sha1
@@ -0,0 +1 @@ +77a15def4fd24246b7be370e71ddf2c45bf15673 \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_UNKNOWN_PASSWORD_ERROR.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_UNKNOWN_PASSWORD_ERROR.png.sha1 new file mode 100644 index 0000000..70998a59 --- /dev/null +++ b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_UNKNOWN_PASSWORD_ERROR.png.sha1
@@ -0,0 +1 @@ +77a15def4fd24246b7be370e71ddf2c45bf15673 \ No newline at end of file
diff --git a/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_USER_NOT_FOUND_PASSWORD_ERROR.png.sha1 b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_USER_NOT_FOUND_PASSWORD_ERROR.png.sha1 new file mode 100644 index 0000000..70998a59 --- /dev/null +++ b/chrome/credential_provider/gaiacp/gaia_resources_grd/IDS_USER_NOT_FOUND_PASSWORD_ERROR.png.sha1
@@ -0,0 +1 @@ +77a15def4fd24246b7be370e71ddf2c45bf15673 \ No newline at end of file
diff --git a/chrome/credential_provider/test/com_fakes.cc b/chrome/credential_provider/test/com_fakes.cc index 7c19b992..cd736b58 100644 --- a/chrome/credential_provider/test/com_fakes.cc +++ b/chrome/credential_provider/test/com_fakes.cc
@@ -232,6 +232,10 @@ ICredentialProviderCredential* pcpc, DWORD dwFieldID, LPCWSTR psz) { + if (psz != nullptr) { + base::string16 copy_wchart(psz); + field_string_[pcpc][dwFieldID] = copy_wchart; + } return S_OK; } @@ -252,6 +256,15 @@ return field_states_[pcpc][dwFieldID]; } +LPCWSTR FakeCredentialProviderCredentialEvents::GetFieldString( + ICredentialProviderCredential* pcpc, + DWORD dwFieldID) { + DCHECK(field_string_.count(pcpc)); + DCHECK(field_string_[pcpc].count(dwFieldID)); + + return field_string_[pcpc][dwFieldID].c_str(); +} + IMPL_IUNKOWN_NOQI_WITH_REF(FakeCredentialProviderCredentialEvents) ///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/credential_provider/test/com_fakes.h b/chrome/credential_provider/test/com_fakes.h index d0a328e..fc2bffa5 100644 --- a/chrome/credential_provider/test/com_fakes.h +++ b/chrome/credential_provider/test/com_fakes.h
@@ -141,11 +141,15 @@ CREDENTIAL_PROVIDER_FIELD_STATE GetFieldState( ICredentialProviderCredential* pcpc, DWORD dwFieldID); + LPCWSTR GetFieldString(ICredentialProviderCredential* pcpc, DWORD dwFieldID); private: std::unordered_map<ICredentialProviderCredential*, std::unordered_map<DWORD, CREDENTIAL_PROVIDER_FIELD_STATE>> field_states_; + std::unordered_map<ICredentialProviderCredential*, + std::unordered_map<DWORD, base::string16>> + field_string_; }; ///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/credential_provider/test/gcp_fakes.cc b/chrome/credential_provider/test/gcp_fakes.cc index b130e6e..3180a83 100644 --- a/chrome/credential_provider/test/gcp_fakes.cc +++ b/chrome/credential_provider/test/gcp_fakes.cc
@@ -204,6 +204,10 @@ DCHECK(old_password); DCHECK(new_password); + if (fail_change_password_) { + return failed_change_password_hr_; + } + if (username_to_info_.count(username) > 0) { if (username_to_info_[username].password != old_password) return HRESULT_FROM_WIN32(ERROR_INVALID_PASSWORD);
diff --git a/chrome/credential_provider/test/gcp_fakes.h b/chrome/credential_provider/test/gcp_fakes.h index 795b482..ee56858 100644 --- a/chrome/credential_provider/test/gcp_fakes.h +++ b/chrome/credential_provider/test/gcp_fakes.h
@@ -180,12 +180,22 @@ size_t GetUserCount() const { return username_to_info_.size(); } std::vector<std::pair<base::string16, base::string16>> GetUsers() const; + void ShouldFailChangePassword(bool status, HRESULT failure_reason) { + fail_change_password_ = status; + if (status) + failed_change_password_hr_ = failure_reason; + } + + bool DoesPasswordChangeFail() { return fail_change_password_; } + private: OSUserManager* original_manager_; DWORD next_rid_ = 0; std::map<base::string16, UserInfo> username_to_info_; bool should_fail_user_creation_ = false; bool is_device_domain_joined_ = false; + bool fail_change_password_ = false; + HRESULT failed_change_password_hr_ = E_FAIL; }; ///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/credential_provider/test/gls_runner_test_base.cc b/chrome/credential_provider/test/gls_runner_test_base.cc index 92f0e4b8..d2fdbdb 100644 --- a/chrome/credential_provider/test/gls_runner_test_base.cc +++ b/chrome/credential_provider/test/gls_runner_test_base.cc
@@ -542,6 +542,7 @@ Microsoft::WRL::ComPtr<ICredentialProviderCredential> local_testing_cred = testing_cred_; + // Release ownership on the testing_cred_ which should be finishing. testing_cred_.Reset(); @@ -549,7 +550,10 @@ expected_success, expected_credentials_change_fired, expected_error_message, local_testing_cred); - EXPECT_EQ(hr, S_OK); + if (!fake_os_user_manager()->DoesPasswordChangeFail()) { + EXPECT_EQ(hr, S_OK); + } + if (FAILED(hr)) return hr; @@ -629,11 +633,21 @@ if (FAILED(hr)) return hr; - EXPECT_EQ(nullptr, status_text); - EXPECT_EQ(CPSI_SUCCESS, status_icon); - EXPECT_EQ(CPGSR_RETURN_CREDENTIAL_FINISHED, cpgsr); - EXPECT_LT(0u, cpcs.cbSerialization); - EXPECT_NE(nullptr, cpcs.rgbSerialization); + // Credentials not valid, login doesn't go through. + if (test_cred->AreCredentialsValid()) { + EXPECT_EQ(nullptr, status_text); + EXPECT_EQ(CPSI_SUCCESS, status_icon); + EXPECT_EQ(CPGSR_RETURN_CREDENTIAL_FINISHED, cpgsr); + EXPECT_LT(0u, cpcs.cbSerialization); + EXPECT_NE(nullptr, cpcs.rgbSerialization); + } else { + EXPECT_EQ(CPSI_ERROR, status_icon); + EXPECT_EQ(CPGSR_RETURN_NO_CREDENTIAL_FINISHED, cpgsr); + // The credential provider has not serialized a credential, + // but has completed its work. This will force the logon UI to + // return, which will call UnAdvise for all the credential providers. + return E_FAIL; + } // Check that values were propagated to the provider. if (expected_credentials_change_fired) {
diff --git a/chrome/test/data/webui/new_tab_page/app_test.js b/chrome/test/data/webui/new_tab_page/app_test.js index d7e1465..d82d38d5 100644 --- a/chrome/test/data/webui/new_tab_page/app_test.js +++ b/chrome/test/data/webui/new_tab_page/app_test.js
@@ -48,6 +48,7 @@ backgroundColor: {value: 0xffff0000}, shortcutBackgroundColor: {value: 0xff00ff00}, shortcutTextColor: {value: 0xff0000ff}, + isDark: false, }; // Act. @@ -67,6 +68,7 @@ backgroundColor: {value: 0xffff0000}, shortcutBackgroundColor: {value: 0xff00ff00}, shortcutTextColor: {value: 0xff0000ff}, + isDark: false, }); await testProxy.callbackRouterRemote.$.flushForTesting();
diff --git a/chrome/test/data/webui/settings/chromeos/crostini_page_test.js b/chrome/test/data/webui/settings/chromeos/crostini_page_test.js index df5f859f..759bb06 100644 --- a/chrome/test/data/webui/settings/chromeos/crostini_page_test.js +++ b/chrome/test/data/webui/settings/chromeos/crostini_page_test.js
@@ -212,6 +212,33 @@ }); }); + test('ExportImportButtonsDisabledOnWhenInstallingCrostini', function() { + assertTrue(!!subpage.$$('#crostini-export-import')); + subpage.$$('#crostini-export-import').click(); + return flushAsync() + .then(() => { + subpage = crostiniPage.$$('settings-crostini-export-import'); + assertFalse(subpage.$$('#export cr-button').disabled); + assertFalse(subpage.$$('#import cr-button').disabled); + cr.webUIListenerCallback('crostini-installer-status-changed', true); + return flushAsync(); + }) + .then(() => { + subpage = crostiniPage.$$('settings-crostini-export-import'); + assertTrue(subpage.$$('#export cr-button').disabled); + assertTrue(subpage.$$('#import cr-button').disabled); + cr.webUIListenerCallback( + 'crostini-installer-status-changed', false); + return flushAsync(); + }) + .then(() => { + subpage = crostiniPage.$$('settings-crostini-export-import'); + assertFalse(subpage.$$('#export cr-button').disabled); + assertFalse(subpage.$$('#import cr-button').disabled); + }); + }); + + test('Remove', function() { assertTrue(!!subpage.$$('#remove cr-button')); subpage.$$('#remove cr-button').click();
diff --git a/chromeos/components/account_manager/BUILD.gn b/chromeos/components/account_manager/BUILD.gn index 2b12bb9f..5038aa51 100644 --- a/chromeos/components/account_manager/BUILD.gn +++ b/chromeos/components/account_manager/BUILD.gn
@@ -14,9 +14,7 @@ "account_manager_factory.h", ] - public_deps = [ - ":account_manager_proto", - ] + public_deps = [ ":account_manager_proto" ] deps = [ "//base", @@ -32,9 +30,7 @@ source_set("unit_tests") { testonly = true - sources = [ - "account_manager_unittest.cc", - ] + sources = [ "account_manager_unittest.cc" ] deps = [ ":account_manager", @@ -50,9 +46,7 @@ } proto_library("account_manager_proto") { - sources = [ - "tokens.proto", - ] + sources = [ "tokens.proto" ] proto_out_dir = "chromeos/components/account_manager" }
diff --git a/chromeos/constants/chromeos_switches.cc b/chromeos/constants/chromeos_switches.cc index 3fb1e14..1cab601 100644 --- a/chromeos/constants/chromeos_switches.cc +++ b/chromeos/constants/chromeos_switches.cc
@@ -334,7 +334,7 @@ // Fingerprint sensor location indicates the physical sensor's location. The // value is a string with possible values: "power-button-top-left", -// "keyboard-top-right", "keyboard-bottom-right". +// "keyboard-bottom-left", keyboard-bottom-right", "keyboard-top-right". const char kFingerprintSensorLocation[] = "fingerprint-sensor-location"; // Forces Chrome to use CertVerifyProcBuiltin for verification of server
diff --git a/chromeos/ime/BUILD.gn b/chromeos/ime/BUILD.gn index 62cbe0c..7f07c98 100644 --- a/chromeos/ime/BUILD.gn +++ b/chromeos/ime/BUILD.gn
@@ -4,12 +4,8 @@ action("gencode") { script = "gen_input_methods.py" - sources = [ - "//chromeos/ime/input_methods.txt", - ] - outputs = [ - "$target_gen_dir/input_methods.h", - ] + sources = [ "//chromeos/ime/input_methods.txt" ] + outputs = [ "$target_gen_dir/input_methods.h" ] args = [ rebase_path("//chromeos/ime/input_methods.txt", root_build_dir), rebase_path("$target_gen_dir/input_methods.h", root_build_dir),
diff --git a/components/OWNERS b/components/OWNERS index 5b9ed4a..bf9c470 100644 --- a/components/OWNERS +++ b/components/OWNERS
@@ -6,6 +6,7 @@ thakis@chromium.org per-file app_modal_strings.grdp=file://components/app_modal/OWNERS +per-file android_system_error_page_strings.grdp=file://components/android_system_error_page/OWNERS per-file autofill_assistant_strings.grdp=file://components/autofill_assistant/OWNERS per-file autofill_payments_strings.grdp=file://components/autofill/core/browser/payments/OWNERS per-file autofill_strings.grdp=file://components/autofill/OWNERS
diff --git a/components/android_system_error_page/OWNERS b/components/android_system_error_page/OWNERS new file mode 100644 index 0000000..dc717abb --- /dev/null +++ b/components/android_system_error_page/OWNERS
@@ -0,0 +1 @@ +file://android_webview/OWNERS
diff --git a/components/android_system_error_page/README.md b/components/android_system_error_page/README.md new file mode 100644 index 0000000..2211ed5 --- /dev/null +++ b/components/android_system_error_page/README.md
@@ -0,0 +1,2 @@ +Contains code and resources for displaying network error pages using an Android +system style.
diff --git a/android_webview/ui/resources/load_error.html b/components/android_system_error_page/resources/load_error.html similarity index 100% rename from android_webview/ui/resources/load_error.html rename to components/android_system_error_page/resources/load_error.html
diff --git a/components/android_system_error_page_strings.grdp b/components/android_system_error_page_strings.grdp new file mode 100644 index 0000000..99cb730 --- /dev/null +++ b/components/android_system_error_page_strings.grdp
@@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<grit-part> + <!-- Strings for displaying error pages with Android system styling --> + <message name="IDS_ANDROID_ERROR_PAGE_WEBPAGE_NOT_AVAILABLE" desc="The title of the webpage shown when the requested URL in unavailable"> + Webpage not available + </message> + <message name="IDS_ANDROID_ERROR_PAGE_WEBPAGE_CAN_NOT_BE_LOADED" desc="Message informing the user that the page can not be loaded"> + The webpage at <ph name="PAGE"><strong>$1</strong><ex>page.html</ex></ph> could not be loaded because: + </message> + <message name="IDS_ANDROID_ERROR_PAGE_WEBPAGE_TEMPORARILY_DOWN" desc="Message informing the user that it is not possible to contact the server"> + The webpage at <ph name="PAGE"><strong>$1</strong><ex>page.html</ex></ph> might be temporarily down or it may have moved permanently to a new web address. + </message> + <message name="IDS_ANDROID_ERROR_PAGE_WEBPAGE_TEMPORARILY_DOWN_SUGGESTIONS" desc="Suggestions provided to the user when it is not possible to contact the server"><ph name="MARKUP_1"><strong><ex>_</ex></ph>Suggestions:<ph name="MARKUP_2"></strong><ul><li><ex>_</ex></ph>Make sure you have a data connection<ph name="MARKUP_3"></li><li><ex>_</ex></ph>Reload this webpage later<ph name="MARKUP_4"></li><li><ex>_</ex></ph>Check the address you entered<ph name="MARKUP_5"></li></ul><ex>_</ex></ph> + </message> +</grit-part>
diff --git a/components/arc/BUILD.gn b/components/arc/BUILD.gn index a03c956c..c9d98d0c 100644 --- a/components/arc/BUILD.gn +++ b/components/arc/BUILD.gn
@@ -161,9 +161,7 @@ "session/arc_supervision_transition.h", ] - deps = [ - "//base", - ] + deps = [ "//base" ] } source_set("arc_features") { @@ -172,9 +170,7 @@ "arc_features.h", ] - deps = [ - "//base", - ] + deps = [ "//base" ] } static_library("arc_base_utils") { @@ -183,9 +179,7 @@ "arc_util.h", ] - public_deps = [ - ":arc_features", - ] + public_deps = [ ":arc_features" ] deps = [ "//ash/public/cpp", "//base", @@ -351,9 +345,7 @@ } source_set("arc_metrics_constants") { - sources = [ - "metrics/arc_metrics_constants.h", - ] + sources = [ "metrics/arc_metrics_constants.h" ] } source_set("unit_tests") {
diff --git a/components/arc/mojom/BUILD.gn b/components/arc/mojom/BUILD.gn index b08ccf02..c2545f1 100644 --- a/components/arc/mojom/BUILD.gn +++ b/components/arc/mojom/BUILD.gn
@@ -83,9 +83,7 @@ } mojom("camera_intent") { - sources = [ - "camera_intent.mojom", - ] + sources = [ "camera_intent.mojom" ] } mojom("notifications") { @@ -94,9 +92,7 @@ "notifications.mojom", ] - deps = [ - ":media", # for gfx.mojom - ] + deps = [ ":media" ] # for gfx.mojom } # Media related mojo interfaces. These are used by @@ -113,15 +109,11 @@ "video_protected_buffer_allocator.mojom", ] - public_deps = [ - "//ui/gfx/geometry/mojom", - ] + public_deps = [ "//ui/gfx/geometry/mojom" ] } source_set("mojom_traits") { - sources = [ - "ime_mojom_traits.h", - ] + sources = [ "ime_mojom_traits.h" ] deps = [ ":mojom", @@ -131,9 +123,7 @@ source_set("unit_tests") { testonly = true - sources = [ - "video_accelerator_mojom_traits_unittest.cc", - ] + sources = [ "video_accelerator_mojom_traits_unittest.cc" ] deps = [ ":mojom",
diff --git a/components/autofill_assistant/browser/controller.cc b/components/autofill_assistant/browser/controller.cc index 8ff5925..d316dac 100644 --- a/components/autofill_assistant/browser/controller.cc +++ b/components/autofill_assistant/browser/controller.cc
@@ -541,6 +541,10 @@ EnterState(AutofillAssistantState::STOPPED); } +void Controller::EnterStateSilent(AutofillAssistantState state) { + EnterState(state); +} + bool Controller::EnterState(AutofillAssistantState state) { if (state_ == state) return false; @@ -922,7 +926,14 @@ SetStatusMessage(l10n_util::GetStringFUTF8( IDS_AUTOFILL_ASSISTANT_LOADING, base::UTF8ToUTF16(deeplink_url_.host()))); SetProgress(kAutostartInitialProgress); - EnterState(AutofillAssistantState::STARTING); + + if (IsNavigatingToNewDocument()) { + start_after_navigation_ = base::BindOnce(&Controller::EnterStateSilent, + weak_ptr_factory_.GetWeakPtr(), + AutofillAssistantState::STARTING); + } else { + EnterState(AutofillAssistantState::STARTING); + } return true; } @@ -1415,10 +1426,16 @@ (navigation_handle->GetResponseHeaders()->response_code() / 100) == 2; navigation_error_ = !is_successful; navigating_to_new_document_ = false; - ReportNavigationStateChanged(); - if (is_successful) - OnUrlChange(); + if (start_after_navigation_) { + std::move(start_after_navigation_).Run(); + } else { + ReportNavigationStateChanged(); + + if (is_successful) { + OnUrlChange(); + } + } } void Controller::DocumentAvailableInMainFrame() {
diff --git a/components/autofill_assistant/browser/controller.h b/components/autofill_assistant/browser/controller.h index 11294bcb..baa28bb2 100644 --- a/components/autofill_assistant/browser/controller.h +++ b/components/autofill_assistant/browser/controller.h
@@ -291,6 +291,9 @@ void SetOverlayColors(std::unique_ptr<OverlayColors> colors); void ReportNavigationStateChanged(); + // Enter step while ignoring the return value. + void EnterStateSilent(AutofillAssistantState state); + // Clear out visible state and enter the stopped state. void EnterStoppedState(); @@ -388,6 +391,10 @@ // Value for ScriptExecutorDelegate::IsNavigatingToNewDocument() bool navigating_to_new_document_ = false; + // If this is set, the controller was still navigating during startup. Wait + // for DidFinishNavigation and execute the callback. + base::OnceClosure start_after_navigation_; + // Value for ScriptExecutorDelegate::HasNavigationError() bool navigation_error_ = false; std::vector<ScriptExecutorDelegate::Listener*> listeners_;
diff --git a/components/autofill_assistant/browser/controller_unittest.cc b/components/autofill_assistant/browser/controller_unittest.cc index 3bce2fa..746b8e7e 100644 --- a/components/autofill_assistant/browser/controller_unittest.cc +++ b/components/autofill_assistant/browser/controller_unittest.cc
@@ -217,6 +217,10 @@ UiDelegate* GetUiDelegate() { return controller_.get(); } + void SetNavigatingToNewDocument(bool value) { + controller_->navigating_to_new_document_ = value; + } + // |task_environment_| must be the first field, to make sure that everything // runs in the same task environment. base::test::ScopedFeatureList scoped_feature_list_; @@ -422,6 +426,7 @@ Start("http://a.example.com/path"); EXPECT_EQ(AutofillAssistantState::STARTING, controller_->GetState()); } + TEST_F(ControllerTest, ReportPromptAndSuggestionsChanged) { SupportsScriptResponseProto script_response; AddRunnableScript(&script_response, "script1"); @@ -952,6 +957,18 @@ EXPECT_THAT(listener.events, IsEmpty()); } +TEST_F(ControllerTest, DelayStartupIfLoading) { + SetNavigatingToNewDocument(true); + + Start("http://a.example.com/"); + EXPECT_EQ(AutofillAssistantState::INACTIVE, controller_->GetState()); + + content::NavigationSimulator::NavigateAndCommitFromDocument( + GURL("http://b.example.com"), web_contents()->GetMainFrame()); + EXPECT_THAT(states_, ElementsAre(AutofillAssistantState::STARTING, + AutofillAssistantState::STOPPED)); +} + TEST_F(ControllerTest, WaitForNavigationActionTimesOut) { // A single script, with a wait_for_navigation action SupportsScriptResponseProto script_response;
diff --git a/components/autofill_assistant/browser/devtools/BUILD.gn b/components/autofill_assistant/browser/devtools/BUILD.gn index b9cc466d..dcc65ba 100644 --- a/components/autofill_assistant/browser/devtools/BUILD.gn +++ b/components/autofill_assistant/browser/devtools/BUILD.gn
@@ -53,9 +53,7 @@ action("gen_devtools_client_api") { script = "devtools_api/client_api_generator.py" - deps = [ - "//third_party/blink/public/devtools_protocol:protocol_version", - ] + deps = [ "//third_party/blink/public/devtools_protocol:protocol_version" ] inputs = [ "$root_gen_dir/third_party/blink/public/devtools_protocol/protocol.json", ]
diff --git a/components/base32/BUILD.gn b/components/base32/BUILD.gn index 839e73d..931e222a 100644 --- a/components/base32/BUILD.gn +++ b/components/base32/BUILD.gn
@@ -10,9 +10,7 @@ "base32.h", ] - deps = [ - "//base", - ] + deps = [ "//base" ] } static_library("base32_test_util") { @@ -30,9 +28,7 @@ source_set("unit_tests") { testonly = true - sources = [ - "base32_unittest.cc", - ] + sources = [ "base32_unittest.cc" ] deps = [ ":base32", @@ -43,9 +39,7 @@ } fuzzer_test("base32_fuzzer") { - sources = [ - "base32_fuzzer.cc", - ] + sources = [ "base32_fuzzer.cc" ] deps = [ ":base32",
diff --git a/components/browser_sync/BUILD.gn b/components/browser_sync/BUILD.gn index 973d2d58..efbc49f 100644 --- a/components/browser_sync/BUILD.gn +++ b/components/browser_sync/BUILD.gn
@@ -16,9 +16,7 @@ "signin_confirmation_helper.h", ] - public_deps = [ - "//components/sync", - ] + public_deps = [ "//components/sync" ] deps = [ "//base",
diff --git a/components/captive_portal/BUILD.gn b/components/captive_portal/BUILD.gn index 93a263cb..1d6bbbd 100644 --- a/components/captive_portal/BUILD.gn +++ b/components/captive_portal/BUILD.gn
@@ -45,9 +45,7 @@ source_set("unit_tests") { testonly = true - sources = [ - "captive_portal_detector_unittest.cc", - ] + sources = [ "captive_portal_detector_unittest.cc" ] deps = [ ":captive_portal",
diff --git a/components/cbor/values.h b/components/cbor/values.h index f7b9960..0fcd1a0 100644 --- a/components/cbor/values.h +++ b/components/cbor/values.h
@@ -31,10 +31,12 @@ // https://tools.ietf.org/html/rfc7049#section-3.9 // TODO(808022): Clarify where this stands. bool operator()(const Value& a, const Value& b) const { - // The current implementation only supports integer, text string, - // and byte string keys. - DCHECK((a.is_integer() || a.is_string() || a.is_bytestring()) && - (b.is_integer() || b.is_string() || b.is_bytestring())); + // The current implementation only supports integer, text string, byte + // string and invalid UTF8 keys. + DCHECK((a.is_integer() || a.is_string() || a.is_bytestring() || + a.is_invalid_utf8()) && + (b.is_integer() || b.is_string() || b.is_bytestring() || + b.is_invalid_utf8())); // Below text from https://tools.ietf.org/html/rfc7049 errata 4409: // * If the major types are different, the one with the lower value @@ -69,6 +71,13 @@ const size_t b_length = b_str.size(); return std::tie(a_length, a_str) < std::tie(b_length, b_str); } + case Type::INVALID_UTF8: { + const auto& a_str = a.GetInvalidUTF8(); + const size_t a_length = a_str.size(); + const auto& b_str = b.GetInvalidUTF8(); + const size_t b_length = b_str.size(); + return std::tie(a_length, a_str) < std::tie(b_length, b_str); + } default: break; }
diff --git a/components/components_strings.grd b/components/components_strings.grd index 1052153..d0c3ce60 100644 --- a/components/components_strings.grd +++ b/components/components_strings.grd
@@ -315,6 +315,9 @@ <if expr="not is_android and not is_ios"> <part file="management_strings.grdp" /> </if> + <if expr="is_android"> + <part file="android_system_error_page_strings.grdp" /> + </if> <!-- Generic terms --> <message name="IDS_CANCEL" desc="Used for Cancel on buttons">
diff --git a/components/consent_auditor/BUILD.gn b/components/consent_auditor/BUILD.gn index d56fb96..ad6191d1 100644 --- a/components/consent_auditor/BUILD.gn +++ b/components/consent_auditor/BUILD.gn
@@ -27,9 +27,7 @@ if (is_android) { java_cpp_enum("consent_auditor_java") { - sources = [ - "consent_auditor.h", - ] + sources = [ "consent_auditor.h" ] } }
diff --git a/components/drive/BUILD.gn b/components/drive/BUILD.gn index c121bf5..cf11462 100644 --- a/components/drive/BUILD.gn +++ b/components/drive/BUILD.gn
@@ -39,15 +39,11 @@ "//third_party/leveldatabase", "//third_party/re2", ] - public_deps = [ - ":proto", - ] + public_deps = [ ":proto" ] } proto_library("proto") { - sources = [ - "drive.proto", - ] + sources = [ "drive.proto" ] } static_library("test_support") {
diff --git a/components/favicon_base/BUILD.gn b/components/favicon_base/BUILD.gn index fb71b75e0..aef5d83 100644 --- a/components/favicon_base/BUILD.gn +++ b/components/favicon_base/BUILD.gn
@@ -34,9 +34,7 @@ "//ui/gfx/geometry", "//url", ] - public_deps = [ - "//skia", - ] + public_deps = [ "//skia" ] } source_set("unit_tests") { @@ -57,9 +55,7 @@ } fuzzer_test("favicon_url_parser_fuzzer") { - sources = [ - "favicon_url_parser_fuzzer.cc", - ] + sources = [ "favicon_url_parser_fuzzer.cc" ] deps = [ ":favicon_base", @@ -70,8 +66,6 @@ if (is_android) { java_cpp_enum("favicon_base_enums_java") { - sources = [ - "favicon_types.h", - ] + sources = [ "favicon_types.h" ] } }
diff --git a/components/feature_engagement/BUILD.gn b/components/feature_engagement/BUILD.gn index 3a8788a..991252e 100644 --- a/components/feature_engagement/BUILD.gn +++ b/components/feature_engagement/BUILD.gn
@@ -21,9 +21,7 @@ "//components/feature_engagement/public", ] - deps = [ - "//components/feature_engagement/internal", - ] + deps = [ "//components/feature_engagement/internal" ] } group("unit_tests") { @@ -34,17 +32,13 @@ "//components/feature_engagement/public:unit_tests", ] - data_deps = [ - ":components_unittests_gtest_filter", - ] + data_deps = [ ":components_unittests_gtest_filter" ] } source_set("components_unittests_gtest_filter") { testonly = true - data = [ - "components_unittests.filter", - ] + data = [ "components_unittests.filter" ] } if (is_android) {
diff --git a/components/feature_engagement/internal/BUILD.gn b/components/feature_engagement/internal/BUILD.gn index b910cb8e..0dc1e54a 100644 --- a/components/feature_engagement/internal/BUILD.gn +++ b/components/feature_engagement/internal/BUILD.gn
@@ -67,9 +67,7 @@ "tracker_impl.h", ] - public_deps = [ - "//components/feature_engagement/internal/proto", - ] + public_deps = [ "//components/feature_engagement/internal/proto" ] deps = [ "//base", @@ -133,9 +131,7 @@ android_library("internal_java") { visibility = [ "//components/feature_engagement:feature_engagement_java" ] - sources = [ - "android/java/src/org/chromium/components/feature_engagement/internal/TrackerImpl.java", - ] + sources = [ "android/java/src/org/chromium/components/feature_engagement/internal/TrackerImpl.java" ] deps = [ "//base:base_java", @@ -149,8 +145,6 @@ generate_jni("jni_headers") { visibility = [ ":*" ] - sources = [ - "android/java/src/org/chromium/components/feature_engagement/internal/TrackerImpl.java", - ] + sources = [ "android/java/src/org/chromium/components/feature_engagement/internal/TrackerImpl.java" ] } }
diff --git a/components/feature_engagement/public/BUILD.gn b/components/feature_engagement/public/BUILD.gn index ce98550..6346d5c 100644 --- a/components/feature_engagement/public/BUILD.gn +++ b/components/feature_engagement/public/BUILD.gn
@@ -40,9 +40,7 @@ # IMPORTANT NOTE: When adding new tests, also remember to update the list of # tests in //components/feature_engagement/components_unittests.filter - sources = [ - "configuration_unittest.cc", - ] + sources = [ "configuration_unittest.cc" ] deps = [ ":public", @@ -69,8 +67,6 @@ java_cpp_enum("public_java_enums_srcjar") { visibility = [ ":*" ] - sources = [ - "tracker.h", - ] + sources = [ "tracker.h" ] } }
diff --git a/components/feed/BUILD.gn b/components/feed/BUILD.gn index 4cc4b96..a1a6507 100644 --- a/components/feed/BUILD.gn +++ b/components/feed/BUILD.gn
@@ -19,16 +19,12 @@ "feed_feature_list.h", ] - deps = [ - "//base", - ] + deps = [ "//base" ] } source_set("unit_tests") { testonly = true - deps = [ - "core:core_unit_tests", - ] + deps = [ "core:core_unit_tests" ] if (!is_ios) { deps += [ "content:content_unit_tests" ]
diff --git a/components/feed/content/BUILD.gn b/components/feed/content/BUILD.gn index 86922f20..2c66bca0 100644 --- a/components/feed/content/BUILD.gn +++ b/components/feed/content/BUILD.gn
@@ -28,9 +28,7 @@ source_set("content_unit_tests") { testonly = true - sources = [ - "feed_offline_host_unittest.cc", - ] + sources = [ "feed_offline_host_unittest.cc" ] deps = [ ":feed_content",
diff --git a/components/feed/core/BUILD.gn b/components/feed/core/BUILD.gn index 01ca5f4..58b17da 100644 --- a/components/feed/core/BUILD.gn +++ b/components/feed/core/BUILD.gn
@@ -63,9 +63,7 @@ if (is_android) { java_cpp_enum("feed_core_java_enums_srcjar") { - sources = [ - "feed_scheduler_host.h", - ] + sources = [ "feed_scheduler_host.h" ] } }
diff --git a/components/keyed_service/content/BUILD.gn b/components/keyed_service/content/BUILD.gn index 940b427..d80ba4b 100644 --- a/components/keyed_service/content/BUILD.gn +++ b/components/keyed_service/content/BUILD.gn
@@ -37,9 +37,7 @@ source_set("unit_tests") { testonly = true - sources = [ - "browser_context_dependency_manager_unittest.cc", - ] + sources = [ "browser_context_dependency_manager_unittest.cc" ] deps = [ ":content", "//testing/gtest",
diff --git a/components/keyed_service/core/BUILD.gn b/components/keyed_service/core/BUILD.gn index 28c3516d..d6dad8d1 100644 --- a/components/keyed_service/core/BUILD.gn +++ b/components/keyed_service/core/BUILD.gn
@@ -47,9 +47,7 @@ source_set("unit_tests") { testonly = true - sources = [ - "dependency_graph_unittest.cc", - ] + sources = [ "dependency_graph_unittest.cc" ] deps = [ ":core", "//base",
diff --git a/components/paint_preview/browser/BUILD.gn b/components/paint_preview/browser/BUILD.gn index e3c93e68..1bd64e1 100644 --- a/components/paint_preview/browser/BUILD.gn +++ b/components/paint_preview/browser/BUILD.gn
@@ -56,9 +56,7 @@ if (is_android) { generate_jni("jni_headers") { - sources = [ - "android/java/src/org/chromium/components/paintpreview/browser/PaintPreviewBaseService.java", - ] + sources = [ "android/java/src/org/chromium/components/paintpreview/browser/PaintPreviewBaseService.java" ] } } @@ -74,9 +72,7 @@ "//components/keyed_service/core", ] - public_deps = [ - ":browser", - ] + public_deps = [ ":browser" ] } source_set("unit_tests") {
diff --git a/components/paint_preview/browser/android/BUILD.gn b/components/paint_preview/browser/android/BUILD.gn index 5ba9cdd..49cdcbf 100644 --- a/components/paint_preview/browser/android/BUILD.gn +++ b/components/paint_preview/browser/android/BUILD.gn
@@ -7,9 +7,7 @@ assert(is_android, "This directory should only be compiled for Android.") generate_jni("jni_headers") { - sources = [ - "java/src/org/chromium/components/paintpreview/browser/PaintPreviewUtils.java", - ] + sources = [ "java/src/org/chromium/components/paintpreview/browser/PaintPreviewUtils.java" ] } android_library("java") { @@ -28,9 +26,7 @@ } source_set("android") { - sources = [ - "paint_preview_utils.cc", - ] + sources = [ "paint_preview_utils.cc" ] deps = [ ":jni_headers",
diff --git a/components/paint_preview/common/BUILD.gn b/components/paint_preview/common/BUILD.gn index f7609a3..9e3d1c5 100644 --- a/components/paint_preview/common/BUILD.gn +++ b/components/paint_preview/common/BUILD.gn
@@ -27,17 +27,13 @@ "//url", ] - public_deps = [ - "//components/paint_preview/common/mojom", - ] + public_deps = [ "//components/paint_preview/common/mojom" ] } source_set("test_utils") { testonly = true - sources = [ - "test_utils.h", - ] + sources = [ "test_utils.h" ] deps = [ "//testing/gmock",
diff --git a/components/paint_preview/common/mojom/BUILD.gn b/components/paint_preview/common/mojom/BUILD.gn index 59ec8b4..bd514d0 100644 --- a/components/paint_preview/common/mojom/BUILD.gn +++ b/components/paint_preview/common/mojom/BUILD.gn
@@ -5,9 +5,7 @@ import("//mojo/public/tools/bindings/mojom.gni") mojom("mojom") { - sources = [ - "paint_preview_recorder.mojom", - ] + sources = [ "paint_preview_recorder.mojom" ] public_deps = [ "//mojo/public/mojom/base",
diff --git a/components/paint_preview/common/proto/BUILD.gn b/components/paint_preview/common/proto/BUILD.gn index 39e32b4..2694d448 100644 --- a/components/paint_preview/common/proto/BUILD.gn +++ b/components/paint_preview/common/proto/BUILD.gn
@@ -5,7 +5,5 @@ import("//third_party/protobuf/proto_library.gni") proto_library("proto") { - sources = [ - "paint_preview.proto", - ] + sources = [ "paint_preview.proto" ] }
diff --git a/components/paint_preview/features/BUILD.gn b/components/paint_preview/features/BUILD.gn index af2dc32..f7b1c13 100644 --- a/components/paint_preview/features/BUILD.gn +++ b/components/paint_preview/features/BUILD.gn
@@ -7,7 +7,5 @@ "features.cc", "features.h", ] - deps = [ - "//base", - ] + deps = [ "//base" ] }
diff --git a/components/paint_preview/player/BUILD.gn b/components/paint_preview/player/BUILD.gn index e731552..8b26931 100644 --- a/components/paint_preview/player/BUILD.gn +++ b/components/paint_preview/player/BUILD.gn
@@ -22,7 +22,6 @@ "//url", ] - public_deps = [ - "//components/services/paint_preview_compositor/public/mojom", - ] + public_deps = + [ "//components/services/paint_preview_compositor/public/mojom" ] }
diff --git a/components/paint_preview/player/android/BUILD.gn b/components/paint_preview/player/android/BUILD.gn index abd9485c..60b7fe5a1 100644 --- a/components/paint_preview/player/android/BUILD.gn +++ b/components/paint_preview/player/android/BUILD.gn
@@ -20,16 +20,13 @@ "//url", ] - public_deps = [ - "//components/services/paint_preview_compositor/public/mojom", - ] + public_deps = + [ "//components/services/paint_preview_compositor/public/mojom" ] } source_set("unit_tests") { testonly = true - sources = [ - "player_compositor_delegate_android_unittest.cc", - ] + sources = [ "player_compositor_delegate_android_unittest.cc" ] deps = [ ":player_android", "//base", @@ -44,9 +41,7 @@ } generate_jni("jni_headers") { - sources = [ - "java/src/org/chromium/components/paintpreview/player/PlayerCompositorDelegateImpl.java", - ] + sources = [ "java/src/org/chromium/components/paintpreview/player/PlayerCompositorDelegateImpl.java" ] } android_library("java") {
diff --git a/components/paint_preview/public/BUILD.gn b/components/paint_preview/public/BUILD.gn index 61485c4..702371c 100644 --- a/components/paint_preview/public/BUILD.gn +++ b/components/paint_preview/public/BUILD.gn
@@ -10,9 +10,8 @@ "paint_preview_compositor_service.h", ] - public_deps = [ - "//components/services/paint_preview_compositor/public/mojom", - ] + public_deps = + [ "//components/services/paint_preview_compositor/public/mojom" ] deps = [ "//base",
diff --git a/components/paint_preview/renderer/BUILD.gn b/components/paint_preview/renderer/BUILD.gn index 86e15924..e262fc5 100644 --- a/components/paint_preview/renderer/BUILD.gn +++ b/components/paint_preview/renderer/BUILD.gn
@@ -31,9 +31,7 @@ source_set("unit_tests") { testonly = true - sources = [ - "paint_preview_recorder_utils_unittest.cc", - ] + sources = [ "paint_preview_recorder_utils_unittest.cc" ] deps = [ ":renderer",
diff --git a/components/policy/BUILD.gn b/components/policy/BUILD.gn index e69d0f80e..fcd4129e 100644 --- a/components/policy/BUILD.gn +++ b/components/policy/BUILD.gn
@@ -178,9 +178,7 @@ # Translates policy_templates.json into various languages. grit("translate_policy_templates") { source = policy_templates_grd_file - inputs = [ - "resources/policy_templates.json", - ] + inputs = [ "resources/policy_templates.json" ] output_dir = "$root_gen_dir/chrome" outputs = policy_templates_translation_outputs } @@ -190,9 +188,7 @@ script = "tools/template_writers/template_formatter.py" chrome_version_abspath = "//chrome/VERSION" chrome_version_path = rebase_path(chrome_version_abspath, root_build_dir) - deps = [ - ":translate_policy_templates_grit", - ] + deps = [ ":translate_policy_templates_grit" ] inputs = [ chrome_version_abspath ] + policy_templates_translation_outputs outputs = [] args = [ @@ -291,16 +287,12 @@ # Run the proto compiler over the generated file and make it a component. component("cloud_policy_proto_generated_compile") { - public_deps = [ - ":cloud_policy_proto_generated_compile_proto", - ] + public_deps = [ ":cloud_policy_proto_generated_compile_proto" ] } proto_library("cloud_policy_proto_generated_compile_proto") { visibility = [ ":cloud_policy_proto_generated_compile" ] - sources = [ - cloud_policy_proto_path, - ] + sources = [ cloud_policy_proto_path ] import_dirs = [ "//components/policy/proto" ] proto_out_dir = "components/policy/proto" @@ -317,17 +309,13 @@ # This target builds the "full" protobuf, used for tests only. component("chrome_settings_proto_generated_compile") { testonly = true - public_deps = [ - ":chrome_settings_proto_generated_compile_proto", - ] + public_deps = [ ":chrome_settings_proto_generated_compile_proto" ] } proto_library("chrome_settings_proto_generated_compile_proto") { testonly = true visibility = [ ":chrome_settings_proto_generated_compile" ] - sources = [ - chrome_settings_proto_path, - ] + sources = [ chrome_settings_proto_path ] import_dirs = [ "//components/policy/proto" ] proto_out_dir = "components/policy/proto" @@ -357,9 +345,7 @@ "//components/policy/proto:policy_common_definitions_compile_proto", "//third_party/protobuf:protobuf_lite", ] - deps = [ - "//build:branding_buildflags", - ] + deps = [ "//build:branding_buildflags" ] } if (gen_policy_templates_android && is_android) { @@ -368,12 +354,8 @@ _generated_resources_dir = "$root_gen_dir/chrome/app/policy/android" copy("app_restrictions_resources_copy") { - sources = [ - app_restrictions_path, - ] - outputs = [ - "$_generated_resources_dir/xml-v21/app_restrictions.xml", - ] + sources = [ app_restrictions_path ] + outputs = [ "$_generated_resources_dir/xml-v21/app_restrictions.xml" ] deps = [ ":policy_code_generate", ":policy_templates", @@ -394,19 +376,13 @@ output = "$target_gen_dir/$chrome_mac_bundle_id.manifest" format = "xml1" - deps = [ - ":policy_templates", - ] + deps = [ ":policy_templates" ] } bundle_data("manifest_bundle_data") { sources = get_target_outputs(":convert_mcx_plist") - outputs = [ - "{{bundle_resources_dir}}/{{source_file_part}}", - ] - public_deps = [ - ":convert_mcx_plist", - ] + outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] + public_deps = [ ":convert_mcx_plist" ] } # The reason we are not enumerating all the locales is that @@ -416,12 +392,8 @@ sources = [ "$policy_templates_base_dir/mac/strings/en.lproj/Localizable.strings", ] - outputs = [ - "{{bundle_resources_dir}}/en.lproj/{{source_file_part}}", - ] - public_deps = [ - ":policy_templates", - ] + outputs = [ "{{bundle_resources_dir}}/en.lproj/{{source_file_part}}" ] + public_deps = [ ":policy_templates" ] } create_bundle("chrome_manifest_bundle") { @@ -440,12 +412,8 @@ version_path = "$policy_templates_base_dir/VERSION" copy("add_version") { - sources = [ - "//chrome/VERSION", - ] - outputs = [ - version_path, - ] + sources = [ "//chrome/VERSION" ] + outputs = [ version_path ] } action("pack_policy_templates") { @@ -453,9 +421,7 @@ script = "tools/make_policy_zip.py" inputs = [ version_path ] + policy_templates_win_outputs + policy_templates_chromeos_outputs + policy_templates_common_outputs - outputs = [ - output_zip_file, - ] + outputs = [ output_zip_file ] args = [ "--output", rebase_path(output_zip_file, root_build_dir),
diff --git a/components/policy/content/BUILD.gn b/components/policy/content/BUILD.gn index faf39e8..fd276bf 100644 --- a/components/policy/content/BUILD.gn +++ b/components/policy/content/BUILD.gn
@@ -30,9 +30,7 @@ source_set("unit_tests") { testonly = true - sources = [ - "policy_blacklist_navigation_throttle_unittest.cc", - ] + sources = [ "policy_blacklist_navigation_throttle_unittest.cc" ] deps = [ ":content", "//base",
diff --git a/components/policy/core/browser/BUILD.gn b/components/policy/core/browser/BUILD.gn index 2e9c1a5..319f086 100644 --- a/components/policy/core/browser/BUILD.gn +++ b/components/policy/core/browser/BUILD.gn
@@ -7,13 +7,9 @@ group("browser") { if (is_component_build) { - public_deps = [ - "//components/policy", - ] + public_deps = [ "//components/policy" ] } else { - public_deps = [ - ":internal", - ] + public_deps = [ ":internal" ] } } @@ -48,9 +44,7 @@ configs += [ "//components/policy:component_implementation" ] - public_deps = [ - "//base", - ] + public_deps = [ "//base" ] deps = [ "//base/third_party/dynamic_annotations", "//components/google/core/common", @@ -103,9 +97,7 @@ "//components/policy:generated", "//components/policy/core/common:test_support", ] - deps = [ - "//testing/gtest", - ] + deps = [ "//testing/gtest" ] } source_set("unit_tests") {
diff --git a/components/policy/core/common/BUILD.gn b/components/policy/core/common/BUILD.gn index 060642c..d867874e 100644 --- a/components/policy/core/common/BUILD.gn +++ b/components/policy/core/common/BUILD.gn
@@ -8,13 +8,9 @@ group("common") { if (is_component_build) { - public_deps = [ - "//components/policy", - ] + public_deps = [ "//components/policy" ] } else { - public_deps = [ - ":internal", - ] + public_deps = [ ":internal" ] } } @@ -323,9 +319,7 @@ source_set("common_constants") { configs += [ "//components/policy:component_implementation" ] - deps = [ - "//base", - ] + deps = [ "//base" ] sources = [ "../../policy_export.h", "cloud/cloud_policy_constants.cc", @@ -403,9 +397,7 @@ } if (is_win || is_linux) { # Needed by policy_loader_win_unittest.cc and preg_parser_unittest.cc - data = [ - "//chrome/test/data/policy/", - ] + data = [ "//chrome/test/data/policy/" ] } deps = [ @@ -428,9 +420,7 @@ if (is_win || is_linux) { fuzzer_test("preg_parser_fuzzer") { - sources = [ - "preg_parser_fuzzer.cc", - ] + sources = [ "preg_parser_fuzzer.cc" ] seed_corpus = "//chrome/test/data/policy/gpo/fuzzer_corpus" dict = "//chrome/test/data/policy/gpo/fuzzer.dict" deps = [
diff --git a/components/policy/proto/BUILD.gn b/components/policy/proto/BUILD.gn index 70f90c23..6d01af42 100644 --- a/components/policy/proto/BUILD.gn +++ b/components/policy/proto/BUILD.gn
@@ -10,9 +10,7 @@ # set, here we link the result into a component. component("proto") { output_name = "policy_proto" - public_deps = [ - ":proto_internal", - ] + public_deps = [ ":proto_internal" ] } proto_library("policy_common_definitions_compile_proto") { @@ -23,9 +21,7 @@ ":proto_internal", ] - sources = [ - "policy_common_definitions.proto", - ] + sources = [ "policy_common_definitions.proto" ] proto_out_dir = "components/policy/proto" }
diff --git a/components/resources/OWNERS b/components/resources/OWNERS index 082f9400..1260bab 100644 --- a/components/resources/OWNERS +++ b/components/resources/OWNERS
@@ -1,3 +1,4 @@ +per-file android_system_error_page_resources.grdp=file://components/android_system_error_page/OWNERS per-file autofill*=file://components/autofill/OWNERS per-file content_suggestions*=file://components/ntp_snippets/OWNERS per-file crash_*=cpu@chromium.org
diff --git a/components/resources/android_system_error_page_resources.grdp b/components/resources/android_system_error_page_resources.grdp new file mode 100644 index 0000000..88b7394 --- /dev/null +++ b/components/resources/android_system_error_page_resources.grdp
@@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<grit-part> + <include name="IDR_ANDROID_ERROR_PAGE_LOAD_ERROR_HTML" file="../android_system_error_page/resources/load_error.html" flattenhtml="true" type="BINDATA" compress="gzip" /> +</grit-part>
diff --git a/components/resources/components_resources.grd b/components/resources/components_resources.grd index 9edac3d..15afa32 100644 --- a/components/resources/components_resources.grd +++ b/components/resources/components_resources.grd
@@ -24,6 +24,10 @@ <part file="security_interstitials_resources.grdp" /> <part file="translate_resources.grdp" /> <part file="version_ui_resources.grdp" /> + + <if expr="is_android"> + <part file="android_system_error_page_resources.grdp" /> + </if> </includes> </release> </grit>
diff --git a/components/safe_browsing/content/password_protection/BUILD.gn b/components/safe_browsing/content/password_protection/BUILD.gn index 0a8818d..8c36ecc 100644 --- a/components/safe_browsing/content/password_protection/BUILD.gn +++ b/components/safe_browsing/content/password_protection/BUILD.gn
@@ -18,9 +18,7 @@ "visual_utils.h", ] - public_deps = [ - "//google_apis:google_apis", - ] + public_deps = [ "//google_apis:google_apis" ] deps = [ ":password_protection_metrics_util",
diff --git a/components/safe_browsing/content/password_protection/password_protection_service_unittest.cc b/components/safe_browsing/content/password_protection/password_protection_service_unittest.cc index 6003107..2685741 100644 --- a/components/safe_browsing/content/password_protection/password_protection_service_unittest.cc +++ b/components/safe_browsing/content/password_protection/password_protection_service_unittest.cc
@@ -176,8 +176,8 @@ if (!CanGetReputationOfURL(url) || IsIncognito()) return; - cache_manager_->CachePhishGuardVerdict(url, trigger_type, password_type, - verdict, receive_time); + cache_manager_->CachePhishGuardVerdict(trigger_type, password_type, verdict, + receive_time); } LoginReputationClientResponse::VerdictType GetCachedVerdict(
diff --git a/components/safe_browsing/core/verdict_cache_manager.cc b/components/safe_browsing/core/verdict_cache_manager.cc index 0e3155a..c651a61 100644 --- a/components/safe_browsing/core/verdict_cache_manager.cc +++ b/components/safe_browsing/core/verdict_cache_manager.cc
@@ -34,6 +34,20 @@ result.append(url::kStandardSchemeSeparator).append(url.host()); return GURL(result); } +// e.g, ("www.foo.com", "/bar/test.cgi") -> "http://www.foo.com/bar/test/cgi" +GURL GetUrlWithHostAndPath(const std::string& host, const std::string& path) { + std::string result(url::kHttpScheme); + result.append(url::kStandardSchemeSeparator).append(host).append(path); + return GURL(result); +} + +// e.g, "www.foo.com/bar/test/cgi" -> "http://www.foo.com" +GURL GetHostNameFromCacheExpression(const std::string& cache_expression) { + std::string cache_expression_url(url::kHttpScheme); + cache_expression_url.append(url::kStandardSchemeSeparator) + .append(cache_expression); + return GetHostNameWithHTTPScheme(GURL(cache_expression_url)); +} // Convert a Proto object into a DictionaryValue. template <class T> @@ -109,6 +123,12 @@ .size(); } +size_t GetHostDepth(const std::string& hostname) { + return base::SplitString(base::StringPiece(hostname), ".", + base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY) + .size(); +} + bool PathVariantsMatchCacheExpression( const std::vector<std::string>& generated_paths, const std::string& cache_expression_path) { @@ -163,7 +183,7 @@ } template <class T> -typename T::VerdictType GetMostMatchingCachedVerdict( +typename T::VerdictType GetMostMatchingCachedVerdictWithPathMatching( const GURL& url, const std::string& type_key, scoped_refptr<HostContentSettingsMap> content_settings, @@ -224,6 +244,37 @@ return most_matching_verdict_type; } +template <class T> +typename T::VerdictType GetMostMatchingCachedVerdictWithHostAndPathMatching( + const GURL& url, + const std::string& type_key, + scoped_refptr<HostContentSettingsMap> content_settings, + const ContentSettingsType contents_setting_type, + const char* proto_name, + T* out_response) { + DCHECK(proto_name == kVerdictProto); + auto most_matching_verdict_type = T::VERDICT_TYPE_UNSPECIFIED; + + std::string root_host, root_path; + V4ProtocolManagerUtil::CanonicalizeUrl(url, &root_host, &root_path, nullptr); + std::vector<std::string> host_variants; + V4ProtocolManagerUtil::GenerateHostVariantsToCheck(root_host, &host_variants); + int max_path_depth = -1; + for (auto host : host_variants) { + int depth = static_cast<int>(GetHostDepth(host)); + GURL url_to_check = GetUrlWithHostAndPath(host, root_path); + auto verdict_type = GetMostMatchingCachedVerdictWithPathMatching<T>( + url_to_check, type_key, content_settings, contents_setting_type, + proto_name, out_response); + if (depth > max_path_depth && verdict_type != T::VERDICT_TYPE_UNSPECIFIED) { + max_path_depth = depth; + most_matching_verdict_type = verdict_type; + } + } + + return most_matching_verdict_type; +} + } // namespace VerdictCacheManager::VerdictCacheManager( @@ -243,7 +294,6 @@ } void VerdictCacheManager::CachePhishGuardVerdict( - const GURL& url, LoginReputationClientRequest::TriggerType trigger_type, ReusedPasswordAccountType password_type, const LoginReputationClientResponse& verdict, @@ -252,7 +302,7 @@ DCHECK(trigger_type == LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE || trigger_type == LoginReputationClientRequest::PASSWORD_REUSE_EVENT); - GURL hostname = GetHostNameWithHTTPScheme(url); + GURL hostname = GetHostNameFromCacheExpression(verdict.cache_expression()); std::unique_ptr<base::DictionaryValue> cache_dictionary = base::DictionaryValue::From(content_settings_->GetWebsiteSetting( @@ -307,9 +357,10 @@ std::string type_key = GetKeyOfTypeFromTriggerType(trigger_type, password_type); - return GetMostMatchingCachedVerdict<LoginReputationClientResponse>( - url, type_key, content_settings_, - ContentSettingsType::PASSWORD_PROTECTION, kVerdictProto, out_response); + return GetMostMatchingCachedVerdictWithHostAndPathMatching< + LoginReputationClientResponse>(url, type_key, content_settings_, + ContentSettingsType::PASSWORD_PROTECTION, + kVerdictProto, out_response); } size_t VerdictCacheManager::GetStoredPhishGuardVerdictCount( @@ -360,21 +411,6 @@ const GURL& url, const RTLookupResponse& verdict, const base::Time& receive_time) { - GURL hostname = GetHostNameWithHTTPScheme(url); - std::unique_ptr<base::DictionaryValue> cache_dictionary = - base::DictionaryValue::From(content_settings_->GetWebsiteSetting( - hostname, GURL(), ContentSettingsType::SAFE_BROWSING_URL_CHECK_DATA, - std::string(), nullptr)); - - if (!cache_dictionary) - cache_dictionary = std::make_unique<base::DictionaryValue>(); - - base::Value* verdict_dictionary = cache_dictionary->FindKeyOfType( - kRealTimeUrlCacheKey, base::Value::Type::DICTIONARY); - if (!verdict_dictionary) { - verdict_dictionary = cache_dictionary->SetKey( - kRealTimeUrlCacheKey, base::Value(base::Value::Type::DICTIONARY)); - } std::vector<std::string> visited_cache_expressions; for (const auto& threat_info : verdict.threat_info()) { @@ -385,6 +421,24 @@ // cache expression. if (base::Contains(visited_cache_expressions, cache_expression)) continue; + + GURL hostname = + GetHostNameFromCacheExpression(threat_info.cache_expression()); + std::unique_ptr<base::DictionaryValue> cache_dictionary = + base::DictionaryValue::From(content_settings_->GetWebsiteSetting( + hostname, GURL(), ContentSettingsType::SAFE_BROWSING_URL_CHECK_DATA, + std::string(), nullptr)); + + if (!cache_dictionary) + cache_dictionary = std::make_unique<base::DictionaryValue>(); + + base::Value* verdict_dictionary = cache_dictionary->FindKeyOfType( + kRealTimeUrlCacheKey, base::Value::Type::DICTIONARY); + if (!verdict_dictionary) { + verdict_dictionary = cache_dictionary->SetKey( + kRealTimeUrlCacheKey, base::Value(base::Value::Type::DICTIONARY)); + } + std::unique_ptr<base::DictionaryValue> threat_info_entry( CreateDictionaryFromVerdict<RTLookupResponse::ThreatInfo>( threat_info, receive_time, kRealTimeThreatInfoProto)); @@ -393,21 +447,24 @@ if (!verdict_dictionary->FindKey(cache_expression)) { stored_verdict_count_real_time_url_check_++; } + verdict_dictionary->SetKey( cache_expression, base::Value::FromUniquePtrValue(std::move(threat_info_entry))); visited_cache_expressions.push_back(cache_expression); + + content_settings_->SetWebsiteSettingDefaultScope( + hostname, GURL(), ContentSettingsType::SAFE_BROWSING_URL_CHECK_DATA, + std::string(), std::move(cache_dictionary)); } - content_settings_->SetWebsiteSettingDefaultScope( - hostname, GURL(), ContentSettingsType::SAFE_BROWSING_URL_CHECK_DATA, - std::string(), std::move(cache_dictionary)); } RTLookupResponse::ThreatInfo::VerdictType VerdictCacheManager::GetCachedRealTimeUrlVerdict( const GURL& url, RTLookupResponse::ThreatInfo* out_threat_info) { - return GetMostMatchingCachedVerdict<RTLookupResponse::ThreatInfo>( + return GetMostMatchingCachedVerdictWithPathMatching< + RTLookupResponse::ThreatInfo>( url, kRealTimeUrlCacheKey, content_settings_, ContentSettingsType::SAFE_BROWSING_URL_CHECK_DATA, kRealTimeThreatInfoProto, out_threat_info);
diff --git a/components/safe_browsing/core/verdict_cache_manager.h b/components/safe_browsing/core/verdict_cache_manager.h index d7db56e..69099ce 100644 --- a/components/safe_browsing/core/verdict_cache_manager.h +++ b/components/safe_browsing/core/verdict_cache_manager.h
@@ -25,6 +25,7 @@ using ReusedPasswordAccountType = LoginReputationClientRequest::PasswordReuseEvent::ReusedPasswordAccountType; +// Structure: http://screen/YaNfDRYrcnk.png. class VerdictCacheManager : public history::HistoryServiceObserver { public: explicit VerdictCacheManager( @@ -44,7 +45,6 @@ // Stores |verdict| in |content_settings_| based on its |trigger_type|, |url|, // reused |password_type|, |verdict| and |receive_time|. void CachePhishGuardVerdict( - const GURL& url, LoginReputationClientRequest::TriggerType trigger_type, ReusedPasswordAccountType password_type, const LoginReputationClientResponse& verdict,
diff --git a/components/safe_browsing/core/verdict_cache_manager_unittest.cc b/components/safe_browsing/core/verdict_cache_manager_unittest.cc index 9e6656c..4a8a2677 100644 --- a/components/safe_browsing/core/verdict_cache_manager_unittest.cc +++ b/components/safe_browsing/core/verdict_cache_manager_unittest.cc
@@ -36,7 +36,6 @@ } void CachePhishGuardVerdict( - const GURL& url, LoginReputationClientRequest::TriggerType trigger, ReusedPasswordAccountType password_type, LoginReputationClientResponse::VerdictType verdict, @@ -48,8 +47,8 @@ response.set_verdict_type(verdict); response.set_cache_expression(cache_expression); response.set_cache_duration_sec(cache_duration_sec); - cache_manager_->CachePhishGuardVerdict(url, trigger, password_type, - response, verdict_received_time); + cache_manager_->CachePhishGuardVerdict(trigger, password_type, response, + verdict_received_time); } void AddThreatInfoToResponse( @@ -86,8 +85,7 @@ url, LoginReputationClientRequest::PASSWORD_REUSE_EVENT, password_type, &cached_verdict)); - CachePhishGuardVerdict(url, - LoginReputationClientRequest::PASSWORD_REUSE_EVENT, + CachePhishGuardVerdict(LoginReputationClientRequest::PASSWORD_REUSE_EVENT, password_type, LoginReputationClientResponse::SAFE, 60, "www.google.com/", base::Time::Now()); @@ -109,8 +107,7 @@ url, LoginReputationClientRequest::PASSWORD_REUSE_EVENT, password_type, &cached_verdict)); - CachePhishGuardVerdict(url, - LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE, + CachePhishGuardVerdict(LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE, password_type, LoginReputationClientResponse::SAFE, 60, "www.google.com/", base::Time::Now()); @@ -134,8 +131,7 @@ password_type.set_account_type( ReusedPasswordAccountType::NON_GAIA_ENTERPRISE); - CachePhishGuardVerdict(url, - LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE, + CachePhishGuardVerdict(LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE, password_type, LoginReputationClientResponse::SAFE, 60, "www.google.com/", base::Time::Now()); password_type.set_account_type(ReusedPasswordAccountType::GSUITE); @@ -146,8 +142,6 @@ } TEST_F(VerdictCacheManagerTest, TestGetStoredPhishGuardVerdictCount) { - GURL url("https://www.google.com/"); - LoginReputationClientResponse cached_verdict; cached_verdict.set_cache_expression("www.google.com/"); EXPECT_EQ(0u, cache_manager_->GetStoredPhishGuardVerdictCount( @@ -156,24 +150,21 @@ password_type.set_account_type( ReusedPasswordAccountType::NON_GAIA_ENTERPRISE); password_type.set_is_account_syncing(true); - CachePhishGuardVerdict(url, - LoginReputationClientRequest::PASSWORD_REUSE_EVENT, + CachePhishGuardVerdict(LoginReputationClientRequest::PASSWORD_REUSE_EVENT, password_type, LoginReputationClientResponse::SAFE, 60, "www.google.com/", base::Time::Now()); EXPECT_EQ(1u, cache_manager_->GetStoredPhishGuardVerdictCount( LoginReputationClientRequest::PASSWORD_REUSE_EVENT)); - CachePhishGuardVerdict(url, - LoginReputationClientRequest::PASSWORD_REUSE_EVENT, + CachePhishGuardVerdict(LoginReputationClientRequest::PASSWORD_REUSE_EVENT, password_type, LoginReputationClientResponse::SAFE, 60, "www.google.com/", base::Time::Now()); EXPECT_EQ(1u, cache_manager_->GetStoredPhishGuardVerdictCount( LoginReputationClientRequest::PASSWORD_REUSE_EVENT)); - CachePhishGuardVerdict(url, - LoginReputationClientRequest::PASSWORD_REUSE_EVENT, + CachePhishGuardVerdict(LoginReputationClientRequest::PASSWORD_REUSE_EVENT, password_type, LoginReputationClientResponse::SAFE, 60, "www.google.com/path", base::Time::Now()); @@ -228,18 +219,15 @@ ReusedPasswordAccountType password_type; password_type.set_account_type(ReusedPasswordAccountType::GSUITE); CachePhishGuardVerdict( - GURL("http://foo.com/abc/index.jsp"), LoginReputationClientRequest::PASSWORD_REUSE_EVENT, password_type, LoginReputationClientResponse::LOW_REPUTATION, 600, "foo.com/abc/", now); password_type.set_account_type( ReusedPasswordAccountType::NON_GAIA_ENTERPRISE); CachePhishGuardVerdict( - GURL("http://foo.com/abc/index.jsp"), LoginReputationClientRequest::PASSWORD_REUSE_EVENT, password_type, LoginReputationClientResponse::LOW_REPUTATION, 600, "foo.com/abc/", now); password_type.set_account_type(ReusedPasswordAccountType::GSUITE); - CachePhishGuardVerdict(GURL("http://bar.com/index.jsp"), - LoginReputationClientRequest::PASSWORD_REUSE_EVENT, + CachePhishGuardVerdict(LoginReputationClientRequest::PASSWORD_REUSE_EVENT, password_type, LoginReputationClientResponse::PHISHING, 600, "bar.com", now); ASSERT_EQ(3u, cache_manager_->GetStoredPhishGuardVerdictCount( @@ -247,11 +235,9 @@ password_type.set_account_type(ReusedPasswordAccountType::UNKNOWN); CachePhishGuardVerdict( - GURL("http://foo.com/abc/index.jsp"), LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE, password_type, LoginReputationClientResponse::LOW_REPUTATION, 600, "foo.com/abc/", now); - CachePhishGuardVerdict(GURL("http://bar.com/index.jsp"), - LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE, + CachePhishGuardVerdict(LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE, password_type, LoginReputationClientResponse::PHISHING, 600, "bar.com", now); ASSERT_EQ(2u, cache_manager_->GetStoredPhishGuardVerdictCount( @@ -307,19 +293,15 @@ ReusedPasswordAccountType password_type; password_type.set_account_type(ReusedPasswordAccountType::GSUITE); CachePhishGuardVerdict( - GURL("https://foo.com/abc/index.jsp"), LoginReputationClientRequest::PASSWORD_REUSE_EVENT, password_type, LoginReputationClientResponse::LOW_REPUTATION, 600, "foo.com/abc/", now); CachePhishGuardVerdict( - GURL("https://foo.com/def/index.jsp"), LoginReputationClientRequest::PASSWORD_REUSE_EVENT, password_type, LoginReputationClientResponse::LOW_REPUTATION, 0, "foo.com/def/", now); - CachePhishGuardVerdict(GURL("https://bar.com/abc/index.jsp"), - LoginReputationClientRequest::PASSWORD_REUSE_EVENT, + CachePhishGuardVerdict(LoginReputationClientRequest::PASSWORD_REUSE_EVENT, password_type, LoginReputationClientResponse::PHISHING, 0, "bar.com/abc/", now); - CachePhishGuardVerdict(GURL("https://bar.com/def/index.jsp"), - LoginReputationClientRequest::PASSWORD_REUSE_EVENT, + CachePhishGuardVerdict(LoginReputationClientRequest::PASSWORD_REUSE_EVENT, password_type, LoginReputationClientResponse::PHISHING, 0, "bar.com/def/", now); ASSERT_EQ(4u, cache_manager_->GetStoredPhishGuardVerdictCount( @@ -329,12 +311,10 @@ // (1) "bar.com/def/" valid // (2) "bar.com/xyz/" expired password_type.set_account_type(ReusedPasswordAccountType::UNKNOWN); - CachePhishGuardVerdict(GURL("https://bar.com/def/index.jsp"), - LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE, + CachePhishGuardVerdict(LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE, password_type, LoginReputationClientResponse::SAFE, 600, "bar.com/def/", now); - CachePhishGuardVerdict(GURL("https://bar.com/xyz/index.jsp"), - LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE, + CachePhishGuardVerdict(LoginReputationClientRequest::UNFAMILIAR_LOGIN_PAGE, password_type, LoginReputationClientResponse::PHISHING, 0, "bar.com/xyz/", now); ASSERT_EQ(2u, cache_manager_->GetStoredPhishGuardVerdictCount( @@ -428,8 +408,7 @@ ReusedPasswordAccountType password_type; password_type.set_account_type(ReusedPasswordAccountType::GSUITE); // Save one valid entry - CachePhishGuardVerdict(GURL("https://www.google.com"), - LoginReputationClientRequest::PASSWORD_REUSE_EVENT, + CachePhishGuardVerdict(LoginReputationClientRequest::PASSWORD_REUSE_EVENT, password_type, LoginReputationClientResponse::SAFE, 60, "www.google.com/", base::Time::Now()); @@ -546,4 +525,49 @@ cache_manager_->GetCachedRealTimeUrlVerdict(url, &out_verdict)); } +TEST_F(VerdictCacheManagerTest, TestHostSuffixMatching) { + // Password protection verdict. + GURL url("https://a.example.test/path"); + ReusedPasswordAccountType password_type; + password_type.set_account_type(ReusedPasswordAccountType::GSUITE); + password_type.set_is_account_syncing(true); + LoginReputationClientResponse cached_verdict; + + CachePhishGuardVerdict(LoginReputationClientRequest::PASSWORD_REUSE_EVENT, + password_type, LoginReputationClientResponse::PHISHING, + 60, "example.test/path/", base::Time::Now()); + + EXPECT_EQ(LoginReputationClientResponse::PHISHING, + cache_manager_->GetCachedPhishGuardVerdict( + GURL("https://b.example.test/path/path2"), + LoginReputationClientRequest::PASSWORD_REUSE_EVENT, + password_type, &cached_verdict)); +} + +TEST_F(VerdictCacheManagerTest, TestHostSuffixMatchingMostExactMatching) { + ReusedPasswordAccountType password_type; + password_type.set_account_type(ReusedPasswordAccountType::GSUITE); + password_type.set_is_account_syncing(true); + LoginReputationClientResponse cached_verdict; + + CachePhishGuardVerdict(LoginReputationClientRequest::PASSWORD_REUSE_EVENT, + password_type, LoginReputationClientResponse::PHISHING, + 60, "example.test/", base::Time::Now()); + + CachePhishGuardVerdict(LoginReputationClientRequest::PASSWORD_REUSE_EVENT, + password_type, LoginReputationClientResponse::SAFE, 60, + "b1.b.example.test/", base::Time::Now()); + + CachePhishGuardVerdict(LoginReputationClientRequest::PASSWORD_REUSE_EVENT, + password_type, + LoginReputationClientResponse::LOW_REPUTATION, 60, + "b.example.test/", base::Time::Now()); + + EXPECT_EQ(LoginReputationClientResponse::SAFE, + cache_manager_->GetCachedPhishGuardVerdict( + GURL("https://b1.b.example.test/"), + LoginReputationClientRequest::PASSWORD_REUSE_EVENT, + password_type, &cached_verdict)); +} + } // namespace safe_browsing
diff --git a/components/security_interstitials/content/BUILD.gn b/components/security_interstitials/content/BUILD.gn index f349c31..2c330c4 100644 --- a/components/security_interstitials/content/BUILD.gn +++ b/components/security_interstitials/content/BUILD.gn
@@ -19,6 +19,8 @@ "connection_help_ui.h", "known_interception_disclosure_ui.cc", "known_interception_disclosure_ui.h", + "mitm_software_blocking_page.cc", + "mitm_software_blocking_page.h", "origin_policy_interstitial_page.cc", "origin_policy_interstitial_page.h", "origin_policy_ui.cc",
diff --git a/chrome/browser/ssl/mitm_software_blocking_page.cc b/components/security_interstitials/content/mitm_software_blocking_page.cc similarity index 69% rename from chrome/browser/ssl/mitm_software_blocking_page.cc rename to components/security_interstitials/content/mitm_software_blocking_page.cc index d7eb3d0..035fdd1c 100644 --- a/chrome/browser/ssl/mitm_software_blocking_page.cc +++ b/components/security_interstitials/content/mitm_software_blocking_page.cc
@@ -2,16 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ssl/mitm_software_blocking_page.h" +#include "components/security_interstitials/content/mitm_software_blocking_page.h" #include <utility> -#include "chrome/browser/interstitials/chrome_metrics_helper.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ssl/chrome_security_blocking_page_factory.h" -#include "chrome/browser/ssl/ssl_error_controller_client.h" #include "components/safe_browsing/core/common/safe_browsing_prefs.h" #include "components/security_interstitials/content/cert_report_helper.h" +#include "components/security_interstitials/content/security_interstitial_controller_client.h" #include "components/security_interstitials/content/ssl_cert_reporter.h" #include "components/security_interstitials/core/metrics_helper.h" #include "content/public/browser/interstitial_page.h" @@ -28,24 +25,7 @@ using content::NavigationController; using content::NavigationEntry; -namespace { - -const char kMitmSoftwareMetricsName[] = "mitm_software"; - -std::unique_ptr<ChromeMetricsHelper> CreateMitmSoftwareMetricsHelper( - content::WebContents* web_contents, - const GURL& request_url) { - // Set up the metrics helper for the MITMSoftwareUI. - security_interstitials::MetricsHelper::ReportDetails reporting_info; - reporting_info.metric_prefix = kMitmSoftwareMetricsName; - std::unique_ptr<ChromeMetricsHelper> metrics_helper = - std::make_unique<ChromeMetricsHelper>(web_contents, request_url, - reporting_info); - metrics_helper.get()->StartRecordingCaptivePortalMetrics(false); - return metrics_helper; -} - -} // namespace +namespace {} // namespace // static const InterstitialPageDelegate::TypeID @@ -63,21 +43,19 @@ std::unique_ptr<SSLCertReporter> ssl_cert_reporter, const net::SSLInfo& ssl_info, const std::string& mitm_software_name, - bool is_enterprise_managed) - : SSLBlockingPageBase( - web_contents, - CertificateErrorReport::INTERSTITIAL_MITM_SOFTWARE, - ssl_info, - request_url, - std::move(ssl_cert_reporter), - false /* overridable */, - base::Time::Now(), - std::make_unique<SSLErrorControllerClient>( - web_contents, - ssl_info, - cert_error, - request_url, - CreateMitmSoftwareMetricsHelper(web_contents, request_url))), + bool is_enterprise_managed, + std::unique_ptr< + security_interstitials::SecurityInterstitialControllerClient> + controller_client) + : SSLBlockingPageBase(web_contents, + CertificateErrorReport::INTERSTITIAL_MITM_SOFTWARE, + ssl_info, + request_url, + std::move(ssl_cert_reporter), + false /* overridable */, + base::Time::Now(), + std::move(controller_client)), + ssl_info_(ssl_info), mitm_software_ui_( new security_interstitials::MITMSoftwareUI(request_url, @@ -85,9 +63,7 @@ ssl_info, mitm_software_name, is_enterprise_managed, - controller())) { - ChromeSecurityBlockingPageFactory::DoChromeSpecificSetup(this); -} + controller())) {} MITMSoftwareBlockingPage::~MITMSoftwareBlockingPage() = default;
diff --git a/chrome/browser/ssl/mitm_software_blocking_page.h b/components/security_interstitials/content/mitm_software_blocking_page.h similarity index 75% rename from chrome/browser/ssl/mitm_software_blocking_page.h rename to components/security_interstitials/content/mitm_software_blocking_page.h index 5daed628..89b0146 100644 --- a/chrome/browser/ssl/mitm_software_blocking_page.h +++ b/components/security_interstitials/content/mitm_software_blocking_page.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 CHROME_BROWSER_SSL_MITM_SOFTWARE_BLOCKING_PAGE_H_ -#define CHROME_BROWSER_SSL_MITM_SOFTWARE_BLOCKING_PAGE_H_ +#ifndef COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_MITM_SOFTWARE_BLOCKING_PAGE_H_ +#define COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_MITM_SOFTWARE_BLOCKING_PAGE_H_ #include <memory> #include <string> @@ -32,13 +32,17 @@ // If the blocking page isn't shown, the caller is responsible for cleaning // up the blocking page. Otherwise, the interstitial takes ownership when // shown. - MITMSoftwareBlockingPage(content::WebContents* web_contents, - int cert_error, - const GURL& request_url, - std::unique_ptr<SSLCertReporter> ssl_cert_reporter, - const net::SSLInfo& ssl_info, - const std::string& mitm_software_name, - bool is_enterprise_managed); + MITMSoftwareBlockingPage( + content::WebContents* web_contents, + int cert_error, + const GURL& request_url, + std::unique_ptr<SSLCertReporter> ssl_cert_reporter, + const net::SSLInfo& ssl_info, + const std::string& mitm_software_name, + bool is_enterprise_managed, + std::unique_ptr< + security_interstitials::SecurityInterstitialControllerClient> + controller_client); ~MITMSoftwareBlockingPage() override; @@ -64,4 +68,4 @@ DISALLOW_COPY_AND_ASSIGN(MITMSoftwareBlockingPage); }; -#endif // CHROME_BROWSER_SSL_MITM_SOFTWARE_BLOCKING_PAGE_H_ +#endif // COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_MITM_SOFTWARE_BLOCKING_PAGE_H_
diff --git a/components/services/filesystem/BUILD.gn b/components/services/filesystem/BUILD.gn index 2af927c6..5f7418aa 100644 --- a/components/services/filesystem/BUILD.gn +++ b/components/services/filesystem/BUILD.gn
@@ -35,9 +35,7 @@ "directory_test_helper.h", ] - deps = [ - "//base/test:test_support", - ] + deps = [ "//base/test:test_support" ] public_deps = [ ":lib",
diff --git a/components/services/filesystem/public/mojom/BUILD.gn b/components/services/filesystem/public/mojom/BUILD.gn index ecd2042..ae146fe 100644 --- a/components/services/filesystem/public/mojom/BUILD.gn +++ b/components/services/filesystem/public/mojom/BUILD.gn
@@ -11,7 +11,5 @@ "file.mojom", "types.mojom", ] - public_deps = [ - "//mojo/public/mojom/base", - ] + public_deps = [ "//mojo/public/mojom/base" ] }
diff --git a/components/services/font/BUILD.gn b/components/services/font/BUILD.gn index 3fcd92ea..cdda8bd3 100644 --- a/components/services/font/BUILD.gn +++ b/components/services/font/BUILD.gn
@@ -24,9 +24,7 @@ "//ui/gfx", ] - public_deps = [ - "//skia", - ] + public_deps = [ "//skia" ] if (is_linux && enable_plugins) { deps += [ ":ppapi_fontconfig_matching" ] @@ -49,9 +47,7 @@ } test("font_service_unittests") { - sources = [ - "font_loader_unittest.cc", - ] + sources = [ "font_loader_unittest.cc" ] deps = [ ":lib",
diff --git a/components/services/font/public/mojom/BUILD.gn b/components/services/font/public/mojom/BUILD.gn index 1e6edba..d6c3ea1 100644 --- a/components/services/font/public/mojom/BUILD.gn +++ b/components/services/font/public/mojom/BUILD.gn
@@ -5,11 +5,7 @@ import("//mojo/public/tools/bindings/mojom.gni") mojom("mojom") { - sources = [ - "font_service.mojom", - ] + sources = [ "font_service.mojom" ] - public_deps = [ - "//mojo/public/mojom/base", - ] + public_deps = [ "//mojo/public/mojom/base" ] }
diff --git a/components/services/unzip/BUILD.gn b/components/services/unzip/BUILD.gn index 0bf7b07..d2648aec 100644 --- a/components/services/unzip/BUILD.gn +++ b/components/services/unzip/BUILD.gn
@@ -48,18 +48,14 @@ "//components/test/data/unzip_service/bad_archive.zip", "//components/test/data/unzip_service/good_archive.zip", ] - outputs = [ - "{{bundle_resources_dir}}/" + - "{{source_root_relative_dir}}/{{source_file_part}}", - ] + outputs = [ "{{bundle_resources_dir}}/" + + "{{source_root_relative_dir}}/{{source_file_part}}" ] } source_set("unit_tests") { testonly = true - sources = [ - "public/cpp/unzip_unittest.cc", - ] + sources = [ "public/cpp/unzip_unittest.cc" ] deps = [ ":lib",
diff --git a/components/services/unzip/public/mojom/BUILD.gn b/components/services/unzip/public/mojom/BUILD.gn index 88db8d34..cd9d585 100644 --- a/components/services/unzip/public/mojom/BUILD.gn +++ b/components/services/unzip/public/mojom/BUILD.gn
@@ -5,9 +5,7 @@ import("//mojo/public/tools/bindings/mojom.gni") mojom("mojom") { - sources = [ - "unzipper.mojom", - ] + sources = [ "unzipper.mojom" ] public_deps = [ "//components/services/filesystem/public/mojom",
diff --git a/components/sync/engine_impl/bookmark_update_preprocessing.cc b/components/sync/engine_impl/bookmark_update_preprocessing.cc index bc83b5a..5d87494 100644 --- a/components/sync/engine_impl/bookmark_update_preprocessing.cc +++ b/components/sync/engine_impl/bookmark_update_preprocessing.cc
@@ -5,12 +5,14 @@ #include "components/sync/engine_impl/bookmark_update_preprocessing.h" #include <array> -#include <string> +#include "base/containers/span.h" #include "base/guid.h" +#include "base/hash/sha1.h" #include "base/logging.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" +#include "base/strings/strcat.h" #include "base/strings/stringprintf.h" #include "components/sync/base/hash_util.h" #include "components/sync/base/unique_position.h" @@ -43,15 +45,65 @@ // GUID came from originator_client_item_id and is valid. kValidOCII = 1, // GUID not found in the specifics and originator_client_item_id is invalid, - // so field left empty. - kLeftEmpty = 2, - kMaxValue = kLeftEmpty, + // so field left empty (currently unused). + kDeprecatedLeftEmpty = 2, + // GUID not found in the specifics and originator_client_item_id is invalid, + // so the GUID is inferred from combining originator_client_item_id and + // originator_cache_guid. + kInferred = 3, + + kMaxValue = kInferred, }; inline void LogGuidSource(BookmarkGuidSource source) { base::UmaHistogramEnumeration("Sync.BookmarkGUIDSource2", source); } +std::string ComputeGuidFromBytes(base::span<const uint8_t> bytes) { + DCHECK_GE(bytes.size(), 16U); + + // This implementation is based on the equivalent logic in base/guid.cc. + + // Set the GUID to version 4 as described in RFC 4122, section 4.4. + // The format of GUID version 4 must be xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, + // where y is one of [8, 9, A, B]. + + // Clear the version bits and set the version to 4: + const uint8_t byte6 = (bytes[6] & 0x0fU) | 0xf0U; + + // Set the two most significant bits (bits 6 and 7) of the + // clock_seq_hi_and_reserved to zero and one, respectively: + const uint8_t byte8 = (bytes[8] & 0x3fU) | 0x80U; + + return base::StringPrintf( + "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], byte6, + bytes[7], byte8, bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], + bytes[14], bytes[15]); +} + +// Bookmarks created before 2015 (https://codereview.chromium.org/1136953013) +// have an originator client item ID that is NOT a GUID. Hence, an alternative +// method must be used to infer a GUID deterministically from a combination of +// sync fields that is known to be a) immutable and b) unique per synced +// bookmark. +std::string InferGuidForLegacyBookmark( + const std::string& originator_cache_guid, + const std::string& originator_client_item_id) { + DCHECK(!base::IsValidGUID(originator_client_item_id)); + + const std::string unique_tag = + base::StrCat({originator_cache_guid, originator_client_item_id}); + const std::array<uint8_t, base::kSHA1Length> hash = + base::SHA1HashSpan(base::as_bytes(base::make_span(unique_tag))); + + static_assert(base::kSHA1Length >= 16, "16 bytes needed to infer GUID"); + + const std::string guid = ComputeGuidFromBytes(base::make_span(hash)); + DCHECK(base::IsValidGUID(guid)); + return guid; +} + } // namespace void AdaptUniquePositionForBookmark(const sync_pb::SyncEntity& update_entity, @@ -138,8 +190,18 @@ update_entity.originator_client_item_id()); LogGuidSource(BookmarkGuidSource::kValidOCII); } else { - LogGuidSource(BookmarkGuidSource::kLeftEmpty); + specifics->mutable_bookmark()->set_guid( + InferGuidForLegacyBookmark(update_entity.originator_cache_guid(), + update_entity.originator_client_item_id())); + LogGuidSource(BookmarkGuidSource::kInferred); } } +std::string InferGuidForLegacyBookmarkForTesting( + const std::string& originator_cache_guid, + const std::string& originator_client_item_id) { + return InferGuidForLegacyBookmark(originator_cache_guid, + originator_client_item_id); +} + } // namespace syncer
diff --git a/components/sync/engine_impl/bookmark_update_preprocessing.h b/components/sync/engine_impl/bookmark_update_preprocessing.h index 5245122..7cdeee7 100644 --- a/components/sync/engine_impl/bookmark_update_preprocessing.h +++ b/components/sync/engine_impl/bookmark_update_preprocessing.h
@@ -10,6 +10,8 @@ #ifndef COMPONENTS_SYNC_ENGINE_IMPL_BOOKMARK_UPDATE_PREPROCESSING_H_ #define COMPONENTS_SYNC_ENGINE_IMPL_BOOKMARK_UPDATE_PREPROCESSING_H_ +#include <string> + namespace sync_pb { class SyncEntity; class EntitySpecifics; @@ -37,6 +39,11 @@ void AdaptGuidForBookmark(const sync_pb::SyncEntity& update_entity, sync_pb::EntitySpecifics* specifics); +// GUID-inferring function exposed for testing. +std::string InferGuidForLegacyBookmarkForTesting( + const std::string& originator_cache_guid, + const std::string& originator_client_item_id); + } // namespace syncer #endif // COMPONENTS_SYNC_ENGINE_IMPL_BOOKMARK_UPDATE_PREPROCESSING_H_
diff --git a/components/sync/engine_impl/bookmark_update_preprocessing_unittest.cc b/components/sync/engine_impl/bookmark_update_preprocessing_unittest.cc index 15f4310..39ba14a 100644 --- a/components/sync/engine_impl/bookmark_update_preprocessing_unittest.cc +++ b/components/sync/engine_impl/bookmark_update_preprocessing_unittest.cc
@@ -6,8 +6,6 @@ #include <stdint.h> -#include <string> - #include "base/guid.h" #include "base/test/metrics/histogram_tester.h" #include "components/sync/base/unique_position.h" @@ -22,6 +20,7 @@ using testing::Eq; using testing::IsEmpty; +using testing::Ne; enum class ExpectedSyncPositioningScheme { kUniquePosition = 0, @@ -34,8 +33,9 @@ enum class ExpectedBookmarkGuidSource { kSpecifics = 0, kValidOCII = 1, - kLeftEmpty = 2, - kMaxValue = kLeftEmpty, + kDeprecatedLeftEmpty = 2, + kInferred = 3, + kMaxValue = kInferred, }; TEST(BookmarkUpdatePreprocessingTest, ShouldPropagateUniquePosition) { @@ -145,9 +145,9 @@ /*count=*/1); } -// Tests that AdaptGuidForBookmark() leaves the GUID in specifics empty when it -// is originally empty and originator client item ID is not a valid GUID. -TEST(BookmarkUpdatePreprocessingTest, ShouldLeaveEmptyGuid) { +// Tests that AdaptGuidForBookmark() infers the GUID when the field in specifics +// is empty and originator client item ID is not a valid GUID. +TEST(BookmarkUpdatePreprocessingTest, ShouldInferGuid) { const std::string kOriginatorClientItemId = "1"; sync_pb::SyncEntity entity; @@ -159,14 +159,31 @@ sync_pb::EntitySpecifics specifics = entity.specifics(); AdaptGuidForBookmark(entity, &specifics); - EXPECT_THAT(specifics.bookmark().guid(), IsEmpty()); + EXPECT_TRUE(base::IsValidGUIDOutputString(specifics.bookmark().guid())); histogram_tester.ExpectUniqueSample("Sync.BookmarkGUIDSource2", /*sample=*/ - ExpectedBookmarkGuidSource::kLeftEmpty, + ExpectedBookmarkGuidSource::kInferred, /*count=*/1); } +// Tests that inferred GUIDs are computed deterministically. +TEST(BookmarkUpdatePreprocessingTest, ShouldInferDeterministicGuid) { + EXPECT_THAT(InferGuidForLegacyBookmarkForTesting("cacheguid1", "1"), + Eq(InferGuidForLegacyBookmarkForTesting("cacheguid1", "1"))); + EXPECT_THAT(InferGuidForLegacyBookmarkForTesting("cacheguid1", "2"), + Eq(InferGuidForLegacyBookmarkForTesting("cacheguid1", "2"))); +} + +// Tests that unique GUIDs are produced if either of the two involved fields +// changes. +TEST(BookmarkUpdatePreprocessingTest, ShouldInferDistictGuids) { + EXPECT_THAT(InferGuidForLegacyBookmarkForTesting("cacheguid1", "1"), + Ne(InferGuidForLegacyBookmarkForTesting("cacheguid1", "2"))); + EXPECT_THAT(InferGuidForLegacyBookmarkForTesting("cacheguid1", "1"), + Ne(InferGuidForLegacyBookmarkForTesting("cacheguid2", "1"))); +} + } // namespace } // namespace syncer
diff --git a/components/sync/engine_impl/loopback_server/loopback_server.cc b/components/sync/engine_impl/loopback_server/loopback_server.cc index 4765bf55..403c9e8 100644 --- a/components/sync/engine_impl/loopback_server/loopback_server.cc +++ b/components/sync/engine_impl/loopback_server/loopback_server.cc
@@ -532,7 +532,7 @@ EntityMap::const_iterator iter = entities_.find(client_entity.id_string()); if (iter != entities_.end()) { entity = PersistentBookmarkEntity::CreateUpdatedVersion( - client_entity, *iter->second, parent_id); + client_entity, *iter->second, parent_id, client_guid); } else { entity = PersistentBookmarkEntity::CreateNew(client_entity, parent_id, client_guid);
diff --git a/components/sync/engine_impl/loopback_server/loopback_server_entity.cc b/components/sync/engine_impl/loopback_server/loopback_server_entity.cc index 428ec8b..01b9efb 100644 --- a/components/sync/engine_impl/loopback_server/loopback_server_entity.cc +++ b/components/sync/engine_impl/loopback_server/loopback_server_entity.cc
@@ -141,6 +141,18 @@ return syncer::GetModelTypeFromSpecificsFieldNumber(field_number); } +// static +std::string LoopbackServerEntity::GetInnerIdFromId(const std::string& id) { + vector<base::StringPiece> tokens = base::SplitStringPiece( + id, kIdSeparator, base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); + + if (tokens.size() != 2) { + return std::string(); + } + + return tokens[1].as_string(); +} + LoopbackServerEntity::LoopbackServerEntity(const string& id, const ModelType& model_type, int64_t version,
diff --git a/components/sync/engine_impl/loopback_server/loopback_server_entity.h b/components/sync/engine_impl/loopback_server/loopback_server_entity.h index c60bc71..ad24892e 100644 --- a/components/sync/engine_impl/loopback_server/loopback_server_entity.h +++ b/components/sync/engine_impl/loopback_server/loopback_server_entity.h
@@ -65,6 +65,9 @@ // a valid ModelType, UNSPECIFIED is returned. static syncer::ModelType GetModelTypeFromId(const std::string& id); + // Extracts the inner ID as specified in the constructor from |id|. + static std::string GetInnerIdFromId(const std::string& id); + protected: LoopbackServerEntity(const std::string& id, const syncer::ModelType& model_type,
diff --git a/components/sync/engine_impl/loopback_server/loopback_server_unittest.cc b/components/sync/engine_impl/loopback_server/loopback_server_unittest.cc index 779b1bc1..1492564d 100644 --- a/components/sync/engine_impl/loopback_server/loopback_server_unittest.cc +++ b/components/sync/engine_impl/loopback_server/loopback_server_unittest.cc
@@ -4,6 +4,7 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" +#include "base/guid.h" #include "components/sync/engine_impl/loopback_server/loopback_connection_manager.h" #include "components/sync/engine_impl/syncer_proto_util.h" #include "components/sync/protocol/sync.pb.h" @@ -31,6 +32,7 @@ SyncEntity entity; entity.mutable_specifics()->mutable_bookmark()->set_url(url); entity.set_parent_id_string(parent_id); + entity.set_id_string(base::GenerateGUID()); return entity; }
diff --git a/components/sync/engine_impl/loopback_server/persistent_bookmark_entity.cc b/components/sync/engine_impl/loopback_server/persistent_bookmark_entity.cc index 3ca35943..713ac60 100644 --- a/components/sync/engine_impl/loopback_server/persistent_bookmark_entity.cc +++ b/components/sync/engine_impl/loopback_server/persistent_bookmark_entity.cc
@@ -27,16 +27,21 @@ std::unique_ptr<LoopbackServerEntity> PersistentBookmarkEntity::CreateNew( const sync_pb::SyncEntity& client_entity, const string& parent_id, - const string& client_guid) { + const string& originator_cache_guid) { if (!IsBookmark(client_entity)) { DLOG(WARNING) << "The given entity must be a bookmark."; return nullptr; } - const string id = - LoopbackServerEntity::CreateId(syncer::BOOKMARKS, base::GenerateGUID()); - const string originator_cache_guid = client_guid; - const string originator_client_item_id = client_entity.id_string(); + const std::string originator_client_item_id = client_entity.id_string(); + if (!base::IsValidGUIDOutputString(originator_client_item_id)) { + DLOG(WARNING) << "Invalid originator client item ID: " + << originator_client_item_id; + return nullptr; + } + + const string id = LoopbackServerEntity::CreateId(syncer::BOOKMARKS, + originator_client_item_id); return std::make_unique<PersistentBookmarkEntity>( id, 0, client_entity.name(), originator_cache_guid, @@ -50,22 +55,34 @@ PersistentBookmarkEntity::CreateUpdatedVersion( const sync_pb::SyncEntity& client_entity, const LoopbackServerEntity& current_server_entity, - const string& parent_id) { + const string& parent_id, + const std::string& updating_client_cache_guid) { if (client_entity.version() == 0) { DLOG(WARNING) << "Existing entities must not have a version = 0."; return nullptr; } + if (!IsBookmark(client_entity)) { DLOG(WARNING) << "The given entity must be a bookmark."; return nullptr; } - const PersistentBookmarkEntity& current_bookmark_entity = - static_cast<const PersistentBookmarkEntity&>(current_server_entity); - const string originator_cache_guid = - current_bookmark_entity.originator_cache_guid_; - const string originator_client_item_id = - current_bookmark_entity.originator_client_item_id_; + std::string originator_cache_guid; + std::string originator_client_item_id; + + if (current_server_entity.IsDeleted()) { + // Handle undeletions. + originator_cache_guid = updating_client_cache_guid; + originator_client_item_id = + LoopbackServerEntity::GetInnerIdFromId(client_entity.id_string()); + } else { + // Regular case (non-undeletion). + const PersistentBookmarkEntity& current_bookmark_entity = + static_cast<const PersistentBookmarkEntity&>(current_server_entity); + originator_cache_guid = current_bookmark_entity.originator_cache_guid_; + originator_client_item_id = + current_bookmark_entity.originator_client_item_id_; + } // Using a version of 0 is okay here as it'll be updated before this entity is // actually saved. @@ -108,8 +125,8 @@ : LoopbackServerEntity(id, syncer::BOOKMARKS, version, name), originator_cache_guid_(originator_cache_guid), originator_client_item_id_(originator_client_item_id), - unique_position_(unique_position), is_folder_(is_folder), + unique_position_(unique_position), parent_id_(parent_id), creation_time_(creation_time), last_modified_time_(last_modified_time) {
diff --git a/components/sync/engine_impl/loopback_server/persistent_bookmark_entity.h b/components/sync/engine_impl/loopback_server/persistent_bookmark_entity.h index 3eb04810..1b1f6db3 100644 --- a/components/sync/engine_impl/loopback_server/persistent_bookmark_entity.h +++ b/components/sync/engine_impl/loopback_server/persistent_bookmark_entity.h
@@ -28,7 +28,7 @@ static std::unique_ptr<LoopbackServerEntity> CreateNew( const sync_pb::SyncEntity& client_entity, const std::string& parent_id, - const std::string& client_guid); + const std::string& originator_cache_guid); // Factory function for PersistentBookmarkEntity. The server's current entity // for this ID, |current_server_entity|, is passed here because the client @@ -37,7 +37,8 @@ static std::unique_ptr<LoopbackServerEntity> CreateUpdatedVersion( const sync_pb::SyncEntity& client_entity, const LoopbackServerEntity& current_server_entity, - const std::string& parent_id); + const std::string& parent_id, + const std::string& originator_cache_guid); // Factory function for PersistentBookmarkEntity used when de-serializing the // information stored in the persistent storage. @@ -68,10 +69,10 @@ private: // All member values have equivalent fields in SyncEntity. - std::string originator_cache_guid_; - std::string originator_client_item_id_; + const std::string originator_cache_guid_; + const std::string originator_client_item_id_; + const bool is_folder_; sync_pb::UniquePosition unique_position_; - bool is_folder_; std::string parent_id_; int64_t creation_time_; int64_t last_modified_time_;
diff --git a/components/sync/engine_impl/loopback_server/persistent_bookmark_entity_unittest.cc b/components/sync/engine_impl/loopback_server/persistent_bookmark_entity_unittest.cc index e2a9e23..0f528a8 100644 --- a/components/sync/engine_impl/loopback_server/persistent_bookmark_entity_unittest.cc +++ b/components/sync/engine_impl/loopback_server/persistent_bookmark_entity_unittest.cc
@@ -4,6 +4,7 @@ #include "components/sync/engine_impl/loopback_server/persistent_bookmark_entity.h" +#include "base/guid.h" #include "components/sync/protocol/sync.pb.h" #include "testing/gtest/include/gtest/gtest.h" @@ -13,6 +14,8 @@ TEST(PersistentBookmarkEntityTest, CreateNew) { sync_pb::SyncEntity entity; + entity.set_id_string(base::GenerateGUID()); + entity.mutable_specifics()->mutable_preference(); EXPECT_FALSE( PersistentBookmarkEntity::CreateNew(entity, "parent_id", "client_guid")); @@ -32,18 +35,18 @@ // Fails with since there's no version ASSERT_FALSE(PersistentBookmarkEntity::CreateUpdatedVersion( - client_entity, *server_entity, "parent_id")); + client_entity, *server_entity, "parent_id", "updating_guid")); // And now succeeds that we have a version. client_entity.set_version(1); ASSERT_TRUE(PersistentBookmarkEntity::CreateUpdatedVersion( - client_entity, *server_entity, "parent_id")); + client_entity, *server_entity, "parent_id", "updating_guid")); // But fails when not actually a bookmark. client_entity.clear_specifics(); client_entity.mutable_specifics()->mutable_preference(); ASSERT_FALSE(PersistentBookmarkEntity::CreateUpdatedVersion( - client_entity, *server_entity, "parent_id")); + client_entity, *server_entity, "parent_id", "updating_guid")); } TEST(PersistentBookmarkEntityTest, CreateFromEntity) {
diff --git a/components/sync/engine_impl/model_type_worker_unittest.cc b/components/sync/engine_impl/model_type_worker_unittest.cc index 3150c26..e813833 100644 --- a/components/sync/engine_impl/model_type_worker_unittest.cc +++ b/components/sync/engine_impl/model_type_worker_unittest.cc
@@ -1630,7 +1630,7 @@ const EntityData& data = response_data.entity; EXPECT_EQ(kInvalidOCII, data.originator_client_item_id); - EXPECT_TRUE(data.specifics.bookmark().guid().empty()); + EXPECT_TRUE(base::IsValidGUIDOutputString(data.specifics.bookmark().guid())); } TEST_F(ModelTypeWorkerTest, @@ -2036,11 +2036,11 @@ .at(0) ->entity.originator_client_item_id); - EXPECT_EQ("", processor() - ->GetNthUpdateResponse(1) - .at(0) - ->entity.specifics.bookmark() - .guid()); + EXPECT_TRUE(base::IsValidGUIDOutputString(processor() + ->GetNthUpdateResponse(1) + .at(0) + ->entity.specifics.bookmark() + .guid())); } TEST_F(ModelTypeWorkerBookmarksTest, @@ -2119,12 +2119,11 @@ .at(0) ->entity.originator_client_item_id); - EXPECT_TRUE(processor() - ->GetNthUpdateResponse(0) - .at(0) - ->entity.specifics.bookmark() - .guid() - .empty()); + EXPECT_TRUE(base::IsValidGUIDOutputString(processor() + ->GetNthUpdateResponse(0) + .at(0) + ->entity.specifics.bookmark() + .guid())); } } // namespace syncer
diff --git a/components/sync/protocol/bookmark_specifics.proto b/components/sync/protocol/bookmark_specifics.proto index 508e0c10..af15cbe4 100644 --- a/components/sync/protocol/bookmark_specifics.proto +++ b/components/sync/protocol/bookmark_specifics.proto
@@ -32,8 +32,16 @@ optional int64 creation_time_us = 4; optional string icon_url = 5; repeated MetaInfo meta_info = 6; - // Introduced in M78. If not present, originator_client_item_id is interpreted - // as GUID as long as it is of the valid format. Otherwise, field is either - // ignored or overwritten locally. - optional string guid = 7; + reserved 7; + // Introduced in M81, it represents a globally unique and immutable ID. + // + // If present, it must be the same as originator_client_item_id, unless + // originator client item ID is not a valid GUID. In such cases (which is the + // case for bookmarks created before 2015), this GUID must match the value + // inferred from the combination of originator cache GUID and + // originator client item ID, see InferGuidForLegacyBookmark(). + // + // If not present, the value can be safely inferred using the very same + // methods listed above. + optional string guid = 8; }
diff --git a/components/sync/test/fake_server/android/fake_server_helper_android.cc b/components/sync/test/fake_server/android/fake_server_helper_android.cc index ca8b9786..fb75a10b 100644 --- a/components/sync/test/fake_server/android/fake_server_helper_android.cc +++ b/components/sync/test/fake_server/android/fake_server_helper_android.cc
@@ -253,6 +253,10 @@ CreateBookmarkEntity(env, title, url, parent_id); sync_pb::SyncEntity proto; bookmark->SerializeAsProto(&proto); + // The GUID has just been regenerated in CreateBookmarkEntity(). To avoid + // running into a GUID mismatch, let's clear it here since it can be auto- + // populated by ModelTypeWorker. + proto.mutable_specifics()->mutable_bookmark()->clear_guid(); fake_server_ptr->ModifyBookmarkEntity( base::android::ConvertJavaStringToUTF8(env, entity_id), base::android::ConvertJavaStringToUTF8(env, parent_id), @@ -278,6 +282,10 @@ sync_pb::SyncEntity proto; bookmark_builder.BuildFolder()->SerializeAsProto(&proto); + // The GUID has just been regenerated in CreateBookmarkEntity(). To avoid + // running into a GUID mismatch, let's clear it here since it can be auto- + // populated by ModelTypeWorker. + proto.mutable_specifics()->mutable_bookmark()->clear_guid(); fake_server_ptr->ModifyBookmarkEntity( base::android::ConvertJavaStringToUTF8(env, entity_id), base::android::ConvertJavaStringToUTF8(env, parent_id),
diff --git a/components/sync/test/fake_server/bookmark_entity_builder.cc b/components/sync/test/fake_server/bookmark_entity_builder.cc index faa8cc78..44252e1 100644 --- a/components/sync/test/fake_server/bookmark_entity_builder.cc +++ b/components/sync/test/fake_server/bookmark_entity_builder.cc
@@ -78,11 +78,10 @@ sync_pb::EntitySpecifics entity_specifics; sync_pb::BookmarkSpecifics* bookmark_specifics = entity_specifics.mutable_bookmark(); + if (!is_legacy) { bookmark_specifics->set_title(title_); - // TODO(crbug.com/516866): Use originator_client_item_id here instead of a - // new GUID, ensuring the value is of valid GUID format. - bookmark_specifics->set_guid(base::GenerateGUID()); + bookmark_specifics->set_guid(originator_client_item_id_); } return entity_specifics;
diff --git a/components/sync_bookmarks/bookmark_model_merger.cc b/components/sync_bookmarks/bookmark_model_merger.cc index 18d9116..4979bb57c 100644 --- a/components/sync_bookmarks/bookmark_model_merger.cc +++ b/components/sync_bookmarks/bookmark_model_merger.cc
@@ -115,45 +115,31 @@ return local_node->url() == GURL(specifics.url()); } -// Goes through remote updates to detect duplicate GUIDs (should be extremely -// rare) and resolve them by ignoring (clearing) all occurrences except one, -// which if possible will be the one that also matches the originator client -// item ID. -// TODO(crbug.com/978430): Remove this logic and deprecate proto field. -void ResolveDuplicateRemoteGUIDs(syncer::UpdateResponseDataList* updates) { +// Goes through remote updates to detect duplicate GUIDs, which cannot exist +// because GUIDs are guaranteed to match the originator client item ID (handled +// in GroupValidUpdatesByParentId()) and duplicates of originator client item +// ID are sorted out by ModelTypeWorker. +void CheckNoDuplicatesInRemoteGUIDs( + const UpdatesPerParentId& updates_per_parent_id) { +#if DCHECK_IS_ON() std::set<std::string> known_guids; - // In a first pass we process |originator_client_item_id| which is more - // authoritative and cannot run into duplicates. - for (const UpdateResponseData& update : *updates) { - // |originator_client_item_id| is empty for permanent nodes. - if (update.entity.is_deleted() || - update.entity.originator_client_item_id.empty()) { - continue; - } - bool success = - known_guids.insert(update.entity.originator_client_item_id).second; - DCHECK(success); - } + for (const auto& parent_id_and_updates : updates_per_parent_id) { + for (const UpdateResponseData& update : parent_id_and_updates.second) { + // |originator_client_item_id| is empty for permanent nodes. + if (update.entity.is_deleted() || + !update.entity.server_defined_unique_tag.empty()) { + continue; + } - // In a second pass, detect if GUIDs in specifics conflict with each other or - // with |originator_client_item_id| values processed earlier. - for (UpdateResponseData& update : *updates) { - const std::string& guid_in_specifics = - update.entity.specifics.bookmark().guid(); - if (guid_in_specifics.empty() || - guid_in_specifics == update.entity.originator_client_item_id) { - continue; - } + const std::string& guid_in_specifics = + update.entity.specifics.bookmark().guid(); - bool success = known_guids.insert(guid_in_specifics).second; - if (!success) { - // This GUID conflicts with another one, so let's ignore it for the - // purpose of merging. This mimics the data produced by old clients, - // without the GUID being populated. - update.entity.specifics.mutable_bookmark()->clear_guid(); + bool success = known_guids.insert(guid_in_specifics).second; + DCHECK(success); } } +#endif // DCHECK_IS_ON() } // Groups all valid updates by the server ID of their parent and moves them away @@ -185,6 +171,13 @@ DLOG(ERROR) << "Remote update with invalid specifics"; continue; } + if (!HasExpectedBookmarkGuid(update_entity.specifics.bookmark(), + update_entity.originator_cache_guid, + update_entity.originator_client_item_id)) { + // Ignore updates with an unexpected GUID. + DLOG(ERROR) << "Remote update with unexpected GUID"; + continue; + } updates_per_parent_id[update_entity.parent_id].push_back(std::move(update)); } @@ -208,8 +201,8 @@ guid_to_remote_node_map) const { DCHECK(guid_to_remote_node_map); - const std::string& guid = entity().specifics.bookmark().guid(); - if (!guid.empty()) { + if (entity().server_defined_unique_tag.empty()) { + const std::string& guid = entity().specifics.bookmark().guid(); DCHECK(base::IsValidGUID(guid)); // Duplicate GUIDs have been sorted out before. @@ -312,13 +305,13 @@ // static BookmarkModelMerger::RemoteForest BookmarkModelMerger::BuildRemoteForest( syncer::UpdateResponseDataList updates) { - ResolveDuplicateRemoteGUIDs(&updates); - // Filter out invalid remote updates and group the valid ones by the server ID // of their parent. UpdatesPerParentId updates_per_parent_id = GroupValidUpdatesByParentId(&updates); + CheckNoDuplicatesInRemoteGUIDs(updates_per_parent_id); + // Construct one tree per permanent entity. RemoteForest update_forest; for (UpdateResponseData& update : updates) { @@ -543,16 +536,12 @@ const bookmarks::BookmarkNode* local_parent, size_t index) { DCHECK(!FindMatchingLocalNodeByGUID(remote_node)); + const EntityData& remote_update_entity = remote_node.entity(); + DCHECK(IsValidBookmarkSpecifics(remote_update_entity.specifics.bookmark(), + remote_update_entity.is_folder)); - // If specifics do not have a valid GUID, create a new one. Legacy clients do - // not populate GUID field and if the originator_client_item_id is not of - // valid GUID format to replace it, the field is left blank. - sync_pb::EntitySpecifics specifics = remote_node.entity().specifics; - if (!base::IsValidGUID(specifics.bookmark().guid())) { - specifics.mutable_bookmark()->set_guid(base::GenerateGUID()); - } - + const sync_pb::EntitySpecifics& specifics = remote_node.entity().specifics; const bookmarks::BookmarkNode* bookmark_node = CreateBookmarkNodeFromSpecifics(specifics.bookmark(), local_parent, index, remote_update_entity.is_folder,
diff --git a/components/sync_bookmarks/bookmark_model_merger_unittest.cc b/components/sync_bookmarks/bookmark_model_merger_unittest.cc index 83e18924..f5c2fbb 100644 --- a/components/sync_bookmarks/bookmark_model_merger_unittest.cc +++ b/components/sync_bookmarks/bookmark_model_merger_unittest.cc
@@ -587,34 +587,6 @@ EXPECT_THAT(tracker.TrackedEntitiesCountForTest(), Eq(2U)); } -TEST(BookmarkModelMergerTest, ShouldMergeRemoteCreationWithoutGUID) { - const std::string kId = "Id"; - const std::string kTitle = "Title"; - - std::unique_ptr<bookmarks::BookmarkModel> bookmark_model = - bookmarks::TestBookmarkClient::CreateModel(); - ASSERT_EQ(bookmark_model->bookmark_bar_node()->children().size(), 0u); - - // -------- The remote model -------- - syncer::UpdateResponseDataList updates; - updates.push_back(CreateBookmarkBarNodeUpdateData()); - updates.push_back(CreateUpdateResponseData( - /*server_id=*/kId, /*parent_id=*/kBookmarkBarId, kTitle, - /*url=*/std::string(), - /*is_folder=*/true, /*unique_position=*/MakeRandomPosition(), - /*guid=*/"")); - - std::unique_ptr<SyncedBookmarkTracker> tracker = - Merge(std::move(updates), bookmark_model.get()); - - // Node should have been created and new GUID should have been set. - ASSERT_EQ(bookmark_model->bookmark_bar_node()->children().size(), 1u); - const bookmarks::BookmarkNode* bookmark = - bookmark_model->bookmark_bar_node()->children()[0].get(); - EXPECT_TRUE(base::IsValidGUID(bookmark->guid())); - EXPECT_THAT(tracker->GetEntityForBookmarkNode(bookmark), NotNull()); -} - TEST(BookmarkModelMergerTest, ShouldMergeAndUseRemoteGUID) { const std::string kId = "Id"; const std::string kTitle = "Title"; @@ -1320,9 +1292,9 @@ EXPECT_THAT(tracker->GetEntityForBookmarkNode(bookmark), NotNull()); } -// Tests that the GUID-based matching algorithm does not match two remote nodes -// with the same local node, even if the remote data contains duplicate GUIDs. -TEST(BookmarkModelMergerTest, ShouldIgnoreRemoteDuplicateGUID) { +// Tests that updates with a GUID that is different to originator client item ID +// are ignored. +TEST(BookmarkModelMergerTest, ShouldIgnoreRemoteUpdateWithInvalidGUID) { base::test::ScopedFeatureList override_features; override_features.InitAndEnableFeature(switches::kMergeBookmarksUsingGUIDs); @@ -1379,90 +1351,13 @@ // -------- The merged model -------- // | - bookmark (kGuid/kUrl/kTitle1) - // | - bookmark (<some-other-guid>/kUrl/kTitle2) - // Both remote nodes should be present in the merged tree. - ASSERT_EQ(bookmark_bar_node->children().size(), 2u); - const bookmarks::BookmarkNode* bookmark1 = + // The second remote node should have been filtered out. + ASSERT_EQ(bookmark_bar_node->children().size(), 1u); + const bookmarks::BookmarkNode* merged_bookmark = bookmark_model->bookmark_bar_node()->children()[0].get(); - const bookmarks::BookmarkNode* bookmark2 = - bookmark_model->bookmark_bar_node()->children()[1].get(); - EXPECT_THAT(bookmark1->guid(), Eq(kGuid)); - EXPECT_THAT(bookmark2->guid(), Ne(kGuid)); - - EXPECT_THAT(tracker->GetEntityForBookmarkNode(bookmark1), NotNull()); - EXPECT_THAT(tracker->GetEntityForBookmarkNode(bookmark2), NotNull()); -} - -// Same as previous test but in addition all nodes match semantically. -TEST(BookmarkModelMergerTest, ShouldIgnoreRemoteDuplicateGUIDAndSemanticMatch) { - base::test::ScopedFeatureList override_features; - override_features.InitAndEnableFeature(switches::kMergeBookmarksUsingGUIDs); - - const std::string kId1 = "Id1"; - const std::string kId2 = "Id2"; - const std::string kTitle = "Title"; - const std::string kUrl = "http://www.foo.com/"; - const std::string kGuid = base::GenerateGUID(); - - std::unique_ptr<bookmarks::BookmarkModel> bookmark_model = - bookmarks::TestBookmarkClient::CreateModel(); - - // -------- The local model -------- - // | - bookmark(kGuid/kUrl/kTitle) - const bookmarks::BookmarkNode* bookmark_bar_node = - bookmark_model->bookmark_bar_node(); - const bookmarks::BookmarkNode* bookmark = bookmark_model->AddURL( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16(kTitle), - GURL(kUrl), nullptr, base::Time::Now(), kGuid); - ASSERT_TRUE(bookmark); - ASSERT_THAT(bookmark_bar_node->children(), ElementRawPointersAre(bookmark)); - - // -------- The remote model -------- - // bookmark_bar - // | - bookmark (kGuid/kUrl/kTitle) - // | - bookmark (kGuid/kUrl/kTitle) - const std::string suffix = syncer::UniquePosition::RandomSuffix(); - syncer::UniquePosition position1 = - syncer::UniquePosition::InitialPosition(suffix); - syncer::UniquePosition position2 = - syncer::UniquePosition::After(position1, suffix); - - syncer::UpdateResponseDataList updates; - updates.push_back(CreateBookmarkBarNodeUpdateData()); - updates.push_back(CreateUpdateResponseData( - /*server_id=*/kId1, /*parent_id=*/kBookmarkBarId, kTitle, - /*url=*/kUrl, - /*is_folder=*/false, /*unique_position=*/position1, - /*guid=*/kGuid)); - updates.push_back(CreateUpdateResponseData( - /*server_id=*/kId2, /*parent_id=*/kBookmarkBarId, kTitle, - /*url=*/kUrl, - /*is_folder=*/false, /*unique_position=*/position2, - /*guid=*/kGuid)); - - // |originator_client_item_id| cannot itself be duplicated because - // ModelTypeWorker guarantees otherwise. - updates.back().entity.originator_client_item_id = base::GenerateGUID(); - - std::unique_ptr<SyncedBookmarkTracker> tracker = - Merge(std::move(updates), bookmark_model.get()); - - // -------- The merged model -------- - // | - bookmark (kGuid/kUrl/kTitle) - // | - bookmark (<some-other-guid>/kUrl/kTitle) - - // Both remote nodes should be present in the merged tree. - ASSERT_EQ(bookmark_bar_node->children().size(), 2u); - const bookmarks::BookmarkNode* bookmark1 = - bookmark_model->bookmark_bar_node()->children()[0].get(); - const bookmarks::BookmarkNode* bookmark2 = - bookmark_model->bookmark_bar_node()->children()[1].get(); - EXPECT_THAT(bookmark1->guid(), Eq(kGuid)); - EXPECT_THAT(bookmark2->guid(), Ne(kGuid)); - - EXPECT_THAT(tracker->GetEntityForBookmarkNode(bookmark1), NotNull()); - EXPECT_THAT(tracker->GetEntityForBookmarkNode(bookmark2), NotNull()); + EXPECT_THAT(merged_bookmark->guid(), Eq(kGuid)); + EXPECT_THAT(tracker->GetEntityForBookmarkNode(merged_bookmark), NotNull()); } } // namespace sync_bookmarks
diff --git a/components/sync_bookmarks/bookmark_remote_updates_handler.cc b/components/sync_bookmarks/bookmark_remote_updates_handler.cc index 55fb8b6..0d38def1 100644 --- a/components/sync_bookmarks/bookmark_remote_updates_handler.cc +++ b/components/sync_bookmarks/bookmark_remote_updates_handler.cc
@@ -48,8 +48,10 @@ kMissingParentNodeInConflict = 7, // Failed to create a bookmark. kCreationFailure = 8, + // The bookmark's GUID did not match the originator client item ID. + kUnexpectedGuid = 9, - kMaxValue = kCreationFailure, + kMaxValue = kUnexpectedGuid, }; void LogProblematicBookmark(RemoteBookmarkUpdateError problem) { @@ -206,7 +208,18 @@ RemoteBookmarkUpdateError::kInvalidUniquePosition); continue; } + if (!HasExpectedBookmarkGuid(update_entity.specifics.bookmark(), + update_entity.originator_cache_guid, + update_entity.originator_client_item_id)) { + // Ignore updates with an unexpected GUID. + DLOG(ERROR) + << "Couldn't process an update bookmark with unexpected GUID: " + << update_entity.specifics.bookmark().guid(); + LogProblematicBookmark(RemoteBookmarkUpdateError::kUnexpectedGuid); + continue; + } } + const SyncedBookmarkTracker::Entity* tracked_entity = bookmark_tracker_->GetEntityForSyncId(update_entity.id); if (tracked_entity && tracked_entity->metadata()->server_version() >= @@ -431,17 +444,6 @@ DCHECK(IsValidBookmarkSpecifics(update_entity.specifics.bookmark(), update_entity.is_folder)); - // If specifics do not have a valid GUID, create a new one. Legacy clients do - // not populate GUID field and if the originator_client_item_id is not of - // valid GUID format to replace it, the field is left blank. - if (!base::IsValidGUID(update_entity.specifics.bookmark().guid())) { - // TODO(crbug.com/978430): Seems that's not the correct place for making any - // changes to |update|, need a proper place for generating GUID. - const_cast<syncer::UpdateResponseData&>(update) - .entity.specifics.mutable_bookmark() - ->set_guid(base::GenerateGUID()); - } - const bookmarks::BookmarkNode* parent_node = GetParentNode(update_entity); if (!parent_node) { // If we cannot find the parent, we can do nothing.
diff --git a/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc b/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc index 1510aab..b765aa4 100644 --- a/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc +++ b/components/sync_bookmarks/bookmark_remote_updates_handler_unittest.cc
@@ -47,6 +47,21 @@ const char kOtherBookmarksId[] = "other_bookmarks_id"; const char kOtherBookmarksTag[] = "other_bookmarks"; +// Fork of enum RemoteBookmarkUpdateError. +enum class ExpectedRemoteBookmarkUpdateError { + kConflictingTypes = 0, + kInvalidSpecifics = 1, + kInvalidUniquePosition = 2, + kPermanentNodeCreationAfterMerge = 3, + kMissingParentEntity = 4, + kMissingParentNode = 5, + kMissingParentEntityInConflict = 6, + kMissingParentNodeInConflict = 7, + kCreationFailure = 8, + kUnexpectedGuid = 9, + kMaxValue = kUnexpectedGuid, +}; + syncer::UpdateResponseData CreateUpdateResponseData( const std::string& server_id, const std::string& parent_id, @@ -59,6 +74,7 @@ data.id = server_id; data.parent_id = parent_id; data.unique_position = unique_position.ToProto(); + data.originator_client_item_id = guid; // EntityData would be considered a deletion if its specifics hasn't been set. if (!is_deletion) { @@ -355,7 +371,38 @@ } TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, - ShouldAssignNewGUIDToRemoteCreation) { + ShouldIgnoreRemoteCreationWithInvalidGuidInSpecifics) { + const std::string kId = "id"; + const std::string kTitle = "title"; + const syncer::UniquePosition kPosition = + syncer::UniquePosition::InitialPosition( + syncer::UniquePosition::RandomSuffix()); + + syncer::UpdateResponseDataList updates; + + // Create update with an invalid GUID. + updates.push_back(CreateUpdateResponseData( + /*server_id=*/kId, + /*parent_id=*/kBookmarkBarId, + /*guid=*/"invalidguid", + /*title=*/kTitle, + /*is_deletion=*/false, + /*version=*/0, + /*unique_position=*/kPosition)); + + base::HistogramTester histogram_tester; + updates_handler()->Process(updates, + /*got_new_encryption_requirements=*/false); + EXPECT_THAT(tracker()->GetEntityForSyncId(kId), IsNull()); + + histogram_tester.ExpectBucketCount( + "Sync.ProblematicServerSideBookmarks", + /*sample=*/ExpectedRemoteBookmarkUpdateError::kInvalidSpecifics, + /*count=*/1); +} + +TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, + ShouldIgnoreRemoteCreationWithUnexpectedGuidInSpecifics) { const std::string kId = "id"; const std::string kTitle = "title"; const syncer::UniquePosition kPosition = @@ -368,18 +415,24 @@ updates.push_back(CreateUpdateResponseData( /*server_id=*/kId, /*parent_id=*/kBookmarkBarId, - /*guid=*/"", + /*guid=*/base::GenerateGUID(), /*title=*/kTitle, /*is_deletion=*/false, /*version=*/0, /*unique_position=*/kPosition)); + // Override the originator client item ID to mimic a mismatch. + updates.back().entity.originator_client_item_id = base::GenerateGUID(); + + base::HistogramTester histogram_tester; updates_handler()->Process(updates, /*got_new_encryption_requirements=*/false); - ASSERT_THAT(tracker()->GetEntityForSyncId(kId), NotNull()); - // New local GUID should have been assigned. - EXPECT_TRUE(base::IsValidGUID( - tracker()->GetEntityForSyncId(kId)->bookmark_node()->guid())); + EXPECT_THAT(tracker()->GetEntityForSyncId(kId), IsNull()); + + histogram_tester.ExpectBucketCount( + "Sync.ProblematicServerSideBookmarks", + /*sample=*/ExpectedRemoteBookmarkUpdateError::kUnexpectedGuid, + /*count=*/1); } TEST_F(BookmarkRemoteUpdatesHandlerWithInitialMergeTest, @@ -792,7 +845,7 @@ TEST(BookmarkRemoteUpdatesHandlerTest, ShouldUpdateSyncIdWhenRecevingAnUpdateForNewlyCreatedLocalNode) { const std::string kCacheGuid = "generated_id"; - const std::string kOriginatorClientItemId = "tmp_server_id"; + const std::string kOriginatorClientItemId = base::GenerateGUID(); const std::string kSyncId = "server_id"; const int64_t kServerVersion = 1000; const base::Time kModificationTime(base::Time::Now() - @@ -842,6 +895,7 @@ syncer::UniquePosition::RandomSuffix()) .ToProto(); data.specifics = specifics; + data.specifics.mutable_bookmark()->set_guid(kOriginatorClientItemId); data.is_folder = true; syncer::UpdateResponseData response_data;
diff --git a/components/sync_bookmarks/bookmark_specifics_conversions.cc b/components/sync_bookmarks/bookmark_specifics_conversions.cc index 74914f18..8ca57fb2 100644 --- a/components/sync_bookmarks/bookmark_specifics_conversions.cc +++ b/components/sync_bookmarks/bookmark_specifics_conversions.cc
@@ -9,8 +9,12 @@ #include <utility> #include <vector> +#include "base/containers/span.h" #include "base/guid.h" +#include "base/hash/sha1.h" #include "base/metrics/histogram_functions.h" +#include "base/strings/strcat.h" +#include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/browser/bookmark_node.h" @@ -129,6 +133,52 @@ pixel_size); } +// This is an exact copy of the same code in bookmark_update_preprocessing.cc. +// TODO(crbug.com/1032052): Remove when client tags are adopted in +// ModelTypeWorker. +std::string ComputeGuidFromBytes(base::span<const uint8_t> bytes) { + DCHECK_GE(bytes.size(), 16U); + + // This implementation is based on the equivalent logic in base/guid.cc. + + // Set the GUID to version 4 as described in RFC 4122, section 4.4. + // The format of GUID version 4 must be xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, + // where y is one of [8, 9, A, B]. + + // Clear the version bits and set the version to 4: + const uint8_t byte6 = (bytes[6] & 0x0fU) | 0xf0U; + + // Set the two most significant bits (bits 6 and 7) of the + // clock_seq_hi_and_reserved to zero and one, respectively: + const uint8_t byte8 = (bytes[8] & 0x3fU) | 0x80U; + + return base::StringPrintf( + "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], byte6, + bytes[7], byte8, bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], + bytes[14], bytes[15]); +} + +// This is an exact copy of the same code in bookmark_update_preprocessing.cc. +// TODO(crbug.com/1032052): Remove when client tags are adopted in +// ModelTypeWorker. +std::string InferGuidForLegacyBookmark( + const std::string& originator_cache_guid, + const std::string& originator_client_item_id) { + DCHECK(!base::IsValidGUID(originator_client_item_id)); + + const std::string unique_tag = + base::StrCat({originator_cache_guid, originator_client_item_id}); + const std::array<uint8_t, base::kSHA1Length> hash = + base::SHA1HashSpan(base::as_bytes(base::make_span(unique_tag))); + + static_assert(base::kSHA1Length >= 16, "16 bytes needed to infer GUID"); + + const std::string guid = ComputeGuidFromBytes(base::make_span(hash)); + DCHECK(base::IsValidGUID(guid)); + return guid; +} + } // namespace sync_pb::EntitySpecifics CreateSpecificsFromBookmarkNode( @@ -142,9 +192,11 @@ } DCHECK(!node->guid().empty()); - DCHECK(base::IsValidGUID(node->guid())); + DCHECK(base::IsValidGUID(node->guid())) << "Actual: " << node->guid(); - bm_specifics->set_guid(node->guid()); + // TODO(crbug.com/978430): populate the GUID, as long as it's known to be + // consistent with the originator client item ID. + bm_specifics->set_title(SpecificsTitleFromNodeTitle(node->GetTitle())); bm_specifics->set_creation_time_us( node->date_added().ToDeltaSinceWindowsEpoch().InMicroseconds()); @@ -286,7 +338,7 @@ LogInvalidSpecifics(InvalidBookmarkSpecificsError::kEmptySpecifics); is_valid = false; } - if (!base::IsValidGUID(specifics.guid()) && !specifics.guid().empty()) { + if (!base::IsValidGUID(specifics.guid())) { DLOG(ERROR) << "Invalid bookmark: invalid GUID in the specifics."; LogInvalidSpecifics(InvalidBookmarkSpecificsError::kInvalidGUID); is_valid = false; @@ -325,4 +377,25 @@ return is_valid; } +bool HasExpectedBookmarkGuid(const sync_pb::BookmarkSpecifics& specifics, + const std::string& originator_cache_guid, + const std::string& originator_client_item_id) { + DCHECK(base::IsValidGUID(specifics.guid())); + + if (originator_client_item_id.empty()) { + // This could be a future bookmark with a client tag instead of an + // originator client item ID. + NOTIMPLEMENTED(); + return true; + } + + if (base::IsValidGUID(originator_client_item_id)) { + return specifics.guid() == originator_client_item_id; + } + + return specifics.guid() == + InferGuidForLegacyBookmark(originator_cache_guid, + originator_client_item_id); +} + } // namespace sync_bookmarks
diff --git a/components/sync_bookmarks/bookmark_specifics_conversions.h b/components/sync_bookmarks/bookmark_specifics_conversions.h index 2b7b3d3..71e46a7 100644 --- a/components/sync_bookmarks/bookmark_specifics_conversions.h +++ b/components/sync_bookmarks/bookmark_specifics_conversions.h
@@ -65,6 +65,15 @@ bool IsValidBookmarkSpecifics(const sync_pb::BookmarkSpecifics& specifics, bool is_folder); +// Checks if bookmark specifics contain a GUID that matches the value that would +// be inferred from other redundant fields. |specifics| must be valid as per +// IsValidBookmarkSpecifics(). +// TODO(crbug.com/1032052): Replace this with an analogous function that +// verifies that the bookmark's client tag hash matches the GUID. +bool HasExpectedBookmarkGuid(const sync_pb::BookmarkSpecifics& specifics, + const std::string& originator_cache_guid, + const std::string& originator_client_item_id); + } // namespace sync_bookmarks #endif // COMPONENTS_SYNC_BOOKMARKS_BOOKMARK_SPECIFICS_CONVERSIONS_H_
diff --git a/components/sync_bookmarks/bookmark_specifics_conversions_unittest.cc b/components/sync_bookmarks/bookmark_specifics_conversions_unittest.cc index a92b3707..7300db69 100644 --- a/components/sync_bookmarks/bookmark_specifics_conversions_unittest.cc +++ b/components/sync_bookmarks/bookmark_specifics_conversions_unittest.cc
@@ -78,7 +78,8 @@ sync_pb::EntitySpecifics specifics = CreateSpecificsFromBookmarkNode( node, model.get(), /*force_favicon_load=*/false); const sync_pb::BookmarkSpecifics& bm_specifics = specifics.bookmark(); - EXPECT_THAT(bm_specifics.guid(), Eq(node->guid())); + // TODO(crbug.com/978430): Update expectation once the GUID is populated. + EXPECT_FALSE(bm_specifics.has_guid()); EXPECT_THAT(bm_specifics.title(), Eq(kTitle)); EXPECT_THAT(GURL(bm_specifics.url()), Eq(kUrl)); EXPECT_THAT( @@ -401,9 +402,13 @@ sync_pb::EntitySpecifics specifics; sync_pb::BookmarkSpecifics* bm_specifics = specifics.mutable_bookmark(); + // No GUID. + bm_specifics->clear_guid(); + EXPECT_FALSE(IsValidBookmarkSpecifics(*bm_specifics, /*is_folder=*/true)); + // Add empty GUID. bm_specifics->set_guid(""); - EXPECT_TRUE(IsValidBookmarkSpecifics(*bm_specifics, /*is_folder=*/true)); + EXPECT_FALSE(IsValidBookmarkSpecifics(*bm_specifics, /*is_folder=*/true)); // Add invalid GUID. bm_specifics->set_guid("INVALID GUID");
diff --git a/components/sync_bookmarks/synced_bookmark_tracker.cc b/components/sync_bookmarks/synced_bookmark_tracker.cc index 5acee27..6e855a0b 100644 --- a/components/sync_bookmarks/synced_bookmark_tracker.cc +++ b/components/sync_bookmarks/synced_bookmark_tracker.cc
@@ -43,7 +43,11 @@ void HashSpecifics(const sync_pb::EntitySpecifics& specifics, std::string* hash) { DCHECK_GT(specifics.ByteSize(), 0); - base::Base64Encode(base::SHA1HashString(specifics.SerializeAsString()), hash); + // TODO(crbug.com/978430): Include GUID in hash when committing is supported. + sync_pb::EntitySpecifics specifics_without_guid = specifics; + specifics_without_guid.mutable_bookmark()->clear_guid(); + base::Base64Encode( + base::SHA1HashString(specifics_without_guid.SerializeAsString()), hash); } } // namespace
diff --git a/components/sync_device_info/BUILD.gn b/components/sync_device_info/BUILD.gn index 32a75909..e5ea18ff 100644 --- a/components/sync_device_info/BUILD.gn +++ b/components/sync_device_info/BUILD.gn
@@ -77,13 +77,9 @@ "fake_local_device_info_provider.h", ] - public_deps = [ - ":sync_device_info", - ] + public_deps = [ ":sync_device_info" ] - deps = [ - "//components/sync:test_support_model", - ] + deps = [ "//components/sync:test_support_model" ] } source_set("unit_tests") {
diff --git a/components/tracing/BUILD.gn b/components/tracing/BUILD.gn index f0c2452..b49f4d4 100644 --- a/components/tracing/BUILD.gn +++ b/components/tracing/BUILD.gn
@@ -37,9 +37,7 @@ defines = [ "TRACING_IMPLEMENTATION" ] - deps = [ - "//base", - ] + deps = [ "//base" ] } source_set("unit_tests") {
diff --git a/components/tracing/common/BUILD.gn b/components/tracing/common/BUILD.gn index 61d1403..9b6f707 100644 --- a/components/tracing/common/BUILD.gn +++ b/components/tracing/common/BUILD.gn
@@ -6,8 +6,6 @@ import("//mojo/public/tools/bindings/mojom.gni") mojom("interfaces") { - sources = [ - "background_tracing_agent.mojom", - ] + sources = [ "background_tracing_agent.mojom" ] cpp_only = true }
diff --git a/components/url_pattern_index/flat/BUILD.gn b/components/url_pattern_index/flat/BUILD.gn index 0b20b05..c99cf1c7 100644 --- a/components/url_pattern_index/flat/BUILD.gn +++ b/components/url_pattern_index/flat/BUILD.gn
@@ -5,7 +5,5 @@ import("//third_party/flatbuffers/flatbuffer.gni") flatbuffer("url_pattern_index") { - sources = [ - "url_pattern_index.fbs", - ] + sources = [ "url_pattern_index.fbs" ] }
diff --git a/components/url_pattern_index/proto/BUILD.gn b/components/url_pattern_index/proto/BUILD.gn index 035744e2..df3a66d 100644 --- a/components/url_pattern_index/proto/BUILD.gn +++ b/components/url_pattern_index/proto/BUILD.gn
@@ -5,7 +5,5 @@ import("//third_party/protobuf/proto_library.gni") proto_library("url_pattern_index") { - sources = [ - "rules.proto", - ] + sources = [ "rules.proto" ] }
diff --git a/components/variations/BUILD.gn b/components/variations/BUILD.gn index 3d36206..0945d0a 100644 --- a/components/variations/BUILD.gn +++ b/components/variations/BUILD.gn
@@ -95,16 +95,12 @@ } android_library("load_seed_result_enum_java") { - deps = [ - "//base:base_java", - ] + deps = [ "//base:base_java" ] srcjar_deps = [ ":load_seed_result_enum_srcjar" ] } java_cpp_enum("load_seed_result_enum_srcjar") { - sources = [ - "metrics.h", - ] + sources = [ "metrics.h" ] } } @@ -115,9 +111,7 @@ "variations_params_manager.h", ] - public_deps = [ - ":variations", - ] + public_deps = [ ":variations" ] deps = [ "field_trial_config:field_trial_config", @@ -170,9 +164,7 @@ # Convenience testing target test("variations_unittests") { - sources = [ - "//components/test/run_all_unittests.cc", - ] + sources = [ "//components/test/run_all_unittests.cc" ] deps = [ ":unit_tests", "//components/test:test_support",
diff --git a/components/variations/android/BUILD.gn b/components/variations/android/BUILD.gn index 488a6f5a..cb1f7e5 100644 --- a/components/variations/android/BUILD.gn +++ b/components/variations/android/BUILD.gn
@@ -19,9 +19,7 @@ } junit_binary("components_variations_junit_tests") { - sources = [ - "junit/src/org/chromium/components/variations/firstrun/VariationsSeedFetcherTest.java", - ] + sources = [ "junit/src/org/chromium/components/variations/firstrun/VariationsSeedFetcherTest.java" ] deps = [ ":variations_java", "//base:base_java",
diff --git a/components/variations/field_trial_config/BUILD.gn b/components/variations/field_trial_config/BUILD.gn index 02e518c4..592dba5 100644 --- a/components/variations/field_trial_config/BUILD.gn +++ b/components/variations/field_trial_config/BUILD.gn
@@ -60,16 +60,12 @@ "//ui/base", ] - public_deps = [ - "//third_party/protobuf:protobuf_lite", - ] + public_deps = [ "//third_party/protobuf:protobuf_lite" ] } source_set("unit_tests") { testonly = true - sources = [ - "field_trial_util_unittest.cc", - ] + sources = [ "field_trial_util_unittest.cc" ] deps = [ ":field_trial_config", "//base",
diff --git a/components/visitedlink/common/BUILD.gn b/components/visitedlink/common/BUILD.gn index 15c465a..47b97795 100644 --- a/components/visitedlink/common/BUILD.gn +++ b/components/visitedlink/common/BUILD.gn
@@ -9,9 +9,7 @@ "visitedlink_common.cc", "visitedlink_common.h", ] - public_deps = [ - ":interfaces", - ] + public_deps = [ ":interfaces" ] deps = [ ":interfaces", @@ -23,11 +21,7 @@ } mojom("interfaces") { - sources = [ - "visitedlink.mojom", - ] + sources = [ "visitedlink.mojom" ] - public_deps = [ - "//mojo/public/mojom/base", - ] + public_deps = [ "//mojo/public/mojom/base" ] }
diff --git a/components/visitedlink/test/BUILD.gn b/components/visitedlink/test/BUILD.gn index 8bac75b..9b79b9c 100644 --- a/components/visitedlink/test/BUILD.gn +++ b/components/visitedlink/test/BUILD.gn
@@ -4,9 +4,7 @@ source_set("unit_tests") { testonly = true - sources = [ - "visitedlink_unittest.cc", - ] + sources = [ "visitedlink_unittest.cc" ] configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
diff --git a/components/viz/service/display_embedder/skia_output_device.cc b/components/viz/service/display_embedder/skia_output_device.cc index a48a773..0379c51 100644 --- a/components/viz/service/display_embedder/skia_output_device.cc +++ b/components/viz/service/display_embedder/skia_output_device.cc
@@ -40,6 +40,11 @@ NOTIMPLEMENTED(); } +void SkiaOutputDevice::SchedulePrimaryPlane( + const OverlayProcessorInterface::OutputSurfaceOverlayPlane& plane) { + NOTIMPLEMENTED(); +} + void SkiaOutputDevice::ScheduleOverlays( SkiaOutputSurface::OverlayList overlays) { NOTIMPLEMENTED(); @@ -87,14 +92,6 @@ void SkiaOutputDevice::EnsureBackbuffer() {} void SkiaOutputDevice::DiscardBackbuffer() {} -gl::GLImage* SkiaOutputDevice::GetOverlayImage() { - return nullptr; -} - -std::unique_ptr<gfx::GpuFence> SkiaOutputDevice::SubmitOverlayGpuFence() { - return nullptr; -} - SkiaOutputDevice::SwapInfo::SwapInfo( uint64_t swap_id, SkiaOutputDevice::BufferPresentedCallback feedback)
diff --git a/components/viz/service/display_embedder/skia_output_device.h b/components/viz/service/display_embedder/skia_output_device.h index 82822077..fa619f8 100644 --- a/components/viz/service/display_embedder/skia_output_device.h +++ b/components/viz/service/display_embedder/skia_output_device.h
@@ -14,6 +14,7 @@ #include "base/optional.h" #include "build/build_config.h" #include "components/viz/service/display/output_surface.h" +#include "components/viz/service/display/overlay_processor_interface.h" #include "components/viz/service/display/skia_output_surface.h" #include "gpu/command_buffer/common/swap_buffers_complete_params.h" #include "third_party/skia/include/core/SkRefCnt.h" @@ -25,17 +26,11 @@ namespace gfx { class ColorSpace; -class GpuFence; class Rect; class Size; struct PresentationFeedback; } // namespace gfx -// TODO(crbug.com/996004): Remove this once we use BufferQueue SharedImage -// implementation. -namespace gl { -class GLImage; -} namespace gpu { class MemoryTracker; @@ -94,15 +89,19 @@ BufferPresentedCallback feedback, std::vector<ui::LatencyInfo> latency_info); - // TODO(crbug.com/996004): Should use BufferQueue SharedImage - // implementation instead of GLImage. - virtual gl::GLImage* GetOverlayImage(); - virtual std::unique_ptr<gfx::GpuFence> SubmitOverlayGpuFence(); - // Set the rectangle that will be drawn into on the surface. virtual void SetDrawRectangle(const gfx::Rect& draw_rectangle); virtual void SetGpuVSyncEnabled(bool enabled); + + // Schedule the output device's back buffer as an overlay plane. The scheduled + // primary plane will be on screen when SwapBuffers() or PostSubBuffer() is + // called. + virtual void SchedulePrimaryPlane( + const OverlayProcessorInterface::OutputSurfaceOverlayPlane& plane); + + // Schedule overlays which will be on screen when SwapBuffers() or + // PostSubBuffer() is called. virtual void ScheduleOverlays(SkiaOutputSurface::OverlayList overlays); #if defined(OS_WIN)
diff --git a/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc b/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc index 4e839810..d101e7d 100644 --- a/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc +++ b/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc
@@ -27,153 +27,142 @@ #endif namespace viz { +namespace { -static constexpr uint32_t kSharedImageUsage = +constexpr uint32_t kSharedImageUsage = gpu::SHARED_IMAGE_USAGE_SCANOUT | gpu::SHARED_IMAGE_USAGE_DISPLAY | gpu::SHARED_IMAGE_USAGE_GLES2_FRAMEBUFFER_HINT; +} // namespace + class SkiaOutputDeviceBufferQueue::Image { public: Image(gpu::SharedImageFactory* factory, - gpu::SharedImageRepresentationFactory* representation_factory); - ~Image(); + gpu::SharedImageRepresentationFactory* representation_factory) + : factory_(factory), representation_factory_(representation_factory) {} + ~Image() = default; bool Initialize(const gfx::Size& size, const gfx::ColorSpace& color_space, ResourceFormat format, SkiaOutputSurfaceDependency* deps, - uint32_t shared_image_usage); + uint32_t shared_image_usage) { + auto mailbox = gpu::Mailbox::GenerateForSharedImage(); + if (!factory_->CreateSharedImage(mailbox, format, size, color_space, + shared_image_usage)) { + DLOG(ERROR) << "CreateSharedImage failed."; + return false; + } + skia_representation_ = representation_factory_->ProduceSkia( + mailbox, deps->GetSharedContextState()); + overlay_representation_ = representation_factory_->ProduceOverlay(mailbox); - SkSurface* BeginWriteSkia(); - void EndWriteSkia(); - void BeginPresent(); - void EndPresent(); - gl::GLImage* GetGLImage() const; - std::unique_ptr<gfx::GpuFence> CreateFence(); - void ResetFence(); + // If the backing doesn't support overlay, then fallback to GL. + if (!overlay_representation_) + gl_representation_ = representation_factory_->ProduceGLTexture(mailbox); + shared_image_deletor_.ReplaceClosure(base::BindOnce( + base::IgnoreResult(&gpu::SharedImageFactory::DestroySharedImage), + base::Unretained(factory_), mailbox)); + return true; + } + + SkSurface* BeginWriteSkia() { + DCHECK(!scoped_write_access_); + DCHECK(!scoped_read_access_); + DCHECK(end_semaphores_.empty()); + + std::vector<GrBackendSemaphore> begin_semaphores; + SkSurfaceProps surface_props{0, kUnknown_SkPixelGeometry}; + + // Buffer queue is internal to GPU proc and handles texture initialization, + // so allow uncleared access. + // TODO(vasilyt): Props and MSAA + scoped_write_access_ = skia_representation_->BeginScopedWriteAccess( + 0 /* final_msaa_count */, surface_props, &begin_semaphores, + &end_semaphores_, + gpu::SharedImageRepresentation::AllowUnclearedAccess::kYes); + DCHECK(scoped_write_access_); + if (!begin_semaphores.empty()) { + scoped_write_access_->surface()->wait(begin_semaphores.size(), + begin_semaphores.data()); + } + + return scoped_write_access_->surface(); + } + + void EndWriteSkia() { + DCHECK(scoped_write_access_); + GrFlushInfo flush_info = { + .fFlags = kNone_GrFlushFlags, + .fNumSemaphores = end_semaphores_.size(), + .fSignalSemaphores = end_semaphores_.data(), + }; + scoped_write_access_->surface()->flush( + SkSurface::BackendSurfaceAccess::kNoAccess, flush_info); + scoped_write_access_.reset(); + end_semaphores_.clear(); + + // SkiaRenderer always draws the full frame. + skia_representation_->SetCleared(); + } + + void BeginPresent() { + DCHECK(!scoped_write_access_); + DCHECK(!scoped_read_access_); + DCHECK(!scoped_gl_read_access_); + + if (overlay_representation_) { + scoped_read_access_ = overlay_representation_->BeginScopedReadAccess( + true /* need_gl_image */); + DCHECK(scoped_read_access_); + return; + } + + scoped_gl_read_access_ = gl_representation_->BeginScopedAccess( + GL_SHARED_IMAGE_ACCESS_MODE_READ_CHROMIUM, + gpu::SharedImageRepresentation::AllowUnclearedAccess::kNo); + DCHECK(scoped_gl_read_access_); + } + + void EndPresent() { + scoped_read_access_.reset(); + scoped_gl_read_access_.reset(); + } + + gl::GLImage* GetGLImage(std::unique_ptr<gfx::GpuFence>* fence) { + *fence = nullptr; + + if (scoped_read_access_) + return scoped_read_access_->gl_image(); + + DCHECK(scoped_gl_read_access_); + if (auto gl_fence = gl::GLFence::CreateForGpuFence()) { + *fence = gl_fence->GetGpuFence(); + } + auto* texture = gl_representation_->GetTexture(); + return texture->GetLevelImage(texture->target(), 0); + } private: gpu::SharedImageFactory* const factory_; gpu::SharedImageRepresentationFactory* const representation_factory_; - gpu::Mailbox mailbox_; + base::ScopedClosureRunner shared_image_deletor_; std::unique_ptr<gpu::SharedImageRepresentationSkia> skia_representation_; + std::unique_ptr<gpu::SharedImageRepresentationOverlay> + overlay_representation_; std::unique_ptr<gpu::SharedImageRepresentationGLTexture> gl_representation_; std::unique_ptr<gpu::SharedImageRepresentationSkia::ScopedWriteAccess> scoped_write_access_; - std::unique_ptr<gpu::SharedImageRepresentationGLTexture::ScopedAccess> + std::unique_ptr<gpu::SharedImageRepresentationOverlay::ScopedReadAccess> scoped_read_access_; + std::unique_ptr<gpu::SharedImageRepresentationGLTexture::ScopedAccess> + scoped_gl_read_access_; std::vector<GrBackendSemaphore> end_semaphores_; - std::unique_ptr<gl::GLFence> fence_; DISALLOW_COPY_AND_ASSIGN(Image); }; -SkiaOutputDeviceBufferQueue::Image::Image( - gpu::SharedImageFactory* factory, - gpu::SharedImageRepresentationFactory* representation_factory) - : factory_(factory), representation_factory_(representation_factory) {} - -SkiaOutputDeviceBufferQueue::Image::~Image() { - scoped_read_access_.reset(); - scoped_write_access_.reset(); - skia_representation_.reset(); - gl_representation_.reset(); - - if (!mailbox_.IsZero()) - factory_->DestroySharedImage(mailbox_); -} - -bool SkiaOutputDeviceBufferQueue::Image::Initialize( - const gfx::Size& size, - const gfx::ColorSpace& color_space, - ResourceFormat format, - SkiaOutputSurfaceDependency* deps, - uint32_t shared_image_usage) { - mailbox_ = gpu::Mailbox::GenerateForSharedImage(); - if (factory_->CreateSharedImage(mailbox_, format, size, color_space, - shared_image_usage)) { - skia_representation_ = representation_factory_->ProduceSkia( - mailbox_, deps->GetSharedContextState()); - gl_representation_ = representation_factory_->ProduceGLTexture(mailbox_); - - return true; - } - - mailbox_.SetZero(); - return false; -} - -SkSurface* SkiaOutputDeviceBufferQueue::Image::BeginWriteSkia() { - DCHECK(!scoped_write_access_); - DCHECK(!scoped_read_access_); - DCHECK(end_semaphores_.empty()); - - std::vector<GrBackendSemaphore> begin_semaphores; - SkSurfaceProps surface_props{0, kUnknown_SkPixelGeometry}; - - // Buffer queue is internal to GPU proc and handles texture initialization, - // so allow uncleared access. - // TODO(vasilyt): Props and MSAA - scoped_write_access_ = skia_representation_->BeginScopedWriteAccess( - 0 /* final_msaa_count */, surface_props, &begin_semaphores, - &end_semaphores_, - gpu::SharedImageRepresentation::AllowUnclearedAccess::kYes); - DCHECK(scoped_write_access_); - if (!begin_semaphores.empty()) { - scoped_write_access_->surface()->wait(begin_semaphores.size(), - begin_semaphores.data()); - } - - return scoped_write_access_->surface(); -} - -void SkiaOutputDeviceBufferQueue::Image::EndWriteSkia() { - DCHECK(scoped_write_access_); - GrFlushInfo flush_info = { - .fFlags = kNone_GrFlushFlags, - .fNumSemaphores = end_semaphores_.size(), - .fSignalSemaphores = end_semaphores_.data(), - }; - scoped_write_access_->surface()->flush( - SkSurface::BackendSurfaceAccess::kNoAccess, flush_info); - scoped_write_access_.reset(); - end_semaphores_.clear(); - - // SkiaRenderer always draws the full frame. - skia_representation_->SetCleared(); -} - -void SkiaOutputDeviceBufferQueue::Image::BeginPresent() { - DCHECK(!scoped_write_access_); - DCHECK(!scoped_read_access_); - scoped_read_access_ = gl_representation_->BeginScopedAccess( - GL_SHARED_IMAGE_ACCESS_MODE_READ_CHROMIUM, - gpu::SharedImageRepresentation::AllowUnclearedAccess::kNo); - DCHECK(scoped_read_access_); -} - -void SkiaOutputDeviceBufferQueue::Image::EndPresent() { - DCHECK(scoped_read_access_); - scoped_read_access_.reset(); - // If the GpuFence was created for ScheduleOverlayPlane we can release it now. - fence_.reset(); - return; -} - -gl::GLImage* SkiaOutputDeviceBufferQueue::Image::GetGLImage() const { - auto* texture = gl_representation_->GetTexture(); - return texture->GetLevelImage(texture->target(), 0); -} - -std::unique_ptr<gfx::GpuFence> -SkiaOutputDeviceBufferQueue::Image::CreateFence() { - if (!fence_) - fence_ = gl::GLFence::CreateForGpuFence(); - DCHECK(fence_) << "Failed to create fence."; - return fence_->GetGpuFence(); -} - class SkiaOutputDeviceBufferQueue::OverlayData { public: OverlayData( @@ -331,24 +320,23 @@ available_images_.clear(); } -gl::GLImage* SkiaOutputDeviceBufferQueue::GetOverlayImage() { - if (current_image_) - return current_image_->GetGLImage(); - return nullptr; -} - -std::unique_ptr<gfx::GpuFence> -SkiaOutputDeviceBufferQueue::SubmitOverlayGpuFence() { +void SkiaOutputDeviceBufferQueue::SchedulePrimaryPlane( + const OverlayProcessorInterface::OutputSurfaceOverlayPlane& plane) { if (!current_image_) - return nullptr; + return; - // For vulkan, we should use fence from vulkan instead. - // TODO(https://crbug.com/1012401): don't depend on GL. - if (!dependency_->GetSharedContextState()->MakeCurrent( - nullptr /* gl_surface */, true /* needs_gl */)) { - return nullptr; - } - return current_image_->CreateFence(); + current_image_->BeginPresent(); + + std::unique_ptr<gfx::GpuFence> fence; + auto* image = current_image_->GetGLImage(&fence); + + // Output surface is also z-order 0. + constexpr int kPlaneZOrder = 0; + // Output surface always uses the full texture. + constexpr gfx::RectF kUVRect(0.f, 0.f, 1.f, 1.f); + gl_surface_->ScheduleOverlayPlane(kPlaneZOrder, plane.transform, image, + ToNearestRect(plane.display_rect), kUVRect, + plane.enable_blending, std::move(fence)); } void SkiaOutputDeviceBufferQueue::ScheduleOverlays( @@ -392,11 +380,6 @@ void SkiaOutputDeviceBufferQueue::SwapBuffers( BufferPresentedCallback feedback, std::vector<ui::LatencyInfo> latency_info) { - // BeginPain() is not called after last SwapBuffer(), if |current_image_| is - // nullptr. - if (current_image_) - current_image_->BeginPresent(); - StartSwapBuffers({}); if (gl_surface_->SupportsAsyncSwap()) { @@ -482,6 +465,7 @@ auto* image = GetCurrentImage(); return image->BeginWriteSkia(); } + void SkiaOutputDeviceBufferQueue::EndPaint( const GrBackendSemaphore& semaphore) { auto* image = GetCurrentImage();
diff --git a/components/viz/service/display_embedder/skia_output_device_buffer_queue.h b/components/viz/service/display_embedder/skia_output_device_buffer_queue.h index 55ca6ae5..2f39800 100644 --- a/components/viz/service/display_embedder/skia_output_device_buffer_queue.h +++ b/components/viz/service/display_embedder/skia_output_device_buffer_queue.h
@@ -54,9 +54,9 @@ void EndPaint(const GrBackendSemaphore& semaphore) override; bool supports_alpha() { return true; } - gl::GLImage* GetOverlayImage() override; - // Creates and submits gpu fence - std::unique_ptr<gfx::GpuFence> SubmitOverlayGpuFence() override; + void SchedulePrimaryPlane( + const OverlayProcessorInterface::OutputSurfaceOverlayPlane& plane) + override; void ScheduleOverlays(SkiaOutputSurface::OverlayList overlays) override; gl::GLSurface* gl_surface() { return gl_surface_.get(); }
diff --git a/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc b/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc index c111755..634acbe 100644 --- a/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc +++ b/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc
@@ -992,20 +992,7 @@ scoped_output_device_paint_.reset(); if (output_surface_plane_) { - if (gl::GLImage* image = output_device_->GetOverlayImage()) { - std::unique_ptr<gfx::GpuFence> gpu_fence = - output_device_->SubmitOverlayGpuFence(); - - // Output surface is also z-order 0. - int plane_z_order = 0; - // Output surface always uses the full texture. - gfx::RectF uv_rect(0.f, 0.f, 1.f, 1.f); - - gl_surface_->ScheduleOverlayPlane( - plane_z_order, output_surface_plane_->transform, image, - ToNearestRect(output_surface_plane_->display_rect), uv_rect, - output_surface_plane_->enable_blending, std::move(gpu_fence)); - } + output_device_->SchedulePrimaryPlane(output_surface_plane_.value()); output_surface_plane_.reset(); }
diff --git a/components/viz/service/surfaces/surface_manager.cc b/components/viz/service/surfaces/surface_manager.cc index c409ed88..676c30f 100644 --- a/components/viz/service/surfaces/surface_manager.cc +++ b/components/viz/service/surfaces/surface_manager.cc
@@ -448,7 +448,7 @@ RemoveTemporaryReferenceImpl(surface_id, RemovedReason::EXPIRED); } -Surface* SurfaceManager::GetSurfaceForId(const SurfaceId& surface_id) { +Surface* SurfaceManager::GetSurfaceForId(const SurfaceId& surface_id) const { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); auto it = surface_map_.find(surface_id); if (it == surface_map_.end())
diff --git a/components/viz/service/surfaces/surface_manager.h b/components/viz/service/surfaces/surface_manager.h index 6888f6c78..c52d125 100644 --- a/components/viz/service/surfaces/surface_manager.h +++ b/components/viz/service/surfaces/surface_manager.h
@@ -87,7 +87,7 @@ void MarkSurfaceForDestruction(const SurfaceId& surface_id); // Returns a Surface corresponding to the provided |surface_id|. - Surface* GetSurfaceForId(const SurfaceId& surface_id); + Surface* GetSurfaceForId(const SurfaceId& surface_id) const; void AddObserver(SurfaceObserver* obs) { observer_list_.AddObserver(obs); }
diff --git a/components/webrtc_logging/browser/BUILD.gn b/components/webrtc_logging/browser/BUILD.gn index 1121490..3fe701dc 100644 --- a/components/webrtc_logging/browser/BUILD.gn +++ b/components/webrtc_logging/browser/BUILD.gn
@@ -19,9 +19,7 @@ source_set("unit_tests") { testonly = true - sources = [ - "log_cleanup_unittest.cc", - ] + sources = [ "log_cleanup_unittest.cc" ] deps = [ ":browser", "//base",
diff --git a/components/webrtc_logging/common/BUILD.gn b/components/webrtc_logging/common/BUILD.gn index 34ff3156..1a47354 100644 --- a/components/webrtc_logging/common/BUILD.gn +++ b/components/webrtc_logging/common/BUILD.gn
@@ -8,16 +8,12 @@ "partial_circular_buffer.h", ] - deps = [ - "//base", - ] + deps = [ "//base" ] } source_set("unit_tests") { testonly = true - sources = [ - "partial_circular_buffer_unittest.cc", - ] + sources = [ "partial_circular_buffer_unittest.cc" ] deps = [ ":common", "//base",
diff --git a/content/BUILD.gn b/content/BUILD.gn index d5a0c31..f99e974 100644 --- a/content/BUILD.gn +++ b/content/BUILD.gn
@@ -136,9 +136,7 @@ source_set("export") { # Must only be used inside of content. visibility = [ "//content/*" ] - sources = [ - "common/content_export.h", - ] + sources = [ "common/content_export.h" ] } # In the GYP build, this file is listed in several targets. In GN just have @@ -151,8 +149,6 @@ "public/app/sandbox_helper_win.h", ] - deps = [ - "//sandbox", - ] + deps = [ "//sandbox" ] } }
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 30a3aac..209829f3 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -2644,13 +2644,9 @@ "//content/public/test/*", ] if (!is_component_build) { - public_deps = [ - ":browser", - ] + public_deps = [ ":browser" ] } else { - public_deps = [ - "//third_party/leveldatabase", - ] + public_deps = [ "//third_party/leveldatabase" ] } } @@ -2658,8 +2654,6 @@ group("for_internal_webauthn") { visibility = [ "//components/autofill/content/browser/webauthn" ] if (!is_component_build) { - public_deps = [ - ":browser", - ] + public_deps = [ ":browser" ] } }
diff --git a/content/browser/appcache/appcache_manifest_parser.cc b/content/browser/appcache/appcache_manifest_parser.cc index abc87d2b..ab88490 100644 --- a/content/browser/appcache/appcache_manifest_parser.cc +++ b/content/browser/appcache/appcache_manifest_parser.cc
@@ -188,17 +188,6 @@ return Mode::kUnknown; } -// True if the next token in the manifest line is the pattern indicator flag. -// -// Pattern URLs are a non-standard feature. -bool NextTokenIsPatternMatchingFlag(base::StringPiece line) { - base::StringPiece is_pattern_token; - std::tie(is_pattern_token, line) = SplitLineToken(line); - - static constexpr base::StringPiece kPatternFlag("isPattern"); - return is_pattern_token == kPatternFlag; -} - // Parses a URL token in an AppCache manifest. // // The returned URL may not be valid, if the token does not represent a valid @@ -549,16 +538,9 @@ continue; } - // Chrome supports URL patterns in manifests. This is not standardized. - // An URL record followed by the "isPattern" token is considered a - // pattern. - - bool is_pattern = NextTokenIsPatternMatchingFlag(line); - if (is_pattern) - parse_metrics.RecordNetworkPattern(); - - manifest.online_whitelist_namespaces.emplace_back(AppCacheNamespace( - APPCACHE_NETWORK_NAMESPACE, namespace_url, GURL(), is_pattern)); + manifest.online_whitelist_namespaces.emplace_back( + AppCacheNamespace(APPCACHE_NETWORK_NAMESPACE, namespace_url, GURL(), + /*is_pattern=*/false)); continue; } @@ -598,12 +580,9 @@ if (manifest_url.GetOrigin() != target_url.GetOrigin()) continue; - bool is_pattern = NextTokenIsPatternMatchingFlag(line); - if (is_pattern) - parse_metrics.RecordInterceptPattern(); - - manifest.intercept_namespaces.emplace_back( - APPCACHE_INTERCEPT_NAMESPACE, namespace_url, target_url, is_pattern); + manifest.intercept_namespaces.emplace_back(APPCACHE_INTERCEPT_NAMESPACE, + namespace_url, target_url, + /*is_pattern=*/false); parse_metrics.RecordInterceptEntry(); continue; } @@ -635,14 +614,11 @@ if (manifest_url.GetOrigin() != fallback_url.GetOrigin()) continue; - bool is_pattern = NextTokenIsPatternMatchingFlag(line); - if (is_pattern) - parse_metrics.RecordFallbackPattern(); - // Store regardless of duplicate namespace URL. Only the first match will // ever be used. - manifest.fallback_namespaces.emplace_back( - APPCACHE_FALLBACK_NAMESPACE, namespace_url, fallback_url, is_pattern); + manifest.fallback_namespaces.emplace_back(APPCACHE_FALLBACK_NAMESPACE, + namespace_url, fallback_url, + /*is_pattern=*/false); continue; }
diff --git a/content/browser/appcache/appcache_manifest_parser_unittest.cc b/content/browser/appcache/appcache_manifest_parser_unittest.cc index cb7080c..0c85bc7 100644 --- a/content/browser/appcache/appcache_manifest_parser_unittest.cc +++ b/content/browser/appcache/appcache_manifest_parser_unittest.cc
@@ -739,12 +739,12 @@ EXPECT_EQ(APPCACHE_NETWORK_NAMESPACE, manifest.online_whitelist_namespaces[0].type); EXPECT_FALSE(manifest.intercept_namespaces[0].is_pattern); - EXPECT_TRUE(manifest.intercept_namespaces[1].is_pattern); - EXPECT_TRUE(manifest.intercept_namespaces[2].is_pattern); + EXPECT_FALSE(manifest.intercept_namespaces[1].is_pattern); + EXPECT_FALSE(manifest.intercept_namespaces[2].is_pattern); EXPECT_FALSE(manifest.fallback_namespaces[0].is_pattern); - EXPECT_TRUE(manifest.fallback_namespaces[1].is_pattern); + EXPECT_FALSE(manifest.fallback_namespaces[1].is_pattern); EXPECT_FALSE(manifest.online_whitelist_namespaces[0].is_pattern); - EXPECT_TRUE(manifest.online_whitelist_namespaces[1].is_pattern); + EXPECT_FALSE(manifest.online_whitelist_namespaces[1].is_pattern); EXPECT_EQ( GURL("http://foo.com/*/intercept_pattern?query"), manifest.intercept_namespaces[2].namespace_url); @@ -879,7 +879,7 @@ 0}, {"NETWORK:\r*\r", 1, 0}, {"NETWORK:\rhttp://foo.com/network\r", 1, 0}, - {"NETWORK:\rhttp://foo.com/network_pattern* isPattern\r", 0, 1}, + {"NETWORK:\rhttp://foo.com/network_pattern* isPattern\r", 1, 0}, {"CHROMIUM-INTERCEPT:\rhttp://foo.com/intercept return /url\r", 1, 0}, {"CHROMIUM-INTERCEPT:\r" "http://foo.com/intercept* return /pattern isPattern\r", @@ -913,8 +913,8 @@ } test_cases[] = { {"", 1, 0}, {"FALLBACK:\rhttp://foo.com/fallback /url\r", 1, 0}, - {"FALLBACK:\rhttp://foo.com/fallback_pattern* /pattern isPattern\r", 0, - 1}, + {"FALLBACK:\rhttp://foo.com/fallback_pattern* /pattern isPattern\r", 1, + 0}, {"NETWORK:\r*\r", 1, 0}, {"NETWORK:\rhttp://foo.com/network\r", 1, 0}, {"NETWORK:\rhttp://foo.com/network_pattern* isPattern\r", 1, 0}, @@ -955,7 +955,7 @@ 0}, {"FALLBACK:\rhttp://foo.com/scope/fallback /url\r", 1, 0}, {"FALLBACK:\rhttp://foo.com/scope/fallback_pattern* /pattern isPattern\r", - 0, 1}, + 1, 0}, {"NETWORK:\r*\r", 1, 0}, {"NETWORK:\rhttp://foo.com/network\r", 1, 0}, {"NETWORK:\rhttp://foo.com/network_pattern* isPattern\r", 1, 0}, @@ -1007,7 +1007,7 @@ {"CHROMIUM-INTERCEPT:\rhttp://foo.com/intercept return /url\r", 0, 1, 0}, {"CHROMIUM-INTERCEPT:\r" "http://foo.com/intercept* return /pattern isPattern\r", - 0, 0, 1}, + 0, 1, 0}, }; for (const auto& test_case : test_cases) { @@ -1054,7 +1054,7 @@ 0, 1, 0}, {"CHROMIUM-INTERCEPT:\r" "http://foo.com/scope/intercept* return /pattern isPattern\r", - 0, 0, 1}, + 0, 1, 0}, }; for (const auto& test_case : test_cases) { @@ -1086,21 +1086,21 @@ } test_cases[] = { {"", 1, 0}, {"FALLBACK:\rhttp://foo.com/fallback /url\r", 1, 0}, - {"FALLBACK:\rhttp://foo.com/fallback_pattern* /pattern isPattern\r", 0, - 1}, - {"FALLBACK:\rhttp://foo.com/scope /pattern isPattern\r", 0, 1}, + {"FALLBACK:\rhttp://foo.com/fallback_pattern* /pattern isPattern\r", 1, + 0}, + {"FALLBACK:\rhttp://foo.com/scope /pattern isPattern\r", 1, 0}, {"FALLBACK:\rhttp://foo.com/scope/fallback_pattern* /pattern isPattern\r", - 0, 1}, + 1, 0}, {"FALLBACK:\rhttp://foo.com/scope/foo/fallback_pattern* /pattern " "isPattern\r", - 0, 1}, + 1, 0}, {"NETWORK:\r*\r", 1, 0}, {"NETWORK:\rhttp://foo.com/network\r", 1, 0}, - {"NETWORK:\rhttp://foo.com/network_pattern* isPattern\r", 0, 1}, + {"NETWORK:\rhttp://foo.com/network_pattern* isPattern\r", 1, 0}, {"CHROMIUM-INTERCEPT:\rhttp://foo.com/intercept return /url\r", 1, 0}, {"CHROMIUM-INTERCEPT:\r" "http://foo.com/intercept* return /pattern isPattern\r", - 0, 1}, + 1, 0}, }; for (const auto& test_case : test_cases) { @@ -1134,13 +1134,13 @@ 0}, {"FALLBACK:\rhttp://foo.com/scope /pattern isPattern\r", 1, 0}, {"FALLBACK:\rhttp://foo.com/scope/fallback_pattern* /pattern isPattern\r", - 0, 1}, + 1, 0}, {"FALLBACK:\rhttp://foo.com/scope/foo/fallback_pattern* /pattern " "isPattern\r", - 0, 1}, + 1, 0}, {"NETWORK:\r*\r", 1, 0}, {"NETWORK:\rhttp://foo.com/network\r", 1, 0}, - {"NETWORK:\rhttp://foo.com/network_pattern* isPattern\r", 0, 1}, + {"NETWORK:\rhttp://foo.com/network_pattern* isPattern\r", 1, 0}, {"CHROMIUM-INTERCEPT:\rhttp://foo.com/intercept return /url\r", 1, 0}, {"CHROMIUM-INTERCEPT:\r" "http://foo.com/intercept* return /pattern isPattern\r", @@ -1152,7 +1152,7 @@ {"CHROMIUM-INTERCEPT:\rhttp://foo.com/scope/x return /url\r", 1, 0}, {"CHROMIUM-INTERCEPT:\r" "http://foo.com/scope/x* return /pattern isPattern\r", - 0, 1}, + 1, 0}, }; for (const auto& test_case : test_cases) {
diff --git a/content/browser/appcache/appcache_namespace.h b/content/browser/appcache/appcache_namespace.h index 709d5ce1..b08f9a4 100644 --- a/content/browser/appcache/appcache_namespace.h +++ b/content/browser/appcache/appcache_namespace.h
@@ -29,9 +29,12 @@ AppCacheNamespaceType type; GURL namespace_url; GURL target_url; + + // TODO(jsbell): Remove pattern support, since it has been removed from the + // parser already. bool is_pattern; }; } // namespace content -#endif // CONTENT_BROWSER_APPCACHE_APPCACHE_NAMESPACE_H_ \ No newline at end of file +#endif // CONTENT_BROWSER_APPCACHE_APPCACHE_NAMESPACE_H_
diff --git a/content/browser/appcache/appcache_unittest.cc b/content/browser/appcache/appcache_unittest.cc index 4195086..f65b8ea 100644 --- a/content/browser/appcache/appcache_unittest.cc +++ b/content/browser/appcache/appcache_unittest.cc
@@ -574,7 +574,7 @@ cache->InitializeWithManifest(&manifest); EXPECT_EQ(APPCACHE_NETWORK_NAMESPACE, cache->online_whitelist_namespaces_[0].type); - EXPECT_TRUE(cache->online_whitelist_namespaces_[0].is_pattern); + EXPECT_FALSE(cache->online_whitelist_namespaces_[0].is_pattern); EXPECT_EQ(kWhitelistUrl, cache->online_whitelist_namespaces_[0].namespace_url); cache->AddEntry(kManifestUrl, AppCacheEntry(AppCacheEntry::MANIFEST, @@ -631,7 +631,7 @@ EXPECT_EQ(0 + 10 + 100, cache->padding_size()); EXPECT_EQ(APPCACHE_NETWORK_NAMESPACE, cache->online_whitelist_namespaces_[0].type); - EXPECT_TRUE(cache->online_whitelist_namespaces_[0].is_pattern); + EXPECT_FALSE(cache->online_whitelist_namespaces_[0].is_pattern); EXPECT_EQ(kWhitelistUrl, cache->online_whitelist_namespaces_[0].namespace_url); }
diff --git a/content/browser/dom_storage/dom_storage_context_wrapper.cc b/content/browser/dom_storage/dom_storage_context_wrapper.cc index e83cb0c5c..21a2542 100644 --- a/content/browser/dom_storage/dom_storage_context_wrapper.cc +++ b/content/browser/dom_storage/dom_storage_context_wrapper.cc
@@ -363,7 +363,7 @@ DCHECK(local_storage_control_); local_storage_control_->BindStorageArea(origin, std::move(receiver)); if (storage_policy_) { - EnsureLocalStorageOriginIsTracked(origin.GetURL()); + EnsureLocalStorageOriginIsTracked(origin); OnStoragePolicyChanged(); } } @@ -452,12 +452,12 @@ void DOMStorageContextWrapper::OnStartupUsageRetrieved( std::vector<storage::mojom::LocalStorageUsageInfoPtr> usage) { for (const auto& info : usage) - EnsureLocalStorageOriginIsTracked(info->origin.GetURL()); + EnsureLocalStorageOriginIsTracked(info->origin); OnStoragePolicyChanged(); } void DOMStorageContextWrapper::EnsureLocalStorageOriginIsTracked( - const GURL& origin) { + const url::Origin& origin) { DCHECK(storage_policy_); auto it = local_storage_origins_.find(origin); if (it == local_storage_origins_.end()) @@ -472,13 +472,13 @@ // managing. std::vector<storage::mojom::LocalStoragePolicyUpdatePtr> policy_updates; for (auto& entry : local_storage_origins_) { - const GURL& origin = entry.first; + const url::Origin& origin = entry.first; LocalStorageOriginState& state = entry.second; state.should_purge_on_shutdown = ShouldPurgeLocalStorageOnShutdown(origin); if (state.should_purge_on_shutdown != state.will_purge_on_shutdown) { state.will_purge_on_shutdown = state.should_purge_on_shutdown; policy_updates.push_back(storage::mojom::LocalStoragePolicyUpdate::New( - url::Origin::Create(origin), state.should_purge_on_shutdown)); + origin, state.should_purge_on_shutdown)); } } @@ -487,11 +487,11 @@ } bool DOMStorageContextWrapper::ShouldPurgeLocalStorageOnShutdown( - const GURL& origin) { + const url::Origin& origin) { if (!storage_policy_) return false; - return storage_policy_->IsStorageSessionOnly(origin) && - !storage_policy_->IsStorageProtected(origin); + return storage_policy_->IsStorageSessionOnly(origin.GetURL()) && + !storage_policy_->IsStorageProtected(origin.GetURL()); } } // namespace content
diff --git a/content/browser/dom_storage/dom_storage_context_wrapper.h b/content/browser/dom_storage/dom_storage_context_wrapper.h index ef3a482..4b78177 100644 --- a/content/browser/dom_storage/dom_storage_context_wrapper.h +++ b/content/browser/dom_storage/dom_storage_context_wrapper.h
@@ -140,9 +140,9 @@ void OnStartupUsageRetrieved( std::vector<storage::mojom::LocalStorageUsageInfoPtr> usage); - void EnsureLocalStorageOriginIsTracked(const GURL& origin); + void EnsureLocalStorageOriginIsTracked(const url::Origin& origin); void OnStoragePolicyChanged(); - bool ShouldPurgeLocalStorageOnShutdown(const GURL& origin); + bool ShouldPurgeLocalStorageOnShutdown(const url::Origin& origin); // Keep all mojo-ish details together and not bleed them through the public // interface. The |mojo_session_state_| object is owned by this object, but @@ -193,7 +193,7 @@ bool will_purge_on_shutdown = false; }; // NOTE: The GURL key is specifically an origin GURL. - std::map<GURL, LocalStorageOriginState> local_storage_origins_; + std::map<url::Origin, LocalStorageOriginState> local_storage_origins_; DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextWrapper); };
diff --git a/content/browser/service_worker/BUILD.gn b/content/browser/service_worker/BUILD.gn index e3f3f91..6080b13b 100644 --- a/content/browser/service_worker/BUILD.gn +++ b/content/browser/service_worker/BUILD.gn
@@ -5,7 +5,5 @@ import("//third_party/protobuf/proto_library.gni") proto_library("service_worker_proto") { - sources = [ - "service_worker_database.proto", - ] + sources = [ "service_worker_database.proto" ] }
diff --git a/content/browser/service_worker/service_worker_container_host.cc b/content/browser/service_worker/service_worker_container_host.cc index 77453de2..74017495 100644 --- a/content/browser/service_worker/service_worker_container_host.cc +++ b/content/browser/service_worker/service_worker_container_host.cc
@@ -291,7 +291,7 @@ TRACE_EVENT_ASYNC_BEGIN1("ServiceWorker", "ServiceWorkerContainerHost::GetRegistration", trace_id, "Client URL", client_url.spec()); - context_->storage()->FindRegistrationForClientUrl( + context_->registry()->FindRegistrationForClientUrl( client_url, base::AdaptCallbackForRepeating(base::BindOnce( &ServiceWorkerContainerHost::GetRegistrationComplete,
diff --git a/content/browser/service_worker/service_worker_container_host.h b/content/browser/service_worker/service_worker_container_host.h index c5af9197..8d6ff05 100644 --- a/content/browser/service_worker/service_worker_container_host.h +++ b/content/browser/service_worker/service_worker_container_host.h
@@ -506,7 +506,7 @@ blink::ServiceWorkerStatusCode status, const std::string& status_message, int64_t registration_id); - // Callback for ServiceWorkerStorage::FindRegistrationForClientUrl(). + // Callback for ServiceWorkerRegistry::FindRegistrationForClientUrl(). void GetRegistrationComplete( GetRegistrationCallback callback, int64_t trace_id,
diff --git a/content/browser/service_worker/service_worker_context_core.cc b/content/browser/service_worker/service_worker_context_core.cc index 1e3101b..2c7d80c 100644 --- a/content/browser/service_worker/service_worker_context_core.cc +++ b/content/browser/service_worker/service_worker_context_core.cc
@@ -284,11 +284,12 @@ ServiceWorkerContextWrapper* wrapper) : wrapper_(wrapper), container_host_by_uuid_(std::make_unique<ContainerHostByClientUUIDMap>()), - registry_(ServiceWorkerRegistry::Create(user_data_directory, - this, - std::move(database_task_runner), - quota_manager_proxy, - special_storage_policy)), + registry_(std::make_unique<ServiceWorkerRegistry>( + user_data_directory, + this, + std::move(database_task_runner), + quota_manager_proxy, + special_storage_policy)), job_coordinator_(std::make_unique<ServiceWorkerJobCoordinator>(this)), loader_factory_getter_(url_loader_factory_getter), force_update_on_page_load_(false), @@ -307,9 +308,9 @@ ServiceWorkerContextWrapper* wrapper) : wrapper_(wrapper), container_host_by_uuid_(old_context->container_host_by_uuid_.release()), - registry_(ServiceWorkerRegistry::CreateForDeleteAndStartOver( - this, - old_context->registry())), + registry_( + std::make_unique<ServiceWorkerRegistry>(this, + old_context->registry())), job_coordinator_(std::make_unique<ServiceWorkerJobCoordinator>(this)), loader_factory_getter_(old_context->loader_factory_getter()), loader_factory_bundle_for_update_check_( @@ -727,7 +728,7 @@ void ServiceWorkerContextCore::CheckHasServiceWorker( const GURL& url, ServiceWorkerContext::CheckHasServiceWorkerCallback callback) { - storage()->FindRegistrationForClientUrl( + registry()->FindRegistrationForClientUrl( url, base::BindOnce(&ServiceWorkerContextCore:: DidFindRegistrationForCheckHasServiceWorker, AsWeakPtr(), std::move(callback))); @@ -739,7 +740,7 @@ auto checker = std::make_unique<ServiceWorkerOfflineCapabilityChecker>(url); ServiceWorkerOfflineCapabilityChecker* checker_rawptr = checker.get(); checker_rawptr->Start( - storage(), + registry(), // Bind unique_ptr to the |callback| so that // ServiceWorkerOfflineCapabilityChecker outlives |callback| and is surely // freed when |callback| is called.
diff --git a/content/browser/service_worker/service_worker_context_core_unittest.cc b/content/browser/service_worker/service_worker_context_core_unittest.cc index 61a2e25..6a9ee7f 100644 --- a/content/browser/service_worker/service_worker_context_core_unittest.cc +++ b/content/browser/service_worker/service_worker_context_core_unittest.cc
@@ -81,11 +81,11 @@ EXPECT_TRUE(registration->active_version()); } - // Wrapper for ServiceWorkerStorage::FindRegistrationForScope. + // Wrapper for ServiceWorkerRegistry::FindRegistrationForScope. blink::ServiceWorkerStatusCode FindRegistrationForScope(const GURL& scope) { base::RunLoop loop; blink::ServiceWorkerStatusCode status; - context()->storage()->FindRegistrationForScope( + context()->registry()->FindRegistrationForScope( scope, base::BindLambdaForTesting( [&](blink::ServiceWorkerStatusCode result_status,
diff --git a/content/browser/service_worker/service_worker_context_unittest.cc b/content/browser/service_worker/service_worker_context_unittest.cc index 7a4b2f7..0b0b9e7 100644 --- a/content/browser/service_worker/service_worker_context_unittest.cc +++ b/content/browser/service_worker/service_worker_context_unittest.cc
@@ -589,7 +589,7 @@ EXPECT_EQ(scope, notifications_[1].scope); EXPECT_EQ(registration_id, notifications_[1].registration_id); - context()->storage()->FindRegistrationForId( + context()->registry()->FindRegistrationForId( registration_id, scope.GetOrigin(), base::BindOnce(&ExpectRegisteredWorkers, blink::ServiceWorkerStatusCode::kOk, @@ -639,7 +639,7 @@ EXPECT_EQ(scope, notifications_[0].scope); EXPECT_EQ(registration_id, notifications_[0].registration_id); - context()->storage()->FindRegistrationForId( + context()->registry()->FindRegistrationForId( registration_id, scope.GetOrigin(), base::BindOnce(&ExpectRegisteredWorkers, blink::ServiceWorkerStatusCode::kErrorNotFound, @@ -690,7 +690,7 @@ EXPECT_EQ(scope, notifications_[1].scope); EXPECT_EQ(registration_id, notifications_[1].registration_id); - context()->storage()->FindRegistrationForId( + context()->registry()->FindRegistrationForId( registration_id, scope.GetOrigin(), base::BindOnce(&ExpectRegisteredWorkers, blink::ServiceWorkerStatusCode::kOk, @@ -723,7 +723,7 @@ base::RunLoop().RunUntilIdle(); ASSERT_TRUE(called); - context()->storage()->FindRegistrationForId( + context()->registry()->FindRegistrationForId( registration_id, scope.GetOrigin(), base::BindOnce(&ExpectRegisteredWorkers, blink::ServiceWorkerStatusCode::kErrorNotFound, @@ -822,23 +822,23 @@ base::RunLoop().RunUntilIdle(); ASSERT_TRUE(called); - context()->storage()->FindRegistrationForId( + context()->registry()->FindRegistrationForId( registration_id1, origin1_s1.GetOrigin(), base::BindOnce(&ExpectRegisteredWorkers, blink::ServiceWorkerStatusCode::kErrorNotFound, false /* expect_waiting */, false /* expect_active */)); - context()->storage()->FindRegistrationForId( + context()->registry()->FindRegistrationForId( registration_id2, origin1_s2.GetOrigin(), base::BindOnce(&ExpectRegisteredWorkers, blink::ServiceWorkerStatusCode::kErrorNotFound, false /* expect_waiting */, false /* expect_active */)); - context()->storage()->FindRegistrationForId( + context()->registry()->FindRegistrationForId( registration_id3, origin2_s1.GetOrigin(), base::BindOnce(&ExpectRegisteredWorkers, blink::ServiceWorkerStatusCode::kOk, false /* expect_waiting */, true /* expect_active */)); - context()->storage()->FindRegistrationForId( + context()->registry()->FindRegistrationForId( registration_id4, origin3_s1.GetOrigin(), base::BindOnce(&ExpectRegisteredWorkers, blink::ServiceWorkerStatusCode::kOk, @@ -1101,7 +1101,7 @@ content::RunAllTasksUntilIdle(); EXPECT_TRUE(called); - context()->storage()->FindRegistrationForId( + context()->registry()->FindRegistrationForId( registration_id, scope.GetOrigin(), base::BindOnce(&ExpectRegisteredWorkers, blink::ServiceWorkerStatusCode::kOk, @@ -1112,7 +1112,7 @@ // The storage is disabled while the recovery process is running, so the // operation should be aborted. - context()->storage()->FindRegistrationForId( + context()->registry()->FindRegistrationForId( registration_id, scope.GetOrigin(), base::BindOnce(&ExpectRegisteredWorkers, blink::ServiceWorkerStatusCode::kErrorAbort, @@ -1121,7 +1121,7 @@ // The context started over and the storage was re-initialized, so the // registration should not be found. - context()->storage()->FindRegistrationForId( + context()->registry()->FindRegistrationForId( registration_id, scope.GetOrigin(), base::BindOnce(&ExpectRegisteredWorkers, blink::ServiceWorkerStatusCode::kErrorNotFound, @@ -1137,7 +1137,7 @@ content::RunAllTasksUntilIdle(); EXPECT_TRUE(called); - context()->storage()->FindRegistrationForId( + context()->registry()->FindRegistrationForId( registration_id, scope.GetOrigin(), base::BindOnce(&ExpectRegisteredWorkers, blink::ServiceWorkerStatusCode::kOk,
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc index aff5d08..08ce3f7 100644 --- a/content/browser/service_worker/service_worker_context_wrapper.cc +++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -950,7 +950,7 @@ blink::ServiceWorkerStatusCode::kErrorAbort, nullptr)); return; } - context_core_->storage()->FindRegistrationForClientUrl( + context_core_->registry()->FindRegistrationForClientUrl( net::SimplifyUrlForRequest(client_url), base::BindOnce( &ServiceWorkerContextWrapper::DidFindRegistrationForFindReady, this, @@ -1006,7 +1006,7 @@ blink::ServiceWorkerStatusCode::kErrorAbort, nullptr)); return; } - context_core_->storage()->FindRegistrationForId( + context_core_->registry()->FindRegistrationForId( registration_id, origin.GetOrigin(), base::BindOnce( &ServiceWorkerContextWrapper::DidFindRegistrationForFindReady, this, @@ -1035,7 +1035,7 @@ blink::ServiceWorkerStatusCode::kErrorAbort, nullptr)); return; } - context_core_->storage()->FindRegistrationForIdOnly( + context_core_->registry()->FindRegistrationForIdOnly( registration_id, base::BindOnce( &ServiceWorkerContextWrapper::DidFindRegistrationForFindReady, this, @@ -1413,7 +1413,7 @@ blink::ServiceWorkerStatusCode::kErrorAbort)); return; } - context_core_->storage()->FindRegistrationForScope( + context_core_->registry()->FindRegistrationForScope( net::SimplifyUrlForRequest(scope), base::BindOnce(&StartActiveWorkerOnCoreThread, std::move(callback))); } @@ -1428,7 +1428,7 @@ } if (!context_core_) return; - context_core_->storage()->FindRegistrationForScope( + context_core_->registry()->FindRegistrationForScope( net::SimplifyUrlForRequest(scope), base::BindOnce(&SkipWaitingWorkerOnCoreThread)); } @@ -1443,7 +1443,7 @@ } if (!context_core_) return; - context_core_->storage()->FindRegistrationForScope( + context_core_->registry()->FindRegistrationForScope( net::SimplifyUrlForRequest(scope), base::BindOnce(&ServiceWorkerContextWrapper::DidFindRegistrationForUpdate, this)); @@ -1523,7 +1523,7 @@ blink::ServiceWorkerStatusCode::kErrorAbort, nullptr)); return; } - context_core_->storage()->FindRegistrationForScope( + context_core_->registry()->FindRegistrationForScope( net::SimplifyUrlForRequest(scope), base::BindOnce( &ServiceWorkerContextWrapper::DidFindRegistrationForFindImpl, this, @@ -1734,7 +1734,7 @@ std::move(callback).Run(StartServiceWorkerForNavigationHintResult::FAILED); return; } - context_core_->storage()->FindRegistrationForClientUrl( + context_core_->registry()->FindRegistrationForClientUrl( net::SimplifyUrlForRequest(document_url), base::BindOnce( &ServiceWorkerContextWrapper::DidFindRegistrationForNavigationHint,
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler.cc b/content/browser/service_worker/service_worker_controllee_request_handler.cc index 9ae71aa6..779ac90 100644 --- a/content/browser/service_worker/service_worker_controllee_request_handler.cc +++ b/content/browser/service_worker/service_worker_controllee_request_handler.cc
@@ -164,7 +164,7 @@ resource_context_ = resource_context; // Look up a registration. - context_->storage()->FindRegistrationForClientUrl( + context_->registry()->FindRegistrationForClientUrl( stripped_url_, base::BindOnce( &ServiceWorkerControlleeRequestHandler::ContinueWithRegistration, @@ -497,7 +497,7 @@ !original_registration->installing_version()) { // Update failed. Look up the registration again since the original // registration was possibly unregistered in the meantime. - context_->storage()->FindRegistrationForClientUrl( + context_->registry()->FindRegistrationForClientUrl( stripped_url_, base::BindOnce( &ServiceWorkerControlleeRequestHandler::ContinueWithRegistration, @@ -553,7 +553,7 @@ // When the status is REDUNDANT, the update failed (eg: script error), we // continue with the incumbent version. // In case unregister job may have run, look up the registration again. - context_->storage()->FindRegistrationForClientUrl( + context_->registry()->FindRegistrationForClientUrl( stripped_url_, base::BindOnce( &ServiceWorkerControlleeRequestHandler::ContinueWithRegistration,
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc index bc10d7b..93c11a0 100644 --- a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc +++ b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc
@@ -337,7 +337,7 @@ version_->set_fetch_handler_existence( ServiceWorkerVersion::FetchHandlerExistence::EXISTS); registration_->SetInstallingVersion(version_); - context()->storage()->NotifyInstallingRegistration(registration_.get()); + context()->registry()->NotifyInstallingRegistration(registration_.get()); // Conduct a main resource load. ServiceWorkerRequestTestResources test_resources(
diff --git a/content/browser/service_worker/service_worker_job_unittest.cc b/content/browser/service_worker/service_worker_job_unittest.cc index 1ed1949..9c98474 100644 --- a/content/browser/service_worker/service_worker_job_unittest.cc +++ b/content/browser/service_worker/service_worker_job_unittest.cc
@@ -167,6 +167,7 @@ ServiceWorkerJobCoordinator* job_coordinator() const { return context()->job_coordinator(); } + ServiceWorkerRegistry* registry() const { return context()->registry(); } ServiceWorkerStorage* storage() const { return context()->storage(); } protected: @@ -235,7 +236,7 @@ blink::ServiceWorkerStatusCode expected_status) { scoped_refptr<ServiceWorkerRegistration> registration; base::RunLoop run_loop; - storage()->FindRegistrationForScope( + registry()->FindRegistrationForScope( scope, SaveFoundRegistration(expected_status, ®istration, run_loop.QuitClosure())); run_loop.Run(); @@ -261,12 +262,12 @@ base::RunLoop run_loop; base::RepeatingClosure barrier_closure = base::BarrierClosure(2, run_loop.QuitClosure()); - storage()->FindRegistrationForClientUrl( + registry()->FindRegistrationForClientUrl( GURL("https://www.example.com/"), SaveFoundRegistration(blink::ServiceWorkerStatusCode::kOk, ®istration1, barrier_closure)); scoped_refptr<ServiceWorkerRegistration> registration2; - storage()->FindRegistrationForClientUrl( + registry()->FindRegistrationForClientUrl( GURL("https://www.example.com/"), SaveFoundRegistration(blink::ServiceWorkerStatusCode::kOk, ®istration2, barrier_closure)); @@ -289,13 +290,13 @@ base::RunLoop run_loop; base::RepeatingClosure barrier_closure = base::BarrierClosure(2, run_loop.QuitClosure()); - storage()->FindRegistrationForClientUrl( + registry()->FindRegistrationForClientUrl( GURL("https://www.example.com/one"), SaveFoundRegistration(blink::ServiceWorkerStatusCode::kOk, ®istration1, barrier_closure)); scoped_refptr<ServiceWorkerRegistration> registration2; - storage()->FindRegistrationForClientUrl( + registry()->FindRegistrationForClientUrl( GURL("https://www.example.com/two"), SaveFoundRegistration(blink::ServiceWorkerStatusCode::kOk, ®istration2, barrier_closure)); @@ -320,11 +321,11 @@ base::RunLoop run_loop; base::RepeatingClosure barrier_closure = base::BarrierClosure(2, run_loop.QuitClosure()); - storage()->FindRegistrationForClientUrl( + registry()->FindRegistrationForClientUrl( scope1, SaveFoundRegistration(blink::ServiceWorkerStatusCode::kOk, ®istration1, barrier_closure)); scoped_refptr<ServiceWorkerRegistration> registration2; - storage()->FindRegistrationForClientUrl( + registry()->FindRegistrationForClientUrl( scope2, SaveFoundRegistration(blink::ServiceWorkerStatusCode::kOk, ®istration2, barrier_closure));
diff --git a/content/browser/service_worker/service_worker_offline_capability_check_browsertest.cc b/content/browser/service_worker/service_worker_offline_capability_check_browsertest.cc index edce4d3..08b30a97 100644 --- a/content/browser/service_worker/service_worker_offline_capability_check_browsertest.cc +++ b/content/browser/service_worker/service_worker_offline_capability_check_browsertest.cc
@@ -223,7 +223,7 @@ void SetupFetchEventDispatchTargetVersionOnCoreThread( base::OnceClosure done) { DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId()); - wrapper()->context()->storage()->FindRegistrationForScope( + wrapper()->context()->registry()->FindRegistrationForScope( embedded_test_server()->GetURL("/service_worker/"), base::BindOnce(&ServiceWorkerOfflineCapabilityCheckBrowserTest:: DidFindRegistration,
diff --git a/content/browser/service_worker/service_worker_offline_capability_checker.cc b/content/browser/service_worker/service_worker_offline_capability_checker.cc index 958a1e8..de6fe25 100644 --- a/content/browser/service_worker/service_worker_offline_capability_checker.cc +++ b/content/browser/service_worker/service_worker_offline_capability_checker.cc
@@ -24,10 +24,10 @@ ~ServiceWorkerOfflineCapabilityChecker() = default; void ServiceWorkerOfflineCapabilityChecker::Start( - ServiceWorkerStorage* storage, + ServiceWorkerRegistry* registry, ServiceWorkerContext::CheckOfflineCapabilityCallback callback) { callback_ = std::move(callback); - storage->FindRegistrationForClientUrl( + registry->FindRegistrationForClientUrl( url_, base::BindOnce( &ServiceWorkerOfflineCapabilityChecker::DidFindRegistration, // We can use base::Unretained(this) because |this| is expected
diff --git a/content/browser/service_worker/service_worker_offline_capability_checker.h b/content/browser/service_worker/service_worker_offline_capability_checker.h index a3286ce..1ce016c 100644 --- a/content/browser/service_worker/service_worker_offline_capability_checker.h +++ b/content/browser/service_worker/service_worker_offline_capability_checker.h
@@ -17,7 +17,7 @@ namespace content { class ServiceWorkerRegistration; -class ServiceWorkerStorage; +class ServiceWorkerRegistry; class ServiceWorkerVersion; // Utility class used to check a service worker's offline capability. @@ -41,7 +41,7 @@ // It's the caller's responsibility to make sure that |this| outlives // |callback|. - void Start(ServiceWorkerStorage* storage, + void Start(ServiceWorkerRegistry* registry, ServiceWorkerContext::CheckOfflineCapabilityCallback callback); private:
diff --git a/content/browser/service_worker/service_worker_register_job.cc b/content/browser/service_worker/service_worker_register_job.cc index 405ecad..a6add92 100644 --- a/content/browser/service_worker/service_worker_register_job.cc +++ b/content/browser/service_worker/service_worker_register_job.cc
@@ -136,14 +136,15 @@ } scoped_refptr<ServiceWorkerRegistration> registration = - context_->storage()->GetUninstallingRegistration(scope_); + context_->registry()->GetUninstallingRegistration(scope_); if (registration.get()) base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(next_step), blink::ServiceWorkerStatusCode::kOk, registration)); else - context_->storage()->FindRegistrationForScope(scope_, std::move(next_step)); + context_->registry()->FindRegistrationForScope(scope_, + std::move(next_step)); } void ServiceWorkerRegisterJob::Abort() { @@ -477,7 +478,7 @@ } void ServiceWorkerRegisterJob::StartWorkerForUpdate() { - context_->storage()->NotifyInstallingRegistration(registration()); + context_->registry()->NotifyInstallingRegistration(registration()); int64_t version_id = context_->storage()->NewVersionId(); if (version_id == blink::mojom::kInvalidServiceWorkerVersionId) { @@ -746,7 +747,7 @@ context_->storage()->DeleteRegistration( registration(), registration()->scope().GetOrigin(), base::DoNothing()); - context_->storage()->NotifyDoneUninstallingRegistration( + context_->registry()->NotifyDoneUninstallingRegistration( registration(), ServiceWorkerRegistration::Status::kUninstalled); } } @@ -756,7 +757,7 @@ } DCHECK(callbacks_.empty()); if (registration()) { - context_->storage()->NotifyDoneInstallingRegistration( + context_->registry()->NotifyDoneInstallingRegistration( registration(), new_version(), status); #if DCHECK_IS_ON() switch (registration()->status()) {
diff --git a/content/browser/service_worker/service_worker_registration.cc b/content/browser/service_worker/service_worker_registration.cc index 7dcda4aa..412a0a86 100644 --- a/content/browser/service_worker/service_worker_registration.cc +++ b/content/browser/service_worker/service_worker_registration.cc
@@ -328,13 +328,13 @@ break; } - context_->storage()->NotifyDoneUninstallingRegistration(this, - Status::kIntact); + context_->registry()->NotifyDoneUninstallingRegistration(this, + Status::kIntact); scoped_refptr<ServiceWorkerVersion> most_recent_version = waiting_version() ? waiting_version() : active_version(); DCHECK(most_recent_version.get()); - context_->storage()->NotifyInstallingRegistration(this); + context_->registry()->NotifyInstallingRegistration(this); context_->storage()->StoreRegistration( this, most_recent_version.get(), base::BindOnce(&ServiceWorkerRegistration::OnRestoreFinished, this, @@ -548,8 +548,8 @@ base::BindOnce(&ServiceWorkerRegistration::OnDeleteFinished, protect)); } DCHECK(is_uninstalling()); - context_->storage()->NotifyDoneUninstallingRegistration(this, - Status::kUninstalled); + context_->registry()->NotifyDoneUninstallingRegistration( + this, Status::kUninstalled); // Tell observers that this registration is gone. NotifyRegistrationFailed(); @@ -660,7 +660,7 @@ auto protect = base::WrapRefCounted(this); if (context_) { - context_->storage()->NotifyDoneUninstallingRegistration( + context_->registry()->NotifyDoneUninstallingRegistration( this, Status::kUninstalled); } @@ -706,8 +706,8 @@ std::move(callback).Run(blink::ServiceWorkerStatusCode::kErrorAbort); return; } - context_->storage()->NotifyDoneInstallingRegistration( - this, version.get(), status); + context_->registry()->NotifyDoneInstallingRegistration(this, version.get(), + status); std::move(callback).Run(status); }
diff --git a/content/browser/service_worker/service_worker_registration_unittest.cc b/content/browser/service_worker/service_worker_registration_unittest.cc index e0cb94a..6aa2949 100644 --- a/content/browser/service_worker/service_worker_registration_unittest.cc +++ b/content/browser/service_worker/service_worker_registration_unittest.cc
@@ -192,6 +192,7 @@ } ServiceWorkerContextCore* context() { return helper_->context(); } + ServiceWorkerRegistry* registry() { return helper_->context()->registry(); } ServiceWorkerStorage* storage() { return helper_->context()->storage(); } class RegistrationListener : public ServiceWorkerRegistration::Listener { @@ -867,7 +868,7 @@ int64_t registration_id, const GURL& scope) { base::Optional<blink::ServiceWorkerStatusCode> status; - storage()->FindRegistrationForId( + registry()->FindRegistrationForId( registration_id, scope, base::AdaptCallbackForRepeating(base::BindOnce( [](base::Optional<blink::ServiceWorkerStatusCode>* out_status,
diff --git a/content/browser/service_worker/service_worker_registry.cc b/content/browser/service_worker/service_worker_registry.cc index c111fae..40449c4c 100644 --- a/content/browser/service_worker/service_worker_registry.cc +++ b/content/browser/service_worker/service_worker_registry.cc
@@ -5,42 +5,134 @@ #include "content/browser/service_worker/service_worker_registry.h" #include "base/memory/ptr_util.h" -#include "content/browser/service_worker/service_worker_storage.h" +#include "content/browser/service_worker/service_worker_registration.h" +#include "content/browser/service_worker/service_worker_version.h" +#include "content/common/service_worker/service_worker_utils.h" namespace content { -// static -std::unique_ptr<ServiceWorkerRegistry> ServiceWorkerRegistry::Create( +ServiceWorkerRegistry::ServiceWorkerRegistry( const base::FilePath& user_data_directory, ServiceWorkerContextCore* context, scoped_refptr<base::SequencedTaskRunner> database_task_runner, storage::QuotaManagerProxy* quota_manager_proxy, - storage::SpecialStoragePolicy* special_storage_policy) { - DCHECK(context); - auto storage = ServiceWorkerStorage::Create( - user_data_directory, context, std::move(database_task_runner), - quota_manager_proxy, special_storage_policy); - return base::WrapUnique(new ServiceWorkerRegistry(std::move(storage))); -} - -// static -std::unique_ptr<ServiceWorkerRegistry> -ServiceWorkerRegistry::CreateForDeleteAndStartOver( - ServiceWorkerContextCore* context, - ServiceWorkerRegistry* old_registry) { - DCHECK(context); - DCHECK(old_registry); - auto new_storage = - ServiceWorkerStorage::Create(context, old_registry->storage()); - return base::WrapUnique(new ServiceWorkerRegistry(std::move(new_storage))); -} + storage::SpecialStoragePolicy* special_storage_policy) + : storage_(ServiceWorkerStorage::Create(user_data_directory, + context, + std::move(database_task_runner), + quota_manager_proxy, + special_storage_policy, + this)) {} ServiceWorkerRegistry::ServiceWorkerRegistry( - std::unique_ptr<ServiceWorkerStorage> storage) - : storage_(std::move(storage)) { - DCHECK(storage_); -} + ServiceWorkerContextCore* context, + ServiceWorkerRegistry* old_registry) + : storage_(ServiceWorkerStorage::Create(context, + old_registry->storage(), + this)) {} ServiceWorkerRegistry::~ServiceWorkerRegistry() = default; +void ServiceWorkerRegistry::FindRegistrationForClientUrl( + const GURL& client_url, + FindRegistrationCallback callback) { + storage()->FindRegistrationForClientUrl(client_url, std::move(callback)); +} + +void ServiceWorkerRegistry::FindRegistrationForScope( + const GURL& scope, + FindRegistrationCallback callback) { + storage()->FindRegistrationForScope(scope, std::move(callback)); +} + +void ServiceWorkerRegistry::FindRegistrationForId( + int64_t registration_id, + const GURL& origin, + FindRegistrationCallback callback) { + storage()->FindRegistrationForId(registration_id, origin, + std::move(callback)); +} + +void ServiceWorkerRegistry::FindRegistrationForIdOnly( + int64_t registration_id, + FindRegistrationCallback callback) { + storage()->FindRegistrationForIdOnly(registration_id, std::move(callback)); +} + +ServiceWorkerRegistration* ServiceWorkerRegistry::GetUninstallingRegistration( + const GURL& scope) { + // TODO(bashi): Should we check state of ServiceWorkerStorage? + for (const auto& registration : uninstalling_registrations_) { + if (registration.second->scope() == scope) { + DCHECK(registration.second->is_uninstalling()); + return registration.second.get(); + } + } + return nullptr; +} + +void ServiceWorkerRegistry::NotifyInstallingRegistration( + ServiceWorkerRegistration* registration) { + DCHECK(installing_registrations_.find(registration->id()) == + installing_registrations_.end()); + installing_registrations_[registration->id()] = registration; +} + +void ServiceWorkerRegistry::NotifyDoneInstallingRegistration( + ServiceWorkerRegistration* registration, + ServiceWorkerVersion* version, + blink::ServiceWorkerStatusCode status) { + installing_registrations_.erase(registration->id()); + if (status != blink::ServiceWorkerStatusCode::kOk && version) { + ResourceList resources; + version->script_cache_map()->GetResources(&resources); + + std::set<int64_t> resource_ids; + for (const auto& resource : resources) + resource_ids.insert(resource.resource_id); + storage()->DoomUncommittedResources(resource_ids); + } +} + +void ServiceWorkerRegistry::NotifyDoneUninstallingRegistration( + ServiceWorkerRegistration* registration, + ServiceWorkerRegistration::Status new_status) { + registration->SetStatus(new_status); + uninstalling_registrations_.erase(registration->id()); +} + +ServiceWorkerRegistration* +ServiceWorkerRegistry::FindInstallingRegistrationForClientUrl( + const GURL& client_url) { + DCHECK(!client_url.has_ref()); + + LongestScopeMatcher matcher(client_url); + ServiceWorkerRegistration* match = nullptr; + + // TODO(nhiroki): This searches over installing registrations linearly and it + // couldn't be scalable. Maybe the regs should be partitioned by origin. + for (const auto& registration : installing_registrations_) + if (matcher.MatchLongest(registration.second->scope())) + match = registration.second.get(); + return match; +} + +ServiceWorkerRegistration* +ServiceWorkerRegistry::FindInstallingRegistrationForScope(const GURL& scope) { + for (const auto& registration : installing_registrations_) + if (registration.second->scope() == scope) + return registration.second.get(); + return nullptr; +} + +ServiceWorkerRegistration* +ServiceWorkerRegistry::FindInstallingRegistrationForId( + int64_t registration_id) { + RegistrationRefsById::const_iterator found = + installing_registrations_.find(registration_id); + if (found == installing_registrations_.end()) + return nullptr; + return found->second.get(); +} + } // namespace content
diff --git a/content/browser/service_worker/service_worker_registry.h b/content/browser/service_worker/service_worker_registry.h index 1b8f4e5..d10c8e9d 100644 --- a/content/browser/service_worker/service_worker_registry.h +++ b/content/browser/service_worker/service_worker_registry.h
@@ -9,6 +9,7 @@ #include "base/files/file_path.h" #include "base/memory/scoped_refptr.h" +#include "content/browser/service_worker/service_worker_storage.h" #include "content/common/content_export.h" namespace base { @@ -23,7 +24,8 @@ namespace content { class ServiceWorkerContextCore; -class ServiceWorkerStorage; +class ServiceWorkerRegistration; +class ServiceWorkerVersion; // This class manages in-memory representation of service worker registrations // (i.e., ServiceWorkerRegistration) including installing and uninstalling @@ -31,31 +33,83 @@ // ServiceWorkerContextCore and has the same lifetime of the owner. // The instance owns ServiceworkerStorage and uses it to store/retrieve // registrations to/from persistent storage. +// The instance lives on the core thread. // TODO(crbug.com/1039200): Move ServiceWorkerStorage's method and fields which // depend on ServiceWorkerRegistration into this class. class CONTENT_EXPORT ServiceWorkerRegistry { public: - ~ServiceWorkerRegistry(); + using ResourceList = ServiceWorkerStorage::ResourceList; + using FindRegistrationCallback = + ServiceWorkerStorage::FindRegistrationCallback; - static std::unique_ptr<ServiceWorkerRegistry> Create( + ServiceWorkerRegistry( const base::FilePath& user_data_directory, ServiceWorkerContextCore* context, scoped_refptr<base::SequencedTaskRunner> database_task_runner, storage::QuotaManagerProxy* quota_manager_proxy, storage::SpecialStoragePolicy* special_storage_policy); - // Re-create the registry from the old one. This is called when something went - // wrong during storage access. - static std::unique_ptr<ServiceWorkerRegistry> CreateForDeleteAndStartOver( - ServiceWorkerContextCore* context, - ServiceWorkerRegistry* old_registry); + // For re-creating the registry from the old one. This is called when + // something went wrong during storage access. + ServiceWorkerRegistry(ServiceWorkerContextCore* context, + ServiceWorkerRegistry* old_registry); + + ~ServiceWorkerRegistry(); ServiceWorkerStorage* storage() const { return storage_.get(); } - private: - explicit ServiceWorkerRegistry(std::unique_ptr<ServiceWorkerStorage> storage); + // TODO(crbug.com/1039200): Move corresponding comments from + // ServiceWorkerStorage. + void FindRegistrationForClientUrl(const GURL& client_url, + FindRegistrationCallback callback); + void FindRegistrationForScope(const GURL& scope, + FindRegistrationCallback callback); + void FindRegistrationForId(int64_t registration_id, + const GURL& origin, + FindRegistrationCallback callback); + void FindRegistrationForIdOnly(int64_t registration_id, + FindRegistrationCallback callback); + ServiceWorkerRegistration* GetUninstallingRegistration(const GURL& scope); + + // Intended for use only by ServiceWorkerRegisterJob and + // ServiceWorkerRegistration. + void NotifyInstallingRegistration(ServiceWorkerRegistration* registration); + void NotifyDoneInstallingRegistration(ServiceWorkerRegistration* registration, + ServiceWorkerVersion* version, + blink::ServiceWorkerStatusCode status); + void NotifyDoneUninstallingRegistration( + ServiceWorkerRegistration* registration, + ServiceWorkerRegistration::Status new_status); + + // TODO(crbug.com/1039200): Make these methods private once methods/fields + // related to ServiceWorkerRegistration in ServiceWorkerStorage are moved + // into this class. + ServiceWorkerRegistration* FindInstallingRegistrationForClientUrl( + const GURL& client_url); + ServiceWorkerRegistration* FindInstallingRegistrationForScope( + const GURL& scope); + ServiceWorkerRegistration* FindInstallingRegistrationForId( + int64_t registration_id); + + using RegistrationRefsById = + std::map<int64_t, scoped_refptr<ServiceWorkerRegistration>>; + // TODO(crbug.com/1039200): Remove these accessors. These are tentatively + // exposed for ServiceWorkerStorage. Code that relies on these should be + // moved into this class. + RegistrationRefsById& installing_registrations() { + return installing_registrations_; + } + RegistrationRefsById& uninstalling_registrations() { + return uninstalling_registrations_; + } + + private: std::unique_ptr<ServiceWorkerStorage> storage_; + + // For finding registrations being installed or uninstalled. + RegistrationRefsById installing_registrations_; + RegistrationRefsById uninstalling_registrations_; }; } // namespace content
diff --git a/content/browser/service_worker/service_worker_storage.cc b/content/browser/service_worker/service_worker_storage.cc index 0714354..2fe159d 100644 --- a/content/browser/service_worker/service_worker_storage.cc +++ b/content/browser/service_worker/service_worker_storage.cc
@@ -22,6 +22,7 @@ #include "content/browser/service_worker/service_worker_disk_cache.h" #include "content/browser/service_worker/service_worker_info.h" #include "content/browser/service_worker/service_worker_registration.h" +#include "content/browser/service_worker/service_worker_registry.h" #include "content/browser/service_worker/service_worker_version.h" #include "content/common/service_worker/service_worker_utils.h" #include "content/public/browser/browser_thread.h" @@ -122,21 +123,23 @@ ServiceWorkerContextCore* context, scoped_refptr<base::SequencedTaskRunner> database_task_runner, storage::QuotaManagerProxy* quota_manager_proxy, - storage::SpecialStoragePolicy* special_storage_policy) { + storage::SpecialStoragePolicy* special_storage_policy, + ServiceWorkerRegistry* registry) { return base::WrapUnique(new ServiceWorkerStorage( user_data_directory, context, std::move(database_task_runner), - quota_manager_proxy, special_storage_policy)); + quota_manager_proxy, special_storage_policy, registry)); } // static std::unique_ptr<ServiceWorkerStorage> ServiceWorkerStorage::Create( ServiceWorkerContextCore* context, - ServiceWorkerStorage* old_storage) { - return base::WrapUnique( - new ServiceWorkerStorage(old_storage->user_data_directory_, context, - old_storage->database_task_runner_, - old_storage->quota_manager_proxy_.get(), - old_storage->special_storage_policy_.get())); + ServiceWorkerStorage* old_storage, + ServiceWorkerRegistry* registry) { + return base::WrapUnique(new ServiceWorkerStorage( + old_storage->user_data_directory_, context, + old_storage->database_task_runner_, + old_storage->quota_manager_proxy_.get(), + old_storage->special_storage_policy_.get(), registry)); } void ServiceWorkerStorage::FindRegistrationForClientUrl( @@ -167,7 +170,7 @@ if (!base::Contains(registered_origins_, client_url.GetOrigin())) { // Look for something currently being installed. scoped_refptr<ServiceWorkerRegistration> installing_registration = - FindInstallingRegistrationForClientUrl(client_url); + registry_->FindInstallingRegistrationForClientUrl(client_url); blink::ServiceWorkerStatusCode status = installing_registration ? blink::ServiceWorkerStatusCode::kOk @@ -222,7 +225,7 @@ if (!base::Contains(registered_origins_, scope.GetOrigin())) { // Look for something currently being installed. scoped_refptr<ServiceWorkerRegistration> installing_registration = - FindInstallingRegistrationForScope(scope); + registry_->FindInstallingRegistrationForScope(scope); blink::ServiceWorkerStatusCode installing_status = installing_registration ? blink::ServiceWorkerStatusCode::kOk @@ -242,19 +245,6 @@ std::move(callback)))); } -ServiceWorkerRegistration* ServiceWorkerStorage::GetUninstallingRegistration( - const GURL& scope) { - if (state_ != STORAGE_STATE_INITIALIZED) - return nullptr; - for (const auto& registration : uninstalling_registrations_) { - if (registration.second->scope() == scope) { - DCHECK(registration.second->is_uninstalling()); - return registration.second.get(); - } - } - return nullptr; -} - void ServiceWorkerStorage::FindRegistrationForId( int64_t registration_id, const GURL& origin, @@ -280,7 +270,7 @@ if (!base::Contains(registered_origins_, origin)) { // Look for something currently being installed. scoped_refptr<ServiceWorkerRegistration> installing_registration = - FindInstallingRegistrationForId(registration_id); + registry_->FindInstallingRegistrationForId(registration_id); CompleteFindNow(installing_registration, installing_registration ? blink::ServiceWorkerStatusCode::kOk @@ -599,7 +589,7 @@ base::BindOnce(&ServiceWorkerStorage::DidDeleteRegistration, weak_factory_.GetWeakPtr(), std::move(params)))); - uninstalling_registrations_[registration->id()] = registration; + registry_->uninstalling_registrations()[registration->id()] = registration; registration->SetStatus(ServiceWorkerRegistration::Status::kUninstalling); } @@ -1104,36 +1094,6 @@ return next_resource_id_++; } -void ServiceWorkerStorage::NotifyInstallingRegistration( - ServiceWorkerRegistration* registration) { - DCHECK(installing_registrations_.find(registration->id()) == - installing_registrations_.end()); - installing_registrations_[registration->id()] = registration; -} - -void ServiceWorkerStorage::NotifyDoneInstallingRegistration( - ServiceWorkerRegistration* registration, - ServiceWorkerVersion* version, - blink::ServiceWorkerStatusCode status) { - installing_registrations_.erase(registration->id()); - if (status != blink::ServiceWorkerStatusCode::kOk && version) { - ResourceList resources; - version->script_cache_map()->GetResources(&resources); - - std::set<int64_t> resource_ids; - for (const auto& resource : resources) - resource_ids.insert(resource.resource_id); - DoomUncommittedResources(resource_ids); - } -} - -void ServiceWorkerStorage::NotifyDoneUninstallingRegistration( - ServiceWorkerRegistration* registration, - ServiceWorkerRegistration::Status new_status) { - registration->SetStatus(new_status); - uninstalling_registrations_.erase(registration->id()); -} - void ServiceWorkerStorage::Disable() { state_ = STORAGE_STATE_DISABLED; if (disk_cache_) @@ -1151,7 +1111,8 @@ ServiceWorkerContextCore* context, scoped_refptr<base::SequencedTaskRunner> database_task_runner, storage::QuotaManagerProxy* quota_manager_proxy, - storage::SpecialStoragePolicy* special_storage_policy) + storage::SpecialStoragePolicy* special_storage_policy, + ServiceWorkerRegistry* registry) : next_registration_id_(blink::mojom::kInvalidServiceWorkerRegistrationId), next_version_id_(blink::mojom::kInvalidServiceWorkerVersionId), next_resource_id_(ServiceWorkerConsts::kInvalidServiceWorkerResourceId), @@ -1163,8 +1124,10 @@ quota_manager_proxy_(quota_manager_proxy), special_storage_policy_(special_storage_policy), is_purge_pending_(false), - has_checked_for_stale_resources_(false) { + has_checked_for_stale_resources_(false), + registry_(registry) { DCHECK(context_); + DCHECK(registry_); database_.reset(new ServiceWorkerDatabase(GetDatabasePath())); } @@ -1260,7 +1223,7 @@ if (status == ServiceWorkerDatabase::STATUS_ERROR_NOT_FOUND) { // Look for something currently being installed. scoped_refptr<ServiceWorkerRegistration> installing_registration = - FindInstallingRegistrationForClientUrl(client_url); + registry_->FindInstallingRegistrationForClientUrl(client_url); blink::ServiceWorkerStatusCode installing_status = installing_registration ? blink::ServiceWorkerStatusCode::kOk @@ -1298,7 +1261,7 @@ if (status == ServiceWorkerDatabase::STATUS_ERROR_NOT_FOUND) { scoped_refptr<ServiceWorkerRegistration> installing_registration = - FindInstallingRegistrationForScope(scope); + registry_->FindInstallingRegistrationForScope(scope); blink::ServiceWorkerStatusCode installing_status = installing_registration ? blink::ServiceWorkerStatusCode::kOk @@ -1376,7 +1339,7 @@ } // Add unstored registrations that are being installed. - for (const auto& registration : installing_registrations_) { + for (const auto& registration : registry_->installing_registrations()) { if (registration.second->scope().GetOrigin() != origin_filter) continue; if (registration_ids.insert(registration.first).second) @@ -1466,7 +1429,7 @@ } // Add unstored registrations that are being installed. - for (const auto& registration : installing_registrations_) { + for (const auto& registration : registry_->installing_registrations()) { if (pushed_registrations.insert(registration.first).second) infos.push_back(registration.second->GetInfo()); } @@ -1644,8 +1607,8 @@ context_->AsWeakPtr()); registration->set_resources_total_size_bytes(data.resources_total_size_bytes); registration->set_last_update_check(data.last_update_check); - DCHECK(uninstalling_registrations_.find(data.registration_id) == - uninstalling_registrations_.end()); + DCHECK(registry_->uninstalling_registrations().find(data.registration_id) == + registry_->uninstalling_registrations().end()); scoped_refptr<ServiceWorkerVersion> version = context_->GetLiveVersion(data.version_id); @@ -1682,39 +1645,6 @@ return registration; } -ServiceWorkerRegistration* -ServiceWorkerStorage::FindInstallingRegistrationForClientUrl( - const GURL& client_url) { - DCHECK(!client_url.has_ref()); - - LongestScopeMatcher matcher(client_url); - ServiceWorkerRegistration* match = nullptr; - - // TODO(nhiroki): This searches over installing registrations linearly and it - // couldn't be scalable. Maybe the regs should be partitioned by origin. - for (const auto& registration : installing_registrations_) - if (matcher.MatchLongest(registration.second->scope())) - match = registration.second.get(); - return match; -} - -ServiceWorkerRegistration* -ServiceWorkerStorage::FindInstallingRegistrationForScope(const GURL& scope) { - for (const auto& registration : installing_registrations_) - if (registration.second->scope() == scope) - return registration.second.get(); - return nullptr; -} - -ServiceWorkerRegistration* -ServiceWorkerStorage::FindInstallingRegistrationForId(int64_t registration_id) { - RegistrationRefsById::const_iterator found = - installing_registrations_.find(registration_id); - if (found == installing_registrations_.end()) - return nullptr; - return found->second.get(); -} - ServiceWorkerDiskCache* ServiceWorkerStorage::disk_cache() { DCHECK(STORAGE_STATE_INITIALIZED == state_ || STORAGE_STATE_DISABLED == state_)
diff --git a/content/browser/service_worker/service_worker_storage.h b/content/browser/service_worker/service_worker_storage.h index aefb038..db12378 100644 --- a/content/browser/service_worker/service_worker_storage.h +++ b/content/browser/service_worker/service_worker_storage.h
@@ -41,6 +41,7 @@ class ServiceWorkerContextCore; class ServiceWorkerDiskCache; +class ServiceWorkerRegistry; class ServiceWorkerResponseMetadataWriter; class ServiceWorkerResponseReader; class ServiceWorkerResponseWriter; @@ -93,17 +94,21 @@ ~ServiceWorkerStorage(); + // TODO(crbug.com/1039200): Stop passing ServiceWorkerRegistry once + // ServiceWorkerRegistration dependencies are moved to ServiceWorkerRegistry. static std::unique_ptr<ServiceWorkerStorage> Create( const base::FilePath& user_data_directory, ServiceWorkerContextCore* context, scoped_refptr<base::SequencedTaskRunner> database_task_runner, storage::QuotaManagerProxy* quota_manager_proxy, - storage::SpecialStoragePolicy* special_storage_policy); + storage::SpecialStoragePolicy* special_storage_policy, + ServiceWorkerRegistry* registry); // Used for DeleteAndStartOver. Creates new storage based on |old_storage|. static std::unique_ptr<ServiceWorkerStorage> Create( ServiceWorkerContextCore* context, - ServiceWorkerStorage* old_storage); + ServiceWorkerStorage* old_storage, + ServiceWorkerRegistry* registry); // Finds registration for |client_url| or |scope| or |registration_id|. // The Find methods will find stored and initially installing registrations. @@ -115,6 +120,9 @@ // for |client_url| or |registration_id| may complete immediately // (the callback may be called prior to the method returning) or // asynchronously. + // NOTE: Do not call these methods directly. These methods will be moved + // to ServiceWorkerRegistry. + // TODO(crbug.com/1039200): Move these methods to ServiceWorkerRegistry. void FindRegistrationForClientUrl(const GURL& client_url, FindRegistrationCallback callback); void FindRegistrationForScope(const GURL& scope, @@ -128,11 +136,12 @@ // is all that is available this method can be used instead. // Like |FindRegistrationForId| this method may complete immediately (the // callback may be called prior to the method returning) or asynchronously. + // NOTE: Do not call this method directly. This method will be moved + // to ServiceWorkerRegistry. + // TODO(crbug.com/1039200): Move this method to ServiceWorkerRegistry. void FindRegistrationForIdOnly(int64_t registration_id, FindRegistrationCallback callback); - ServiceWorkerRegistration* GetUninstallingRegistration(const GURL& scope); - // Returns all stored registrations for a given origin. void GetRegistrationsForOrigin(const GURL& origin, GetRegistrationsCallback callback); @@ -272,17 +281,6 @@ // is disabled. int64_t NewResourceId(); - // Intended for use only by ServiceWorkerRegisterJob and - // ServiceWorkerRegistration. - void NotifyInstallingRegistration( - ServiceWorkerRegistration* registration); - void NotifyDoneInstallingRegistration(ServiceWorkerRegistration* registration, - ServiceWorkerVersion* version, - blink::ServiceWorkerStatusCode status); - void NotifyDoneUninstallingRegistration( - ServiceWorkerRegistration* registration, - ServiceWorkerRegistration::Status new_status); - void Disable(); // Schedules deleting |resources| from the disk cache and removing their keys @@ -343,8 +341,6 @@ }; using RegistrationList = std::vector<ServiceWorkerDatabase::RegistrationData>; - using RegistrationRefsById = - std::map<int64_t, scoped_refptr<ServiceWorkerRegistration>>; using InitializeCallback = base::OnceCallback<void(std::unique_ptr<InitialData> data, ServiceWorkerDatabase::Status status)>; @@ -380,7 +376,8 @@ ServiceWorkerContextCore* context, scoped_refptr<base::SequencedTaskRunner> database_task_runner, storage::QuotaManagerProxy* quota_manager_proxy, - storage::SpecialStoragePolicy* special_storage_policy); + storage::SpecialStoragePolicy* special_storage_policy, + ServiceWorkerRegistry* registry); base::FilePath GetDatabasePath(); base::FilePath GetDiskCachePath(); @@ -455,12 +452,6 @@ scoped_refptr<ServiceWorkerRegistration> GetOrCreateRegistration( const ServiceWorkerDatabase::RegistrationData& data, const ResourceList& resources); - ServiceWorkerRegistration* FindInstallingRegistrationForClientUrl( - const GURL& client_url); - ServiceWorkerRegistration* FindInstallingRegistrationForScope( - const GURL& scope); - ServiceWorkerRegistration* FindInstallingRegistrationForId( - int64_t registration_id); // Lazy disk_cache getter. ServiceWorkerDiskCache* disk_cache(); @@ -569,10 +560,6 @@ // Posted when we finish deleting the cache directory. void DidDeleteDiskCache(StatusCallback callback, bool result); - // For finding registrations being installed or uninstalled. - RegistrationRefsById installing_registrations_; - RegistrationRefsById uninstalling_registrations_; - // Origins having registations. std::set<GURL> registered_origins_; @@ -623,6 +610,11 @@ bool has_checked_for_stale_resources_; base::OnceClosure purging_complete_callback_for_test_; + // |registry_| owns this class and must outlive this. + // TODO(crbug.com/1039200): Remove this reference once + // ServiceWorkerRegistration dependencies are moved to ServiceWorkerRegistry. + ServiceWorkerRegistry* registry_; + base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage);
diff --git a/content/browser/service_worker/service_worker_storage_unittest.cc b/content/browser/service_worker/service_worker_storage_unittest.cc index 5cc7e7f..10bd4730 100644 --- a/content/browser/service_worker/service_worker_storage_unittest.cc +++ b/content/browser/service_worker/service_worker_storage_unittest.cc
@@ -274,6 +274,7 @@ } ServiceWorkerContextCore* context() { return helper_->context(); } + ServiceWorkerRegistry* registry() { return context()->registry(); } ServiceWorkerStorage* storage() { return context()->storage(); } ServiceWorkerDatabase* database() { return storage()->database_.get(); } @@ -477,7 +478,7 @@ scoped_refptr<ServiceWorkerRegistration>* registration) { base::Optional<blink::ServiceWorkerStatusCode> result; base::RunLoop loop; - storage()->FindRegistrationForClientUrl( + registry()->FindRegistrationForClientUrl( document_url, base::BindOnce(&FindCallback, loop.QuitClosure(), &result, registration)); loop.Run(); @@ -489,7 +490,7 @@ scoped_refptr<ServiceWorkerRegistration>* registration) { base::Optional<blink::ServiceWorkerStatusCode> result; base::RunLoop loop; - storage()->FindRegistrationForScope( + registry()->FindRegistrationForScope( scope, base::BindOnce(&FindCallback, loop.QuitClosure(), &result, registration)); EXPECT_FALSE(result); // always async @@ -503,7 +504,7 @@ scoped_refptr<ServiceWorkerRegistration>* registration) { base::Optional<blink::ServiceWorkerStatusCode> result; base::RunLoop loop; - storage()->FindRegistrationForId( + registry()->FindRegistrationForId( registration_id, origin, base::BindOnce(&FindCallback, loop.QuitClosure(), &result, registration)); @@ -516,7 +517,7 @@ scoped_refptr<ServiceWorkerRegistration>* registration) { base::Optional<blink::ServiceWorkerStatusCode> result; base::RunLoop loop; - storage()->FindRegistrationForIdOnly( + registry()->FindRegistrationForIdOnly( registration_id, base::BindOnce(&FindCallback, loop.QuitClosure(), &result, registration)); loop.Run(); @@ -604,7 +605,7 @@ &found_registration)); EXPECT_EQ(blink::ServiceWorkerStatusCode::kErrorAbort, FindRegistrationForIdOnly(kRegistrationId, &found_registration)); - EXPECT_FALSE(storage()->GetUninstallingRegistration(kScope.GetOrigin())); + EXPECT_FALSE(registry()->GetUninstallingRegistration(kScope.GetOrigin())); std::vector<scoped_refptr<ServiceWorkerRegistration>> found_registrations; EXPECT_EQ( @@ -911,7 +912,7 @@ EXPECT_TRUE(registrations_for_origin.empty()); // Notify storage of it being installed. - storage()->NotifyInstallingRegistration(live_registration.get()); + registry()->NotifyInstallingRegistration(live_registration.get()); // Now should be findable. EXPECT_EQ(blink::ServiceWorkerStatusCode::kOk, @@ -953,7 +954,7 @@ EXPECT_TRUE(registrations_for_origin.empty()); // Notify storage of installation no longer happening. - storage()->NotifyDoneInstallingRegistration( + registry()->NotifyDoneInstallingRegistration( live_registration.get(), nullptr, blink::ServiceWorkerStatusCode::kOk); // Once again, should not be findable. @@ -1211,7 +1212,7 @@ registration->EnableNavigationPreload(true); registration->SetNavigationPreloadHeader("header"); - storage()->NotifyInstallingRegistration(registration.get()); + registry()->NotifyInstallingRegistration(registration.get()); EXPECT_EQ(blink::ServiceWorkerStatusCode::kOk, StoreRegistration(registration, registration->waiting_version())); std::vector<ServiceWorkerRegistrationInfo> all_registrations; @@ -1694,9 +1695,9 @@ CreateServiceWorkerRegistrationAndVersion(context(), kScope3, kScript3); // Notify storage of them being installed. - storage()->NotifyInstallingRegistration(live_registration1.get()); - storage()->NotifyInstallingRegistration(live_registration2.get()); - storage()->NotifyInstallingRegistration(live_registration3.get()); + registry()->NotifyInstallingRegistration(live_registration1.get()); + registry()->NotifyInstallingRegistration(live_registration2.get()); + registry()->NotifyInstallingRegistration(live_registration3.get()); // Find a registration among installing ones. EXPECT_EQ(blink::ServiceWorkerStatusCode::kOk, @@ -1716,11 +1717,11 @@ live_registration3->waiting_version())); // Notify storage of installations no longer happening. - storage()->NotifyDoneInstallingRegistration( + registry()->NotifyDoneInstallingRegistration( live_registration1.get(), nullptr, blink::ServiceWorkerStatusCode::kOk); - storage()->NotifyDoneInstallingRegistration( + registry()->NotifyDoneInstallingRegistration( live_registration2.get(), nullptr, blink::ServiceWorkerStatusCode::kOk); - storage()->NotifyDoneInstallingRegistration( + registry()->NotifyDoneInstallingRegistration( live_registration3.get(), nullptr, blink::ServiceWorkerStatusCode::kOk); // Find a registration among installed ones.
diff --git a/content/browser/service_worker/service_worker_unregister_job.cc b/content/browser/service_worker/service_worker_unregister_job.cc index 2abb284e..3cb0e6b 100644 --- a/content/browser/service_worker/service_worker_unregister_job.cc +++ b/content/browser/service_worker/service_worker_unregister_job.cc
@@ -34,7 +34,7 @@ } void ServiceWorkerUnregisterJob::Start() { - context_->storage()->FindRegistrationForScope( + context_->registry()->FindRegistrationForScope( scope_, base::BindOnce(&ServiceWorkerUnregisterJob::OnRegistrationFound, weak_factory_.GetWeakPtr())); }
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc index 577030e..01aa37c 100644 --- a/content/browser/service_worker/service_worker_version.cc +++ b/content/browser/service_worker/service_worker_version.cc
@@ -443,7 +443,7 @@ // Ensure the live registration during starting worker so that the worker can // get associated with it in // ServiceWorkerProviderHost::CompleteStartWorkerPreparation. - context_->storage()->FindRegistrationForId( + context_->registry()->FindRegistrationForId( registration_id_, scope_.GetOrigin(), base::BindOnce( &ServiceWorkerVersion::DidEnsureLiveRegistrationForStartWorker, @@ -538,7 +538,7 @@ void ServiceWorkerVersion::StartUpdate() { if (!context_) return; - context_->storage()->FindRegistrationForId( + context_->registry()->FindRegistrationForId( registration_id_, scope_.GetOrigin(), base::BindOnce(&ServiceWorkerVersion::FoundRegistrationForUpdate, weak_factory_.GetWeakPtr()));
diff --git a/content/browser/service_worker/service_worker_version_browsertest.cc b/content/browser/service_worker/service_worker_version_browsertest.cc index 7a948061..fce2677 100644 --- a/content/browser/service_worker/service_worker_version_browsertest.cc +++ b/content/browser/service_worker/service_worker_version_browsertest.cc
@@ -444,7 +444,7 @@ script_type, wrapper()->context()->storage()->NewVersionId(), wrapper()->context()->AsWeakPtr()); // Make the registration findable via storage functions. - wrapper()->context()->storage()->NotifyInstallingRegistration( + wrapper()->context()->registry()->NotifyInstallingRegistration( registration_.get()); } @@ -561,7 +561,7 @@ const GURL& origin) { ASSERT_TRUE( BrowserThread::CurrentlyOn(ServiceWorkerContext::GetCoreThreadId())); - wrapper()->context()->storage()->FindRegistrationForId( + wrapper()->context()->registry()->FindRegistrationForId( id, origin, CreateFindRegistrationReceiver(BrowserThread::UI, std::move(done), result)); @@ -571,7 +571,7 @@ blink::ServiceWorkerStatusCode status) { ASSERT_TRUE( BrowserThread::CurrentlyOn(ServiceWorkerContext::GetCoreThreadId())); - wrapper()->context()->storage()->NotifyDoneInstallingRegistration( + wrapper()->context()->registry()->NotifyDoneInstallingRegistration( registration_.get(), version_.get(), status); }
diff --git a/content/browser/speech/proto/BUILD.gn b/content/browser/speech/proto/BUILD.gn index fb54fb25..dafd61f7 100644 --- a/content/browser/speech/proto/BUILD.gn +++ b/content/browser/speech/proto/BUILD.gn
@@ -5,7 +5,5 @@ import("//third_party/protobuf/proto_library.gni") proto_library("proto") { - sources = [ - "google_streaming_api.proto", - ] + sources = [ "google_streaming_api.proto" ] }
diff --git a/content/browser/tracing/BUILD.gn b/content/browser/tracing/BUILD.gn index d439864..52e083c7 100644 --- a/content/browser/tracing/BUILD.gn +++ b/content/browser/tracing/BUILD.gn
@@ -20,18 +20,14 @@ "$tracing_gen_dir/about_tracing.js", ] inputs = input_pages - outputs = [ - tracing_grd, - ] + outputs = [ tracing_grd ] args = rebase_path(input_pages, target_gen_dir) + [ "--output", rebase_path(tracing_grd, root_build_dir), ] - deps = [ - "//third_party/catapult/tracing:generate_about_tracing", - ] + deps = [ "//third_party/catapult/tracing:generate_about_tracing" ] } grit("resources") { @@ -49,7 +45,5 @@ defines = [ "SHARED_INTERMEDIATE_DIR=" + rebase_path(root_gen_dir, root_build_dir) ] - deps = [ - ":generate_tracing_grd", - ] + deps = [ ":generate_tracing_grd" ] }
diff --git a/content/browser/web_package/web_bundle_browsertest.cc b/content/browser/web_package/web_bundle_browsertest.cc index eb7233c9..da160c24 100644 --- a/content/browser/web_package/web_bundle_browsertest.cc +++ b/content/browser/web_package/web_bundle_browsertest.cc
@@ -12,6 +12,7 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/system/sys_info.h" +#include "base/test/bind_test_util.h" #include "base/test/scoped_feature_list.h" #include "base/threading/thread_restrictions.h" #include "build/build_config.h" @@ -32,6 +33,7 @@ #include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_response.h" #include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h" +#include "services/data_decoder/public/cpp/test_support/web_bundle_builder.h" #if defined(OS_ANDROID) #include "base/android/content_uri_utils.h" @@ -413,6 +415,45 @@ return base::UTF16ToUTF8(console_observer.messages()[0].message); } +std::string CreateSimpleWebBundle(const GURL& primary_url) { + data_decoder::test::WebBundleBuilder builder(primary_url.spec(), ""); + builder.AddExchange(primary_url.spec(), + {{":status", "200"}, {"content-type", "text/html"}}, + "<title>Ready</title>"); + std::vector<uint8_t> bundle = builder.CreateBundle(); + return std::string(bundle.begin(), bundle.end()); +} + +std::string CreatePathTestWebBundle( + const net::test_server::EmbeddedTestServer* server) { + const GURL primary_url = server->GetURL("/web_bundle/path_test/in_scope/"); + data_decoder::test::WebBundleBuilder builder(primary_url.spec(), ""); + builder.AddExchange(primary_url.spec(), + {{":status", "200"}, {"content-type", "text/html"}}, + "<title>Ready</title>"); + builder.AddExchange( + server->GetURL("/web_bundle/path_test/in_scope/page.html").spec(), + {{":status", "200"}, {"content-type", "text/html"}}, + "<script>const page_info = 'In scope page in Web Bundle';</script>" + "<script src=\"page.js\"></script>"); + builder.AddExchange( + server->GetURL("/web_bundle/path_test/in_scope/page.js").spec(), + {{":status", "200"}, {"content-type", "application/javascript"}}, + "document.title = page_info + ' / in scope script in Web Bundle';"); + builder.AddExchange( + server->GetURL("/web_bundle/path_test/out_scope/page.html").spec(), + {{":status", "200"}, {"content-type", "text/html"}}, + "<script>const page_info = 'Out scope page in Web Bundle';</script>" + "<script src=\"page.js\"></script>"); + builder.AddExchange( + server->GetURL("/web_bundle/path_test/out_scope/page.js").spec(), + {{":status", "200"}, {"content-type", "application/javascript"}}, + "document.title = page_info + ' / out scope script in Web Bundle';"); + + std::vector<uint8_t> bundle = builder.CreateBundle(); + return std::string(bundle.begin(), bundle.end()); +} + } // namespace class InvalidTrustableWebBundleFileUrlBrowserTest : public ContentBrowserTest { @@ -939,9 +980,6 @@ class WebBundleNetworkBrowserTest : public WebBundleBrowserTestBase { protected: - // Keep consistent with NETWORK_TEST_PORT in generate-test-wbns.sh. - static constexpr int kNetworkTestPort = 39600; - WebBundleNetworkBrowserTest() = default; ~WebBundleNetworkBrowserTest() override = default; @@ -949,37 +987,27 @@ WebBundleBrowserTestBase::SetUpOnMainThread(); host_resolver()->AddRule("*", "127.0.0.1"); } + void TearDownOnMainThread() override { + // Shutdown the server to avoid the data race of |headers_| and |contents_| + // caused by page reload on error. + EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); + WebBundleBrowserTestBase::TearDownOnMainThread(); + } void SetUp() override { feature_list_.InitWithFeatures({features::kWebBundlesFromNetwork}, {}); WebBundleBrowserTestBase::SetUp(); } - void RegisterRequestHandler(const std::string& relative_url, - const std::string& headers, - const std::string& contents) { - embedded_test_server()->RegisterRequestHandler(base::BindRepeating( - [](const std::string& relative_url, const std::string& headers, - const std::string& contents, - const net::test_server::HttpRequest& request) + void RegisterRequestHandler(const std::string& relative_url) { + embedded_test_server()->RegisterRequestHandler(base::BindLambdaForTesting( + [this, relative_url](const net::test_server::HttpRequest& request) -> std::unique_ptr<net::test_server::HttpResponse> { if (request.relative_url != relative_url) return nullptr; - return std::make_unique<net::test_server::RawHttpResponse>(headers, - contents); - }, - relative_url, headers, contents)); - } - - std::string GetTestFile(const std::string& file_name) const { - base::ScopedAllowBlockingForTesting allow_blocking; - std::string contents; - base::FilePath src_dir; - CHECK(base::PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)); - base::FilePath test_path = - src_dir.Append(FILE_PATH_LITERAL("content/test/data/web_bundle")); - CHECK(base::ReadFileToString(test_path.AppendASCII(file_name), &contents)); - return contents; + return std::make_unique<net::test_server::RawHttpResponse>(headers_, + contents_); + })); } void TestNavigationFailure(const GURL& url, @@ -990,50 +1018,8 @@ EXPECT_EQ(expected_console_error, console_message); } - void RunHistoryNavigationErrorTest( - const std::string& first_headers, - const std::string& first_contents, - const std::string& subsequent_headers, - const std::string& subsequent_contents, + void HistoryBackAndWaitUntilConsoleError( const std::string& expected_error_message) { - scoped_refptr<base::RefCountedData<bool>> is_first_call = - base::MakeRefCounted<base::RefCountedData<bool>>(true); - embedded_test_server()->RegisterRequestHandler(base::BindRepeating( - [](const std::string& relative_url, - scoped_refptr<base::RefCountedData<bool>> is_first_call, - const std::string& first_headers, const std::string& first_contents, - const std::string& subsequent_headers, - const std::string& subsequent_contents, - const net::test_server::HttpRequest& request) - -> std::unique_ptr<net::test_server::HttpResponse> { - if (request.relative_url != relative_url) - return nullptr; - if (is_first_call->data) { - is_first_call->data = false; - return std::make_unique<net::test_server::RawHttpResponse>( - first_headers, first_contents); - } else { - return std::make_unique<net::test_server::RawHttpResponse>( - subsequent_headers, subsequent_contents); - } - }, - "/web_bundle/path_test/in_scope/path_test.wbn", - std::move(is_first_call), first_headers, first_contents, - subsequent_headers, subsequent_contents)); - ASSERT_TRUE(embedded_test_server()->Start(kNetworkTestPort)); - NavigateToBundleAndWaitForReady( - GURL(base::StringPrintf( - "http://localhost:%d/web_bundle/path_test/in_scope/path_test.wbn", - kNetworkTestPort)), - GURL(base::StringPrintf( - "http://localhost:%d/web_bundle/path_test/in_scope/", - kNetworkTestPort))); - NavigateToURLAndWaitForTitle( - GURL(base::StringPrintf( - "http://localhost:%d/web_bundle/path_test/out_scope/page.html", - kNetworkTestPort)), - "Out scope page from server / out scope script from server"); - WebContents* web_contents = shell()->web_contents(); WebContentsConsoleObserver console_observer(web_contents); @@ -1055,181 +1041,201 @@ base::UTF16ToUTF8(console_observer.messages()[0].message)); } - static GURL GetTestUrl(const std::string& host) { - return GURL(base::StringPrintf("http://%s:%d/web_bundle/test.wbn", - host.c_str(), kNetworkTestPort)); - } + void SetHeaders(const std::string& headers) { headers_ = headers; } + void SetContents(const std::string& contents) { contents_ = contents; } + const std::string& contents() const { return contents_; } private: base::test::ScopedFeatureList feature_list_; + std::string headers_; + std::string contents_; DISALLOW_COPY_AND_ASSIGN(WebBundleNetworkBrowserTest); }; -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. -IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, DISABLED_Simple) { - const std::string test_bundle = - GetTestFile("web_bundle_browsertest_network.wbn"); - RegisterRequestHandler( - "/web_bundle/test.wbn", - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle); - ASSERT_TRUE(embedded_test_server()->Start(kNetworkTestPort)); - NavigateToBundleAndWaitForReady( - GetTestUrl("localhost"), - GURL(base::StringPrintf("http://localhost:%d/web_bundle/network/", - kNetworkTestPort))); +IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, Simple) { + const std::string wbn_path = "/web_bundle/test.wbn"; + const std::string primary_url_path = "/web_bundle/test.html"; + RegisterRequestHandler(wbn_path); + SetHeaders( + "HTTP/1.1 200 OK\n" + "Content-Type:application/webbundle\n"); + ASSERT_TRUE(embedded_test_server()->Start()); + + const GURL wbn_url = embedded_test_server()->GetURL(wbn_path); + const GURL primary_url = embedded_test_server()->GetURL(primary_url_path); + + SetContents(CreateSimpleWebBundle(primary_url)); + NavigateToBundleAndWaitForReady(wbn_url, primary_url); } -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. -IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, DISABLED_Download) { - const std::string test_bundle = - GetTestFile("web_bundle_browsertest_network.wbn"); - // Web Bundle file with attachment Content-Disposition must trigger download. - RegisterRequestHandler( - "/web_bundle/test.wbn", - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Content-Disposition:attachment; filename=test.wbn\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle); - ASSERT_TRUE(embedded_test_server()->Start(kNetworkTestPort)); - const GURL url = GetTestUrl("localhost"); +IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, SimpleWithScript) { + const std::string wbn_path = "/web_bundle/test.wbn"; + RegisterRequestHandler(wbn_path); + SetHeaders( + "HTTP/1.1 200 OK\n" + "Content-Type:application/webbundle\n"); + ASSERT_TRUE(embedded_test_server()->Start()); + + const GURL wbn_url = embedded_test_server()->GetURL(wbn_path); + const GURL primary_url = + embedded_test_server()->GetURL("/web_bundle/test.html"); + const GURL script_url = + embedded_test_server()->GetURL("/web_bundle/script.js"); + + data_decoder::test::WebBundleBuilder builder(primary_url.spec(), ""); + builder.AddExchange(primary_url.spec(), + {{":status", "200"}, {"content-type", "text/html"}}, + "<script src=\"script.js\"></script>"); + builder.AddExchange( + script_url.spec(), + {{":status", "200"}, {"content-type", "application/javascript"}}, + "document.title = 'Ready';"); + + std::vector<uint8_t> bundle = builder.CreateBundle(); + SetContents(std::string(bundle.begin(), bundle.end())); + NavigateToBundleAndWaitForReady(wbn_url, primary_url); +} + +IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, Download) { + const std::string wbn_path = "/web_bundle/test.wbn"; + const std::string primary_url_path = "/web_bundle/test.html"; + RegisterRequestHandler(wbn_path); + SetHeaders( + "HTTP/1.1 200 OK\n" + "Content-Disposition:attachment; filename=test.wbn\n" + "Content-Type:application/webbundle\n"); + ASSERT_TRUE(embedded_test_server()->Start()); + + const GURL wbn_url = embedded_test_server()->GetURL(wbn_path); + const GURL primary_url = embedded_test_server()->GetURL(primary_url_path); + + SetContents(CreateSimpleWebBundle(primary_url)); WebContents* web_contents = shell()->web_contents(); std::unique_ptr<DownloadObserver> download_observer = std::make_unique<DownloadObserver>(BrowserContext::GetDownloadManager( web_contents->GetBrowserContext())); - EXPECT_FALSE(NavigateToURL(web_contents, url)); + + EXPECT_FALSE(NavigateToURL(web_contents, wbn_url)); download_observer->WaitUntilDownloadCreated(); - EXPECT_EQ(url, download_observer->observed_url()); + EXPECT_EQ(wbn_url, download_observer->observed_url()); } -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. -IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, DISABLED_NoContentLength) { - const std::string test_bundle = - GetTestFile("web_bundle_browsertest_network.wbn"); - // No Content-Length header. - RegisterRequestHandler("/web_bundle/test.wbn", - "HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n", - test_bundle); - ASSERT_TRUE(embedded_test_server()->Start(kNetworkTestPort)); - NavigateToBundleAndWaitForReady( - GetTestUrl("localhost"), - GURL(base::StringPrintf("http://localhost:%d/web_bundle/network/", - kNetworkTestPort))); -} +IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, ContentLength) { + const std::string wbn_path = "/web_bundle/test.wbn"; + const std::string primary_url_path = "/web_bundle/test.html"; + RegisterRequestHandler(wbn_path); + ASSERT_TRUE(embedded_test_server()->Start()); -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. -IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, DISABLED_NonSecureUrl) { - const std::string test_bundle = - GetTestFile("web_bundle_browsertest_network.wbn"); - RegisterRequestHandler( - "/web_bundle/test.wbn", + const GURL wbn_url = embedded_test_server()->GetURL(wbn_path); + const GURL primary_url = embedded_test_server()->GetURL(primary_url_path); + + SetContents(CreateSimpleWebBundle(primary_url)); + SetHeaders( base::StringPrintf("HTTP/1.1 200 OK\n" "Content-Type:application/webbundle\n" "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle); - ASSERT_TRUE(embedded_test_server()->Start(kNetworkTestPort)); + contents().size())); + NavigateToBundleAndWaitForReady(wbn_url, primary_url); +} + +IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, NonSecureUrl) { + const std::string wbn_path = "/web_bundle/test.wbn"; + const std::string primary_url_path = "/web_bundle/test.html"; + RegisterRequestHandler(wbn_path); + SetHeaders( + "HTTP/1.1 200 OK\n" + "Content-Type:application/webbundle\n"); + ASSERT_TRUE(embedded_test_server()->Start()); + + const GURL wbn_url = embedded_test_server()->GetURL("example.com", wbn_path); + const GURL primary_url = + embedded_test_server()->GetURL("example.com", primary_url_path); + SetContents(CreateSimpleWebBundle(primary_url)); TestNavigationFailure( - GetTestUrl("example.com"), + wbn_url, "Web Bundle response must be served from HTTPS or localhost HTTP."); } -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. -IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, - DISABLED_PrimaryURLNotFound) { - const std::string test_bundle = - GetTestFile("web_bundle_browsertest_network_primary_url_not_found.wbn"); +IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, PrimaryURLNotFound) { + const std::string wbn_path = "/web_bundle/test.wbn"; + const std::string primary_url_path = "/web_bundle/test.html"; + RegisterRequestHandler(wbn_path); + SetHeaders( + "HTTP/1.1 200 OK\n" + "Content-Type:application/webbundle\n"); + ASSERT_TRUE(embedded_test_server()->Start()); - RegisterRequestHandler( - "/web_bundle/test.wbn", - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle); - ASSERT_TRUE(embedded_test_server()->Start(kNetworkTestPort)); + const GURL wbn_url = embedded_test_server()->GetURL(wbn_path); + const GURL primary_url = embedded_test_server()->GetURL(primary_url_path); + const GURL inner_url = + embedded_test_server()->GetURL("/web_bundle/inner.html"); + data_decoder::test::WebBundleBuilder builder(primary_url.spec(), ""); + builder.AddExchange(inner_url.spec(), + {{":status", "200"}, {"content-type", "text/html"}}, + "<title>Ready</title>"); + std::vector<uint8_t> bundle = builder.CreateBundle(); + SetContents(std::string(bundle.begin(), bundle.end())); TestNavigationFailure( - GetTestUrl("localhost"), - "The primary URL resource is not found in the web bundle."); + wbn_url, "The primary URL resource is not found in the web bundle."); } -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. -IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, DISABLED_OriginMismatch) { - const std::string test_bundle = - GetTestFile("web_bundle_browsertest_network.wbn"); - RegisterRequestHandler( - "/web_bundle/test.wbn", - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle); - ASSERT_TRUE(embedded_test_server()->Start(kNetworkTestPort)); +IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, OriginMismatch) { + const std::string wbn_path = "/web_bundle/test.wbn"; + const std::string primary_url_path = "/web_bundle/test.html"; + RegisterRequestHandler(wbn_path); + SetHeaders( + "HTTP/1.1 200 OK\n" + "Content-Type:application/webbundle\n"); + ASSERT_TRUE(embedded_test_server()->Start()); + + const GURL primary_url = + embedded_test_server()->GetURL("localhost", primary_url_path); + + SetContents(CreateSimpleWebBundle(primary_url)); TestNavigationFailure( - GetTestUrl("127.0.0.1"), + embedded_test_server()->GetURL("127.0.0.1", wbn_path), "The origin of primary URL doesn't match with the origin of the web " "bundle."); } -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. -IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, DISABLED_InvalidFile) { - const std::string test_bundle = GetTestFile("invalid_web_bundle.wbn"); - RegisterRequestHandler( - "/web_bundle/test.wbn", - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle); - ASSERT_TRUE(embedded_test_server()->Start(kNetworkTestPort)); +IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, InvalidFile) { + const std::string wbn_path = "/web_bundle/test.wbn"; + const std::string primary_url_path = "/web_bundle/test.html"; + RegisterRequestHandler(wbn_path); + SetHeaders( + "HTTP/1.1 200 OK\n" + "Content-Type:application/webbundle\n"); + SetContents("This is an invalid Web Bundle file."); + ASSERT_TRUE(embedded_test_server()->Start()); + TestNavigationFailure( - GetTestUrl("localhost"), + embedded_test_server()->GetURL(wbn_path), "Failed to read metadata of Web Bundle file: Wrong magic bytes."); } -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. -IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, - DISABLED_DataDecoderRestart) { - const GURL primary_url(base::StringPrintf( - "http://localhost:%d/web_bundle/network/", kNetworkTestPort)); - const GURL script_url(base::StringPrintf( - "http://localhost:%d/web_bundle/network/script.js", kNetworkTestPort)); +IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, DataDecoderRestart) { + const std::string wbn_path = "/web_bundle/test.wbn"; + RegisterRequestHandler(wbn_path); + SetHeaders( + "HTTP/1.1 200 OK\n" + "Content-Type:application/webbundle\n"); + ASSERT_TRUE(embedded_test_server()->Start()); + + const GURL primary_url = + embedded_test_server()->GetURL("/web_bundle/test.html"); + const GURL script_url = + embedded_test_server()->GetURL("/web_bundle/script.js"); const std::string primary_url_content = "<title>Ready</title>"; const std::string script_url_content = "document.title = 'OK'"; + SetContents(primary_url_content + script_url_content); + std::vector<std::pair<GURL, const std::string&>> items = { {primary_url, primary_url_content}, {script_url, script_url_content}}; - const std::string test_bundle = primary_url_content + script_url_content; - RegisterRequestHandler( - "/web_bundle/test.wbn", - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle); - MockParserFactory mock_factory(items); - ASSERT_TRUE(embedded_test_server()->Start(kNetworkTestPort)); - const GURL test_data_url = GetTestUrl("localhost"); - NavigateToBundleAndWaitForReady( - test_data_url, - GURL(base::StringPrintf("http://localhost:%d/web_bundle/network/", - kNetworkTestPort))); + NavigateToBundleAndWaitForReady(embedded_test_server()->GetURL(wbn_path), + primary_url); EXPECT_EQ(1, mock_factory.GetParserCreationCount()); mock_factory.SimulateParserDisconnect(); @@ -1243,258 +1249,242 @@ EXPECT_EQ(2, mock_factory.GetParserCreationCount()); } -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. -IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, - DISABLED_ParseMetadataCrash) { - const GURL primary_url(base::StringPrintf( - "http://localhost:%d/web_bundle/network/", kNetworkTestPort)); - const std::string test_bundle = "<title>Ready</title>"; +IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, ParseMetadataCrash) { + const std::string wbn_path = "/web_bundle/test.wbn"; + RegisterRequestHandler(wbn_path); + SetHeaders( + "HTTP/1.1 200 OK\n" + "Content-Type:application/webbundle\n"); + SetContents("<title>Ready</title>"); + ASSERT_TRUE(embedded_test_server()->Start()); + + const GURL primary_url = + embedded_test_server()->GetURL("/web_bundle/test.html"); std::vector<std::pair<GURL, const std::string&>> items = { - {primary_url, test_bundle}}; - RegisterRequestHandler( - "/web_bundle/test.wbn", - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle); + {primary_url, contents()}}; MockParserFactory mock_factory(items); mock_factory.SimulateParseMetadataCrash(); - ASSERT_TRUE(embedded_test_server()->Start(kNetworkTestPort)); - const GURL test_data_url = GetTestUrl("localhost"); - TestNavigationFailure(test_data_url, + TestNavigationFailure(embedded_test_server()->GetURL(wbn_path), "Failed to read metadata of Web Bundle file: Cannot " "connect to the remote parser service"); } -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. -IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, - DISABLED_ParseResponseCrash) { - const GURL primary_url(base::StringPrintf( - "http://localhost:%d/web_bundle/network/", kNetworkTestPort)); - const std::string test_bundle = "<title>Ready</title>"; +IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, ParseResponseCrash) { + const std::string wbn_path = "/web_bundle/test.wbn"; + RegisterRequestHandler(wbn_path); + SetHeaders( + "HTTP/1.1 200 OK\n" + "Content-Type:application/webbundle\n"); + SetContents("<title>Ready</title>"); + ASSERT_TRUE(embedded_test_server()->Start()); + + const GURL primary_url = + embedded_test_server()->GetURL("/web_bundle/test.html"); std::vector<std::pair<GURL, const std::string&>> items = { - {primary_url, test_bundle}}; - RegisterRequestHandler( - "/web_bundle/test.wbn", - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle); + {primary_url, contents()}}; MockParserFactory mock_factory(items); mock_factory.SimulateParseResponseCrash(); - ASSERT_TRUE(embedded_test_server()->Start(kNetworkTestPort)); - const GURL test_data_url = GetTestUrl("localhost"); - TestNavigationFailure(test_data_url, + TestNavigationFailure(embedded_test_server()->GetURL(wbn_path), "Failed to read response header of Web Bundle file: " "Cannot connect to the remote parser service"); } -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. -IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, DISABLED_PathMismatch) { - const std::string test_bundle = - GetTestFile("web_bundle_browsertest_network.wbn"); - RegisterRequestHandler( - "/other_dir/test.wbn", - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle); - ASSERT_TRUE(embedded_test_server()->Start(kNetworkTestPort)); +IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, PathMismatch) { + const std::string wbn_path = "/web_bundle/test.wbn"; + const std::string primary_url_path = "/other_dir/test.html"; + RegisterRequestHandler(wbn_path); + SetHeaders( + "HTTP/1.1 200 OK\n" + "Content-Type:application/webbundle\n"); + ASSERT_TRUE(embedded_test_server()->Start()); + + const GURL wbn_url = embedded_test_server()->GetURL(wbn_path); + const GURL primary_url = embedded_test_server()->GetURL(primary_url_path); + + SetContents(CreateSimpleWebBundle(primary_url)); TestNavigationFailure( - GURL(base::StringPrintf("http://localhost:%d/other_dir/" - "test.wbn", - kNetworkTestPort)), - base::StringPrintf( - "Path restriction mismatch: Can't navigate to " - "http://localhost:%d/web_bundle/network/ in the web bundle served " - "from http://localhost:%d/other_dir/test.wbn.", - kNetworkTestPort, kNetworkTestPort)); + wbn_url, + base::StringPrintf("Path restriction mismatch: Can't navigate to %s in " + "the web bundle served from %s.", + primary_url.spec().c_str(), wbn_url.spec().c_str())); } -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. -IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, DISABLED_Navigations) { - const std::string test_bundle = GetTestFile("path_test.wbn"); - RegisterRequestHandler( - "/web_bundle/path_test/in_scope/path_test.wbn", - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle); - ASSERT_TRUE(embedded_test_server()->Start(kNetworkTestPort)); +IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, Navigations) { + const std::string wbn_path = "/web_bundle/path_test/in_scope/path_test.wbn"; + RegisterRequestHandler(wbn_path); + SetHeaders( + "HTTP/1.1 200 OK\n" + "Content-Type:application/webbundle\n"); + ASSERT_TRUE(embedded_test_server()->Start()); + SetContents(CreatePathTestWebBundle(embedded_test_server())); - NavigateToBundleAndWaitForReady( - GURL(base::StringPrintf( - "http://localhost:%d/web_bundle/path_test/in_scope/path_test.wbn", - kNetworkTestPort)), - GURL(base::StringPrintf( - "http://localhost:%d/web_bundle/path_test/in_scope/", - kNetworkTestPort))); + const GURL wbn_url = embedded_test_server()->GetURL(wbn_path); + const GURL primary_url = + embedded_test_server()->GetURL("/web_bundle/path_test/in_scope/"); + NavigateToBundleAndWaitForReady(wbn_url, primary_url); NavigateToURLAndWaitForTitle( - GURL(base::StringPrintf( - "http://localhost:%d/web_bundle/path_test/in_scope/page.html", - kNetworkTestPort)), + embedded_test_server()->GetURL( + "/web_bundle/path_test/in_scope/page.html"), "In scope page in Web Bundle / in scope script in Web Bundle"); - NavigateToURLAndWaitForTitle( - GURL(base::StringPrintf( - "http://localhost:%d/web_bundle/path_test/out_scope/page.html", - kNetworkTestPort)), + embedded_test_server()->GetURL( + "/web_bundle/path_test/out_scope/page.html"), "Out scope page from server / out scope script from server"); - NavigateToURLAndWaitForTitle( - GURL(base::StringPrintf( - "http://localhost:%d/web_bundle/path_test/in_scope/page.html", - kNetworkTestPort)), + embedded_test_server()->GetURL( + "/web_bundle/path_test/in_scope/page.html"), "In scope page from server / in scope script from server"); } -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. -IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, - DISABLED_HistoryNavigations) { - const std::string test_bundle = GetTestFile("path_test.wbn"); - RegisterRequestHandler( - "/web_bundle/path_test/in_scope/path_test.wbn", - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle); - ASSERT_TRUE(embedded_test_server()->Start(kNetworkTestPort)); +IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, HistoryNavigations) { + const std::string wbn_path = "/web_bundle/path_test/in_scope/path_test.wbn"; + RegisterRequestHandler(wbn_path); + SetHeaders( + "HTTP/1.1 200 OK\n" + "Content-Type:application/webbundle\n"); + ASSERT_TRUE(embedded_test_server()->Start()); + SetContents(CreatePathTestWebBundle(embedded_test_server())); - NavigateToBundleAndWaitForReady( - GURL(base::StringPrintf( - "http://localhost:%d/web_bundle/path_test/in_scope/path_test.wbn", - kNetworkTestPort)), - GURL(base::StringPrintf( - "http://localhost:%d/web_bundle/path_test/in_scope/", - kNetworkTestPort))); + const GURL wbn_url = embedded_test_server()->GetURL(wbn_path); + const GURL primary_url = + embedded_test_server()->GetURL("/web_bundle/path_test/in_scope/"); + NavigateToBundleAndWaitForReady(wbn_url, primary_url); NavigateToURLAndWaitForTitle( - GURL(base::StringPrintf( - "http://localhost:%d/web_bundle/path_test/in_scope/page.html", - kNetworkTestPort)), + embedded_test_server()->GetURL( + "/web_bundle/path_test/in_scope/page.html"), "In scope page in Web Bundle / in scope script in Web Bundle"); NavigateToURLAndWaitForTitle( - GURL(base::StringPrintf( - "http://localhost:%d/web_bundle/path_test/in_scope/", - kNetworkTestPort)), + embedded_test_server()->GetURL("/web_bundle/path_test/in_scope/"), "Ready"); ExecuteScriptAndWaitForTitle( "history.back();", "In scope page in Web Bundle / in scope script in Web Bundle"); EXPECT_EQ(shell()->web_contents()->GetLastCommittedURL(), - GURL(base::StringPrintf( - "http://localhost:%d/web_bundle/path_test/in_scope/page.html", - kNetworkTestPort))); + embedded_test_server()->GetURL( + "/web_bundle/path_test/in_scope/page.html")); NavigateToURLAndWaitForTitle( - GURL(base::StringPrintf( - "http://localhost:%d/web_bundle/path_test/out_scope/page.html", - kNetworkTestPort)), + embedded_test_server()->GetURL( + "/web_bundle/path_test/out_scope/page.html"), "Out scope page from server / out scope script from server"); ExecuteScriptAndWaitForTitle( "history.back();", "In scope page in Web Bundle / in scope script in Web Bundle"); EXPECT_EQ(shell()->web_contents()->GetLastCommittedURL(), - GURL(base::StringPrintf( - "http://localhost:%d/web_bundle/path_test/in_scope/page.html", - kNetworkTestPort))); + embedded_test_server()->GetURL( + "/web_bundle/path_test/in_scope/page.html")); } -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, - DISABLED_HistoryNavigationError_UnexpectedContentType) { - const std::string test_bundle = GetTestFile("path_test.wbn"); - RunHistoryNavigationErrorTest( - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Cache-Control:no-store\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle, - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/foo_bar\n" - "Cache-Control:no-store\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle, "Unexpected content type."); + HistoryNavigationError_UnexpectedContentType) { + const std::string wbn_path = "/web_bundle/test.wbn"; + const std::string primary_url_path = "/web_bundle/test.html"; + RegisterRequestHandler(wbn_path); + ASSERT_TRUE(embedded_test_server()->Start()); + + const GURL wbn_url = embedded_test_server()->GetURL(wbn_path); + const GURL primary_url = embedded_test_server()->GetURL(primary_url_path); + + SetHeaders( + "HTTP/1.1 200 OK\n" + "Cache-Control:no-store\n" + "Content-Type:application/webbundle\n"); + SetContents(CreateSimpleWebBundle(primary_url)); + NavigateToBundleAndWaitForReady(wbn_url, primary_url); + NavigateToURLAndWaitForTitle( + embedded_test_server()->GetURL("/web_bundle/empty_page.html"), + "Empty Page"); + + SetHeaders( + "HTTP/1.1 200 OK\n" + "Cache-Control:no-store\n" + "Content-Type:application/foo_bar\n"); + HistoryBackAndWaitUntilConsoleError("Unexpected content type."); } -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, - DISABLED_HistoryNavigationError_UnexpectedRedirect) { - const std::string test_bundle = GetTestFile("path_test.wbn"); - RunHistoryNavigationErrorTest( - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Cache-Control:no-store\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle, + HistoryNavigationError_UnexpectedRedirect) { + const std::string wbn_path = "/web_bundle/test.wbn"; + const std::string primary_url_path = "/web_bundle/test.html"; + RegisterRequestHandler(wbn_path); + ASSERT_TRUE(embedded_test_server()->Start()); + + const GURL wbn_url = embedded_test_server()->GetURL(wbn_path); + const GURL primary_url = embedded_test_server()->GetURL(primary_url_path); + + SetHeaders( + "HTTP/1.1 200 OK\n" + "Cache-Control:no-store\n" + "Content-Type:application/webbundle\n"); + SetContents(CreateSimpleWebBundle(primary_url)); + NavigateToBundleAndWaitForReady(wbn_url, primary_url); + NavigateToURLAndWaitForTitle( + embedded_test_server()->GetURL("/web_bundle/empty_page.html"), + "Empty Page"); + + SetHeaders( "HTTP/1.1 302 OK\n" - "Location:/web_bundle/empty_page.html\n", - "", "Unexpected redirect."); + "Location:/web_bundle/empty_page.html\n"); + SetContents(""); + HistoryBackAndWaitUntilConsoleError("Unexpected redirect."); } -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, - DISABLED_HistoryNavigationError_ReadMetadataFailure) { - const std::string test_bundle = GetTestFile("path_test.wbn"); - const std::string invalid_bundle = GetTestFile("invalid_web_bundle.wbn"); - RunHistoryNavigationErrorTest( - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Cache-Control:no-store\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle, - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Cache-Control:no-store\n" - "Content-Length: %" PRIuS "\n", - invalid_bundle.size()), - invalid_bundle, + HistoryNavigationError_ReadMetadataFailure) { + const std::string wbn_path = "/web_bundle/test.wbn"; + const std::string primary_url_path = "/web_bundle/test.html"; + RegisterRequestHandler(wbn_path); + ASSERT_TRUE(embedded_test_server()->Start()); + + const GURL wbn_url = embedded_test_server()->GetURL(wbn_path); + const GURL primary_url = embedded_test_server()->GetURL(primary_url_path); + + SetHeaders( + "HTTP/1.1 200 OK\n" + "Cache-Control:no-store\n" + "Content-Type:application/webbundle\n"); + SetContents(CreateSimpleWebBundle(primary_url)); + NavigateToBundleAndWaitForReady(wbn_url, primary_url); + NavigateToURLAndWaitForTitle( + embedded_test_server()->GetURL("/web_bundle/empty_page.html"), + "Empty Page"); + + SetContents("This is an invalid Web Bundle file."); + HistoryBackAndWaitUntilConsoleError( "Failed to read metadata of Web Bundle file: Wrong magic bytes."); } -// TODO(crbug.com/1038346): Starting the embedded test server on a fixed port -// will fail if the bot is simultaneously running several of these tests. IN_PROC_BROWSER_TEST_F(WebBundleNetworkBrowserTest, - DISABLED_HistoryNavigationError_ExpectedUrlNotFound) { - const std::string test_bundle = GetTestFile("path_test.wbn"); - const std::string other_bundle = - GetTestFile("web_bundle_browsertest_network.wbn"); - RunHistoryNavigationErrorTest( - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Cache-Control:no-store\n" - "Content-Length: %" PRIuS "\n", - test_bundle.size()), - test_bundle, - base::StringPrintf("HTTP/1.1 200 OK\n" - "Content-Type:application/webbundle\n" - "Cache-Control:no-store\n" - "Content-Length: %" PRIuS "\n", - other_bundle.size()), - other_bundle, + HistoryNavigationError_ExpectedUrlNotFound) { + const std::string wbn_path = "/web_bundle/test.wbn"; + const std::string primary_url_path = "/web_bundle/test.html"; + const std::string alt_primary_url_path = "/web_bundle/alt.html"; + RegisterRequestHandler(wbn_path); + ASSERT_TRUE(embedded_test_server()->Start()); + + const GURL wbn_url = embedded_test_server()->GetURL(wbn_path); + const GURL primary_url = embedded_test_server()->GetURL(primary_url_path); + + SetHeaders( + "HTTP/1.1 200 OK\n" + "Cache-Control:no-store\n" + "Content-Type:application/webbundle\n"); + SetContents(CreateSimpleWebBundle(primary_url)); + NavigateToBundleAndWaitForReady(wbn_url, primary_url); + NavigateToURLAndWaitForTitle( + embedded_test_server()->GetURL("/web_bundle/empty_page.html"), + "Empty Page"); + + SetContents(CreateSimpleWebBundle( + embedded_test_server()->GetURL(alt_primary_url_path))); + HistoryBackAndWaitUntilConsoleError( "The expected URL resource is not found in the web bundle."); }
diff --git a/content/public/browser/push_messaging_service.h b/content/public/browser/push_messaging_service.h index 7ac6d5b..37a3a2fe 100644 --- a/content/public/browser/push_messaging_service.h +++ b/content/public/browser/push_messaging_service.h
@@ -57,7 +57,7 @@ virtual void SubscribeFromDocument( const GURL& requesting_origin, int64_t service_worker_registration_id, - int renderer_id, + int render_process_id, int render_frame_id, blink::mojom::PushSubscriptionOptionsPtr options, bool user_gesture,
diff --git a/content/public/test/android/BUILD.gn b/content/public/test/android/BUILD.gn index 213fe69..56f3c1fb 100644 --- a/content/public/test/android/BUILD.gn +++ b/content/public/test/android/BUILD.gn
@@ -3,19 +3,13 @@ generate_jni("test_support_content_jni_headers") { testonly = true - sources = [ - "javatests/src/org/chromium/content_public/browser/test/NestedSystemMessageHandler.java", - ] + sources = [ "javatests/src/org/chromium/content_public/browser/test/NestedSystemMessageHandler.java" ] } android_library("android_test_message_pump_support_java") { testonly = true - deps = [ - "//base:base_java", - ] - sources = [ - "javatests/src/org/chromium/content_public/browser/test/NestedSystemMessageHandler.java", - ] + deps = [ "//base:base_java" ] + sources = [ "javatests/src/org/chromium/content_public/browser/test/NestedSystemMessageHandler.java" ] } android_library("content_java_test_support") {
diff --git a/content/test/data/web_bundle/generate-test-wbns.sh b/content/test/data/web_bundle/generate-test-wbns.sh index b550033..0734126 100755 --- a/content/test/data/web_bundle/generate-test-wbns.sh +++ b/content/test/data/web_bundle/generate-test-wbns.sh
@@ -46,31 +46,6 @@ sed 's/3a737461747573/3a787878787878/3' | xxd -r -p > broken_bundle_broken_script_entry.wbn - -# Keep consistent with WebBundleNetworkBrowserTest::kNetworkTestPort. -NETWORK_TEST_PORT=39600 - -gen-bundle \ - -version b1 \ - -baseURL http://localhost:$NETWORK_TEST_PORT/web_bundle/network/ \ - -primaryURL http://localhost:$NETWORK_TEST_PORT/web_bundle/network/ \ - -dir web_bundle_browsertest/ \ - -o web_bundle_browsertest_network.wbn - -gen-bundle \ - -version b1 \ - -baseURL http://localhost:$NETWORK_TEST_PORT/web_bundle/network/ \ - -primaryURL http://localhost:$NETWORK_TEST_PORT/web_bundle/network/not_found.html \ - -dir web_bundle_browsertest/ \ - -o web_bundle_browsertest_network_primary_url_not_found.wbn - -gen-bundle \ - -version b1 \ - -baseURL http://localhost:$NETWORK_TEST_PORT/web_bundle/path_test/ \ - -primaryURL http://localhost:$NETWORK_TEST_PORT/web_bundle/path_test/in_scope/ \ - -dir path_test_wbn/ \ - -o path_test.wbn - gen-bundle \ -version b1 \ -primaryURL https://test.example.org/ \
diff --git a/content/test/data/web_bundle/path_test.wbn b/content/test/data/web_bundle/path_test.wbn deleted file mode 100644 index ff64712..0000000 --- a/content/test/data/web_bundle/path_test.wbn +++ /dev/null Binary files differ
diff --git a/content/test/data/web_bundle/path_test_wbn/in_scope/index.html b/content/test/data/web_bundle/path_test_wbn/in_scope/index.html deleted file mode 100644 index 57026d5..0000000 --- a/content/test/data/web_bundle/path_test_wbn/in_scope/index.html +++ /dev/null
@@ -1,2 +0,0 @@ -<!DOCTYPE html> -<title>Ready</title>
diff --git a/content/test/data/web_bundle/path_test_wbn/in_scope/page.html b/content/test/data/web_bundle/path_test_wbn/in_scope/page.html deleted file mode 100644 index 3d9b810..0000000 --- a/content/test/data/web_bundle/path_test_wbn/in_scope/page.html +++ /dev/null
@@ -1,5 +0,0 @@ -<!DOCTYPE html> -<script> -const page_info = 'In scope page in Web Bundle'; -</script> -<script src="page.js"></script>
diff --git a/content/test/data/web_bundle/path_test_wbn/in_scope/page.js b/content/test/data/web_bundle/path_test_wbn/in_scope/page.js deleted file mode 100644 index 70bbf46a..0000000 --- a/content/test/data/web_bundle/path_test_wbn/in_scope/page.js +++ /dev/null
@@ -1,5 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -document.title = page_info + ' / in scope script in Web Bundle';
diff --git a/content/test/data/web_bundle/path_test_wbn/out_scope/page.html b/content/test/data/web_bundle/path_test_wbn/out_scope/page.html deleted file mode 100644 index c77141b..0000000 --- a/content/test/data/web_bundle/path_test_wbn/out_scope/page.html +++ /dev/null
@@ -1,5 +0,0 @@ -<!DOCTYPE html> -<script> -const page_info = 'Out scope page in Web Bundle'; -</script> -<script src="page.js"></script>
diff --git a/content/test/data/web_bundle/path_test_wbn/out_scope/page.js b/content/test/data/web_bundle/path_test_wbn/out_scope/page.js deleted file mode 100644 index a82c740..0000000 --- a/content/test/data/web_bundle/path_test_wbn/out_scope/page.js +++ /dev/null
@@ -1,5 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -document.title = page_info + ' / out scope script in Web Bundle';
diff --git a/content/test/data/web_bundle/web_bundle_browsertest_network.wbn b/content/test/data/web_bundle/web_bundle_browsertest_network.wbn deleted file mode 100644 index 20d32c6..0000000 --- a/content/test/data/web_bundle/web_bundle_browsertest_network.wbn +++ /dev/null Binary files differ
diff --git a/content/test/data/web_bundle/web_bundle_browsertest_network_primary_url_not_found.wbn b/content/test/data/web_bundle/web_bundle_browsertest_network_primary_url_not_found.wbn deleted file mode 100644 index 28632aaf..0000000 --- a/content/test/data/web_bundle/web_bundle_browsertest_network_primary_url_not_found.wbn +++ /dev/null Binary files differ
diff --git a/device/base/BUILD.gn b/device/base/BUILD.gn index ae74994..cfbb391 100644 --- a/device/base/BUILD.gn +++ b/device/base/BUILD.gn
@@ -20,13 +20,9 @@ defines = [ "DEVICE_BASE_IMPLEMENTATION" ] - deps = [ - "//device/vr/buildflags", - ] + deps = [ "//device/vr/buildflags" ] - public_deps = [ - "//base", - ] + public_deps = [ "//base" ] if (use_udev) { sources += [
diff --git a/device/base/synchronization/BUILD.gn b/device/base/synchronization/BUILD.gn index 2f7b609b..437e7e6 100644 --- a/device/base/synchronization/BUILD.gn +++ b/device/base/synchronization/BUILD.gn
@@ -9,7 +9,5 @@ "shared_memory_seqlock_buffer.h", ] - deps = [ - "//base", - ] + deps = [ "//base" ] }
diff --git a/device/bluetooth/BUILD.gn b/device/bluetooth/BUILD.gn index d9dde513..cd39168 100644 --- a/device/bluetooth/BUILD.gn +++ b/device/bluetooth/BUILD.gn
@@ -228,9 +228,7 @@ "//ui/base", ] - public_deps = [ - "//device/bluetooth/public/cpp", - ] + public_deps = [ "//device/bluetooth/public/cpp" ] if (is_android) { deps += [ ":jni_headers" ]
diff --git a/extensions/browser/api/automation_internal/BUILD.gn b/extensions/browser/api/automation_internal/BUILD.gn index 0e1c50e..e1258b38 100644 --- a/extensions/browser/api/automation_internal/BUILD.gn +++ b/extensions/browser/api/automation_internal/BUILD.gn
@@ -18,9 +18,7 @@ "automation_internal_api_delegate.h", ] - public_deps = [ - "//extensions/browser:browser_sources", - ] + public_deps = [ "//extensions/browser:browser_sources" ] deps = [ "//components/prefs",
diff --git a/google_apis/BUILD.gn b/google_apis/BUILD.gn index 29d2d75..82d8a5c6 100644 --- a/google_apis/BUILD.gn +++ b/google_apis/BUILD.gn
@@ -193,9 +193,7 @@ source_set("run_all_unittests") { testonly = true - sources = [ - "run_all_unittests.cc", - ] + sources = [ "run_all_unittests.cc" ] deps = [ "//base/test:test_support", @@ -220,9 +218,7 @@ "google_api_keys_unittest.h", ] - data = [ - "test/", - ] + data = [ "test/" ] configs += [ ":key_defines" ]
diff --git a/gpu/command_buffer/service/shared_image_backing_factory_ahardwarebuffer.cc b/gpu/command_buffer/service/shared_image_backing_factory_ahardwarebuffer.cc index 8ad933f..483bddb 100644 --- a/gpu/command_buffer/service/shared_image_backing_factory_ahardwarebuffer.cc +++ b/gpu/command_buffer/service/shared_image_backing_factory_ahardwarebuffer.cc
@@ -13,6 +13,7 @@ #include <vector> #include "base/android/android_hardware_buffer_compat.h" +#include "base/android/scoped_hardware_buffer_fence_sync.h" #include "base/android/scoped_hardware_buffer_handle.h" #include "base/containers/flat_set.h" #include "base/logging.h" @@ -115,6 +116,66 @@ vk_image_info.fImage, vk_image_info.fAlloc.fMemory); } +class OverlayImage final : public gl::GLImage { + public: + explicit OverlayImage(AHardwareBuffer* buffer) + : handle_(base::android::ScopedHardwareBufferHandle::Create(buffer)) {} + + void SetBeginFence(base::ScopedFD fence_fd) { + DCHECK(!end_read_fence_.is_valid()); + DCHECK(!begin_read_fence_.is_valid()); + begin_read_fence_ = std::move(fence_fd); + } + + base::ScopedFD TakeEndFence() { + DCHECK(!begin_read_fence_.is_valid()); + return std::move(end_read_fence_); + } + + // gl::GLImage: + std::unique_ptr<base::android::ScopedHardwareBufferFenceSync> + GetAHardwareBuffer() override { + return std::make_unique<ScopedHardwareBufferFenceSyncImpl>( + this, base::android::ScopedHardwareBufferHandle::Create(handle_.get()), + std::move(begin_read_fence_)); + } + + protected: + ~OverlayImage() override = default; + + private: + class ScopedHardwareBufferFenceSyncImpl + : public base::android::ScopedHardwareBufferFenceSync { + public: + ScopedHardwareBufferFenceSyncImpl( + scoped_refptr<OverlayImage> image, + base::android::ScopedHardwareBufferHandle handle, + base::ScopedFD fence_fd) + : ScopedHardwareBufferFenceSync(std::move(handle), std::move(fence_fd)), + image_(std::move(image)) {} + ~ScopedHardwareBufferFenceSyncImpl() override = default; + + void SetReadFence(base::ScopedFD fence_fd, bool has_context) override { + DCHECK(!image_->begin_read_fence_.is_valid()); + DCHECK(!image_->end_read_fence_.is_valid()); + image_->end_read_fence_ = std::move(fence_fd); + } + + private: + scoped_refptr<OverlayImage> image_; + }; + + base::android::ScopedHardwareBufferHandle handle_; + + // The fence for overlay controller to wait on before scanning out. + base::ScopedFD begin_read_fence_; + + // The fence for overlay controller to set to indicate scanning out + // completion. The image content should not be modified before passing this + // fence. + base::ScopedFD end_read_fence_; +}; + } // namespace // Implementation of SharedImageBacking that holds an AHardwareBuffer. This @@ -141,6 +202,7 @@ NO_THREAD_SAFETY_ANALYSIS override; gfx::Rect ClearedRect() const override; void SetClearedRect(const gfx::Rect& cleared_rect) override; + base::android::ScopedHardwareBufferHandle GetAhbHandle() const; bool BeginWrite(base::ScopedFD* fd_to_wait_on); @@ -149,6 +211,8 @@ base::ScopedFD* fd_to_wait_on); void EndRead(const SharedImageRepresentation* reader, base::ScopedFD end_read_fd); + gl::GLImage* BeginOverlayAccess(); + void EndOverlayAccess(); protected: std::unique_ptr<SharedImageRepresentationGLTexture> ProduceGLTexture( @@ -160,6 +224,10 @@ MemoryTypeTracker* tracker, scoped_refptr<SharedContextState> context_state) override; + std::unique_ptr<SharedImageRepresentationOverlay> ProduceOverlay( + SharedImageManager* manager, + MemoryTypeTracker* tracker) override; + private: gles2::Texture* GenGLTexture(); const base::android::ScopedHardwareBufferHandle hardware_buffer_handle_; @@ -177,6 +245,9 @@ base::flat_set<const SharedImageRepresentation*> active_readers_ GUARDED_BY(lock_); + scoped_refptr<OverlayImage> overlay_image_ GUARDED_BY(lock_); + bool is_overlay_accessing_ GUARDED_BY(lock_) = false; + DISALLOW_COPY_AND_ASSIGN(SharedImageBackingAHB); }; @@ -431,6 +502,43 @@ VkSemaphore end_access_semaphore_ = VK_NULL_HANDLE; }; +class SharedImageRepresentationOverlayAHB + : public SharedImageRepresentationOverlay { + public: + SharedImageRepresentationOverlayAHB(SharedImageManager* manager, + SharedImageBacking* backing, + MemoryTypeTracker* tracker) + : SharedImageRepresentationOverlay(manager, backing, tracker) {} + + ~SharedImageRepresentationOverlayAHB() override { EndReadAccess(); } + + private: + SharedImageBackingAHB* ahb_backing() { + return static_cast<SharedImageBackingAHB*>(backing()); + } + + void NotifyOverlayPromotion(bool promotion, + const gfx::Rect& bounds) override { + NOTREACHED(); + } + + bool BeginReadAccess() override { + gl_image_ = ahb_backing()->BeginOverlayAccess(); + return !!gl_image_; + } + + void EndReadAccess() override { + if (gl_image_) { + ahb_backing()->EndOverlayAccess(); + gl_image_ = nullptr; + } + } + + gl::GLImage* GetGLImage() override { return gl_image_; } + + gl::GLImage* gl_image_ = nullptr; +}; + SharedImageBackingAHB::SharedImageBackingAHB( const Mailbox& mailbox, viz::ResourceFormat format, @@ -563,10 +671,17 @@ manager, this, tracker); } +std::unique_ptr<SharedImageRepresentationOverlay> +SharedImageBackingAHB::ProduceOverlay(SharedImageManager* manager, + MemoryTypeTracker* tracker) { + return std::make_unique<SharedImageRepresentationOverlayAHB>(manager, this, + tracker); +} + bool SharedImageBackingAHB::BeginWrite(base::ScopedFD* fd_to_wait_on) { AutoLock auto_lock(this); - if (is_writing_ || !active_readers_.empty()) { + if (is_writing_ || !active_readers_.empty() || is_overlay_accessing_) { LOG(ERROR) << "BeginWrite should only be called when there are no other " "readers or writers"; return false; @@ -634,6 +749,41 @@ gl::MergeFDs(std::move(read_sync_fd_), std::move(end_read_fd)); } +gl::GLImage* SharedImageBackingAHB::BeginOverlayAccess() { + AutoLock auto_lock(this); + + DCHECK(!is_overlay_accessing_); + + if (is_writing_) { + LOG(ERROR) + << "BeginOverlayAccess should only be called when there are no writers"; + return nullptr; + } + + if (!overlay_image_) { + overlay_image_ = + base::MakeRefCounted<OverlayImage>(hardware_buffer_handle_.get()); + } + + if (write_sync_fd_.is_valid()) { + base::ScopedFD fence_fd(HANDLE_EINTR(dup(write_sync_fd_.get()))); + overlay_image_->SetBeginFence(std::move(fence_fd)); + } + + is_overlay_accessing_ = true; + return overlay_image_.get(); +} + +void SharedImageBackingAHB::EndOverlayAccess() { + AutoLock auto_lock(this); + + DCHECK(is_overlay_accessing_); + is_overlay_accessing_ = false; + + auto fence_fd = overlay_image_->TakeEndFence(); + read_sync_fd_ = gl::MergeFDs(std::move(read_sync_fd_), std::move(fence_fd)); +} + gles2::Texture* SharedImageBackingAHB::GenGLTexture() { DCHECK(hardware_buffer_handle_.is_valid());
diff --git a/gpu/command_buffer/service/shared_image_backing_factory_ahardwarebuffer_unittest.cc b/gpu/command_buffer/service/shared_image_backing_factory_ahardwarebuffer_unittest.cc index ed7e983..30e3458 100644 --- a/gpu/command_buffer/service/shared_image_backing_factory_ahardwarebuffer_unittest.cc +++ b/gpu/command_buffer/service/shared_image_backing_factory_ahardwarebuffer_unittest.cc
@@ -607,5 +607,41 @@ EXPECT_FALSE(mailbox_manager_->ConsumeTexture(mailbox_)); } +TEST_F(SharedImageBackingFactoryAHBTest, Overlay) { + if (!base::AndroidHardwareBufferCompat::IsSupportAvailable()) + return; + + GlLegacySharedImage gl_legacy_shared_image{ + backing_factory_.get(), false /* is_thread_safe */, + &mailbox_manager_, &shared_image_manager_, + memory_type_tracker_.get(), shared_image_representation_factory_.get()}; + + auto skia_representation = shared_image_representation_factory_->ProduceSkia( + gl_legacy_shared_image.mailbox(), context_state_.get()); + + std::vector<GrBackendSemaphore> begin_semaphores; + std::vector<GrBackendSemaphore> end_semaphores; + auto scoped_write_access = skia_representation->BeginScopedWriteAccess( + &begin_semaphores, &end_semaphores, + SharedImageRepresentation::AllowUnclearedAccess::kYes); + EXPECT_TRUE(scoped_write_access); + EXPECT_EQ(0u, begin_semaphores.size()); + EXPECT_EQ(0u, end_semaphores.size()); + scoped_write_access.reset(); + + auto overlay_representation = + shared_image_representation_factory_->ProduceOverlay( + gl_legacy_shared_image.mailbox()); + EXPECT_TRUE(overlay_representation); + + auto scoped_read_access = + overlay_representation->BeginScopedReadAccess(true /* needs_gl_image */); + EXPECT_TRUE(scoped_read_access); + EXPECT_TRUE(scoped_read_access->gl_image()); + + scoped_read_access.reset(); + skia_representation.reset(); +} + } // anonymous namespace } // namespace gpu
diff --git a/gpu/command_buffer/service/shared_image_representation.cc b/gpu/command_buffer/service/shared_image_representation.cc index 3e34acb..ea59dad 100644 --- a/gpu/command_buffer/service/shared_image_representation.cc +++ b/gpu/command_buffer/service/shared_image_representation.cc
@@ -170,7 +170,9 @@ return nullptr; } - BeginReadAccess(); + if (!BeginReadAccess()) + return nullptr; + return std::make_unique<ScopedReadAccess>( util::PassKey<SharedImageRepresentationOverlay>(), this, needs_gl_image ? GetGLImage() : nullptr);
diff --git a/gpu/command_buffer/service/shared_image_representation.h b/gpu/command_buffer/service/shared_image_representation.h index 065db021..67c76c4 100644 --- a/gpu/command_buffer/service/shared_image_representation.h +++ b/gpu/command_buffer/service/shared_image_representation.h
@@ -359,7 +359,7 @@ protected: // TODO(weiliangc): Currently this only handles Android pre-SurfaceControl // case. Add appropriate fence later. - virtual void BeginReadAccess() = 0; + virtual bool BeginReadAccess() = 0; virtual void EndReadAccess() = 0; // TODO(weiliangc): Add API to backing AHardwareBuffer.
diff --git a/gpu/command_buffer/service/shared_image_video.cc b/gpu/command_buffer/service/shared_image_video.cc index 8a534000..0240c02 100644 --- a/gpu/command_buffer/service/shared_image_video.cc +++ b/gpu/command_buffer/service/shared_image_video.cc
@@ -526,7 +526,7 @@ stream_image_(backing->stream_texture_sii_) {} protected: - void BeginReadAccess() override { + bool BeginReadAccess() override { // A |CodecImage| is already in a SurfaceView, render content to the // overlay. if (!stream_image_->HasTextureOwner()) { @@ -534,6 +534,7 @@ "SharedImageRepresentationOverlayVideo::BeginReadAccess"); stream_image_->RenderToOverlay(); } + return true; } void EndReadAccess() override {}
diff --git a/gpu/command_buffer/service/test_shared_image_backing.cc b/gpu/command_buffer/service/test_shared_image_backing.cc index 3427f341a..d07cfd6 100644 --- a/gpu/command_buffer/service/test_shared_image_backing.cc +++ b/gpu/command_buffer/service/test_shared_image_backing.cc
@@ -115,7 +115,7 @@ MemoryTypeTracker* tracker) : SharedImageRepresentationOverlay(manager, backing, tracker) {} - void BeginReadAccess() override {} + bool BeginReadAccess() override { return true; } void EndReadAccess() override {} gl::GLImage* GetGLImage() override { return nullptr; }
diff --git a/ios/chrome/browser/context_menu/BUILD.gn b/ios/chrome/browser/context_menu/BUILD.gn index dccf88e1..a88e90a 100644 --- a/ios/chrome/browser/context_menu/BUILD.gn +++ b/ios/chrome/browser/context_menu/BUILD.gn
@@ -6,9 +6,7 @@ configs += [ "//build/config/compiler:enable_arc" ] defines = [ "CHROME_EARL_GREY_1" ] testonly = true - sources = [ - "context_menu_egtest.mm", - ] + sources = [ "context_menu_egtest.mm" ] deps = [ "//base", "//base/test:test_support", @@ -35,9 +33,7 @@ "//build/config/ios:xctest_config", ] testonly = true - sources = [ - "context_menu_egtest.mm", - ] + sources = [ "context_menu_egtest.mm" ] deps = [ "//base", "//base/test:test_support",
diff --git a/ios/chrome/browser/reading_list/BUILD.gn b/ios/chrome/browser/reading_list/BUILD.gn index 11e0aa1..45fbb6c8 100644 --- a/ios/chrome/browser/reading_list/BUILD.gn +++ b/ios/chrome/browser/reading_list/BUILD.gn
@@ -53,9 +53,7 @@ "//ui/base", "//url", ] - public_deps = [ - "//ios/chrome/browser/dom_distiller", - ] + public_deps = [ "//ios/chrome/browser/dom_distiller" ] allow_circular_includes_from = [ ":reading_list_remover" ] } @@ -113,9 +111,7 @@ bundle_data("distilled_bundle_data") { testonly = true - sources = [ - "data/distilled.html", - ] + sources = [ "data/distilled.html" ] outputs = [ "{{bundle_resources_dir}}/ios/testing/data/Offline/{{source_file_part}}", ]
diff --git a/ios/chrome/browser/sync/BUILD.gn b/ios/chrome/browser/sync/BUILD.gn index 19d308e..8339783 100644 --- a/ios/chrome/browser/sync/BUILD.gn +++ b/ios/chrome/browser/sync/BUILD.gn
@@ -115,9 +115,7 @@ "//ios/web", "//ui/base", ] - public_deps = [ - "//testing/gmock", - ] + public_deps = [ "//testing/gmock" ] } source_set("unit_tests") {
diff --git a/ios/chrome/browser/ui/BUILD.gn b/ios/chrome/browser/ui/BUILD.gn index 5ac87f4a..d89170a 100644 --- a/ios/chrome/browser/ui/BUILD.gn +++ b/ios/chrome/browser/ui/BUILD.gn
@@ -10,7 +10,5 @@ "ui_feature_flags.cc", "ui_feature_flags.h", ] - deps = [ - "//base", - ] + deps = [ "//base" ] }
diff --git a/ios/chrome/browser/ui/app_launcher/BUILD.gn b/ios/chrome/browser/ui/app_launcher/BUILD.gn index d4c94a74..a7e3d5f 100644 --- a/ios/chrome/browser/ui/app_launcher/BUILD.gn +++ b/ios/chrome/browser/ui/app_launcher/BUILD.gn
@@ -32,9 +32,7 @@ source_set("unit_tests") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true - sources = [ - "app_launcher_coordinator_unittest.mm", - ] + sources = [ "app_launcher_coordinator_unittest.mm" ] deps = [ ":app_launcher", "//base",
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_coordinator.mm b/ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_coordinator.mm index 03d688ec..3229b202 100644 --- a/ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_coordinator.mm +++ b/ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_coordinator.mm
@@ -64,8 +64,7 @@ self.state = IdentityChooserCoordinatorStateStarted; // Creates the controller. self.identityChooserViewController = [[IdentityChooserViewController alloc] - initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + initWithStyle:UITableViewStylePlain]; self.identityChooserViewController.modalPresentationStyle = UIModalPresentationCustom; self.transitionController = [[IdentityChooserTransitionDelegate alloc] init];
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.h b/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.h index a8e2388..ed668f3 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.h +++ b/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.h
@@ -16,10 +16,7 @@ - (instancetype)init NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; // If set to YES, the controller will add negative content insets inverse to the // ones added by UITableViewController to accommodate for the keyboard.
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.mm b/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.mm index 321245d..15f0fb5 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.mm +++ b/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.mm
@@ -63,8 +63,7 @@ @implementation FallbackViewController - (instancetype)init { - self = [super initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:UITableViewStylePlain]; if (self) { [[NSNotificationCenter defaultCenter] addObserver:self
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_edit_view_controller.h b/ios/chrome/browser/ui/bookmarks/bookmark_edit_view_controller.h index 67d0a49..caa7483e 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_edit_view_controller.h +++ b/ios/chrome/browser/ui/bookmarks/bookmark_edit_view_controller.h
@@ -58,9 +58,7 @@ browserState:(ios::ChromeBrowserState*)browserState dispatcher:(id<BrowserCommands>)dispatcher NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle:(ChromeTableViewControllerStyle)style - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; // Closes the edit view as if close button was pressed. - (void)dismiss;
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_edit_view_controller.mm b/ios/chrome/browser/ui/bookmarks/bookmark_edit_view_controller.mm index 6f8d6ba..4eddcf6 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_edit_view_controller.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_edit_view_controller.mm
@@ -183,8 +183,7 @@ dispatcher:(id<BrowserCommands>)dispatcher { DCHECK(bookmark); DCHECK(browserState); - self = [super initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:UITableViewStylePlain]; if (self) { DCHECK(!bookmark->is_folder()); DCHECK(!browserState->IsOffTheRecord());
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_folder_editor_view_controller.h b/ios/chrome/browser/ui/bookmarks/bookmark_folder_editor_view_controller.h index 4b4b762..5e848339 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_folder_editor_view_controller.h +++ b/ios/chrome/browser/ui/bookmarks/bookmark_folder_editor_view_controller.h
@@ -66,9 +66,7 @@ browserState:(ios::ChromeBrowserState*)browserState dispatcher:(id<BrowserCommands>)dispatcher; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle:(ChromeTableViewControllerStyle)style - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_folder_editor_view_controller.mm b/ios/chrome/browser/ui/bookmarks/bookmark_folder_editor_view_controller.mm index ab0cfac..d4607f6 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_folder_editor_view_controller.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_folder_editor_view_controller.mm
@@ -146,8 +146,7 @@ - (instancetype)initWithBookmarkModel:(bookmarks::BookmarkModel*)bookmarkModel { DCHECK(bookmarkModel); DCHECK(bookmarkModel->loaded()); - self = [super initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:UITableViewStylePlain]; if (self) { _bookmarkModel = bookmarkModel;
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_folder_view_controller.mm b/ios/chrome/browser/ui/bookmarks/bookmark_folder_view_controller.mm index b934b97..782d5497 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_folder_view_controller.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_folder_view_controller.mm
@@ -119,8 +119,7 @@ DCHECK(bookmarkModel); DCHECK(bookmarkModel->loaded()); DCHECK(selectedFolder == NULL || selectedFolder->is_folder()); - self = [super initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:UITableViewStylePlain]; if (self) { _allowsCancel = allowsCancel; _allowsNewFolders = allowsNewFolders;
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.h b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.h index ab010bc..ecedc7d4 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.h +++ b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.h
@@ -55,10 +55,7 @@ initWithBrowserState:(ios::ChromeBrowserState*)browserState dispatcher:(id<ApplicationCommands, BrowserCommands>)dispatcher webStateList:(WebStateList*)webStateList NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)tableViewStyle - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)tableViewStyle NS_UNAVAILABLE; // Setter to set _rootNode value. - (void)setRootNode:(const bookmarks::BookmarkNode*)rootNode;
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm index 736d7f9..4a6f62d3 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm
@@ -210,8 +210,7 @@ dispatcher:(id<ApplicationCommands, BrowserCommands>)dispatcher webStateList:(WebStateList*)webStateList { DCHECK(browserState); - self = [super initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:UITableViewStylePlain]; if (self) { _browserState = browserState->GetOriginalChromeBrowserState(); _dispatcher = dispatcher;
diff --git a/ios/chrome/browser/ui/browser_view/BUILD.gn b/ios/chrome/browser/ui/browser_view/BUILD.gn index 737d4f40..9015181 100644 --- a/ios/chrome/browser/ui/browser_view/BUILD.gn +++ b/ios/chrome/browser/ui/browser_view/BUILD.gn
@@ -252,9 +252,7 @@ defines = [ "CHROME_EARL_GREY_1" ] configs += [ "//build/config/compiler:enable_arc" ] testonly = true - sources = [ - "browser_view_controller_egtest.mm", - ] + sources = [ "browser_view_controller_egtest.mm" ] deps = [ ":browser_view", "//base", @@ -292,9 +290,7 @@ "//build/config/ios:xctest_config", ] testonly = true - sources = [ - "browser_view_controller_egtest.mm", - ] + sources = [ "browser_view_controller_egtest.mm" ] deps = [ "//base", "//base/test:test_support",
diff --git a/ios/chrome/browser/ui/commands/BUILD.gn b/ios/chrome/browser/ui/commands/BUILD.gn index 23a4bdb..e4073d24 100644 --- a/ios/chrome/browser/ui/commands/BUILD.gn +++ b/ios/chrome/browser/ui/commands/BUILD.gn
@@ -50,9 +50,7 @@ source_set("unit_tests") { testonly = true configs += [ "//build/config/compiler:enable_arc" ] - sources = [ - "command_dispatcher_unittest.mm", - ] + sources = [ "command_dispatcher_unittest.mm" ] deps = [ ":commands", "//base",
diff --git a/ios/chrome/browser/ui/history/history_table_view_controller.h b/ios/chrome/browser/ui/history/history_table_view_controller.h index 7847b787..7abf490 100644 --- a/ios/chrome/browser/ui/history/history_table_view_controller.h +++ b/ios/chrome/browser/ui/history/history_table_view_controller.h
@@ -42,10 +42,7 @@ // Initializers. - (instancetype)init NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/history/history_table_view_controller.mm b/ios/chrome/browser/ui/history/history_table_view_controller.mm index 4c44970..fd3d0ae 100644 --- a/ios/chrome/browser/ui/history/history_table_view_controller.mm +++ b/ios/chrome/browser/ui/history/history_table_view_controller.mm
@@ -122,8 +122,7 @@ #pragma mark - ViewController Lifecycle. - (instancetype)init { - return [super initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + return [super initWithStyle:UITableViewStylePlain]; } - (void)viewWillAppear:(BOOL)animated { @@ -627,7 +626,6 @@ #pragma mark - UIScrollViewDelegate - (void)scrollViewDidScroll:(UIScrollView*)scrollView { - [super scrollViewDidScroll:scrollView]; if (self.hasFinishedLoading) return;
diff --git a/ios/chrome/browser/ui/icons/BUILD.gn b/ios/chrome/browser/ui/icons/BUILD.gn index af58f4c..c80ecb91 100644 --- a/ios/chrome/browser/ui/icons/BUILD.gn +++ b/ios/chrome/browser/ui/icons/BUILD.gn
@@ -26,9 +26,7 @@ source_set("unit_tests") { testonly = true - sources = [ - "chrome_icon_unittest.mm", - ] + sources = [ "chrome_icon_unittest.mm" ] deps = [ ":icons", "//ios/chrome/app/strings",
diff --git a/ios/chrome/browser/ui/infobars/modals/infobar_password_table_view_controller.h b/ios/chrome/browser/ui/infobars/modals/infobar_password_table_view_controller.h index 882bfa1..02a6ed44 100644 --- a/ios/chrome/browser/ui/infobars/modals/infobar_password_table_view_controller.h +++ b/ios/chrome/browser/ui/infobars/modals/infobar_password_table_view_controller.h
@@ -20,10 +20,7 @@ - (instancetype)initWithDelegate:(id<InfobarPasswordModalDelegate>)modalDelegate type:(InfobarType)infobarType NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/infobars/modals/infobar_password_table_view_controller.mm b/ios/chrome/browser/ui/infobars/modals/infobar_password_table_view_controller.mm index 4fdec53..b49bcf00 100644 --- a/ios/chrome/browser/ui/infobars/modals/infobar_password_table_view_controller.mm +++ b/ios/chrome/browser/ui/infobars/modals/infobar_password_table_view_controller.mm
@@ -74,8 +74,7 @@ - (instancetype)initWithDelegate:(id<InfobarPasswordModalDelegate>)modalDelegate type:(InfobarType)infobarType { - self = [super initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:UITableViewStylePlain]; if (self) { _infobarModalDelegate = modalDelegate; _metricsRecorder =
diff --git a/ios/chrome/browser/ui/infobars/modals/infobar_save_card_table_view_controller.h b/ios/chrome/browser/ui/infobars/modals/infobar_save_card_table_view_controller.h index b43a245b..7d9406c 100644 --- a/ios/chrome/browser/ui/infobars/modals/infobar_save_card_table_view_controller.h +++ b/ios/chrome/browser/ui/infobars/modals/infobar_save_card_table_view_controller.h
@@ -16,10 +16,7 @@ - (instancetype)initWithModalDelegate: (id<InfobarSaveCardModalDelegate>)modalDelegate NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; // Cardholder name to be displayed. @property(nonatomic, copy) NSString* cardholderName;
diff --git a/ios/chrome/browser/ui/infobars/modals/infobar_save_card_table_view_controller.mm b/ios/chrome/browser/ui/infobars/modals/infobar_save_card_table_view_controller.mm index 2b20a6d..78075304 100644 --- a/ios/chrome/browser/ui/infobars/modals/infobar_save_card_table_view_controller.mm +++ b/ios/chrome/browser/ui/infobars/modals/infobar_save_card_table_view_controller.mm
@@ -70,8 +70,7 @@ - (instancetype)initWithModalDelegate: (id<InfobarSaveCardModalDelegate>)modalDelegate { - self = [super initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:UITableViewStylePlain]; if (self) { _saveCardModalDelegate = modalDelegate; _metricsRecorder = [[InfobarMetricsRecorder alloc]
diff --git a/ios/chrome/browser/ui/infobars/modals/infobar_translate_language_selection_table_view_controller.h b/ios/chrome/browser/ui/infobars/modals/infobar_translate_language_selection_table_view_controller.h index 30694f1..32d98582 100644 --- a/ios/chrome/browser/ui/infobars/modals/infobar_translate_language_selection_table_view_controller.h +++ b/ios/chrome/browser/ui/infobars/modals/infobar_translate_language_selection_table_view_controller.h
@@ -20,10 +20,7 @@ - (instancetype)initWithDelegate:(id<InfobarTranslateLanguageSelectionDelegate>) langageSelectionDelegate selectingSourceLanguage:(BOOL)sourceLanguage NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/infobars/modals/infobar_translate_language_selection_table_view_controller.mm b/ios/chrome/browser/ui/infobars/modals/infobar_translate_language_selection_table_view_controller.mm index 2454cfd1..00e0778 100644 --- a/ios/chrome/browser/ui/infobars/modals/infobar_translate_language_selection_table_view_controller.mm +++ b/ios/chrome/browser/ui/infobars/modals/infobar_translate_language_selection_table_view_controller.mm
@@ -43,8 +43,7 @@ - (instancetype)initWithDelegate:(id<InfobarTranslateLanguageSelectionDelegate>) langageSelectionDelegate selectingSourceLanguage:(BOOL)sourceLanguage { - self = [super initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:UITableViewStylePlain]; if (self) { _langageSelectionDelegate = langageSelectionDelegate; _selectingSourceLanguage = sourceLanguage;
diff --git a/ios/chrome/browser/ui/infobars/modals/infobar_translate_table_view_controller.h b/ios/chrome/browser/ui/infobars/modals/infobar_translate_table_view_controller.h index 69de154..75d3ce8 100644 --- a/ios/chrome/browser/ui/infobars/modals/infobar_translate_table_view_controller.h +++ b/ios/chrome/browser/ui/infobars/modals/infobar_translate_table_view_controller.h
@@ -18,10 +18,7 @@ - (instancetype)initWithDelegate: (id<InfobarTranslateModalDelegate>)modalDelegate NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/infobars/modals/infobar_translate_table_view_controller.mm b/ios/chrome/browser/ui/infobars/modals/infobar_translate_table_view_controller.mm index 52db303..56f4efc 100644 --- a/ios/chrome/browser/ui/infobars/modals/infobar_translate_table_view_controller.mm +++ b/ios/chrome/browser/ui/infobars/modals/infobar_translate_table_view_controller.mm
@@ -71,8 +71,7 @@ - (instancetype)initWithDelegate: (id<InfobarTranslateModalDelegate>)modalDelegate { - self = [super initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:UITableViewStylePlain]; if (self) { _infobarModalDelegate = modalDelegate; }
diff --git a/ios/chrome/browser/ui/integration_tests/BUILD.gn b/ios/chrome/browser/ui/integration_tests/BUILD.gn index 4754c29..4c1e8fa 100644 --- a/ios/chrome/browser/ui/integration_tests/BUILD.gn +++ b/ios/chrome/browser/ui/integration_tests/BUILD.gn
@@ -9,9 +9,7 @@ "//build/config/ios:xctest_config", ] testonly = true - sources = [ - "pdf_egtest.mm", - ] + sources = [ "pdf_egtest.mm" ] deps = [ "//ios/chrome/test/earl_grey:eg_test_support+eg2", "//ios/testing/earl_grey:eg_test_support+eg2",
diff --git a/ios/chrome/browser/ui/keyboard/BUILD.gn b/ios/chrome/browser/ui/keyboard/BUILD.gn index dd5a110..7ec8802 100644 --- a/ios/chrome/browser/ui/keyboard/BUILD.gn +++ b/ios/chrome/browser/ui/keyboard/BUILD.gn
@@ -17,9 +17,7 @@ source_set("unit_tests") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true - sources = [ - "UIKeyCommand+ChromeTest.mm", - ] + sources = [ "UIKeyCommand+ChromeTest.mm" ] deps = [ ":keyboard", "//base", @@ -32,9 +30,7 @@ defines = [ "CHROME_EARL_GREY_1" ] configs += [ "//build/config/compiler:enable_arc" ] testonly = true - sources = [ - "keyboard_commands_egtest.mm", - ] + sources = [ "keyboard_commands_egtest.mm" ] deps = [ "//components/strings", "//ios/chrome/app/strings", @@ -58,9 +54,7 @@ "//build/config/ios:xctest_config", ] testonly = true - sources = [ - "keyboard_commands_egtest.mm", - ] + sources = [ "keyboard_commands_egtest.mm" ] deps = [ "//components/strings", "//ios/chrome/app/strings",
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_egtest.mm b/ios/chrome/browser/ui/omnibox/omnibox_egtest.mm index d8e1dba..fdfab48 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_egtest.mm +++ b/ios/chrome/browser/ui/omnibox/omnibox_egtest.mm
@@ -150,8 +150,7 @@ // Tests that the XClientData header is sent when navigating to // https://google.com through the omnibox. -// TODO(crbug.com/1036225): Test very flaky on all config. -- (void)DISABLED_testXClientData { +- (void)testXClientData { // Rewrite the google URL to localhost URL. [OmniboxAppInterface rewriteGoogleURLToLocalhost];
diff --git a/ios/chrome/browser/ui/open_in/BUILD.gn b/ios/chrome/browser/ui/open_in/BUILD.gn index 3345c393..a1b0f8b 100644 --- a/ios/chrome/browser/ui/open_in/BUILD.gn +++ b/ios/chrome/browser/ui/open_in/BUILD.gn
@@ -67,9 +67,7 @@ ] testonly = true - sources = [ - "open_in_controller_egtest.mm", - ] + sources = [ "open_in_controller_egtest.mm" ] deps = [ "//base", "//ios/chrome/app/strings",
diff --git a/ios/chrome/browser/ui/page_info/BUILD.gn b/ios/chrome/browser/ui/page_info/BUILD.gn index e8a6c0ed..bd25f91 100644 --- a/ios/chrome/browser/ui/page_info/BUILD.gn +++ b/ios/chrome/browser/ui/page_info/BUILD.gn
@@ -36,9 +36,7 @@ "//ui/gfx", "//url", ] - public_deps = [ - ":constants", - ] + public_deps = [ ":constants" ] libs = [ "UIKit.framework" ] } @@ -56,9 +54,7 @@ "features.h", "features.mm", ] - deps = [ - "//base", - ] + deps = [ "//base" ] } source_set("coordinator") { @@ -105,9 +101,7 @@ configs += [ "//build/config/compiler:enable_arc" ] defines = [ "CHROME_EARL_GREY_1" ] testonly = true - sources = [ - "page_info_egtest.mm", - ] + sources = [ "page_info_egtest.mm" ] deps = [ ":page_info", "//ios/chrome/browser/ui/popup_menu:constants", @@ -128,9 +122,7 @@ "//build/config/ios:xctest_config", ] testonly = true - sources = [ - "page_info_egtest.mm", - ] + sources = [ "page_info_egtest.mm" ] deps = [ ":constants", "//ios/chrome/browser/ui/popup_menu:constants",
diff --git a/ios/chrome/browser/ui/page_info/requirements/BUILD.gn b/ios/chrome/browser/ui/page_info/requirements/BUILD.gn index 789a97e..1c74fce9 100644 --- a/ios/chrome/browser/ui/page_info/requirements/BUILD.gn +++ b/ios/chrome/browser/ui/page_info/requirements/BUILD.gn
@@ -4,7 +4,5 @@ source_set("requirements") { configs += [ "//build/config/compiler:enable_arc" ] - sources = [ - "page_info_presentation.h", - ] + sources = [ "page_info_presentation.h" ] }
diff --git a/ios/chrome/browser/ui/popup_menu/public/popup_menu_table_view_controller.h b/ios/chrome/browser/ui/popup_menu/public/popup_menu_table_view_controller.h index 7f22958..364081cc 100644 --- a/ios/chrome/browser/ui/popup_menu/public/popup_menu_table_view_controller.h +++ b/ios/chrome/browser/ui/popup_menu/public/popup_menu_table_view_controller.h
@@ -28,10 +28,7 @@ // Initializers. - (instancetype)init NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; // Selects the row at |point|. This is the same as tapping the row. Point must // be in window base coordinates.
diff --git a/ios/chrome/browser/ui/popup_menu/public/popup_menu_table_view_controller.mm b/ios/chrome/browser/ui/popup_menu/public/popup_menu_table_view_controller.mm index 225e23ab..4239a8ed 100644 --- a/ios/chrome/browser/ui/popup_menu/public/popup_menu_table_view_controller.mm +++ b/ios/chrome/browser/ui/popup_menu/public/popup_menu_table_view_controller.mm
@@ -38,8 +38,7 @@ @synthesize viewDidAppear = _viewDidAppear; - (instancetype)init { - return [super initWithTableViewStyle:UITableViewStyleGrouped - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + return [super initWithStyle:UITableViewStyleGrouped]; } - (void)selectRowAtPoint:(CGPoint)point {
diff --git a/ios/chrome/browser/ui/presenters/BUILD.gn b/ios/chrome/browser/ui/presenters/BUILD.gn index a167500..59dbe6c 100644 --- a/ios/chrome/browser/ui/presenters/BUILD.gn +++ b/ios/chrome/browser/ui/presenters/BUILD.gn
@@ -22,9 +22,7 @@ testonly = true configs += [ "//build/config/compiler:enable_arc" ] - sources = [ - "vertical_animation_container_unittest.mm", - ] + sources = [ "vertical_animation_container_unittest.mm" ] deps = [ ":presenters",
diff --git a/ios/chrome/browser/ui/promos/BUILD.gn b/ios/chrome/browser/ui/promos/BUILD.gn index 361d0f0..e1356441 100644 --- a/ios/chrome/browser/ui/promos/BUILD.gn +++ b/ios/chrome/browser/ui/promos/BUILD.gn
@@ -25,18 +25,14 @@ "//ios/public/provider/chrome/browser/signin", "//net", ] - public_deps = [ - "//ios/chrome/browser/ui/authentication", - ] + public_deps = [ "//ios/chrome/browser/ui/authentication" ] libs = [ "UIKit.framework" ] } source_set("unit_tests") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true - sources = [ - "signin_promo_view_controller_unittest.mm", - ] + sources = [ "signin_promo_view_controller_unittest.mm" ] deps = [ ":promos", "//base",
diff --git a/ios/chrome/browser/ui/reading_list/BUILD.gn b/ios/chrome/browser/ui/reading_list/BUILD.gn index 909c8f1..53f80b4 100644 --- a/ios/chrome/browser/ui/reading_list/BUILD.gn +++ b/ios/chrome/browser/ui/reading_list/BUILD.gn
@@ -165,9 +165,7 @@ defines = [ "CHROME_EARL_GREY_1" ] configs += [ "//build/config/compiler:enable_arc" ] testonly = true - sources = [ - "reading_list_egtest.mm", - ] + sources = [ "reading_list_egtest.mm" ] deps = [ ":reading_list", ":reading_list_constants", @@ -214,9 +212,7 @@ "//build/config/ios:xctest_config", ] testonly = true - sources = [ - "reading_list_egtest.mm", - ] + sources = [ "reading_list_egtest.mm" ] deps = [ ":eg_test_support+eg2", ":reading_list_constants",
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_table_view_controller.h b/ios/chrome/browser/ui/reading_list/reading_list_table_view_controller.h index c4e3c32..b9d35d3 100644 --- a/ios/chrome/browser/ui/reading_list/reading_list_table_view_controller.h +++ b/ios/chrome/browser/ui/reading_list/reading_list_table_view_controller.h
@@ -27,10 +27,7 @@ // Initializers. - (instancetype)init NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; // Prepares this view controller to be dismissed. - (void)willBeDismissed;
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_table_view_controller.mm b/ios/chrome/browser/ui/reading_list/reading_list_table_view_controller.mm index 8acf1fc..e35bcbc 100644 --- a/ios/chrome/browser/ui/reading_list/reading_list_table_view_controller.mm +++ b/ios/chrome/browser/ui/reading_list/reading_list_table_view_controller.mm
@@ -102,8 +102,7 @@ @synthesize needsSectionCleanupAfterEditing = _needsSectionCleanupAfterEditing; - (instancetype)init { - self = [super initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:UITableViewStylePlain]; if (self) { _toolbarManager = [[ReadingListToolbarButtonManager alloc] init]; _toolbarManager.commandHandler = self;
diff --git a/ios/chrome/browser/ui/recent_tabs/recent_tabs_table_view_controller.h b/ios/chrome/browser/ui/recent_tabs/recent_tabs_table_view_controller.h index 1333fd6..246f017b 100644 --- a/ios/chrome/browser/ui/recent_tabs/recent_tabs_table_view_controller.h +++ b/ios/chrome/browser/ui/recent_tabs/recent_tabs_table_view_controller.h
@@ -45,10 +45,7 @@ // Initializers. - (instancetype)init NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/recent_tabs/recent_tabs_table_view_controller.mm b/ios/chrome/browser/ui/recent_tabs/recent_tabs_table_view_controller.mm index f62885e5..69fee76b 100644 --- a/ios/chrome/browser/ui/recent_tabs/recent_tabs_table_view_controller.mm +++ b/ios/chrome/browser/ui/recent_tabs/recent_tabs_table_view_controller.mm
@@ -130,8 +130,7 @@ #pragma mark - Public Interface - (instancetype)init { - self = [super initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:UITableViewStylePlain]; if (self) { _sessionState = SessionsSyncUserState::USER_SIGNED_OUT; _syncedSessions.reset(new synced_sessions::SyncedSessions());
diff --git a/ios/chrome/browser/ui/safe_mode/BUILD.gn b/ios/chrome/browser/ui/safe_mode/BUILD.gn index e31b7a10..0f2a9ebd 100644 --- a/ios/chrome/browser/ui/safe_mode/BUILD.gn +++ b/ios/chrome/browser/ui/safe_mode/BUILD.gn
@@ -32,9 +32,7 @@ configs += [ "//build/config/compiler:enable_arc" ] defines = [ "CHROME_EARL_GREY_1" ] testonly = true - sources = [ - "safe_mode_egtest.mm", - ] + sources = [ "safe_mode_egtest.mm" ] deps = [ ":safe_mode", ":test_support", @@ -90,9 +88,7 @@ ] testonly = true - sources = [ - "safe_mode_app_interface.h", - ] + sources = [ "safe_mode_app_interface.h" ] } source_set("eg2_tests") { @@ -102,9 +98,7 @@ "//build/config/ios:xctest_config", ] testonly = true - sources = [ - "safe_mode_egtest.mm", - ] + sources = [ "safe_mode_egtest.mm" ] deps = [ ":eg_test_support+eg2", "//base:base",
diff --git a/ios/chrome/browser/ui/scanner/BUILD.gn b/ios/chrome/browser/ui/scanner/BUILD.gn index 72cff64..4a63191 100644 --- a/ios/chrome/browser/ui/scanner/BUILD.gn +++ b/ios/chrome/browser/ui/scanner/BUILD.gn
@@ -43,7 +43,5 @@ } source_set("camera_state") { - sources = [ - "camera_state.h", - ] + sources = [ "camera_state.h" ] }
diff --git a/ios/chrome/browser/ui/send_tab_to_self/send_tab_to_self_table_view_controller.h b/ios/chrome/browser/ui/send_tab_to_self/send_tab_to_self_table_view_controller.h index e91ebf8..81cb9bd 100644 --- a/ios/chrome/browser/ui/send_tab_to_self/send_tab_to_self_table_view_controller.h +++ b/ios/chrome/browser/ui/send_tab_to_self/send_tab_to_self_table_view_controller.h
@@ -23,10 +23,7 @@ NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; // The text used for the cancel button. @property(nonatomic, copy) NSString* cancelButtonText;
diff --git a/ios/chrome/browser/ui/send_tab_to_self/send_tab_to_self_table_view_controller.mm b/ios/chrome/browser/ui/send_tab_to_self/send_tab_to_self_table_view_controller.mm index 8890184..715ca96 100644 --- a/ios/chrome/browser/ui/send_tab_to_self/send_tab_to_self_table_view_controller.mm +++ b/ios/chrome/browser/ui/send_tab_to_self/send_tab_to_self_table_view_controller.mm
@@ -88,8 +88,7 @@ - (instancetype)initWithModel: (send_tab_to_self::SendTabToSelfModel*)sendTabToSelfModel delegate:(id<SendTabToSelfModalDelegate>)delegate { - self = [super initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:UITableViewStylePlain]; if (self) { _target_device_list = sendTabToSelfModel->GetTargetDeviceInfoSortedList();
diff --git a/ios/chrome/browser/ui/settings/BUILD.gn b/ios/chrome/browser/ui/settings/BUILD.gn index 9273ce9..6bfab65 100644 --- a/ios/chrome/browser/ui/settings/BUILD.gn +++ b/ios/chrome/browser/ui/settings/BUILD.gn
@@ -18,7 +18,6 @@ "//ios/chrome/browser/browser_state", "//ios/chrome/browser/ui:feature_flags", "//ios/chrome/browser/ui/commands", - "//ios/chrome/browser/ui/material_components", "//ios/chrome/browser/ui/settings/cells", "//ios/chrome/browser/ui/settings/cells:public", "//ios/chrome/browser/ui/table_view", @@ -153,7 +152,6 @@ "//ios/chrome/browser/ui/icons", "//ios/chrome/browser/ui/keyboard", "//ios/chrome/browser/ui/list_model", - "//ios/chrome/browser/ui/material_components", "//ios/chrome/browser/ui/payments/cells", "//ios/chrome/browser/ui/settings/autofill", "//ios/chrome/browser/ui/settings/cells",
diff --git a/ios/chrome/browser/ui/settings/about_chrome_table_view_controller.h b/ios/chrome/browser/ui/settings/about_chrome_table_view_controller.h index ce1baf3..1ad7fc8 100644 --- a/ios/chrome/browser/ui/settings/about_chrome_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/about_chrome_table_view_controller.h
@@ -13,10 +13,7 @@ - (instancetype)init NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/about_chrome_table_view_controller.mm b/ios/chrome/browser/ui/settings/about_chrome_table_view_controller.mm index 1f412c2..dca770bd 100644 --- a/ios/chrome/browser/ui/settings/about_chrome_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/about_chrome_table_view_controller.mm
@@ -59,8 +59,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { self.title = l10n_util::GetNSString(IDS_IOS_ABOUT_PRODUCT_NAME); }
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_view_controller.h b/ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_view_controller.h index 014191a..f3d70cf 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_view_controller.h +++ b/ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_view_controller.h
@@ -27,10 +27,7 @@ - (instancetype)initWithDelegate: (id<AddCreditCardViewControllerDelegate>)delegate NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; // Returns "YES" if any of tableview cells has user input. @property(nonatomic, getter=tableViewHasUserInput, readonly)
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_view_controller.mm b/ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_view_controller.mm index 878ebcc..c29ddf10 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_view_controller.mm +++ b/ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_view_controller.mm
@@ -87,8 +87,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { _delegate = delegate;
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_edit_table_view_controller.h b/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_edit_table_view_controller.h index 92d63f58..08a652c 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_edit_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_edit_table_view_controller.h
@@ -22,10 +22,7 @@ personalDataManager:(autofill::PersonalDataManager*)dataManager NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_edit_table_view_controller.mm b/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_edit_table_view_controller.mm index 4496721..da2dcbc 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_edit_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_edit_table_view_controller.mm
@@ -68,8 +68,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { DCHECK(dataManager);
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_table_view_controller.h b/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_table_view_controller.h index 2ff1d14d..cc417e7 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_table_view_controller.h
@@ -24,10 +24,7 @@ - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState NS_UNAVAILABLE; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_table_view_controller.mm b/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_table_view_controller.mm index 91597f6b..72519de 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_table_view_controller.mm
@@ -92,8 +92,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { self.title = l10n_util::GetNSString(IDS_AUTOFILL_PAYMENT_METHODS); self.shouldHideDoneButton = YES;
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_edit_table_view_controller.mm b/ios/chrome/browser/ui/settings/autofill/autofill_edit_table_view_controller.mm index 1a5d379..e14f7b4a 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_edit_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/autofill/autofill_edit_table_view_controller.mm
@@ -25,10 +25,8 @@ @implementation AutofillEditTableViewController -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle { - self = [super initWithTableViewStyle:style appBarStyle:appBarStyle]; +- (instancetype)initWithStyle:(UITableViewStyle)style { + self = [super initWithStyle:style]; if (!self) { return nil; }
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller.h b/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller.h index e7c07f8..fec5c48 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller.h
@@ -21,10 +21,7 @@ personalDataManager: (autofill::PersonalDataManager*)dataManager; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller.mm b/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller.mm index b3b85a5..3391873 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller.mm
@@ -98,8 +98,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { _personalDataManager = dataManager; _autofillProfile = profile;
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_profile_table_view_controller.h b/ios/chrome/browser/ui/settings/autofill/autofill_profile_table_view_controller.h index a48b8a5..9416b03 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_profile_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/autofill/autofill_profile_table_view_controller.h
@@ -17,10 +17,7 @@ // The designated initializer. |browserState| must not be nil. - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_profile_table_view_controller.mm b/ios/chrome/browser/ui/settings/autofill/autofill_profile_table_view_controller.mm index 2d4c2dd..ccb9a6f4 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_profile_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/autofill/autofill_profile_table_view_controller.mm
@@ -79,8 +79,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { self.title = l10n_util::GetNSString(IDS_AUTOFILL_ADDRESSES_SETTINGS_TITLE); self.shouldHideDoneButton = YES;
diff --git a/ios/chrome/browser/ui/settings/bandwidth_management_table_view_controller.h b/ios/chrome/browser/ui/settings/bandwidth_management_table_view_controller.h index 53aa171..ab565f6 100644 --- a/ios/chrome/browser/ui/settings/bandwidth_management_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/bandwidth_management_table_view_controller.h
@@ -19,10 +19,7 @@ // The designated initializer. |browserState| must not be nil. - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end #endif // IOS_CHROME_BROWSER_UI_SETTINGS_BANDWIDTH_MANAGEMENT_TABLE_VIEW_CONTROLLER_H_
diff --git a/ios/chrome/browser/ui/settings/bandwidth_management_table_view_controller.mm b/ios/chrome/browser/ui/settings/bandwidth_management_table_view_controller.mm index d955cfd3..550ee4e1 100644 --- a/ios/chrome/browser/ui/settings/bandwidth_management_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/bandwidth_management_table_view_controller.mm
@@ -62,8 +62,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { self.title = l10n_util::GetNSString(IDS_IOS_BANDWIDTH_MANAGEMENT_SETTINGS); _browserState = browserState;
diff --git a/ios/chrome/browser/ui/settings/block_popups_table_view_controller.h b/ios/chrome/browser/ui/settings/block_popups_table_view_controller.h index 92012ed..5b9e8e7 100644 --- a/ios/chrome/browser/ui/settings/block_popups_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/block_popups_table_view_controller.h
@@ -18,10 +18,7 @@ - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/block_popups_table_view_controller.mm b/ios/chrome/browser/ui/settings/block_popups_table_view_controller.mm index 5e1db9b4..7234262 100644 --- a/ios/chrome/browser/ui/settings/block_popups_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/block_popups_table_view_controller.mm
@@ -66,8 +66,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { _browserState = browserState; HostContentSettingsMap* settingsMap =
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.h b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.h index 21bb02c1..00c7d639 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.h
@@ -23,10 +23,7 @@ // Initializers. |browserState| can't be nil. - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; // Prepares view controller so that -dismissViewControllerAnimated dismisses it. // Call this method before dismissing view controller.
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm index 839f9640..9d32071 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm
@@ -84,8 +84,7 @@ #pragma mark - ViewController Lifecycle. - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState { - self = [super initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:UITableViewStylePlain]; if (self) { _browserState = browserState; _dataManager =
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/time_range_selector_table_view_controller.h b/ios/chrome/browser/ui/settings/clear_browsing_data/time_range_selector_table_view_controller.h index 84ecf95..4df45b1 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/time_range_selector_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/time_range_selector_table_view_controller.h
@@ -15,10 +15,7 @@ - (instancetype)initWithPrefs:(PrefService*)prefs NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; // Returns the text for the current setting, based on the values of the // preference. Kept in this class, so that all of the code to translate from
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/time_range_selector_table_view_controller.mm b/ios/chrome/browser/ui/settings/clear_browsing_data/time_range_selector_table_view_controller.mm index 38fc68b0..5a5b92e 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/time_range_selector_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/time_range_selector_table_view_controller.mm
@@ -61,8 +61,7 @@ - (instancetype)initWithPrefs:(PrefService*)prefs { UITableViewStyle style = UITableViewStylePlain; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { self.title = l10n_util::GetNSString( IDS_IOS_CLEAR_BROWSING_DATA_TIME_RANGE_SELECTOR_TITLE);
diff --git a/ios/chrome/browser/ui/settings/content_settings_table_view_controller.h b/ios/chrome/browser/ui/settings/content_settings_table_view_controller.h index e20eed17..7741c15c 100644 --- a/ios/chrome/browser/ui/settings/content_settings_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/content_settings_table_view_controller.h
@@ -18,10 +18,7 @@ // The designated initializer. |browserState| must not be nil. - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end #endif // IOS_CHROME_BROWSER_UI_SETTINGS_CONTENT_SETTINGS_TABLE_VIEW_CONTROLLER_H_
diff --git a/ios/chrome/browser/ui/settings/content_settings_table_view_controller.mm b/ios/chrome/browser/ui/settings/content_settings_table_view_controller.mm index 60a9d7e..42761a9 100644 --- a/ios/chrome/browser/ui/settings/content_settings_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/content_settings_table_view_controller.mm
@@ -67,8 +67,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { _browserState = browserState; self.title = l10n_util::GetNSString(IDS_IOS_CONTENT_SETTINGS_TITLE);
diff --git a/ios/chrome/browser/ui/settings/credit_card_scanner/BUILD.gn b/ios/chrome/browser/ui/settings/credit_card_scanner/BUILD.gn index b143203..946a8f1 100644 --- a/ios/chrome/browser/ui/settings/credit_card_scanner/BUILD.gn +++ b/ios/chrome/browser/ui/settings/credit_card_scanner/BUILD.gn
@@ -44,9 +44,7 @@ source_set("unit_tests") { configs += [ "//build/config/compiler:enable_arc" ] testonly = true - sources = [ - "credit_card_scanner_string_util_unittest.mm", - ] + sources = [ "credit_card_scanner_string_util_unittest.mm" ] deps = [ "//ios/chrome/browser/ui/settings/credit_card_scanner", "//testing/gtest",
diff --git a/ios/chrome/browser/ui/settings/dataplan_usage_table_view_controller.h b/ios/chrome/browser/ui/settings/dataplan_usage_table_view_controller.h index 8a11bcc..db48f1e 100644 --- a/ios/chrome/browser/ui/settings/dataplan_usage_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/dataplan_usage_table_view_controller.h
@@ -18,10 +18,7 @@ wifiPref:(const char*)wifiPreference title:(NSString*)title NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; // Returns the text for the current setting, based on the values of the // preferences. Kept in this class, so that all of the code to translate from
diff --git a/ios/chrome/browser/ui/settings/dataplan_usage_table_view_controller.mm b/ios/chrome/browser/ui/settings/dataplan_usage_table_view_controller.mm index 09a6282..0ce02223 100644 --- a/ios/chrome/browser/ui/settings/dataplan_usage_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/dataplan_usage_table_view_controller.mm
@@ -58,8 +58,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { self.title = title; _basePreference.Init(basePreference, prefs);
diff --git a/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.h b/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.h index 0e40217..052e7c25 100644 --- a/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.h
@@ -24,10 +24,7 @@ closeSettingsOnAddAccount:(BOOL)closeSettingsOnAddAccount NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.mm b/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.mm index 4af69aaa..7ea88d8 100644 --- a/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.mm
@@ -112,8 +112,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { _browser = browser; _closeSettingsOnAddAccount = closeSettingsOnAddAccount;
diff --git a/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm b/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm index 13a8cfc4..bbdbf79 100644 --- a/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm +++ b/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm
@@ -81,9 +81,7 @@ : UITableViewStyleGrouped; GoogleServicesSettingsViewController* viewController = - [[GoogleServicesSettingsViewController alloc] - initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + [[GoogleServicesSettingsViewController alloc] initWithStyle:style]; viewController.presentationDelegate = self; self.viewController = viewController; SyncSetupService* syncSetupService =
diff --git a/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm b/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm index 151a41d..7418832 100644 --- a/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm +++ b/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm
@@ -69,8 +69,7 @@ SyncSetupServiceFactory::GetForBrowserState(self.browserState); self.mediator.commandHandler = self; self.viewController = [[ManageSyncSettingsTableViewController alloc] - initWithTableViewStyle:UITableViewStyleGrouped - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + initWithStyle:UITableViewStyleGrouped]; self.viewController.serviceDelegate = self.mediator; self.viewController.presentationDelegate = self; self.viewController.modelDelegate = self.mediator;
diff --git a/ios/chrome/browser/ui/settings/handoff_table_view_controller.h b/ios/chrome/browser/ui/settings/handoff_table_view_controller.h index cca2f78..536e247 100644 --- a/ios/chrome/browser/ui/settings/handoff_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/handoff_table_view_controller.h
@@ -18,10 +18,7 @@ // The designated initializer. |browserState| must not be nil. - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/handoff_table_view_controller.mm b/ios/chrome/browser/ui/settings/handoff_table_view_controller.mm index 8bef8129..06ec32b7 100644 --- a/ios/chrome/browser/ui/settings/handoff_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/handoff_table_view_controller.mm
@@ -50,8 +50,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { self.title = l10n_util::GetNSString(IDS_IOS_OPTIONS_CONTINUITY_LABEL); _handoffEnabled.Init(prefs::kIosHandoffToOtherDevices,
diff --git a/ios/chrome/browser/ui/settings/import_data_table_view_controller.h b/ios/chrome/browser/ui/settings/import_data_table_view_controller.h index 6050e53..c7ce6f77 100644 --- a/ios/chrome/browser/ui/settings/import_data_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/import_data_table_view_controller.h
@@ -43,10 +43,7 @@ toEmail:(NSString*)toEmail isSignedIn:(BOOL)isSignedIn NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/import_data_table_view_controller.mm b/ios/chrome/browser/ui/settings/import_data_table_view_controller.mm index 8321325..d13a766 100644 --- a/ios/chrome/browser/ui/settings/import_data_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/import_data_table_view_controller.mm
@@ -62,8 +62,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { _delegate = delegate; _fromEmail = [fromEmail copy];
diff --git a/ios/chrome/browser/ui/settings/language/add_language_table_view_controller.h b/ios/chrome/browser/ui/settings/language/add_language_table_view_controller.h index c68abd5..9525857 100644 --- a/ios/chrome/browser/ui/settings/language/add_language_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/language/add_language_table_view_controller.h
@@ -30,10 +30,7 @@ - (instancetype)initWithDataSource:(id<LanguageSettingsDataSource>)dataSource delegate:(id<AddLanguageTableViewControllerDelegate>) delegate NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; // Called when the list of supported languages changes so that the view // controller can update its model from |dataSource|.
diff --git a/ios/chrome/browser/ui/settings/language/add_language_table_view_controller.mm b/ios/chrome/browser/ui/settings/language/add_language_table_view_controller.mm index 0be016bf..0310058 100644 --- a/ios/chrome/browser/ui/settings/language/add_language_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/language/add_language_table_view_controller.mm
@@ -67,8 +67,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { _dataSource = dataSource; _delegate = delegate;
diff --git a/ios/chrome/browser/ui/settings/language/language_details_table_view_controller.h b/ios/chrome/browser/ui/settings/language/language_details_table_view_controller.h index 28bb5d85..db02717d 100644 --- a/ios/chrome/browser/ui/settings/language/language_details_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/language/language_details_table_view_controller.h
@@ -35,10 +35,7 @@ delegate: (id<LanguageDetailsTableViewControllerDelegate>) delegate NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/language/language_details_table_view_controller.mm b/ios/chrome/browser/ui/settings/language/language_details_table_view_controller.mm index 018f5b1..b1bd834 100644 --- a/ios/chrome/browser/ui/settings/language/language_details_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/language/language_details_table_view_controller.mm
@@ -58,8 +58,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { _languageItem = languageItem; _delegate = delegate;
diff --git a/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.h b/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.h index 23eb2523..607bb703 100644 --- a/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.h
@@ -23,10 +23,7 @@ - (instancetype)initWithDataSource:(id<LanguageSettingsDataSource>)dataSource commandHandler:(id<LanguageSettingsCommands>)commandHandler NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end #endif // IOS_CHROME_BROWSER_UI_SETTINGS_LANGUAGE_LANGUAGE_SETTINGS_TABLE_VIEW_CONTROLLER_H_
diff --git a/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.mm b/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.mm index 6ac1cae..583be8a 100644 --- a/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.mm
@@ -80,8 +80,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { _dataSource = dataSource; _commandHandler = commandHandler;
diff --git a/ios/chrome/browser/ui/settings/password/password_details_table_view_controller.h b/ios/chrome/browser/ui/settings/password/password_details_table_view_controller.h index 8df2b96c..160d538d 100644 --- a/ios/chrome/browser/ui/settings/password/password_details_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/password/password_details_table_view_controller.h
@@ -30,9 +30,7 @@ (nonnull id<ReauthenticationProtocol>)reauthenticationModule NS_DESIGNATED_INITIALIZER; -- (nullable instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle:(ChromeTableViewControllerStyle) - appBarStyle NS_UNAVAILABLE; +- (nullable instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/password/password_details_table_view_controller.mm b/ios/chrome/browser/ui/settings/password/password_details_table_view_controller.mm index bdf52fc..777889b 100644 --- a/ios/chrome/browser/ui/settings/password/password_details_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/password/password_details_table_view_controller.mm
@@ -106,8 +106,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { _delegate = delegate; _weakReauthenticationModule = reauthenticationModule;
diff --git a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.h b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.h index 78c1278..68e9e813 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.h
@@ -23,10 +23,7 @@ - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm index 12a8bea..a06ec42 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm
@@ -225,8 +225,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { _browserState = browserState; _reauthenticationModule = [[ReauthenticationModule alloc] @@ -333,6 +332,7 @@ } [self setSearchBarEnabled:YES]; } + [self updateUIForEditState]; } #pragma mark - SettingsRootTableViewController
diff --git a/ios/chrome/browser/ui/settings/privacy_table_view_controller.h b/ios/chrome/browser/ui/settings/privacy_table_view_controller.h index 6e6a2fc8..ab685fe 100644 --- a/ios/chrome/browser/ui/settings/privacy_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/privacy_table_view_controller.h
@@ -20,10 +20,7 @@ - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/privacy_table_view_controller.mm b/ios/chrome/browser/ui/settings/privacy_table_view_controller.mm index f5caeae..1a957720 100644 --- a/ios/chrome/browser/ui/settings/privacy_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/privacy_table_view_controller.mm
@@ -82,8 +82,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { _browserState = browserState; self.title =
diff --git a/ios/chrome/browser/ui/settings/search_engine_table_view_controller.h b/ios/chrome/browser/ui/settings/search_engine_table_view_controller.h index f4a4484..1dfe64b 100644 --- a/ios/chrome/browser/ui/settings/search_engine_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/search_engine_table_view_controller.h
@@ -17,10 +17,7 @@ // The designated initializer. |browserState| must not be nil. - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/search_engine_table_view_controller.mm b/ios/chrome/browser/ui/settings/search_engine_table_view_controller.mm index 9e501ecc..b20b037 100644 --- a/ios/chrome/browser/ui/settings/search_engine_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/search_engine_table_view_controller.mm
@@ -77,8 +77,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { _templateURLService = ios::TemplateURLServiceFactory::GetForBrowserState(browserState);
diff --git a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm index a2ead3e..610353d16 100644 --- a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm
@@ -12,7 +12,6 @@ #include "ios/chrome/browser/sync/sync_setup_service_factory.h" #import "ios/chrome/browser/ui/icons/chrome_icon.h" #import "ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.h" -#import "ios/chrome/browser/ui/material_components/utils.h" #import "ios/chrome/browser/ui/settings/autofill/autofill_credit_card_table_view_controller.h" #import "ios/chrome/browser/ui/settings/autofill/autofill_profile_table_view_controller.h" #import "ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.h"
diff --git a/ios/chrome/browser/ui/settings/settings_root_table_view_controller.h b/ios/chrome/browser/ui/settings/settings_root_table_view_controller.h index 75f7f45..fab364b 100644 --- a/ios/chrome/browser/ui/settings/settings_root_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/settings_root_table_view_controller.h
@@ -7,7 +7,6 @@ #import <UIKit/UIKit.h> -#import "ios/chrome/browser/ui/material_components/app_bar_view_controller_presenting.h" #import "ios/chrome/browser/ui/settings/settings_root_view_controlling.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_link_header_footer_item.h" #import "ios/chrome/browser/ui/table_view/chrome_table_view_controller.h"
diff --git a/ios/chrome/browser/ui/settings/settings_root_table_view_controller.mm b/ios/chrome/browser/ui/settings/settings_root_table_view_controller.mm index 33c6345..0489ee6 100644 --- a/ios/chrome/browser/ui/settings/settings_root_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_root_table_view_controller.mm
@@ -7,7 +7,6 @@ #import "base/mac/foundation_util.h" #import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/open_new_tab_command.h" -#import "ios/chrome/browser/ui/material_components/utils.h" #import "ios/chrome/browser/ui/settings/bar_button_activity_indicator.h" #import "ios/chrome/browser/ui/settings/cells/settings_cells_constants.h" #import "ios/chrome/browser/ui/settings/settings_navigation_controller.h"
diff --git a/ios/chrome/browser/ui/settings/settings_root_table_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/settings_root_table_view_controller_unittest.mm index 003daa5..f0aba72 100644 --- a/ios/chrome/browser/ui/settings/settings_root_table_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/settings_root_table_view_controller_unittest.mm
@@ -24,8 +24,7 @@ public: SettingsRootTableViewController* Controller() { return [[SettingsRootTableViewController alloc] - initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + initWithStyle:UITableViewStylePlain]; } SettingsNavigationController* NavigationController() {
diff --git a/ios/chrome/browser/ui/settings/settings_table_view_controller.h b/ios/chrome/browser/ui/settings/settings_table_view_controller.h index 77baf004..340560e 100644 --- a/ios/chrome/browser/ui/settings/settings_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/settings_table_view_controller.h
@@ -27,10 +27,7 @@ (id<ApplicationCommands, BrowserCommands, BrowsingDataCommands>) dispatcher NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
diff --git a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm index c36bf6a..6e6b092 100644 --- a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm
@@ -249,8 +249,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { _browser = browser; _browserState = _browser->GetBrowserState();
diff --git a/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.h b/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.h index db8c20f..e442f4b8 100644 --- a/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.h
@@ -40,10 +40,7 @@ // |browserState| must not be nil. - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm b/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm index 0a433c25..46edbd3 100644 --- a/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm
@@ -78,8 +78,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { self.title = l10n_util::GetNSString(IDS_IOS_SYNC_ENTER_PASSPHRASE_TITLE); self.shouldHideDoneButton = YES;
diff --git a/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.h b/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.h index b54b41f..ac57a79 100644 --- a/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.h
@@ -17,10 +17,7 @@ // Designated initializer. |browserState| must not be nil. - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.mm b/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.mm index fac5e35..6c519d3 100644 --- a/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.mm
@@ -66,8 +66,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { self.title = l10n_util::GetNSString(IDS_IOS_SYNC_ENCRYPTION_TITLE); _browserState = browserState;
diff --git a/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.h b/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.h index 04fb622e..a2eceb8 100644 --- a/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.h +++ b/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.h
@@ -14,10 +14,7 @@ @interface TableCellCatalogViewController : SettingsRootTableViewController - (instancetype)init NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.mm b/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.mm index 39e5b1aa..32f8c89d 100644 --- a/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.mm +++ b/ios/chrome/browser/ui/settings/table_cell_catalog_view_controller.mm
@@ -80,8 +80,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - return [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + return [super initWithStyle:style]; } - (void)viewDidLoad {
diff --git a/ios/chrome/browser/ui/settings/translate_table_view_controller.h b/ios/chrome/browser/ui/settings/translate_table_view_controller.h index 2a0e585..9c6eee7 100644 --- a/ios/chrome/browser/ui/settings/translate_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/translate_table_view_controller.h
@@ -14,10 +14,7 @@ // |prefs| must not be nil. - (instancetype)initWithPrefs:(PrefService*)prefs NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/translate_table_view_controller.mm b/ios/chrome/browser/ui/settings/translate_table_view_controller.mm index f5d1689..0929be95 100644 --- a/ios/chrome/browser/ui/settings/translate_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/translate_table_view_controller.mm
@@ -73,8 +73,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { _prefs = prefs; _translationEnabled = [[PrefBackedBoolean alloc]
diff --git a/ios/chrome/browser/ui/settings/voice_search_table_view_controller.h b/ios/chrome/browser/ui/settings/voice_search_table_view_controller.h index dc2a5e71..d35174d7 100644 --- a/ios/chrome/browser/ui/settings/voice_search_table_view_controller.h +++ b/ios/chrome/browser/ui/settings/voice_search_table_view_controller.h
@@ -15,10 +15,7 @@ // The designated initializer. - (instancetype)initWithPrefs:(PrefService*)prefs NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; @end
diff --git a/ios/chrome/browser/ui/settings/voice_search_table_view_controller.mm b/ios/chrome/browser/ui/settings/voice_search_table_view_controller.mm index 9a0faea..95df94a 100644 --- a/ios/chrome/browser/ui/settings/voice_search_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/voice_search_table_view_controller.mm
@@ -55,8 +55,7 @@ UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain : UITableViewStyleGrouped; - self = [super initWithTableViewStyle:style - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + self = [super initWithStyle:style]; if (self) { self.title = l10n_util::GetNSString(IDS_IOS_VOICE_SEARCH_SETTING_TITLE); _prefs = prefs;
diff --git a/ios/chrome/browser/ui/table_view/chrome_table_view_controller.h b/ios/chrome/browser/ui/table_view/chrome_table_view_controller.h index 1ebf442..fe53124c 100644 --- a/ios/chrome/browser/ui/table_view/chrome_table_view_controller.h +++ b/ios/chrome/browser/ui/table_view/chrome_table_view_controller.h
@@ -8,7 +8,6 @@ #import <UIKit/UIKit.h> #include "base/ios/block_types.h" -#import "ios/chrome/browser/ui/material_components/app_bar_view_controller_presenting.h" #import "ios/chrome/browser/ui/table_view/chrome_table_view_consumer.h" #import "ios/chrome/browser/ui/table_view/table_view_model.h" @@ -21,15 +20,9 @@ @class ChromeTableViewStyler; @class TableViewItem; -typedef NS_ENUM(NSInteger, ChromeTableViewControllerStyle) { - ChromeTableViewControllerStyleNoAppBar, - ChromeTableViewControllerStyleWithAppBar, -}; - // Chrome-specific TableViewController. @interface ChromeTableViewController - : UITableViewController <AppBarViewControllerPresenting, - ChromeTableViewConsumer> + : UITableViewController <ChromeTableViewConsumer> // The model of this controller. @property(nonatomic, readonly, strong) @@ -40,14 +33,10 @@ // changes made afterwards are not guaranteed to take effect. @property(nonatomic, readwrite, strong) ChromeTableViewStyler* styler; -// Initializes the view controller, configured with |style|, |appBarStyle|. The -// default ChromeTableViewStyler will be used. -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle - NS_DESIGNATED_INITIALIZER; +// Initializes the view controller, configured with |style|. The default +// ChromeTableViewStyler will be used. +- (instancetype)initWithStyle:(UITableViewStyle)style NS_DESIGNATED_INITIALIZER; // Unavailable initializers. -- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; - (instancetype)initWithNibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE; @@ -104,33 +93,6 @@ // accidental touches outside the table view cannot lose user data. - (BOOL)shouldBeDismissedOnTouchOutside; -#pragma mark - UIScrollViewDelegate - -// Updates the MDCFlexibleHeader with changes to the table view scroll -// state. Must be called by subclasses if they override this method in order to -// maintain this functionality. -- (void)scrollViewDidScroll:(UIScrollView*)scrollView NS_REQUIRES_SUPER; - -// Updates the MDCFlexibleHeader with changes to the table view scroll -// state. Must be called by subclasses if they override this method in order to -// maintain this functionality. -- (void)scrollViewDidEndDragging:(UIScrollView*)scrollView - willDecelerate:(BOOL)decelerate NS_REQUIRES_SUPER; - -// Updates the MDCFlexibleHeader with changes to the table view scroll -// state. Must be called by subclasses if they override this method in order to -// maintain this functionality. -- (void)scrollViewDidEndDecelerating:(UIScrollView*)scrollView - NS_REQUIRES_SUPER; - -// Updates the MDCFlexibleHeader with changes to the table view scroll -// state. Must be called by subclasses if they override this method in order to -// maintain this functionality. -- (void)scrollViewWillEndDragging:(UIScrollView*)scrollView - withVelocity:(CGPoint)velocity - targetContentOffset:(inout CGPoint*)targetContentOffset - NS_REQUIRES_SUPER; - #pragma mark - UITableViewDelegate // Prevents non-editable (i.e. returns NO in |tableView:canEditRowAtIndexPath:|)
diff --git a/ios/chrome/browser/ui/table_view/chrome_table_view_controller.mm b/ios/chrome/browser/ui/table_view/chrome_table_view_controller.mm index b129eaa..9682a58 100644 --- a/ios/chrome/browser/ui/table_view/chrome_table_view_controller.mm +++ b/ios/chrome/browser/ui/table_view/chrome_table_view_controller.mm
@@ -7,7 +7,6 @@ #include "base/logging.h" #include "base/mac/foundation_util.h" #import "ios/chrome/browser/ui/material_components/chrome_app_bar_view_controller.h" -#import "ios/chrome/browser/ui/material_components/utils.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_cell.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_header_footer_item.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_item.h" @@ -33,28 +32,20 @@ @end @implementation ChromeTableViewController -@synthesize appBarViewController = _appBarViewController; @synthesize emptyView = _emptyView; @synthesize loadingView = _loadingView; @synthesize styler = _styler; @synthesize tableViewModel = _tableViewModel; -- (instancetype)initWithTableViewStyle:(UITableViewStyle)style - appBarStyle: - (ChromeTableViewControllerStyle)appBarStyle { +- (instancetype)initWithStyle:(UITableViewStyle)style { if ((self = [super initWithStyle:style])) { _styler = [[ChromeTableViewStyler alloc] init]; - - if (appBarStyle == ChromeTableViewControllerStyleWithAppBar) { - _appBarViewController = [[ChromeAppBarViewController alloc] init]; - } } return self; } - (instancetype)init { - return [self initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + return [self initWithStyle:UITableViewStylePlain]; } #pragma mark - UIViewController @@ -67,21 +58,6 @@ [self.tableView setSeparatorInset:UIEdgeInsetsMake(0, kTableViewSeparatorInsetWithIcon, 0, 0)]; - - // Configure the app bar if needed. - if (_appBarViewController) { - ConfigureAppBarViewControllerWithCardStyle(self.appBarViewController); - self.appBarViewController.headerView.trackingScrollView = self.tableView; - // Add the AppBar's views after all other views have been registered. - [self addChildViewController:_appBarViewController]; - CGRect frame = self.appBarViewController.view.frame; - frame.origin.x = 0; - frame.size.width = - self.appBarViewController.parentViewController.view.bounds.size.width; - self.appBarViewController.view.frame = frame; - [self.view addSubview:self.appBarViewController.view]; - [self.appBarViewController didMoveToParentViewController:self]; - } } #pragma mark - UITableViewDelegate @@ -301,39 +277,4 @@ return view; } -#pragma mark - MDCAppBarViewController support - -- (void)scrollViewDidScroll:(UIScrollView*)scrollView { - MDCFlexibleHeaderView* headerView = self.appBarViewController.headerView; - if (scrollView == headerView.trackingScrollView) { - [headerView trackingScrollViewDidScroll]; - } -} - -- (void)scrollViewDidEndDecelerating:(UIScrollView*)scrollView { - MDCFlexibleHeaderView* headerView = self.appBarViewController.headerView; - if (scrollView == headerView.trackingScrollView) { - [headerView trackingScrollViewDidEndDecelerating]; - } -} - -- (void)scrollViewDidEndDragging:(UIScrollView*)scrollView - willDecelerate:(BOOL)decelerate { - MDCFlexibleHeaderView* headerView = self.appBarViewController.headerView; - if (scrollView == headerView.trackingScrollView) { - [headerView trackingScrollViewDidEndDraggingWillDecelerate:decelerate]; - } -} - -- (void)scrollViewWillEndDragging:(UIScrollView*)scrollView - withVelocity:(CGPoint)velocity - targetContentOffset:(inout CGPoint*)targetContentOffset { - MDCFlexibleHeaderView* headerView = self.appBarViewController.headerView; - if (scrollView == headerView.trackingScrollView) { - [headerView - trackingScrollViewWillEndDraggingWithVelocity:velocity - targetContentOffset:targetContentOffset]; - } -} - @end
diff --git a/ios/chrome/browser/ui/table_view/chrome_table_view_controller_unittest.mm b/ios/chrome/browser/ui/table_view/chrome_table_view_controller_unittest.mm index 61879f3..619b3e2 100644 --- a/ios/chrome/browser/ui/table_view/chrome_table_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/table_view/chrome_table_view_controller_unittest.mm
@@ -64,9 +64,8 @@ using ChromeTableViewControllerTest = PlatformTest; TEST_F(ChromeTableViewControllerTest, CellForItemAtIndexPath) { - ChromeTableViewController* controller = [[ChromeTableViewController alloc] - initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + ChromeTableViewController* controller = + [[ChromeTableViewController alloc] initWithStyle:UITableViewStylePlain]; [controller loadModel]; [[controller tableViewModel] addSectionWithIdentifier:SectionIdentifierFoo]; @@ -82,9 +81,8 @@ } TEST_F(ChromeTableViewControllerTest, HeaderForItemAtSection) { - ChromeTableViewController* controller = [[ChromeTableViewController alloc] - initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + ChromeTableViewController* controller = + [[ChromeTableViewController alloc] initWithStyle:UITableViewStylePlain]; [controller loadModel]; [[controller tableViewModel] addSectionWithIdentifier:SectionIdentifierFoo]; @@ -99,9 +97,8 @@ } TEST_F(ChromeTableViewControllerTest, FooterForItemAtSection) { - ChromeTableViewController* controller = [[ChromeTableViewController alloc] - initWithTableViewStyle:UITableViewStylePlain - appBarStyle:ChromeTableViewControllerStyleNoAppBar]; + ChromeTableViewController* controller = + [[ChromeTableViewController alloc] initWithStyle:UITableViewStylePlain]; [controller loadModel]; [[controller tableViewModel] addSectionWithIdentifier:SectionIdentifierFoo];
diff --git a/ios/chrome/common/colors/BUILD.gn b/ios/chrome/common/colors/BUILD.gn index 4b72ae82..eb5dfee8 100644 --- a/ios/chrome/common/colors/BUILD.gn +++ b/ios/chrome/common/colors/BUILD.gn
@@ -15,8 +15,6 @@ "semantic_color_names.h", "semantic_color_names.mm", ] - deps = [ - "resources", - ] + deps = [ "resources" ] configs += [ "//build/config/compiler:enable_arc" ] }
diff --git a/ios/chrome/common/colors/resources/BUILD.gn b/ios/chrome/common/colors/resources/BUILD.gn index 90dcbb7..080ae97 100644 --- a/ios/chrome/common/colors/resources/BUILD.gn +++ b/ios/chrome/common/colors/resources/BUILD.gn
@@ -52,253 +52,169 @@ } colorset("background_color") { - sources = [ - "background_color.colorset/Contents.json", - ] + sources = [ "background_color.colorset/Contents.json" ] } colorset("background_dark_color") { - sources = [ - "background_dark_color.colorset/Contents.json", - ] + sources = [ "background_dark_color.colorset/Contents.json" ] } colorset("blue_color") { - sources = [ - "blue_color.colorset/Contents.json", - ] + sources = [ "blue_color.colorset/Contents.json" ] } colorset("blue_dark_color") { - sources = [ - "blue_dark_color.colorset/Contents.json", - ] + sources = [ "blue_dark_color.colorset/Contents.json" ] } colorset("blue_halo_color") { - sources = [ - "blue_halo_color.colorset/Contents.json", - ] + sources = [ "blue_halo_color.colorset/Contents.json" ] } colorset("close_button_color") { - sources = [ - "close_button_color.colorset/Contents.json", - ] + sources = [ "close_button_color.colorset/Contents.json" ] } colorset("close_button_dark_color") { - sources = [ - "close_button_dark_color.colorset/Contents.json", - ] + sources = [ "close_button_dark_color.colorset/Contents.json" ] } colorset("disabled_tint_color") { - sources = [ - "disabled_tint_color.colorset/Contents.json", - ] + sources = [ "disabled_tint_color.colorset/Contents.json" ] } colorset("favicon_background_color") { - sources = [ - "favicon_background_color.colorset/Contents.json", - ] + sources = [ "favicon_background_color.colorset/Contents.json" ] } colorset("green_color") { - sources = [ - "green_color.colorset/Contents.json", - ] + sources = [ "green_color.colorset/Contents.json" ] } colorset("green_dark_color") { - sources = [ - "green_dark_color.colorset/Contents.json", - ] + sources = [ "green_dark_color.colorset/Contents.json" ] } colorset("grey_50_color") { - sources = [ - "grey_50_color.colorset/Contents.json", - ] + sources = [ "grey_50_color.colorset/Contents.json" ] } colorset("grey_100_color") { - sources = [ - "grey_100_color.colorset/Contents.json", - ] + sources = [ "grey_100_color.colorset/Contents.json" ] } colorset("grey_200_color") { - sources = [ - "grey_200_color.colorset/Contents.json", - ] + sources = [ "grey_200_color.colorset/Contents.json" ] } colorset("grey_300_color") { - sources = [ - "grey_300_color.colorset/Contents.json", - ] + sources = [ "grey_300_color.colorset/Contents.json" ] } colorset("grey_400_color") { - sources = [ - "grey_400_color.colorset/Contents.json", - ] + sources = [ "grey_400_color.colorset/Contents.json" ] } colorset("grey_500_color") { - sources = [ - "grey_500_color.colorset/Contents.json", - ] + sources = [ "grey_500_color.colorset/Contents.json" ] } colorset("grey_600_color") { - sources = [ - "grey_600_color.colorset/Contents.json", - ] + sources = [ "grey_600_color.colorset/Contents.json" ] } colorset("grey_700_color") { - sources = [ - "grey_700_color.colorset/Contents.json", - ] + sources = [ "grey_700_color.colorset/Contents.json" ] } colorset("grey_800_color") { - sources = [ - "grey_800_color.colorset/Contents.json", - ] + sources = [ "grey_800_color.colorset/Contents.json" ] } colorset("grey_900_color") { - sources = [ - "grey_900_color.colorset/Contents.json", - ] + sources = [ "grey_900_color.colorset/Contents.json" ] } colorset("red_color") { - sources = [ - "red_color.colorset/Contents.json", - ] + sources = [ "red_color.colorset/Contents.json" ] } colorset("red_dark_color") { - sources = [ - "red_dark_color.colorset/Contents.json", - ] + sources = [ "red_dark_color.colorset/Contents.json" ] } colorset("mdc_ink_color") { - sources = [ - "mdc_ink_color.colorset/Contents.json", - ] + sources = [ "mdc_ink_color.colorset/Contents.json" ] } colorset("mdc_secondary_ink_color") { - sources = [ - "mdc_secondary_ink_color.colorset/Contents.json", - ] + sources = [ "mdc_secondary_ink_color.colorset/Contents.json" ] } colorset("placeholder_image_tint_color") { - sources = [ - "placeholder_image_tint_color.colorset/Contents.json", - ] + sources = [ "placeholder_image_tint_color.colorset/Contents.json" ] } colorset("scrim_background_color") { - sources = [ - "scrim_background_color.colorset/Contents.json", - ] + sources = [ "scrim_background_color.colorset/Contents.json" ] } colorset("separator_color") { - sources = [ - "separator_color.colorset/Contents.json", - ] + sources = [ "separator_color.colorset/Contents.json" ] } colorset("solid_button_text_color") { - sources = [ - "solid_button_text_color.colorset/Contents.json", - ] + sources = [ "solid_button_text_color.colorset/Contents.json" ] } colorset("table_view_row_highlight_color") { - sources = [ - "table_view_row_highlight_color.colorset/Contents.json", - ] + sources = [ "table_view_row_highlight_color.colorset/Contents.json" ] } colorset("table_view_row_highlight_dark_color") { - sources = [ - "table_view_row_highlight_dark_color.colorset/Contents.json", - ] + sources = [ "table_view_row_highlight_dark_color.colorset/Contents.json" ] } colorset("text_primary_color") { - sources = [ - "text_primary_color.colorset/Contents.json", - ] + sources = [ "text_primary_color.colorset/Contents.json" ] } colorset("text_primary_dark_color") { - sources = [ - "text_primary_dark_color.colorset/Contents.json", - ] + sources = [ "text_primary_dark_color.colorset/Contents.json" ] } colorset("text_secondary_color") { - sources = [ - "text_secondary_color.colorset/Contents.json", - ] + sources = [ "text_secondary_color.colorset/Contents.json" ] } colorset("text_secondary_dark_color") { - sources = [ - "text_secondary_dark_color.colorset/Contents.json", - ] + sources = [ "text_secondary_dark_color.colorset/Contents.json" ] } colorset("textfield_placeholder_color") { - sources = [ - "textfield_placeholder_color.colorset/Contents.json", - ] + sources = [ "textfield_placeholder_color.colorset/Contents.json" ] } colorset("textfield_placeholder_dark_color") { - sources = [ - "textfield_placeholder_dark_color.colorset/Contents.json", - ] + sources = [ "textfield_placeholder_dark_color.colorset/Contents.json" ] } colorset("textfield_background_color") { - sources = [ - "textfield_background_color.colorset/Contents.json", - ] + sources = [ "textfield_background_color.colorset/Contents.json" ] } colorset("textfield_background_dark_color") { - sources = [ - "textfield_background_dark_color.colorset/Contents.json", - ] + sources = [ "textfield_background_dark_color.colorset/Contents.json" ] } colorset("toolbar_button_color") { - sources = [ - "toolbar_button_color.colorset/Contents.json", - ] + sources = [ "toolbar_button_color.colorset/Contents.json" ] } colorset("toolbar_button_dark_color") { - sources = [ - "toolbar_button_dark_color.colorset/Contents.json", - ] + sources = [ "toolbar_button_dark_color.colorset/Contents.json" ] } colorset("toolbar_shadow_color") { - sources = [ - "toolbar_shadow_color.colorset/Contents.json", - ] + sources = [ "toolbar_shadow_color.colorset/Contents.json" ] }
diff --git a/ios/chrome/search_widget_extension/BUILD.gn b/ios/chrome/search_widget_extension/BUILD.gn index 84efa42..bbe2aa08 100644 --- a/ios/chrome/search_widget_extension/BUILD.gn +++ b/ios/chrome/search_widget_extension/BUILD.gn
@@ -80,9 +80,7 @@ source_set("unit_tests") { testonly = true - sources = [ - "search_widget_view_controller_unittest.mm", - ] + sources = [ "search_widget_view_controller_unittest.mm" ] deps = [ ":search_widget", "//testing/gtest",
diff --git a/ios/chrome/search_widget_extension/strings/BUILD.gn b/ios/chrome/search_widget_extension/strings/BUILD.gn index 47745c1..4e7fa47 100644 --- a/ios/chrome/search_widget_extension/strings/BUILD.gn +++ b/ios/chrome/search_widget_extension/strings/BUILD.gn
@@ -16,9 +16,7 @@ grit("ios_search_widget_extension_strings") { source = "ios_search_widget_extension_strings.grd" output_dir = "$root_gen_dir/ios/search_widget_extension" - outputs = [ - "grit/ios_search_widget_extension_strings.h", - ] + outputs = [ "grit/ios_search_widget_extension_strings.h" ] foreach(locale, locales_with_fake_bidi) { outputs += [ "ios_search_widget_extension_strings_$locale.pak" ] } @@ -27,9 +25,7 @@ grit("ios_search_widget_extension_chromium_strings") { source = "ios_search_widget_extension_chromium_strings.grd" output_dir = "$root_gen_dir/ios/search_widget_extension" - outputs = [ - "grit/ios_search_widget_extension_chromium_strings.h", - ] + outputs = [ "grit/ios_search_widget_extension_chromium_strings.h" ] foreach(locale, locales_with_fake_bidi) { outputs += [ "ios_search_widget_extension_chromium_strings_$locale.pak" ] } @@ -38,9 +34,7 @@ grit("ios_search_widget_extension_google_chrome_strings") { source = "ios_search_widget_extension_google_chrome_strings.grd" output_dir = "$root_gen_dir/ios/search_widget_extension" - outputs = [ - "grit/ios_search_widget_extension_google_chrome_strings.h", - ] + outputs = [ "grit/ios_search_widget_extension_google_chrome_strings.h" ] foreach(locale, locales_with_fake_bidi) { outputs += [ "ios_search_widget_extension_google_chrome_strings_$locale.pak" ]
diff --git a/ios/public/provider/chrome/browser/signin/BUILD.gn b/ios/public/provider/chrome/browser/signin/BUILD.gn index 0488c2f..0ad570be 100644 --- a/ios/public/provider/chrome/browser/signin/BUILD.gn +++ b/ios/public/provider/chrome/browser/signin/BUILD.gn
@@ -44,9 +44,7 @@ "//ios/public/provider/chrome/browser", "//ui/base:test_support", ] - public_deps = [ - "//testing/gmock", - ] + public_deps = [ "//testing/gmock" ] } source_set("fake_chrome_identity") { @@ -69,7 +67,5 @@ "fake_chrome_identity_interaction_manager_constants.h", "fake_chrome_identity_interaction_manager_constants.mm", ] - deps = [ - "//base", - ] + deps = [ "//base" ] }
diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn index 3947aa5..32c78e9 100644 --- a/media/audio/BUILD.gn +++ b/media/audio/BUILD.gn
@@ -13,9 +13,7 @@ extra_header = "pulse/pulse_stub_header.fragment" sigs = [ "pulse/pulse.sigs" ] output_name = "pulse/pulse_stubs" - deps = [ - "//base", - ] + deps = [ "//base" ] } } @@ -24,9 +22,7 @@ extra_header = "android/aaudio_stub_header.fragment" sigs = [ "android/aaudio.sigs" ] output_name = "android/aaudio_stubs" - deps = [ - "//base", - ] + deps = [ "//base" ] } }
diff --git a/mojo/BUILD.gn b/mojo/BUILD.gn index 099e5cc9..a495043 100644 --- a/mojo/BUILD.gn +++ b/mojo/BUILD.gn
@@ -8,9 +8,7 @@ group("mojo") { # Meta-target, don't link into production code. testonly = true - deps = [ - ":tests", - ] + deps = [ ":tests" ] if (!(is_linux && current_cpu == "x86")) { deps += [ "//mojo/public" ] @@ -54,9 +52,7 @@ ] if (!is_ios) { - sources = [ - "//mojo/core/message_pipe_perftest.cc", - ] + sources = [ "//mojo/core/message_pipe_perftest.cc" ] deps += [ "//base",
diff --git a/mojo/core/BUILD.gn b/mojo/core/BUILD.gn index ad65243..1fde8c4 100644 --- a/mojo/core/BUILD.gn +++ b/mojo/core/BUILD.gn
@@ -12,9 +12,7 @@ component("embedder_internal") { output_name = "mojo_core_embedder_internal" - public_deps = [ - ":impl_for_embedder", - ] + public_deps = [ ":impl_for_embedder" ] visibility = [ ":test_sources", "//mojo:*", @@ -180,9 +178,7 @@ shared_library("shared_library") { output_name = "mojo_core" - sources = [ - "mojo_core.cc", - ] + sources = [ "mojo_core.cc" ] defines = [ "MOJO_CORE_SHARED_LIBRARY" ] deps = [ ":impl_for_shared_library", @@ -212,24 +208,16 @@ } copy("shared_library_arc32") { - sources = [ - "${root_out_dir}/${android32_toolchain}/libmojo_core.so", - ] - outputs = [ - "${root_out_dir}/libmojo_core_arc32.so", - ] + sources = [ "${root_out_dir}/${android32_toolchain}/libmojo_core.so" ] + outputs = [ "${root_out_dir}/libmojo_core_arc32.so" ] deps = [ ":shared_library(//build/toolchain/android:${android32_toolchain})", ] } copy("shared_library_arc64") { - sources = [ - "${root_out_dir}/${android64_toolchain}/libmojo_core.so", - ] - outputs = [ - "${root_out_dir}/libmojo_core_arc64.so", - ] + sources = [ "${root_out_dir}/${android64_toolchain}/libmojo_core.so" ] + outputs = [ "${root_out_dir}/libmojo_core_arc64.so" ] deps = [ ":shared_library(//build/toolchain/android:${android64_toolchain})", ] @@ -237,9 +225,7 @@ } config("export_only_thunks_api") { - inputs = [ - "export_only_thunks_api.lst", - ] + inputs = [ "export_only_thunks_api.lst" ] ldflags = [ "-Wl,--version-script=" + rebase_path("//mojo/core/export_only_thunks_api.lst", root_build_dir) ] @@ -261,9 +247,7 @@ "//testing/gtest", ] - data_deps = [ - ":shared_library", - ] + data_deps = [ ":shared_library" ] } } } @@ -334,15 +318,11 @@ } group("core_impl_for_fuzzers") { - public_deps = [ - ":impl_for_embedder", - ] + public_deps = [ ":impl_for_embedder" ] } fuzzer_test("mojo_core_channel_fuzzer") { - sources = [ - "channel_fuzzer.cc", - ] + sources = [ "channel_fuzzer.cc" ] deps = [ ":core_impl_for_fuzzers", "//base", @@ -383,9 +363,7 @@ } fuzzer_test("mojo_core_channel_mac_fuzzer") { - sources = [ - "channel_mac_fuzzer.cc", - ] + sources = [ "channel_mac_fuzzer.cc" ] seed_corpus = "$target_gen_dir/mojo_core_channel_mac_corpus" seed_corpus_deps = [ ":mojo_core_channel_mac_fuzzer_convert_corpus" ] deps = [ @@ -400,9 +378,7 @@ } fuzzer_test("mojo_core_node_channel_fuzzer") { - sources = [ - "node_channel_fuzzer.cc", - ] + sources = [ "node_channel_fuzzer.cc" ] deps = [ ":core_impl_for_fuzzers", "//base", @@ -411,9 +387,7 @@ } fuzzer_test("mojo_core_port_event_fuzzer") { - sources = [ - "port_event_fuzzer.cc", - ] + sources = [ "port_event_fuzzer.cc" ] deps = [ ":core_impl_for_fuzzers", "//base", @@ -421,9 +395,7 @@ } fuzzer_test("mojo_core_user_message_fuzzer") { - sources = [ - "user_message_fuzzer.cc", - ] + sources = [ "user_message_fuzzer.cc" ] deps = [ ":core_impl_for_fuzzers", "//base",
diff --git a/mojo/core/embedder/BUILD.gn b/mojo/core/embedder/BUILD.gn index 47f1c390..a2b8772 100644 --- a/mojo/core/embedder/BUILD.gn +++ b/mojo/core/embedder/BUILD.gn
@@ -18,9 +18,7 @@ defines = [ "IS_MOJO_CORE_EMBEDDER_IMPL" ] - public_deps = [ - "//base", - ] + public_deps = [ "//base" ] deps = [ "//mojo/core:embedder_internal",
diff --git a/mojo/core/ports/BUILD.gn b/mojo/core/ports/BUILD.gn index 68dce3f..e70ff860 100644 --- a/mojo/core/ports/BUILD.gn +++ b/mojo/core/ports/BUILD.gn
@@ -31,14 +31,10 @@ defines = [ "IS_MOJO_CORE_PORTS_IMPL" ] - public_deps = [ - "//base", - ] + public_deps = [ "//base" ] if (!is_nacl) { - deps = [ - "//crypto", - ] + deps = [ "//crypto" ] } }
diff --git a/mojo/core/test/BUILD.gn b/mojo/core/test/BUILD.gn index d907d3f..1abadfc 100644 --- a/mojo/core/test/BUILD.gn +++ b/mojo/core/test/BUILD.gn
@@ -35,9 +35,7 @@ source_set("run_all_unittests") { testonly = true - sources = [ - "run_all_unittests.cc", - ] + sources = [ "run_all_unittests.cc" ] deps = [ ":test_support", @@ -65,9 +63,7 @@ "//mojo/public/c/test_support", ] - sources = [ - "run_all_perftests.cc", - ] + sources = [ "run_all_perftests.cc" ] if (is_linux && !is_component_build) { public_configs = [ "//build/config/gcc:rpath_for_built_shared_libraries" ] @@ -92,9 +88,7 @@ if (is_mac) { proto_library("channel_mac_proto") { proto_in_dir = "//" - sources = [ - "data/channel_mac/channel_mac.proto", - ] + sources = [ "data/channel_mac/channel_mac.proto" ] link_deps = [ "//testing/libfuzzer/fuzzers/mach:proto" ] } }
diff --git a/mojo/public/BUILD.gn b/mojo/public/BUILD.gn index b7d5d05..06847220 100644 --- a/mojo/public/BUILD.gn +++ b/mojo/public/BUILD.gn
@@ -28,7 +28,5 @@ } group("fuzzers") { - deps = [ - "tools/fuzzers", - ] + deps = [ "tools/fuzzers" ] }
diff --git a/mojo/public/c/system/BUILD.gn b/mojo/public/c/system/BUILD.gn index 6cc2b02..d208afb 100644 --- a/mojo/public/c/system/BUILD.gn +++ b/mojo/public/c/system/BUILD.gn
@@ -5,19 +5,13 @@ component("system") { output_name = "mojo_public_system" - sources = [ - "thunks.cc", - ] + sources = [ "thunks.cc" ] defines = [ "MOJO_SYSTEM_IMPLEMENTATION" ] - public_deps = [ - ":headers", - ] + public_deps = [ ":headers" ] - deps = [ - "//base", - ] + deps = [ "//base" ] } source_set("headers") {
diff --git a/mojo/public/c/system/tests/BUILD.gn b/mojo/public/c/system/tests/BUILD.gn index f116cc6..6c36633 100644 --- a/mojo/public/c/system/tests/BUILD.gn +++ b/mojo/public/c/system/tests/BUILD.gn
@@ -26,9 +26,7 @@ source_set("perftests") { testonly = true - sources = [ - "core_perftest.cc", - ] + sources = [ "core_perftest.cc" ] deps = [ "//mojo/public/cpp/system",
diff --git a/mojo/public/cpp/platform/tests/BUILD.gn b/mojo/public/cpp/platform/tests/BUILD.gn index d90e9f6..94548c9 100644 --- a/mojo/public/cpp/platform/tests/BUILD.gn +++ b/mojo/public/cpp/platform/tests/BUILD.gn
@@ -5,9 +5,7 @@ source_set("tests") { testonly = true - sources = [ - "platform_handle_unittest.cc", - ] + sources = [ "platform_handle_unittest.cc" ] deps = [ "//base",
diff --git a/mojo/public/cpp/test/BUILD.gn b/mojo/public/cpp/test/BUILD.gn index c667cd41..fb0ee030 100644 --- a/mojo/public/cpp/test/BUILD.gn +++ b/mojo/public/cpp/test/BUILD.gn
@@ -6,7 +6,5 @@ mojom("test_mojom") { testonly = true - sources = [ - "module.test-mojom", - ] + sources = [ "module.test-mojom" ] }
diff --git a/mojo/public/interfaces/BUILD.gn b/mojo/public/interfaces/BUILD.gn index fb11ec2..3106e8c 100644 --- a/mojo/public/interfaces/BUILD.gn +++ b/mojo/public/interfaces/BUILD.gn
@@ -3,7 +3,5 @@ # found in the LICENSE file. group("interfaces") { - deps = [ - "bindings", - ] + deps = [ "bindings" ] }
diff --git a/mojo/public/interfaces/bindings/tests/BUILD.gn b/mojo/public/interfaces/bindings/tests/BUILD.gn index 8921a939..8d9ab8de 100644 --- a/mojo/public/interfaces/bindings/tests/BUILD.gn +++ b/mojo/public/interfaces/bindings/tests/BUILD.gn
@@ -251,21 +251,15 @@ "data/validation/resp_conformance_msghdr_no_such_method.expected", ] - outputs = [ - "$root_gen_dir/layout_test_data/{{source_root_relative_dir}}/{{source_file_part}}", - ] + outputs = [ "$root_gen_dir/layout_test_data/{{source_root_relative_dir}}/{{source_file_part}}" ] } action_foreach("validation_test_data_list") { testonly = true script = "//mojo/public/tools/bindings/gen_data_files_list.py" inputs = mojom_generator_sources - sources = [ - "data/validation", - ] - outputs = [ - "$root_gen_dir/layout_test_data/{{source_root_relative_dir}}/{{source_file_part}}_index.txt", - ] + sources = [ "data/validation" ] + outputs = [ "$root_gen_dir/layout_test_data/{{source_root_relative_dir}}/{{source_file_part}}_index.txt" ] args = [ "-d", rebase_path(sources[0], root_build_dir), @@ -277,9 +271,7 @@ mojom("test_deserializer_interface") { testonly = true generate_java = true - sources = [ - "deserializer.test-mojom", - ] + sources = [ "deserializer.test-mojom" ] js_generate_struct_deserializers = true } @@ -324,25 +316,19 @@ component("test_export_component") { testonly = true - deps = [ - ":test_export", - ] + deps = [ ":test_export" ] } if (!is_ios) { component("test_export_blink_component") { testonly = true - public_deps = [ - ":test_export_blink", - ] + public_deps = [ ":test_export_blink" ] } } mojom("test_export") { testonly = true - sources = [ - "test_export.mojom", - ] + sources = [ "test_export.mojom" ] export_class_attribute = "MOJO_TEST_EXPORT" export_define = "MOJO_TEST_IMPLEMENTATION=1" export_header = "mojo/public/cpp/bindings/tests/mojo_test_export.h" @@ -360,12 +346,8 @@ mojom("test_exported_import") { testonly = true - sources = [ - "test_import.mojom", - ] - public_deps = [ - ":test_export", - ] + sources = [ "test_import.mojom" ] + public_deps = [ ":test_export" ] overridden_deps = [ ":test_export" ] component_deps = [ ":test_export_component" ] @@ -384,16 +366,12 @@ # test_export.mojom from |test_exported_import|. component("test_export_component2") { testonly = true - public_deps = [ - ":test_export2", - ] + public_deps = [ ":test_export2" ] } mojom("test_export2") { testonly = true - sources = [ - "test_export2.mojom", - ] + sources = [ "test_export2.mojom" ] export_class_attribute = "MOJO_TEST_EXPORT" export_define = "MOJO_TEST_IMPLEMENTATION=1" export_header = "mojo/public/cpp/bindings/tests/mojo_test_export.h" @@ -403,33 +381,25 @@ mojom("test_mojom_import") { testonly = true generate_java = true - sources = [ - "sample_import.mojom", - ] + sources = [ "sample_import.mojom" ] } mojom("test_mojom_import_wrapper") { testonly = true generate_java = true - public_deps = [ - ":test_mojom_import", - ] + public_deps = [ ":test_mojom_import" ] } mojom("test_mojom_import_wrapper_wrapper") { testonly = true generate_java = true - public_deps = [ - ":test_mojom_import_wrapper", - ] + public_deps = [ ":test_mojom_import_wrapper" ] } mojom("test_mojom_import2") { testonly = true generate_java = true - sources = [ - "sample_import2.mojom", - ] + sources = [ "sample_import2.mojom" ] public_deps = [ ":test_mojom_import", ":test_mojom_import_wrapper_wrapper", @@ -438,9 +408,7 @@ mojom("test_struct_traits_interfaces") { testonly = true - sources = [ - "struct_with_traits.mojom", - ] + sources = [ "struct_with_traits.mojom" ] support_lazy_serialization = true } @@ -454,9 +422,7 @@ "validation_test_associated_interfaces.mojom", ] - public_deps = [ - ":test_interfaces", - ] + public_deps = [ ":test_interfaces" ] # Validation tests require precise message content matching, so we avoid # scrambling message IDs for test interfaces. @@ -466,17 +432,13 @@ mojom("test_wtf_types") { testonly = true - sources = [ - "test_wtf_types.mojom", - ] + sources = [ "test_wtf_types.mojom" ] } mojom("test_no_sources") { testonly = true - public_deps = [ - ":test_interfaces", - ] + public_deps = [ ":test_interfaces" ] } mojom("echo") { @@ -492,9 +454,7 @@ mojom("other_test_interfaces") { testonly = true generate_java = true - sources = [ - "new_endpoint_types.test-mojom", - ] + sources = [ "new_endpoint_types.test-mojom" ] } # Ensure that some target forces JS and Java bindings generation when all
diff --git a/mojo/public/java/BUILD.gn b/mojo/public/java/BUILD.gn index 4f0c75d5..eb6a000 100644 --- a/mojo/public/java/BUILD.gn +++ b/mojo/public/java/BUILD.gn
@@ -22,9 +22,7 @@ "system/src/org/chromium/mojo/system/Watcher.java", ] - deps = [ - "//base:base_java", - ] + deps = [ "//base:base_java" ] } android_library("bindings_java") { @@ -69,9 +67,7 @@ } android_library("base_java") { - sources = [ - "base/src/org/chromium/mojo_base/BigBufferUtil.java", - ] + sources = [ "base/src/org/chromium/mojo_base/BigBufferUtil.java" ] deps = [ ":system_java",
diff --git a/mojo/public/java/system/BUILD.gn b/mojo/public/java/system/BUILD.gn index 93cfcaf..9ade81d 100644 --- a/mojo/public/java/system/BUILD.gn +++ b/mojo/public/java/system/BUILD.gn
@@ -19,9 +19,7 @@ "javatests/src/org/chromium/mojo/MojoTestRule.java", "javatests/src/org/chromium/mojo/bindings/ValidationTestUtil.java", ] - public_deps = [ - ":system_impl_java_jni_headers", - ] + public_deps = [ ":system_impl_java_jni_headers" ] } generate_jni("system_impl_java_jni_headers") { @@ -71,9 +69,7 @@ # Targets should also depend on :test_support for the native side. android_library("test_support_java") { testonly = true - sources = [ - "javatests/src/org/chromium/mojo/MojoTestRule.java", - ] + sources = [ "javatests/src/org/chromium/mojo/MojoTestRule.java" ] deps = [ "//base:base_java", "//third_party/junit", @@ -82,9 +78,7 @@ source_set("test_support") { testonly = true - sources = [ - "javatests/mojo_test_rule.cc", - ] + sources = [ "javatests/mojo_test_rule.cc" ] deps = [ ":jni_headers", "//base", @@ -135,9 +129,7 @@ "//third_party/junit", ] - data = [ - "//mojo/public/interfaces/bindings/tests/data/validation/", - ] + data = [ "//mojo/public/interfaces/bindings/tests/data/validation/" ] } shared_library("mojo_java_unittests") {
diff --git a/mojo/public/js/BUILD.gn b/mojo/public/js/BUILD.gn index bf728bc..41f47e5 100644 --- a/mojo/public/js/BUILD.gn +++ b/mojo/public/js/BUILD.gn
@@ -41,16 +41,12 @@ script = "//mojo/public/tools/bindings/concatenate-files.py" sources = bindings_js_files - outputs = [ - compiled_file, - ] + outputs = [ compiled_file ] args = rebase_path(bindings_js_files, root_build_dir) args += [ rebase_path(compiled_file, root_build_dir) ] - deps = [ - "//mojo/public/interfaces/bindings:bindings_js__generator", - ] + deps = [ "//mojo/public/interfaces/bindings:bindings_js__generator" ] } bindings_lite_sources = [ @@ -62,19 +58,13 @@ js_library("bindings_lite_sources") { sources = [ "compile_preamble.js" ] + bindings_lite_sources - deps = [ - "//mojo/public/interfaces/bindings:bindings_js_library_for_compile", - ] + deps = [ "//mojo/public/interfaces/bindings:bindings_js_library_for_compile" ] } if (enable_mojom_closure_compile || closure_compile) { js_binary("bindings_lite") { - outputs = [ - bindings_lite_compiled_file, - ] - deps = [ - ":bindings_lite_sources", - ] + outputs = [ bindings_lite_compiled_file ] + deps = [ ":bindings_lite_sources" ] externs_list = [ "$externs_path/mojo_core.js", "$externs_path/pending.js", @@ -93,14 +83,10 @@ all_sources = bindings_lite_sources + [ "$root_gen_dir/mojo/public/interfaces/bindings/interface_control_messages.mojom-lite.js" ] script = "//mojo/public/tools/bindings/concatenate_and_replace_closure_exports.py" sources = all_sources - outputs = [ - bindings_lite_compiled_file, - ] + outputs = [ bindings_lite_compiled_file ] args = rebase_path(all_sources, root_build_dir) + [ rebase_path(bindings_lite_compiled_file, root_build_dir) ] - deps = [ - "//mojo/public/interfaces/bindings:bindings_js__generator", - ] + deps = [ "//mojo/public/interfaces/bindings:bindings_js__generator" ] } } @@ -130,7 +116,5 @@ } group("tests") { - deps = [ - "//mojo/public/js/test:compile_test", - ] + deps = [ "//mojo/public/js/test:compile_test" ] }
diff --git a/mojo/public/js/test/BUILD.gn b/mojo/public/js/test/BUILD.gn index c5fa1d5..68397db1 100644 --- a/mojo/public/js/test/BUILD.gn +++ b/mojo/public/js/test/BUILD.gn
@@ -17,12 +17,8 @@ if (enable_mojom_closure_compile || closure_compile) { js_binary("compile_test") { - outputs = [ - "$target_gen_dir/compile_test.js", - ] - deps = [ - ":test_mojom_js_library_for_compile", - ] + outputs = [ "$target_gen_dir/compile_test.js" ] + deps = [ ":test_mojom_js_library_for_compile" ] closure_flags = strict_error_checking_closure_args + [ "compilation_level=ADVANCED_OPTIMIZATIONS", "language_in=ECMASCRIPT_2017",
diff --git a/mojo/public/js/ts/bindings/tests/BUILD.gn b/mojo/public/js/ts/bindings/tests/BUILD.gn index 19c34b8..bafb2d6 100644 --- a/mojo/public/js/ts/bindings/tests/BUILD.gn +++ b/mojo/public/js/ts/bindings/tests/BUILD.gn
@@ -18,7 +18,5 @@ source_set("tests") { testonly = true - deps = [ - ":test_interfaces_js", - ] + deps = [ ":test_interfaces_js" ] }
diff --git a/mojo/public/tools/bindings/generators/js_templates/lite/test/BUILD.gn b/mojo/public/tools/bindings/generators/js_templates/lite/test/BUILD.gn index ec085c5..c6bf1be 100644 --- a/mojo/public/tools/bindings/generators/js_templates/lite/test/BUILD.gn +++ b/mojo/public/tools/bindings/generators/js_templates/lite/test/BUILD.gn
@@ -7,19 +7,13 @@ mojom("mojo_bindings") { testonly = true - sources = [ - "test.test-mojom", - ] + sources = [ "test.test-mojom" ] } js_type_check("closure_compile") { - deps = [ - ":test", - ] + deps = [ ":test" ] } js_library("test") { - deps = [ - ":mojo_bindings_js_library_for_compile", - ] + deps = [ ":mojo_bindings_js_library_for_compile" ] }
diff --git a/mojo/public/tools/bindings/mojom.gni b/mojo/public/tools/bindings/mojom.gni index 273a3e17..095ae53 100644 --- a/mojo/public/tools/bindings/mojom.gni +++ b/mojo/public/tools/bindings/mojom.gni
@@ -532,9 +532,7 @@ script = mojom_generator_script inputs = mojom_generator_sources + jinja2_sources sources = invoker.sources - deps = [ - ":$parsed_target_name", - ] + deps = [ ":$parsed_target_name" ] outputs = [] filelist = [] foreach(source, invoker.sources) { @@ -752,18 +750,14 @@ testonly = invoker.testonly } output_name = "$shared_component_output_name" - public_deps = [ - ":$shared_cpp_sources_target_name", - ] + public_deps = [ ":$shared_cpp_sources_target_name" ] } } else { group(shared_cpp_library_target_name) { if (defined(invoker.testonly)) { testonly = invoker.testonly } - public_deps = [ - ":$shared_cpp_sources_target_name", - ] + public_deps = [ ":$shared_cpp_sources_target_name" ] } } @@ -992,9 +986,7 @@ action(type_mappings_target_name) { inputs = _bindings_configuration_files + mojom_generator_sources + jinja2_sources - outputs = [ - type_mappings_path, - ] + outputs = [ type_mappings_path ] script = "$mojom_generator_root/generate_type_mappings.py" deps = [] args = [ @@ -1229,9 +1221,7 @@ process_file_template(enabled_sources, generator_java_outputs) } output = "$target_gen_dir/$target_name.srcjar" - outputs = [ - output, - ] + outputs = [ output ] rebase_inputs = rebase_path(inputs, root_build_dir) rebase_output = rebase_path(output, root_build_dir) args = [ @@ -1240,9 +1230,7 @@ ] deps = [] if (enabled_sources != []) { - deps = [ - ":$java_generator_target_name", - ] + deps = [ ":$java_generator_target_name" ] } } @@ -1466,9 +1454,7 @@ script = compile_typescript_script sources = ts_outputs outputs = js_outputs - public_deps = [ - ":$generator_ts_target_name", - ] + public_deps = [ ":$generator_ts_target_name" ] response_file_contents = ts_filelist args = [ "--filelist={{response_file_name}}" ] } @@ -1488,9 +1474,7 @@ group(js_data_deps_target_name) { data = process_file_template(invoker.sources, js_outputs) - deps = [ - ":$generator_js_target_name", - ] + deps = [ ":$generator_js_target_name" ] data_deps = [] foreach(d, all_deps) { full_name = get_label_info(d, "label_no_toolchain")
diff --git a/mojo/public/tools/fuzzers/BUILD.gn b/mojo/public/tools/fuzzers/BUILD.gn index 6953155..159c3d5 100644 --- a/mojo/public/tools/fuzzers/BUILD.gn +++ b/mojo/public/tools/fuzzers/BUILD.gn
@@ -14,9 +14,7 @@ } mojom("fuzz_mojom") { - sources = [ - "fuzz.mojom", - ] + sources = [ "fuzz.mojom" ] } fuzzer_test("mojo_parse_message_fuzzer") { @@ -61,7 +59,5 @@ } proto_library("mojo_fuzzer_proto") { - sources = [ - "mojo_fuzzer.proto", - ] + sources = [ "mojo_fuzzer.proto" ] }
diff --git a/services/audio/public/cpp/BUILD.gn b/services/audio/public/cpp/BUILD.gn index 43563aac..b206da9f 100644 --- a/services/audio/public/cpp/BUILD.gn +++ b/services/audio/public/cpp/BUILD.gn
@@ -43,9 +43,7 @@ "fake_system_info.h", ] - deps = [ - "//testing/gmock", - ] + deps = [ "//testing/gmock" ] public_deps = [ "//base",
diff --git a/services/content/BUILD.gn b/services/content/BUILD.gn index 6c5e825..f61ba73 100644 --- a/services/content/BUILD.gn +++ b/services/content/BUILD.gn
@@ -53,9 +53,7 @@ source_set("tests") { testonly = true - sources = [ - "service_unittest.cc", - ] + sources = [ "service_unittest.cc" ] deps = [ ":impl",
diff --git a/services/content/public/cpp/test/BUILD.gn b/services/content/public/cpp/test/BUILD.gn index 6ba22928..d89c0fb 100644 --- a/services/content/public/cpp/test/BUILD.gn +++ b/services/content/public/cpp/test/BUILD.gn
@@ -24,9 +24,7 @@ source_set("tests") { testonly = true - sources = [ - "fake_navigable_contents_factory_unittest.cc", - ] + sources = [ "fake_navigable_contents_factory_unittest.cc" ] deps = [ ":test_support",
diff --git a/services/device/BUILD.gn b/services/device/BUILD.gn index 65ce0bb..e3461f2 100644 --- a/services/device/BUILD.gn +++ b/services/device/BUILD.gn
@@ -97,9 +97,7 @@ source_set("perftests") { testonly = true - sources = [ - "geolocation/position_cache_impl_perftest.cc", - ] + sources = [ "geolocation/position_cache_impl_perftest.cc" ] deps = [ ":test_support",
diff --git a/services/device/hid/BUILD.gn b/services/device/hid/BUILD.gn index b6d9548..494ecc1 100644 --- a/services/device/hid/BUILD.gn +++ b/services/device/hid/BUILD.gn
@@ -80,9 +80,7 @@ } fuzzer_test("hid_report_descriptor_fuzzer") { - sources = [ - "hid_report_descriptor_fuzzer.cc", - ] + sources = [ "hid_report_descriptor_fuzzer.cc" ] deps = [ "//services/device/public/cpp/hid", "//services/device/public/mojom",
diff --git a/services/device/media_transfer_protocol/BUILD.gn b/services/device/media_transfer_protocol/BUILD.gn index 37c0f7b..31a8ff1 100644 --- a/services/device/media_transfer_protocol/BUILD.gn +++ b/services/device/media_transfer_protocol/BUILD.gn
@@ -9,16 +9,12 @@ assert(use_dbus) proto_library("mtp_file_entry_proto") { - sources = [ - "//third_party/cros_system_api/dbus/mtp_file_entry.proto", - ] + sources = [ "//third_party/cros_system_api/dbus/mtp_file_entry.proto" ] proto_out_dir = "services/device/media_transfer_protocol" } proto_library("mtp_storage_info_proto") { - sources = [ - "//third_party/cros_system_api/dbus/mtp_storage_info.proto", - ] + sources = [ "//third_party/cros_system_api/dbus/mtp_storage_info.proto" ] proto_out_dir = "services/device/media_transfer_protocol" } @@ -30,9 +26,7 @@ "mtp_device_manager.h", ] - public_deps = [ - "//services/device/public/mojom", - ] + public_deps = [ "//services/device/public/mojom" ] deps = [ ":mtp_file_entry_proto",
diff --git a/services/device/public/cpp/BUILD.gn b/services/device/public/cpp/BUILD.gn index 6205d43..a8e0088 100644 --- a/services/device/public/cpp/BUILD.gn +++ b/services/device/public/cpp/BUILD.gn
@@ -5,17 +5,13 @@ import("//build/config/features.gni") component("device_features") { - public = [ - "device_features.h", - ] + public = [ "device_features.h" ] sources = [ "device_features.cc", "device_features_export.h", ] configs += [ "//build/config/compiler:wexit_time_destructors" ] - public_deps = [ - "//base", - ] + public_deps = [ "//base" ] defines = [ "DEVICE_FEATURES_IMPLEMENTATION" ] }
diff --git a/services/device/public/cpp/generic_sensor/BUILD.gn b/services/device/public/cpp/generic_sensor/BUILD.gn index 2eaa63b..0426a01 100644 --- a/services/device/public/cpp/generic_sensor/BUILD.gn +++ b/services/device/public/cpp/generic_sensor/BUILD.gn
@@ -29,7 +29,5 @@ "platform_sensor_configuration.h", ] - deps = [ - "//base", - ] + deps = [ "//base" ] }
diff --git a/services/device/public/cpp/power_monitor/BUILD.gn b/services/device/public/cpp/power_monitor/BUILD.gn index 27ca57cb..451533d 100644 --- a/services/device/public/cpp/power_monitor/BUILD.gn +++ b/services/device/public/cpp/power_monitor/BUILD.gn
@@ -16,7 +16,5 @@ "//services/service_manager/public/cpp", ] - public_deps = [ - "//services/device/public/mojom", - ] + public_deps = [ "//services/device/public/mojom" ] }
diff --git a/services/device/public/cpp/usb/BUILD.gn b/services/device/public/cpp/usb/BUILD.gn index 55e7c03..20dcc56 100644 --- a/services/device/public/cpp/usb/BUILD.gn +++ b/services/device/public/cpp/usb/BUILD.gn
@@ -7,12 +7,8 @@ action("usb_device_ids") { script = "//services/device/public/cpp/usb/tools/usb_ids.py" - inputs = [ - source_ids, - ] - outputs = [ - generated_ids, - ] + inputs = [ source_ids ] + outputs = [ generated_ids ] args = [ "-i", rebase_path(source_ids, root_build_dir),
diff --git a/services/device/public/java/BUILD.gn b/services/device/public/java/BUILD.gn index 68d6a6f..daba332 100644 --- a/services/device/public/java/BUILD.gn +++ b/services/device/public/java/BUILD.gn
@@ -5,18 +5,12 @@ import("//build/config/android/rules.gni") android_library("nfc_java") { - sources = [ - "src/org/chromium/device/nfc/NfcDelegate.java", - ] - deps = [ - "//base:base_java", - ] + sources = [ "src/org/chromium/device/nfc/NfcDelegate.java" ] + deps = [ "//base:base_java" ] } android_library("geolocation_java") { - sources = [ - "src/org/chromium/device/geolocation/LocationProvider.java", - ] + sources = [ "src/org/chromium/device/geolocation/LocationProvider.java" ] } android_library("geolocation_java_test_support") {
diff --git a/services/device/public/mojom/BUILD.gn b/services/device/public/mojom/BUILD.gn index 98f6e0f3..2b17735 100644 --- a/services/device/public/mojom/BUILD.gn +++ b/services/device/public/mojom/BUILD.gn
@@ -63,9 +63,7 @@ } mojom("device_service") { - sources = [ - "device_service.mojom", - ] + sources = [ "device_service.mojom" ] # We can't depend on the Blink variant of ":generic_sensors", but we need the # non-Blink variant as a dependency. Blink can never use the DeviceService @@ -149,11 +147,7 @@ mojom("usb_test") { generate_java = true - sources = [ - "usb_manager_test.mojom", - ] + sources = [ "usb_manager_test.mojom" ] - public_deps = [ - "//url/mojom:url_mojom_gurl", - ] + public_deps = [ "//url/mojom:url_mojom_gurl" ] }
diff --git a/services/device/screen_orientation/BUILD.gn b/services/device/screen_orientation/BUILD.gn index 5bfd967b..ceec11a 100644 --- a/services/device/screen_orientation/BUILD.gn +++ b/services/device/screen_orientation/BUILD.gn
@@ -21,9 +21,7 @@ "//mojo/public/cpp/bindings", ] - public_deps = [ - "//services/device/public/mojom", - ] + public_deps = [ "//services/device/public/mojom" ] if (is_android) { deps += [ ":screen_orientation_jni_headers" ] @@ -33,9 +31,7 @@ if (is_android) { generate_jni("screen_orientation_jni_headers") { visibility = [ ":screen_orientation" ] - sources = [ - "android/java/src/org/chromium/device/screen_orientation/ScreenOrientationListener.java", - ] + sources = [ "android/java/src/org/chromium/device/screen_orientation/ScreenOrientationListener.java" ] } android_library("java") { @@ -43,9 +39,7 @@ # However, various generated targets also need to see this target as a # result of //services/device:java depending on it. visibility = [ "//services/device:*" ] - sources = [ - "android/java/src/org/chromium/device/screen_orientation/ScreenOrientationListener.java", - ] + sources = [ "android/java/src/org/chromium/device/screen_orientation/ScreenOrientationListener.java" ] deps = [ "//base:base_java", "//ui/android:ui_java",
diff --git a/services/device/serial/BUILD.gn b/services/device/serial/BUILD.gn index 79daf9e6..d75328bfb 100644 --- a/services/device/serial/BUILD.gn +++ b/services/device/serial/BUILD.gn
@@ -43,9 +43,7 @@ public_configs = [ ":platform_support" ] - public_deps = [ - "//services/device/public/mojom", - ] + public_deps = [ "//services/device/public/mojom" ] deps = [ "//base",
diff --git a/services/tracing/BUILD.gn b/services/tracing/BUILD.gn index 29d5e41..6c3f1013 100644 --- a/services/tracing/BUILD.gn +++ b/services/tracing/BUILD.gn
@@ -128,18 +128,12 @@ if (is_android) { generate_jni("jni_headers") { testonly = true - sources = [ - "android/test/src/org/chromium/tracing/UnwindTestHelper.java", - ] + sources = [ "android/test/src/org/chromium/tracing/UnwindTestHelper.java" ] } android_library("tracing_test_helper_java") { testonly = true - deps = [ - "//base:base_java", - ] - sources = [ - "android/test/src/org/chromium/tracing/UnwindTestHelper.java", - ] + deps = [ "//base:base_java" ] + sources = [ "android/test/src/org/chromium/tracing/UnwindTestHelper.java" ] } }
diff --git a/services/tracing/public/cpp/BUILD.gn b/services/tracing/public/cpp/BUILD.gn index dd65c31..37aa9b7 100644 --- a/services/tracing/public/cpp/BUILD.gn +++ b/services/tracing/public/cpp/BUILD.gn
@@ -15,14 +15,10 @@ "traced_process.h", ] - public_deps = [ - "//services/tracing/public/mojom", - ] + public_deps = [ "//services/tracing/public/mojom" ] if (!is_nacl && !is_ios) { - deps = [ - ":cpp", - ] + deps = [ ":cpp" ] } }
diff --git a/services/tracing/public/mojom/BUILD.gn b/services/tracing/public/mojom/BUILD.gn index 4c9cbff..d6ec584 100644 --- a/services/tracing/public/mojom/BUILD.gn +++ b/services/tracing/public/mojom/BUILD.gn
@@ -21,7 +21,5 @@ ] } - public_deps = [ - "//mojo/public/mojom/base", - ] + public_deps = [ "//mojo/public/mojom/base" ] }
diff --git a/testing/buildbot/filters/bfcache.content_browsertests.filter b/testing/buildbot/filters/bfcache.content_browsertests.filter index 103a5438..c37a545 100644 --- a/testing/buildbot/filters/bfcache.content_browsertests.filter +++ b/testing/buildbot/filters/bfcache.content_browsertests.filter
@@ -30,7 +30,7 @@ -RenderFrameHostManagerTest.RestoreSubframeFileAccessForHistoryNavigation -RenderProcessHostTest.KeepAliveRendererProcess -SitePerProcessBrowserTest.SubframePendingAndBackToSameSiteInstance --SitePerProcessBrowserTest.SwapOutACKArrivesPriorToProcessShutdownRequest +-SitePerProcessBrowserTest.UnloadACKArrivesPriorToProcessShutdownRequest # Expect the swapped out RenderFrameHost to have a replacement proxy. This won't # happen when the BackForwardCache is used to store the old document.
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index c14701a..932f8fb 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -7681,24 +7681,6 @@ ] } ], - "WebRTC-Bwe-LossBasedControl": [ - { - "platforms": [ - "windows", - "mac", - "chromeos", - "linux", - "ios", - "android", - "android_webview" - ], - "experiments": [ - { - "name": "Enabled,balance_incr:5kbps,balance_decr:24kbps,exponent:0.7,resets:true,decr:0.9" - } - ] - } - ], "WebRTC-Bwe-MaxRttLimit": [ { "platforms": [
diff --git a/third_party/abseil-cpp/absl/algorithm/BUILD.gn b/third_party/abseil-cpp/absl/algorithm/BUILD.gn index 210c9e38..350ed5f 100644 --- a/third_party/abseil-cpp/absl/algorithm/BUILD.gn +++ b/third_party/abseil-cpp/absl/algorithm/BUILD.gn
@@ -24,9 +24,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "algorithm.h", - ] + public = [ "algorithm.h" ] } source_set("container") { @@ -36,9 +34,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "container.h", - ] + public = [ "container.h" ] deps = [ ":algorithm", "../base:core_headers",
diff --git a/third_party/abseil-cpp/absl/base/BUILD.gn b/third_party/abseil-cpp/absl/base/BUILD.gn index beb08f2e..3d555b5 100644 --- a/third_party/abseil-cpp/absl/base/BUILD.gn +++ b/third_party/abseil-cpp/absl/base/BUILD.gn
@@ -24,12 +24,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/atomic_hook.h", - ] - deps = [ - ":core_headers", - ] + public = [ "internal/atomic_hook.h" ] + deps = [ ":core_headers" ] visibility = [] visibility += [ "../*" ] } @@ -41,15 +37,9 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "log_severity.cc", - ] - public = [ - "log_severity.h", - ] - deps = [ - ":core_headers", - ] + sources = [ "log_severity.cc" ] + public = [ "log_severity.h" ] + deps = [ ":core_headers" ] } source_set("raw_logging_internal") { @@ -81,9 +71,7 @@ "internal/scheduling_mode.h", "internal/spinlock_wait.h", ] - deps = [ - ":core_headers", - ] + deps = [ ":core_headers" ] visibility = [] visibility += [ "../base:*" ] } @@ -115,12 +103,8 @@ ":clang_support_dynamic_annotations", "//third_party/abseil-cpp:absl_include_config", ] - sources = [ - "dynamic_annotations.cc", - ] - public = [ - "dynamic_annotations.h", - ] + sources = [ "dynamic_annotations.cc" ] + public = [ "dynamic_annotations.h" ] # Abseil's dynamic annotations are only visible inside Abseil because # their usage is deprecated in Chromium (see README.chromium for more info). @@ -143,9 +127,7 @@ "port.h", "thread_annotations.h", ] - deps = [ - ":config", - ] + deps = [ ":config" ] } source_set("malloc_internal") { @@ -155,9 +137,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/low_level_alloc.cc", - ] + sources = [ "internal/low_level_alloc.cc" ] public = [ "internal/direct_mmap.h", "internal/low_level_alloc.h", @@ -187,9 +167,7 @@ "internal/invoke.h", "internal/scheduling_mode.h", ] - deps = [ - "../meta:type_traits", - ] + deps = [ "../meta:type_traits" ] visibility = [] visibility += [ "../*" ] } @@ -241,12 +219,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/throw_delegate.cc", - ] - public = [ - "internal/throw_delegate.h", - ] + sources = [ "internal/throw_delegate.cc" ] + public = [ "internal/throw_delegate.h" ] deps = [ ":base", ":config", @@ -263,12 +237,8 @@ "//third_party/abseil-cpp:absl_test_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/exception_testing.h", - ] - deps = [ - ":config", - ] + public = [ "internal/exception_testing.h" ] + deps = [ ":config" ] visibility = [] visibility += [ "../*" ] } @@ -280,9 +250,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/pretty_function.h", - ] + public = [ "internal/pretty_function.h" ] visibility = [] visibility += [ "../*" ] } @@ -322,9 +290,7 @@ "//third_party/abseil-cpp:absl_test_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "spinlock_test_common.cc", - ] + sources = [ "spinlock_test_common.cc" ] deps = [ ":base", ":core_headers", @@ -357,12 +323,8 @@ "//build/config/compiler:no_chromium_code", "//third_party/abseil-cpp:absl_default_cflags_cc", ] - public = [ - "internal/bits.h", - ] - deps = [ - ":core_headers", - ] + public = [ "internal/bits.h" ] + deps = [ ":core_headers" ] visibility = [] visibility += [ "../*" ] } @@ -374,15 +336,9 @@ "//build/config/compiler:no_chromium_code", "//third_party/abseil-cpp:absl_default_cflags_cc", ] - public = [ - "internal/scoped_set_env.h", - ] - sources = [ - "internal/scoped_set_env.cc", - ] - deps = [ - ":base", - ] + public = [ "internal/scoped_set_env.h" ] + sources = [ "internal/scoped_set_env.cc" ] + deps = [ ":base" ] visibility = [] visibility += [ "../*" ] }
diff --git a/third_party/abseil-cpp/absl/container/BUILD.gn b/third_party/abseil-cpp/absl/container/BUILD.gn index 452f160..96e16ba3 100644 --- a/third_party/abseil-cpp/absl/container/BUILD.gn +++ b/third_party/abseil-cpp/absl/container/BUILD.gn
@@ -24,12 +24,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/compressed_tuple.h", - ] - deps = [ - "../utility", - ] + public = [ "internal/compressed_tuple.h" ] + deps = [ "../utility" ] } source_set("fixed_array") { @@ -39,9 +35,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "fixed_array.h", - ] + public = [ "fixed_array.h" ] deps = [ ":compressed_tuple", "../algorithm", @@ -59,9 +53,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/inlined_vector.h", - ] + public = [ "internal/inlined_vector.h" ] deps = [ ":compressed_tuple", "../base:core_headers", @@ -78,9 +70,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "inlined_vector.h", - ] + public = [ "inlined_vector.h" ] deps = [ ":inlined_vector_internal", "../algorithm", @@ -98,9 +88,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/counting_allocator.h", - ] + public = [ "internal/counting_allocator.h" ] visibility = [] visibility += [ ":*" ] } @@ -113,15 +101,9 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/test_instance_tracker.cc", - ] - public = [ - "internal/test_instance_tracker.h", - ] - deps = [ - "../types:compare", - ] + sources = [ "internal/test_instance_tracker.cc" ] + public = [ "internal/test_instance_tracker.h" ] + deps = [ "../types:compare" ] visibility = [] visibility += [ "../*" ] } @@ -133,9 +115,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "flat_hash_map.h", - ] + public = [ "flat_hash_map.h" ] deps = [ ":container_memory", ":hash_function_defaults", @@ -152,9 +132,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "flat_hash_set.h", - ] + public = [ "flat_hash_set.h" ] deps = [ ":container_memory", ":hash_function_defaults", @@ -172,9 +150,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "node_hash_map.h", - ] + public = [ "node_hash_map.h" ] deps = [ ":container_memory", ":hash_function_defaults", @@ -192,9 +168,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "node_hash_set.h", - ] + public = [ "node_hash_set.h" ] deps = [ ":container_memory", ":hash_function_defaults", @@ -212,9 +186,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/container_memory.h", - ] + public = [ "internal/container_memory.h" ] deps = [ "../memory", "../utility", @@ -228,9 +200,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/hash_function_defaults.h", - ] + public = [ "internal/hash_function_defaults.h" ] deps = [ "../base:config", "../hash", @@ -246,12 +216,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/hash_generator_testing.cc", - ] - public = [ - "internal/hash_generator_testing.h", - ] + sources = [ "internal/hash_generator_testing.cc" ] + public = [ "internal/hash_generator_testing.h" ] deps = [ ":hash_policy_testing", "../meta:type_traits", @@ -267,9 +233,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/hash_policy_testing.h", - ] + public = [ "internal/hash_policy_testing.h" ] deps = [ "../hash", "../strings", @@ -283,12 +247,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/hash_policy_traits.h", - ] - deps = [ - "../meta:type_traits", - ] + public = [ "internal/hash_policy_traits.h" ] + deps = [ "../meta:type_traits" ] } source_set("hashtable_debug") { @@ -298,12 +258,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/hashtable_debug.h", - ] - deps = [ - ":hashtable_debug_hooks", - ] + public = [ "internal/hashtable_debug.h" ] + deps = [ ":hashtable_debug_hooks" ] } source_set("hashtable_debug_hooks") { @@ -313,9 +269,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/hashtable_debug_hooks.h", - ] + public = [ "internal/hashtable_debug_hooks.h" ] } source_set("hashtablez_sampler") { @@ -325,9 +279,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/hashtablez_sampler.h", - ] + public = [ "internal/hashtablez_sampler.h" ] sources = [ "internal/hashtablez_sampler.cc", "internal/hashtablez_sampler_force_weak_definition.cc", @@ -350,9 +302,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/node_hash_policy.h", - ] + public = [ "internal/node_hash_policy.h" ] } source_set("raw_hash_map") { @@ -362,9 +312,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/raw_hash_map.h", - ] + public = [ "internal/raw_hash_map.h" ] deps = [ ":container_memory", ":raw_hash_set", @@ -379,9 +327,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/have_sse.h", - ] + public = [ "internal/have_sse.h" ] visibility = [] visibility += [ ":*" ] } @@ -393,9 +339,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/common.h", - ] + public = [ "internal/common.h" ] deps = [ "../meta:type_traits", "../types:optional", @@ -409,12 +353,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/raw_hash_set.cc", - ] - public = [ - "internal/raw_hash_set.h", - ] + sources = [ "internal/raw_hash_set.cc" ] + public = [ "internal/raw_hash_set.h" ] deps = [ ":common", ":compressed_tuple", @@ -441,9 +381,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/layout.h", - ] + public = [ "internal/layout.h" ] deps = [ "../base:core_headers", "../meta:type_traits", @@ -461,9 +399,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/tracked.h", - ] + public = [ "internal/tracked.h" ] } source_set("unordered_map_constructor_test") { @@ -474,9 +410,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/unordered_map_constructor_test.h", - ] + public = [ "internal/unordered_map_constructor_test.h" ] deps = [ ":hash_generator_testing", ":hash_policy_testing", @@ -492,9 +426,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/unordered_map_lookup_test.h", - ] + public = [ "internal/unordered_map_lookup_test.h" ] deps = [ ":hash_generator_testing", ":hash_policy_testing", @@ -510,9 +442,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/unordered_map_modifiers_test.h", - ] + public = [ "internal/unordered_map_modifiers_test.h" ] deps = [ ":hash_generator_testing", ":hash_policy_testing", @@ -528,9 +458,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/unordered_set_constructor_test.h", - ] + public = [ "internal/unordered_set_constructor_test.h" ] deps = [ ":hash_generator_testing", ":hash_policy_testing", @@ -547,9 +475,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/unordered_set_members_test.h", - ] + public = [ "internal/unordered_set_members_test.h" ] deps = [ "../meta:type_traits", "//testing/gtest", @@ -564,9 +490,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/unordered_map_members_test.h", - ] + public = [ "internal/unordered_map_members_test.h" ] deps = [ "../meta:type_traits", "//testing/gtest", @@ -581,9 +505,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/unordered_set_lookup_test.h", - ] + public = [ "internal/unordered_set_lookup_test.h" ] deps = [ ":hash_generator_testing", ":hash_policy_testing", @@ -599,9 +521,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/unordered_set_modifiers_test.h", - ] + public = [ "internal/unordered_set_modifiers_test.h" ] deps = [ ":hash_generator_testing", ":hash_policy_testing",
diff --git a/third_party/abseil-cpp/absl/debugging/BUILD.gn b/third_party/abseil-cpp/absl/debugging/BUILD.gn index 35ebbfc3..7829314 100644 --- a/third_party/abseil-cpp/absl/debugging/BUILD.gn +++ b/third_party/abseil-cpp/absl/debugging/BUILD.gn
@@ -25,12 +25,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "stacktrace.cc", - ] - public = [ - "stacktrace.h", - ] + sources = [ "stacktrace.cc" ] + public = [ "stacktrace.h" ] deps = [ ":debugging_internal", "../base", @@ -72,12 +68,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/examine_stack.cc", - ] - public = [ - "internal/examine_stack.h", - ] + sources = [ "internal/examine_stack.cc" ] + public = [ "internal/examine_stack.h" ] visibility = [] visibility += [ ":*" ] deps = [ @@ -95,12 +87,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "failure_signal_handler.cc", - ] - public = [ - "failure_signal_handler.h", - ] + sources = [ "failure_signal_handler.cc" ] + public = [ "failure_signal_handler.h" ] deps = [ ":examine_stack", ":stacktrace", @@ -142,12 +130,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/demangle.cc", - ] - public = [ - "internal/demangle.h", - ] + sources = [ "internal/demangle.cc" ] + public = [ "internal/demangle.h" ] deps = [ "../base", "../base:core_headers", @@ -165,16 +149,10 @@ sources = [] public = [] } else { - sources = [ - "leak_check.cc", - ] - public = [ - "leak_check.h", - ] + sources = [ "leak_check.cc" ] + public = [ "leak_check.h" ] } - deps = [ - "../base:core_headers", - ] + deps = [ "../base:core_headers" ] } source_set("leak_check_disable") { @@ -184,9 +162,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "leak_check_disable.cc", - ] + sources = [ "leak_check_disable.cc" ] } if (is_lsan) { @@ -198,12 +174,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "leak_check.cc", - ] - public = [ - "leak_check.h", - ] + sources = [ "leak_check.cc" ] + public = [ "leak_check.h" ] visibility = [] visibility += [ ":*" ] } @@ -216,12 +188,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "leak_check.cc", - ] - public = [ - "leak_check.h", - ] + sources = [ "leak_check.cc" ] + public = [ "leak_check.h" ] visibility = [] visibility += [ ":*" ] } @@ -235,12 +203,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/stack_consumption.cc", - ] - public = [ - "internal/stack_consumption.h", - ] + sources = [ "internal/stack_consumption.cc" ] + public = [ "internal/stack_consumption.h" ] deps = [ "../base", "../base:core_headers",
diff --git a/third_party/abseil-cpp/absl/flags/BUILD.gn b/third_party/abseil-cpp/absl/flags/BUILD.gn index ee54fd4..54529f82 100644 --- a/third_party/abseil-cpp/absl/flags/BUILD.gn +++ b/third_party/abseil-cpp/absl/flags/BUILD.gn
@@ -30,9 +30,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/program_name.cc", - ] + sources = [ "internal/program_name.cc" ] public = [ "internal/path_util.h", "internal/program_name.h", @@ -53,9 +51,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "usage_config.cc", - ] + sources = [ "usage_config.cc" ] public = [ "config.h", "usage_config.h", @@ -76,12 +72,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "marshalling.cc", - ] - public = [ - "marshalling.h", - ] + sources = [ "marshalling.cc" ] + public = [ "marshalling.h" ] deps = [ "../base:core_headers", "../strings", @@ -97,12 +89,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/commandlineflag.cc", - ] - public = [ - "internal/commandlineflag.h", - ] + sources = [ "internal/commandlineflag.cc" ] + public = [ "internal/commandlineflag.h" ] deps = [ ":config", ":marshalling", @@ -153,9 +141,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "flag.cc", - ] + sources = [ "flag.cc" ] public = [ "declare.h", "flag.h", @@ -180,12 +166,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/usage.cc", - ] - public = [ - "internal/usage.h", - ] + sources = [ "internal/usage.cc" ] + public = [ "internal/usage.h" ] deps = [ ":config", ":flag", @@ -206,12 +188,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "usage.cc", - ] - public = [ - "usage.h", - ] + sources = [ "usage.cc" ] + public = [ "usage.h" ] deps = [ ":usage_internal", "../strings", @@ -227,9 +205,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "parse.cc", - ] + sources = [ "parse.cc" ] public = [ "internal/parse.h", "parse.h",
diff --git a/third_party/abseil-cpp/absl/hash/BUILD.gn b/third_party/abseil-cpp/absl/hash/BUILD.gn index 5293ba4..37acead6 100644 --- a/third_party/abseil-cpp/absl/hash/BUILD.gn +++ b/third_party/abseil-cpp/absl/hash/BUILD.gn
@@ -29,9 +29,7 @@ "internal/hash.cc", "internal/hash.h", ] - public = [ - "hash.h", - ] + public = [ "hash.h" ] deps = [ ":city", "../base:core_headers", @@ -54,9 +52,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "hash_testing.h", - ] + public = [ "hash_testing.h" ] deps = [ ":spy_hash_state", "../meta:type_traits", @@ -74,9 +70,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/spy_hash_state.h", - ] + public = [ "internal/spy_hash_state.h" ] deps = [ ":hash", "../strings", @@ -93,12 +87,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/city.h", - ] - sources = [ - "internal/city.cc", - ] + public = [ "internal/city.h" ] + sources = [ "internal/city.cc" ] deps = [ "../base:config", "../base:core_headers",
diff --git a/third_party/abseil-cpp/absl/memory/BUILD.gn b/third_party/abseil-cpp/absl/memory/BUILD.gn index 1709322..8f9c151da 100644 --- a/third_party/abseil-cpp/absl/memory/BUILD.gn +++ b/third_party/abseil-cpp/absl/memory/BUILD.gn
@@ -24,9 +24,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "memory.h", - ] + public = [ "memory.h" ] deps = [ "../base:core_headers", "../meta:type_traits",
diff --git a/third_party/abseil-cpp/absl/meta/BUILD.gn b/third_party/abseil-cpp/absl/meta/BUILD.gn index 9fbfc9b..372a9d9 100644 --- a/third_party/abseil-cpp/absl/meta/BUILD.gn +++ b/third_party/abseil-cpp/absl/meta/BUILD.gn
@@ -24,10 +24,6 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "type_traits.h", - ] - deps = [ - "../base:config", - ] + public = [ "type_traits.h" ] + deps = [ "../base:config" ] }
diff --git a/third_party/abseil-cpp/absl/numeric/BUILD.gn b/third_party/abseil-cpp/absl/numeric/BUILD.gn index b3e3955..5440f94a 100644 --- a/third_party/abseil-cpp/absl/numeric/BUILD.gn +++ b/third_party/abseil-cpp/absl/numeric/BUILD.gn
@@ -29,9 +29,7 @@ "int128_have_intrinsic.inc", "int128_no_intrinsic.inc", ] - public = [ - "int128.h", - ] + public = [ "int128.h" ] deps = [ "../base:config", "../base:core_headers",
diff --git a/third_party/abseil-cpp/absl/random/BUILD.gn b/third_party/abseil-cpp/absl/random/BUILD.gn index 7b928c7..5be2d89 100644 --- a/third_party/abseil-cpp/absl/random/BUILD.gn +++ b/third_party/abseil-cpp/absl/random/BUILD.gn
@@ -25,9 +25,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "random.h", - ] + public = [ "random.h" ] deps = [ ":distributions", ":seed_sequences", @@ -86,15 +84,9 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "seed_gen_exception.h", - ] - sources = [ - "seed_gen_exception.cc", - ] - deps = [ - "../base:config", - ] + public = [ "seed_gen_exception.h" ] + sources = [ "seed_gen_exception.cc" ] + deps = [ "../base:config" ] } source_set("seed_sequences") { @@ -104,12 +96,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "seed_sequences.h", - ] - sources = [ - "seed_sequences.cc", - ] + public = [ "seed_sequences.h" ] + sources = [ "seed_sequences.cc" ] deps = [ ":seed_gen_exception", "../container:inlined_vector",
diff --git a/third_party/abseil-cpp/absl/random/internal/BUILD.gn b/third_party/abseil-cpp/absl/random/internal/BUILD.gn index 8665208f..6eb6b7d 100644 --- a/third_party/abseil-cpp/absl/random/internal/BUILD.gn +++ b/third_party/abseil-cpp/absl/random/internal/BUILD.gn
@@ -25,14 +25,10 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "traits.h", - ] + public = [ "traits.h" ] visibility = [] visibility += [ "../../random/*" ] - deps = [ - "../../base:config", - ] + deps = [ "../../base:config" ] } source_set("distribution_caller") { @@ -42,9 +38,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "distribution_caller.h", - ] + public = [ "distribution_caller.h" ] visibility = [] visibility += [ "../../random/*" ] } @@ -56,9 +50,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "distributions.h", - ] + public = [ "distributions.h" ] deps = [ ":distribution_caller", ":fast_uniform_bits", @@ -78,9 +70,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "fast_uniform_bits.h", - ] + public = [ "fast_uniform_bits.h" ] visibility = [] visibility += [ "../../random/*" ] } @@ -92,12 +82,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "seed_material.h", - ] - sources = [ - "seed_material.cc", - ] + public = [ "seed_material.h" ] + sources = [ "seed_material.cc" ] deps = [ ":fast_uniform_bits", "../../base", @@ -115,12 +101,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "pool_urbg.h", - ] - sources = [ - "pool_urbg.cc", - ] + public = [ "pool_urbg.h" ] + sources = [ "pool_urbg.cc" ] deps = [ ":randen", ":seed_material", @@ -142,9 +124,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "explicit_seed_seq.h", - ] + public = [ "explicit_seed_seq.h" ] } source_set("sequence_urbg") { @@ -155,9 +135,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "sequence_urbg.h", - ] + public = [ "sequence_urbg.h" ] } source_set("salted_seed_seq") { @@ -167,9 +145,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "salted_seed_seq.h", - ] + public = [ "salted_seed_seq.h" ] deps = [ ":seed_material", "../../container:inlined_vector", @@ -186,9 +162,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "iostream_state_saver.h", - ] + public = [ "iostream_state_saver.h" ] deps = [ "../../meta:type_traits", "../../numeric:int128", @@ -202,9 +176,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "distribution_impl.h", - ] + public = [ "distribution_impl.h" ] deps = [ ":fastmath", ":traits", @@ -221,12 +193,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "fastmath.h", - ] - deps = [ - "../../base:bits", - ] + public = [ "fastmath.h" ] + deps = [ "../../base:bits" ] } source_set("nonsecure_base") { @@ -236,9 +204,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "nonsecure_base.h", - ] + public = [ "nonsecure_base.h" ] deps = [ ":pool_urbg", ":salted_seed_seq", @@ -258,9 +224,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "pcg_engine.h", - ] + public = [ "pcg_engine.h" ] deps = [ ":fastmath", ":iostream_state_saver", @@ -277,9 +241,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "randen_engine.h", - ] + public = [ "randen_engine.h" ] deps = [ ":iostream_state_saver", ":randen", @@ -308,12 +270,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "randen.h", - ] - sources = [ - "randen.cc", - ] + public = [ "randen.h" ] + sources = [ "randen.cc" ] deps = [ ":platform", ":randen_hwaes", @@ -329,15 +287,9 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "randen_slow.h", - ] - sources = [ - "randen_slow.cc", - ] - deps = [ - ":platform", - ] + public = [ "randen_slow.h" ] + sources = [ "randen_slow.cc" ] + deps = [ ":platform" ] } source_set("randen_hwaes") { @@ -351,9 +303,7 @@ "randen_detect.h", "randen_hwaes.h", ] - sources = [ - "randen_detect.cc", - ] + sources = [ "randen_detect.cc" ] deps = [ ":platform", ":randen_hwaes_impl", @@ -371,9 +321,7 @@ "randen_hwaes.cc", "randen_hwaes.h", ] - deps = [ - ":platform", - ] + deps = [ ":platform" ] } executable("gaussian_distribution_gentables") { @@ -383,9 +331,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "gaussian_distribution_gentables.cc", - ] + sources = [ "gaussian_distribution_gentables.cc" ] deps = [ "../../base:core_headers", "../../random:distributions", @@ -424,9 +370,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "nanobenchmark.cc", - ] + sources = [ "nanobenchmark.cc" ] deps = [ ":platform", ":randen_engine", @@ -441,9 +385,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "uniform_helper.h", - ] + public = [ "uniform_helper.h" ] deps = [ ":distribution_impl", ":fast_uniform_bits",
diff --git a/third_party/abseil-cpp/absl/strings/BUILD.gn b/third_party/abseil-cpp/absl/strings/BUILD.gn index 2fff590..fa0a46cf 100644 --- a/third_party/abseil-cpp/absl/strings/BUILD.gn +++ b/third_party/abseil-cpp/absl/strings/BUILD.gn
@@ -105,12 +105,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "str_format.h", - ] - deps = [ - ":str_format_internal", - ] + public = [ "str_format.h" ] + deps = [ ":str_format_internal" ] } source_set("str_format_internal") { @@ -157,12 +153,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/pow10_helper.cc", - ] - public = [ - "internal/pow10_helper.h", - ] + sources = [ "internal/pow10_helper.cc" ] + public = [ "internal/pow10_helper.h" ] visibility = [] visibility += [ ":*" ] }
diff --git a/third_party/abseil-cpp/absl/synchronization/BUILD.gn b/third_party/abseil-cpp/absl/synchronization/BUILD.gn index 8af38bc..8529824 100644 --- a/third_party/abseil-cpp/absl/synchronization/BUILD.gn +++ b/third_party/abseil-cpp/absl/synchronization/BUILD.gn
@@ -24,12 +24,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/graphcycles.cc", - ] - public = [ - "internal/graphcycles.h", - ] + sources = [ "internal/graphcycles.cc" ] + public = [ "internal/graphcycles.h" ] deps = [ "../base", "../base:base_internal", @@ -90,9 +86,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "internal/thread_pool.h", - ] + public = [ "internal/thread_pool.h" ] deps = [ ":synchronization", "../base:core_headers", @@ -109,9 +103,7 @@ "//third_party/abseil-cpp:absl_test_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/per_thread_sem_test.cc", - ] + sources = [ "internal/per_thread_sem_test.cc" ] deps = [ ":synchronization", "../base",
diff --git a/third_party/abseil-cpp/absl/time/BUILD.gn b/third_party/abseil-cpp/absl/time/BUILD.gn index 36ae3d2..2b10fd4 100644 --- a/third_party/abseil-cpp/absl/time/BUILD.gn +++ b/third_party/abseil-cpp/absl/time/BUILD.gn
@@ -60,9 +60,7 @@ "internal/test_util.cc", "internal/zoneinfo.inc", ] - public = [ - "internal/test_util.h", - ] + public = [ "internal/test_util.h" ] deps = [ ":time", "../base",
diff --git a/third_party/abseil-cpp/absl/time/internal/cctz/BUILD.gn b/third_party/abseil-cpp/absl/time/internal/cctz/BUILD.gn index 5daa2a3..879c4016 100644 --- a/third_party/abseil-cpp/absl/time/internal/cctz/BUILD.gn +++ b/third_party/abseil-cpp/absl/time/internal/cctz/BUILD.gn
@@ -34,9 +34,7 @@ configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "src/civil_time_detail.cc", - ] + sources = [ "src/civil_time_detail.cc" ] public = [ "include/cctz/civil_time.h", "include/cctz/civil_time_detail.h", @@ -72,7 +70,5 @@ if (is_mac || is_ios) { libs = [ "Foundation.framework" ] } - deps = [ - ":civil_time", - ] + deps = [ ":civil_time" ] }
diff --git a/third_party/abseil-cpp/absl/types/BUILD.gn b/third_party/abseil-cpp/absl/types/BUILD.gn index f948fa6..81fee56 100644 --- a/third_party/abseil-cpp/absl/types/BUILD.gn +++ b/third_party/abseil-cpp/absl/types/BUILD.gn
@@ -29,9 +29,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "any.h", - ] + public = [ "any.h" ] deps = [ ":bad_any_cast", "../base:config", @@ -48,9 +46,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "bad_any_cast.h", - ] + public = [ "bad_any_cast.h" ] deps = [ ":bad_any_cast_impl", "../base:config", @@ -64,12 +60,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "bad_any_cast.cc", - ] - public = [ - "bad_any_cast.h", - ] + sources = [ "bad_any_cast.cc" ] + public = [ "bad_any_cast.h" ] deps = [ "../base", "../base:config", @@ -85,12 +77,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "span.h", - ] - sources = [ - "internal/span.h", - ] + public = [ "span.h" ] + sources = [ "internal/span.h" ] deps = [ "../algorithm", "../base:core_headers", @@ -106,12 +94,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/optional.h", - ] - public = [ - "optional.h", - ] + sources = [ "internal/optional.h" ] + public = [ "optional.h" ] deps = [ ":bad_optional_access", "../base:base_internal", @@ -130,12 +114,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "bad_optional_access.cc", - ] - public = [ - "bad_optional_access.h", - ] + sources = [ "bad_optional_access.cc" ] + public = [ "bad_optional_access.h" ] deps = [ "../base", "../base:config", @@ -149,12 +129,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "bad_variant_access.cc", - ] - public = [ - "bad_variant_access.h", - ] + sources = [ "bad_variant_access.cc" ] + public = [ "bad_variant_access.h" ] deps = [ "../base", "../base:config", @@ -168,12 +144,8 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - sources = [ - "internal/variant.h", - ] - public = [ - "variant.h", - ] + sources = [ "internal/variant.h" ] + public = [ "variant.h" ] deps = [ ":bad_variant_access", "../base:base_internal", @@ -191,9 +163,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "compare.h", - ] + public = [ "compare.h" ] deps = [ "../base:core_headers", "../meta:type_traits",
diff --git a/third_party/abseil-cpp/absl/utility/BUILD.gn b/third_party/abseil-cpp/absl/utility/BUILD.gn index cbfdd65e..ced693b 100644 --- a/third_party/abseil-cpp/absl/utility/BUILD.gn +++ b/third_party/abseil-cpp/absl/utility/BUILD.gn
@@ -24,9 +24,7 @@ "//third_party/abseil-cpp:absl_default_cflags_cc", ] public_configs = [ "//third_party/abseil-cpp:absl_include_config" ] - public = [ - "utility.h", - ] + public = [ "utility.h" ] deps = [ "../base:base_internal", "../base:config",
diff --git a/third_party/android_crazy_linker/BUILD.gn b/third_party/android_crazy_linker/BUILD.gn index 017bf57..e31e6a4 100644 --- a/third_party/android_crazy_linker/BUILD.gn +++ b/third_party/android_crazy_linker/BUILD.gn
@@ -154,9 +154,7 @@ # This is used to allow shared memory regions to work on Android Q+ # See http://crbug.com/949804 - deps = [ - "//third_party/ashmem", - ] + deps = [ "//third_party/ashmem" ] } } @@ -240,66 +238,44 @@ } crazy_linker_test_library("crazy_linker_tests_libfoo") { - sources = [ - "src/tests/foo.cpp", - ] + sources = [ "src/tests/foo.cpp" ] } crazy_linker_test_library("crazy_linker_tests_libfoo_with_gnu_hash_table") { - sources = [ - "src/tests/foo.cpp", - ] + sources = [ "src/tests/foo.cpp" ] ldflags = [ "-Wl,--hash-style=gnu" ] } crazy_linker_test_library("crazy_linker_tests_libfoo2") { - sources = [ - "src/tests/foo2.cpp", - ] + sources = [ "src/tests/foo2.cpp" ] } crazy_linker_test_library("crazy_linker_tests_libfoo_with_relro") { - sources = [ - "src/tests/foo_with_relro.cpp", - ] + sources = [ "src/tests/foo_with_relro.cpp" ] } crazy_linker_test_library("crazy_linker_tests_libfoo_with_relro_and_relr") { - sources = [ - "src/tests/foo_with_relro.cpp", - ] + sources = [ "src/tests/foo_with_relro.cpp" ] ldflags = [ "-Wl,--pack-dyn-relocs=relr,--use-android-relr-tags" ] } crazy_linker_test_library( "crazy_linker_tests_libfoo_with_static_constructor") { - sources = [ - "src/tests/foo_with_static_constructor.cpp", - ] + sources = [ "src/tests/foo_with_static_constructor.cpp" ] } crazy_linker_test_library("crazy_linker_tests_libbar") { - sources = [ - "src/tests/bar.cpp", - ] - deps = [ - ":crazy_linker_tests_libfoo", - ] + sources = [ "src/tests/bar.cpp" ] + deps = [ ":crazy_linker_tests_libfoo" ] } crazy_linker_test_library("crazy_linker_tests_libbar_with_relro") { - sources = [ - "src/tests/bar_with_relro.cpp", - ] - deps = [ - ":crazy_linker_tests_libfoo_with_relro", - ] + sources = [ "src/tests/bar_with_relro.cpp" ] + deps = [ ":crazy_linker_tests_libfoo_with_relro" ] } crazy_linker_test_library("crazy_linker_tests_libbar_with_two_dlopens") { - sources = [ - "src/tests/bar_with_two_dlopens.cpp", - ] + sources = [ "src/tests/bar_with_two_dlopens.cpp" ] data_deps = [ ":crazy_linker_tests_libfoo", ":crazy_linker_tests_libfoo2", @@ -308,296 +284,170 @@ } crazy_linker_test_library("crazy_linker_tests_libzoo") { - sources = [ - "src/tests/zoo.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libbar", - ] + sources = [ "src/tests/zoo.cpp" ] + data_deps = [ ":crazy_linker_tests_libbar" ] } crazy_linker_test_library( "crazy_linker_tests_libzoo_with_android_dlopen_ext") { - sources = [ - "src/tests/zoo_with_android_dlopen_ext.cpp", - ] + sources = [ "src/tests/zoo_with_android_dlopen_ext.cpp" ] libs = [ "dl" ] } crazy_linker_test_library("crazy_linker_tests_libzoo_with_dlopen_handle") { - sources = [ - "src/tests/zoo_with_dlopen_handle.cpp", - ] + sources = [ "src/tests/zoo_with_dlopen_handle.cpp" ] libs = [ "dl" ] } crazy_linker_test_library("crazy_linker_tests_libzoo_dlopen_in_initializer") { - sources = [ - "src/tests/zoo_with_dlopen_in_elf_initializer.cpp", - ] + sources = [ "src/tests/zoo_with_dlopen_in_elf_initializer.cpp" ] defines = [ "THIS_LIB_NAME=\"libzoo_dlopen_in_initializer\"", "LIB_NAME=\"libcrazy_linker_tests_libzoo_dlopen_in_initializer_inner.so\"", ] - data_deps = [ - ":crazy_linker_tests_libzoo_dlopen_in_initializer_inner", - ] + data_deps = [ ":crazy_linker_tests_libzoo_dlopen_in_initializer_inner" ] libs = [ "dl" ] } crazy_linker_test_library( "crazy_linker_tests_libzoo_dlopen_in_initializer_inner") { - sources = [ - "src/tests/zoo_with_dlopen_in_elf_initializer.cpp", - ] + sources = [ "src/tests/zoo_with_dlopen_in_elf_initializer.cpp" ] defines = [ "THIS_LIB_NAME=\"libzoo_dlopen_in_initializer_inner\"", "LIB_NAME=\"libcrazy_linker_tests_libzoo.so\"", ] - data_deps = [ - ":crazy_linker_tests_libzoo", - ] + data_deps = [ ":crazy_linker_tests_libzoo" ] libs = [ "dl" ] } crazy_linker_test_library("crazy_linker_tests_libjni_lib") { - sources = [ - "src/tests/jni_lib.cpp", - ] + sources = [ "src/tests/jni_lib.cpp" ] } # Integration tests are provided as standalone executables for now. executable("crazy_linker_bench_load_library") { - sources = [ - "src/tests/bench_load_library.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libfoo", - ] - deps = [ - ":android_crazy_linker", - ] + sources = [ "src/tests/bench_load_library.cpp" ] + data_deps = [ ":crazy_linker_tests_libfoo" ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_jni_hooks") { - sources = [ - "src/tests/test_jni_hooks.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libjni_lib", - ] - deps = [ - ":android_crazy_linker", - ] + sources = [ "src/tests/test_jni_hooks.cpp" ] + data_deps = [ ":crazy_linker_tests_libjni_lib" ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_load_library") { - sources = [ - "src/tests/test_load_library.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libfoo", - ] - deps = [ - ":android_crazy_linker", - ] + sources = [ "src/tests/test_load_library.cpp" ] + data_deps = [ ":crazy_linker_tests_libfoo" ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_load_library_with_fd") { - sources = [ - "src/tests/test_load_library_with_fd.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libfoo", - ] - deps = [ - ":android_crazy_linker", - ] + sources = [ "src/tests/test_load_library_with_fd.cpp" ] + data_deps = [ ":crazy_linker_tests_libfoo" ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_load_library_with_reserved_map") { - sources = [ - "src/tests/test_load_library_with_reserved_map.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libfoo", - ] - deps = [ - ":android_crazy_linker", - ] + sources = [ "src/tests/test_load_library_with_reserved_map.cpp" ] + data_deps = [ ":crazy_linker_tests_libfoo" ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_load_library_with_relr_relocations") { - sources = [ - "src/tests/test_load_library.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libfoo_with_relro_and_relr", - ] + sources = [ "src/tests/test_load_library.cpp" ] + data_deps = [ ":crazy_linker_tests_libfoo_with_relro_and_relr" ] defines = [ "LIB_NAME=\"libcrazy_linker_tests_libfoo_with_relro_and_relr.so\"" ] - deps = [ - ":android_crazy_linker", - ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_load_library_depends") { - sources = [ - "src/tests/test_load_library_depends.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libbar", - ] - deps = [ - ":android_crazy_linker", - ] + sources = [ "src/tests/test_load_library_depends.cpp" ] + data_deps = [ ":crazy_linker_tests_libbar" ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_constructors_destructors") { - sources = [ - "src/tests/test_constructors_destructors.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libfoo_with_static_constructor", - ] - deps = [ - ":android_crazy_linker", - ] + sources = [ "src/tests/test_constructors_destructors.cpp" ] + data_deps = [ ":crazy_linker_tests_libfoo_with_static_constructor" ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_load_library_with_gnu_hash_table") { - sources = [ - "src/tests/test_load_library.cpp", - ] + sources = [ "src/tests/test_load_library.cpp" ] defines = [ "LIB_NAME=\"libcrazy_linker_tests_libfoo_with_gnu_hash_table.so\"" ] - data_deps = [ - ":crazy_linker_tests_libfoo_with_gnu_hash_table", - ] - deps = [ - ":android_crazy_linker", - ] + data_deps = [ ":crazy_linker_tests_libfoo_with_gnu_hash_table" ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_dl_wrappers") { - sources = [ - "src/tests/test_dl_wrappers.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libzoo", - ] - deps = [ - ":android_crazy_linker", - ] + sources = [ "src/tests/test_dl_wrappers.cpp" ] + data_deps = [ ":crazy_linker_tests_libzoo" ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_dl_wrappers_recursive") { - sources = [ - "src/tests/test_dl_wrappers_recursive.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libzoo_dlopen_in_initializer", - ] - deps = [ - ":android_crazy_linker", - ] + sources = [ "src/tests/test_dl_wrappers_recursive.cpp" ] + data_deps = [ ":crazy_linker_tests_libzoo_dlopen_in_initializer" ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_dl_wrappers_with_system_handle") { - sources = [ - "src/tests/test_dl_wrappers_with_system_handle.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libzoo_with_dlopen_handle", - ] - deps = [ - ":android_crazy_linker", - ] + sources = [ "src/tests/test_dl_wrappers_with_system_handle.cpp" ] + data_deps = [ ":crazy_linker_tests_libzoo_with_dlopen_handle" ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_dl_wrappers_with_android_dlopen_ext") { - sources = [ - "src/tests/test_dl_wrappers_with_android_dlopen_ext.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libzoo_with_android_dlopen_ext", - ] - deps = [ - ":android_crazy_linker", - ] + sources = [ "src/tests/test_dl_wrappers_with_android_dlopen_ext.cpp" ] + data_deps = [ ":crazy_linker_tests_libzoo_with_android_dlopen_ext" ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_dl_wrappers_valid_handles") { - sources = [ - "src/tests/test_dl_wrappers_valid_handles.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libbar_with_two_dlopens", - ] - deps = [ - ":android_crazy_linker", - ] + sources = [ "src/tests/test_dl_wrappers_valid_handles.cpp" ] + data_deps = [ ":crazy_linker_tests_libbar_with_two_dlopens" ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_search_path_list") { - sources = [ - "src/tests/test_search_path_list.cpp", - ] + sources = [ "src/tests/test_search_path_list.cpp" ] data_deps = [ ":crazy_linker_tests_libfoo", ":crazy_linker_tests_libfoo2", ] - deps = [ - ":android_crazy_linker", - ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_relocated_shared_relro") { - sources = [ - "src/tests/test_relocated_shared_relro.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libfoo_with_relro", - ] - deps = [ - ":android_crazy_linker", - ] + sources = [ "src/tests/test_relocated_shared_relro.cpp" ] + data_deps = [ ":crazy_linker_tests_libfoo_with_relro" ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_shared_relro") { - sources = [ - "src/tests/test_shared_relro.cpp", - ] - data_deps = [ - ":crazy_linker_tests_libfoo_with_relro", - ] - deps = [ - ":android_crazy_linker", - ] + sources = [ "src/tests/test_shared_relro.cpp" ] + data_deps = [ ":crazy_linker_tests_libfoo_with_relro" ] + deps = [ ":android_crazy_linker" ] } executable("crazy_linker_test_two_shared_relros") { - sources = [ - "src/tests/test_two_shared_relros.cpp", - ] + sources = [ "src/tests/test_two_shared_relros.cpp" ] data_deps = [ ":crazy_linker_tests_libbar_with_relro", ":crazy_linker_tests_libfoo_with_relro", ] - deps = [ - ":android_crazy_linker", - ] + deps = [ ":android_crazy_linker" ] } # Copy the script that runs all integration tests to the right directory. copy("run_android_crazy_linker_tests") { - sources = [ - "src/run_tests.sh", - ] - outputs = [ - "$root_out_dir/bin/run_android_crazy_linker_tests", - ] + sources = [ "src/run_tests.sh" ] + outputs = [ "$root_out_dir/bin/run_android_crazy_linker_tests" ] } } # is_android
diff --git a/third_party/blink/public/BUILD.gn b/third_party/blink/public/BUILD.gn index 07626a8..311bfe7 100644 --- a/third_party/blink/public/BUILD.gn +++ b/third_party/blink/public/BUILD.gn
@@ -17,9 +17,7 @@ } group("blink") { - public_deps = [ - ":blink_headers", - ] + public_deps = [ ":blink_headers" ] deps = [ "//third_party/blink/renderer/controller", "//third_party/blink/renderer/core", @@ -461,21 +459,15 @@ devtools_frontend_path = "//third_party/devtools-frontend/src" group("blink_devtools_frontend_resources") { - public_deps = [ - "$devtools_frontend_path:devtools_frontend_resources", - ] + public_deps = [ "$devtools_frontend_path:devtools_frontend_resources" ] } group("blink_devtools_frontend_resources_files") { - data_deps = [ - "$devtools_frontend_path:devtools_all_files", - ] + data_deps = [ "$devtools_frontend_path:devtools_all_files" ] } group("blink_generate_devtools_grd") { - public_deps = [ - "$devtools_frontend_path:generate_devtools_grd", - ] + public_deps = [ "$devtools_frontend_path:generate_devtools_grd" ] } resources_out_dir = "$root_gen_dir/third_party/blink/public/resources" @@ -512,9 +504,7 @@ "$root_gen_dir/third_party/blink/public/resources/blink_image_resources_100_percent.pak", "$root_gen_dir/third_party/blink/renderer/modules/media_controls/resources/media_controls_resources_100_percent.pak", ] - deps = [ - ":scaled_resources", - ] + deps = [ ":scaled_resources" ] } repack("scaled_resources_200_percent") { @@ -523,7 +513,5 @@ "$root_gen_dir/third_party/blink/public/resources/blink_image_resources_200_percent.pak", "$root_gen_dir/third_party/blink/renderer/modules/media_controls/resources/media_controls_resources_200_percent.pak", ] - deps = [ - ":scaled_resources", - ] + deps = [ ":scaled_resources" ] }
diff --git a/third_party/blink/public/devtools_protocol/browser_protocol.pdl b/third_party/blink/public/devtools_protocol/browser_protocol.pdl index d9b8997..5d1f2bf 100644 --- a/third_party/blink/public/devtools_protocol/browser_protocol.pdl +++ b/third_party/blink/public/devtools_protocol/browser_protocol.pdl
@@ -1244,6 +1244,8 @@ command takeCoverageDelta returns array of RuleUsage coverage + # Monotonically increasing time, in seconds. + number timestamp # Fires whenever a web font is updated. A non-empty font parameter indicates a successfully loaded # web font
diff --git a/third_party/blink/public/mojom/push_messaging/push_messaging_status.mojom b/third_party/blink/public/mojom/push_messaging/push_messaging_status.mojom index 8a9039b8..48aa00a0 100644 --- a/third_party/blink/public/mojom/push_messaging/push_messaging_status.mojom +++ b/third_party/blink/public/mojom/push_messaging/push_messaging_status.mojom
@@ -136,6 +136,9 @@ // happen when a subscription is invalidated by the push service. SUCCESS_NEW_SUBSCRIPTION_FROM_PUSH_SERVICE = 16, + // Registration failed because a GCM Sender ID was used. + UNSUPPORTED_GCM_SENDER_ID = 17, + // NOTE: Do not renumber or delete these as that would confuse interpretation // of previously logged data. When making changes, also update the enum list // in tools/metrics/histograms/histograms.xml to keep it in sync.
diff --git a/third_party/blink/public/mojom/web_feature/web_feature.mojom b/third_party/blink/public/mojom/web_feature/web_feature.mojom index f26bc15b..ed89ed4f 100644 --- a/third_party/blink/public/mojom/web_feature/web_feature.mojom +++ b/third_party/blink/public/mojom/web_feature/web_feature.mojom
@@ -2493,6 +2493,7 @@ kWebkitBoxPackCenterDoesSomething = 3124, kWebkitBoxPackEndDoesSomething = 3125, kV8KeyframeEffect_Constructor = 3126, + kWebNfcAPI = 3127, // Add new features immediately above this line. Don't change assigned // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/blink/renderer/DEPS b/third_party/blink/renderer/DEPS index e35cf69..df685f5 100644 --- a/third_party/blink/renderer/DEPS +++ b/third_party/blink/renderer/DEPS
@@ -37,6 +37,7 @@ "+base/system/sys_info.h", "+base/task/post_task.h", "+base/test/metrics/histogram_tester.h", + "+base/test/mock_callback.h", "+base/test/scoped_feature_list.h", "+base/test/test_simple_task_runner.h", "+base/thread_annotations.h",
diff --git a/third_party/blink/renderer/bindings/BUILD.gn b/third_party/blink/renderer/bindings/BUILD.gn index 90910159..3b0fc61 100644 --- a/third_party/blink/renderer/bindings/BUILD.gn +++ b/third_party/blink/renderer/bindings/BUILD.gn
@@ -18,9 +18,7 @@ "$bindings_core_output_dir/interfaces_info_core.pickle", "$bindings_modules_output_dir/interfaces_info_modules.pickle", ] - outputs = [ - "$bindings_output_dir/interfaces_info.pickle", - ] + outputs = [ "$bindings_output_dir/interfaces_info.pickle" ] args = [ "--", @@ -56,9 +54,7 @@ script = "${bindings_scripts_dir}/collect_idl_files.py" inputs = invoker.inputs - outputs = [ - invoker.output, - ] + outputs = [ invoker.output ] # List input file names in a temporary file. response_file_contents = rebase_path(inputs, root_build_dir) @@ -122,9 +118,7 @@ runtime_enabled_features_test_file, ] output_data_file = "${bindings_output_dir}/web_idl_database.pickle" - outputs = [ - output_data_file, - ] + outputs = [ output_data_file ] args = [ "--output", @@ -156,9 +150,7 @@ web_idl_database_outputs = get_target_outputs(":web_idl_database") web_idl_database = web_idl_database_outputs[0] - inputs = [ - web_idl_database, - ] + inputs = [ web_idl_database ] outputs = generated_core_dictionary_files + generated_modules_dictionary_files + generated_core_testing_dictionary_files + generated_demo_files @@ -177,9 +169,7 @@ rebase_path("${bindings_output_dir}/modules/v8/", root_gen_dir), ] - deps = [ - ":web_idl_database", - ] + deps = [ ":web_idl_database" ] } } @@ -189,13 +179,9 @@ web_idl_database_outputs = get_target_outputs(":web_idl_database") web_idl_database = web_idl_database_outputs[0] - inputs = [ - web_idl_database, - ] + inputs = [ web_idl_database ] output_data_file = "${bindings_output_dir}/high_entropy_list.txt" - outputs = [ - output_data_file, - ] + outputs = [ output_data_file ] args = [ "--web_idl_database", @@ -204,7 +190,5 @@ rebase_path(output_data_file, root_build_dir), ] - deps = [ - ":web_idl_database", - ] + deps = [ ":web_idl_database" ] }
diff --git a/third_party/blink/renderer/bindings/bindings.gni b/third_party/blink/renderer/bindings/bindings.gni index 0e062d62..41c19819 100644 --- a/third_party/blink/renderer/bindings/bindings.gni +++ b/third_party/blink/renderer/bindings/bindings.gni
@@ -165,6 +165,7 @@ "core/v8/v8_persistent_value_vector.h", "core/v8/v8_script_runner.cc", "core/v8/v8_script_runner.h", + "core/v8/v8_set_return_value_for_core.h", "core/v8/v8_string_resource.h", "core/v8/v8_throw_dom_exception.cc", "core/v8/v8_throw_dom_exception.h",
diff --git a/third_party/blink/renderer/bindings/core/BUILD.gn b/third_party/blink/renderer/bindings/core/BUILD.gn index ba48ea2e..03ff1184 100644 --- a/third_party/blink/renderer/bindings/core/BUILD.gn +++ b/third_party/blink/renderer/bindings/core/BUILD.gn
@@ -34,7 +34,5 @@ basenames = core_global_constructors_original_interface_basenames component = "core" output_dir = blink_core_output_dir - deps = [ - ":core_global_objects", - ] + deps = [ ":core_global_objects" ] }
diff --git a/third_party/blink/renderer/bindings/core/v8/BUILD.gn b/third_party/blink/renderer/bindings/core/v8/BUILD.gn index 9e9cc48..926fc05 100644 --- a/third_party/blink/renderer/bindings/core/v8/BUILD.gn +++ b/third_party/blink/renderer/bindings/core/v8/BUILD.gn
@@ -53,13 +53,9 @@ if (use_v8_bind_gen_for_dictionary) { sources -= core_dictionary_idl_files } - outputs = [ - "$bindings_core_v8_output_dir/v8_generated_core_bindings.cc", - ] + outputs = [ "$bindings_core_v8_output_dir/v8_generated_core_bindings.cc" ] component = "core" - public_deps = [ - ":generate_bindings_core_v8_interfaces", - ] + public_deps = [ ":generate_bindings_core_v8_interfaces" ] } idl_impl("bindings_core_impl_generated") { @@ -117,9 +113,7 @@ } fuzzer_test("v8_serialized_script_value_fuzzer") { - sources = [ - "serialization/serialized_script_value_fuzzer.cc", - ] + sources = [ "serialization/serialized_script_value_fuzzer.cc" ] seed_corpus = "serialization/fuzz_corpus" deps = [ "//third_party/blink/renderer/core",
diff --git a/third_party/blink/renderer/bindings/core/v8/idl_types.h b/third_party/blink/renderer/bindings/core/v8/idl_types.h index 77a95514b..1b921b0 100644 --- a/third_party/blink/renderer/bindings/core/v8/idl_types.h +++ b/third_party/blink/renderer/bindings/core/v8/idl_types.h
@@ -18,6 +18,7 @@ namespace blink { +class EventListener; class ScriptPromise; // Boolean @@ -85,7 +86,7 @@ namespace bindings { -enum class NativeValueTraitsStringConv { +enum class IDLStringConvMode { kDefault, kNullable, kTreatNullAsEmptyString, @@ -94,30 +95,29 @@ } // namespace bindings // ByteString -template <bindings::NativeValueTraitsStringConv mode> +template <bindings::IDLStringConvMode mode> struct IDLByteStringBaseV2 final : public IDLBaseHelper<String> {}; using IDLByteStringV2 = - IDLByteStringBaseV2<bindings::NativeValueTraitsStringConv::kDefault>; + IDLByteStringBaseV2<bindings::IDLStringConvMode::kDefault>; using IDLByteStringOrNullV2 = - IDLByteStringBaseV2<bindings::NativeValueTraitsStringConv::kNullable>; + IDLByteStringBaseV2<bindings::IDLStringConvMode::kNullable>; // DOMString -template <bindings::NativeValueTraitsStringConv mode> +template <bindings::IDLStringConvMode mode> struct IDLStringBaseV2 final : public IDLBaseHelper<String> {}; -using IDLStringV2 = - IDLStringBaseV2<bindings::NativeValueTraitsStringConv::kDefault>; +using IDLStringV2 = IDLStringBaseV2<bindings::IDLStringConvMode::kDefault>; using IDLStringOrNullV2 = - IDLStringBaseV2<bindings::NativeValueTraitsStringConv::kNullable>; -using IDLStringTreatNullAsEmptyStringV2 = IDLStringBaseV2< - bindings::NativeValueTraitsStringConv::kTreatNullAsEmptyString>; + IDLStringBaseV2<bindings::IDLStringConvMode::kNullable>; +using IDLStringTreatNullAsEmptyStringV2 = + IDLStringBaseV2<bindings::IDLStringConvMode::kTreatNullAsEmptyString>; // USVString -template <bindings::NativeValueTraitsStringConv mode> +template <bindings::IDLStringConvMode mode> struct IDLUSVStringBaseV2 final : public IDLBaseHelper<String> {}; using IDLUSVStringV2 = - IDLUSVStringBaseV2<bindings::NativeValueTraitsStringConv::kDefault>; + IDLUSVStringBaseV2<bindings::IDLStringConvMode::kDefault>; using IDLUSVStringOrNullV2 = - IDLUSVStringBaseV2<bindings::NativeValueTraitsStringConv::kNullable>; + IDLUSVStringBaseV2<bindings::IDLStringConvMode::kNullable>; // Double struct IDLDouble final : public IDLBaseHelper<double> {}; @@ -187,6 +187,11 @@ static inline ResultType NullValue() { return InnerTraits::NullValue(); } }; +// EventHandler types +struct IDLEventHandler : public IDLBaseHelper<EventListener*> {}; +struct IDLOnBeforeUnloadEventHandler : public IDLBaseHelper<EventListener*> {}; +struct IDLOnErrorEventHandler : public IDLBaseHelper<EventListener*> {}; + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_IDL_TYPES_H_
diff --git a/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.cc b/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.cc index af20f02..265a1fd 100644 --- a/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.cc +++ b/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.cc
@@ -4,6 +4,7 @@ #include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h" +#include "third_party/blink/renderer/bindings/core/v8/js_event_handler.h" #include "third_party/blink/renderer/bindings/core/v8/v8_array_buffer.h" #include "third_party/blink/renderer/bindings/core/v8/v8_array_buffer_view.h" #include "third_party/blink/renderer/bindings/core/v8/v8_big_int_64_array.h" @@ -37,8 +38,23 @@ return ToScriptWrappable(value.As<v8::Object>()); } +ScriptWrappable* NativeValueTraitsInterfaceArgumentValue( + v8::Isolate* isolate, + const WrapperTypeInfo* wrapper_type_info, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + if (!V8PerIsolateData::From(isolate)->HasInstance(wrapper_type_info, value)) { + exception_state.ThrowTypeError(ExceptionMessages::ArgumentNotOfType( + argument_index, wrapper_type_info->interface_name)); + return nullptr; + } + return ToScriptWrappable(value.As<v8::Object>()); +} + } // namespace bindings +// Buffer source types #define DEFINE_NATIVE_VALUE_TRAITS_BUFFER_SOURCE_TYPE(T, V8T) \ T* NativeValueTraits<T>::NativeValue(v8::Isolate* isolate, \ v8::Local<v8::Value> value, \ @@ -70,4 +86,29 @@ DEFINE_NATIVE_VALUE_TRAITS_BUFFER_SOURCE_TYPE(DOMDataView, V8DataView) #undef DEFINE_NATIVE_VALUE_TRAITS_BUFFER_SOURCE_TYPE +// EventHandler +EventListener* NativeValueTraits<IDLEventHandler>::NativeValue( + v8::Isolate* isolate, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return JSEventHandler::CreateOrNull( + value, JSEventHandler::HandlerType::kEventHandler); +} + +EventListener* NativeValueTraits<IDLOnBeforeUnloadEventHandler>::NativeValue( + v8::Isolate* isolate, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return JSEventHandler::CreateOrNull( + value, JSEventHandler::HandlerType::kOnBeforeUnloadEventHandler); +} + +EventListener* NativeValueTraits<IDLOnErrorEventHandler>::NativeValue( + v8::Isolate* isolate, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return JSEventHandler::CreateOrNull( + value, JSEventHandler::HandlerType::kOnErrorEventHandler); +} + } // namespace blink
diff --git a/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h b/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h index c9994d7..a6f69cd 100644 --- a/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h +++ b/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h
@@ -18,6 +18,7 @@ namespace blink { class CallbackFunctionBase; +class EventListener; class ScriptWrappable; struct WrapperTypeInfo; @@ -31,6 +32,13 @@ v8::Local<v8::Value> value, ExceptionState& exception_state); +CORE_EXPORT ScriptWrappable* NativeValueTraitsInterfaceArgumentValue( + v8::Isolate* isolate, + const WrapperTypeInfo* wrapper_type_info, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state); + } // namespace bindings // Boolean @@ -42,6 +50,13 @@ ExceptionState& exception_state) { return ToBoolean(isolate, value, exception_state); } + + static bool ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; // Integers @@ -53,6 +68,13 @@ ExceptionState& exception_state) { return ToInt8(isolate, value, kNormalConversion, exception_state); } + + static int8_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -63,6 +85,13 @@ ExceptionState& exception_state) { return ToUInt8(isolate, value, kNormalConversion, exception_state); } + + static uint8_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -73,6 +102,13 @@ ExceptionState& exception_state) { return ToInt16(isolate, value, kNormalConversion, exception_state); } + + static int16_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -83,6 +119,13 @@ ExceptionState& exception_state) { return ToUInt16(isolate, value, kNormalConversion, exception_state); } + + static uint16_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -93,6 +136,13 @@ ExceptionState& exception_state) { return ToInt32(isolate, value, kNormalConversion, exception_state); } + + static int32_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -103,6 +153,13 @@ ExceptionState& exception_state) { return ToUInt32(isolate, value, kNormalConversion, exception_state); } + + static uint32_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -113,6 +170,13 @@ ExceptionState& exception_state) { return ToInt64(isolate, value, kNormalConversion, exception_state); } + + static int64_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -123,6 +187,13 @@ ExceptionState& exception_state) { return ToUInt64(isolate, value, kNormalConversion, exception_state); } + + static uint64_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; // [Clamp] Integers @@ -134,6 +205,13 @@ ExceptionState& exception_state) { return ToInt8(isolate, value, kClamp, exception_state); } + + static int8_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -144,6 +222,13 @@ ExceptionState& exception_state) { return ToUInt8(isolate, value, kClamp, exception_state); } + + static uint8_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -154,6 +239,13 @@ ExceptionState& exception_state) { return ToInt16(isolate, value, kClamp, exception_state); } + + static int16_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -164,6 +256,13 @@ ExceptionState& exception_state) { return ToUInt16(isolate, value, kClamp, exception_state); } + + static uint16_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -174,6 +273,13 @@ ExceptionState& exception_state) { return ToInt32(isolate, value, kClamp, exception_state); } + + static int32_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -184,6 +290,13 @@ ExceptionState& exception_state) { return ToUInt32(isolate, value, kClamp, exception_state); } + + static uint32_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -194,6 +307,13 @@ ExceptionState& exception_state) { return ToInt64(isolate, value, kClamp, exception_state); } + + static int64_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -204,6 +324,13 @@ ExceptionState& exception_state) { return ToUInt64(isolate, value, kClamp, exception_state); } + + static uint64_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; // [EnforceRange] Integers @@ -215,6 +342,13 @@ ExceptionState& exception_state) { return ToInt8(isolate, value, kEnforceRange, exception_state); } + + static int8_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -225,6 +359,13 @@ ExceptionState& exception_state) { return ToUInt8(isolate, value, kEnforceRange, exception_state); } + + static uint8_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -235,6 +376,13 @@ ExceptionState& exception_state) { return ToInt16(isolate, value, kEnforceRange, exception_state); } + + static int16_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -245,6 +393,13 @@ ExceptionState& exception_state) { return ToUInt16(isolate, value, kEnforceRange, exception_state); } + + static uint16_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -255,6 +410,13 @@ ExceptionState& exception_state) { return ToInt32(isolate, value, kEnforceRange, exception_state); } + + static int32_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -265,6 +427,13 @@ ExceptionState& exception_state) { return ToUInt32(isolate, value, kEnforceRange, exception_state); } + + static uint32_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -275,6 +444,13 @@ ExceptionState& exception_state) { return ToInt64(isolate, value, kEnforceRange, exception_state); } + + static int64_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -285,6 +461,13 @@ ExceptionState& exception_state) { return ToUInt64(isolate, value, kEnforceRange, exception_state); } + + static uint64_t ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; // Strings @@ -401,7 +584,7 @@ } // namespace bindings -template <bindings::NativeValueTraitsStringConv mode> +template <bindings::IDLStringConvMode mode> struct NativeValueTraits<IDLByteStringBaseV2<mode>> : public NativeValueTraitsBase<IDLByteStringBaseV2<mode>> { // http://heycam.github.io/webidl/#es-ByteString @@ -416,7 +599,7 @@ value.As<v8::Int32>()->Value()); } - if (mode == bindings::NativeValueTraitsStringConv::kNullable) { + if (mode == bindings::IDLStringConvMode::kNullable) { if (value->IsNullOrUndefined()) return bindings::NativeValueTraitsStringAdapter(); } @@ -434,9 +617,21 @@ } return bindings::NativeValueTraitsStringAdapter(v8_string); } + + static bindings::NativeValueTraitsStringAdapter ArgumentValue( + v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } + + static bindings::NativeValueTraitsStringAdapter NullValue() { + return bindings::NativeValueTraitsStringAdapter(); + } }; -template <bindings::NativeValueTraitsStringConv mode> +template <bindings::IDLStringConvMode mode> struct NativeValueTraits<IDLStringBaseV2<mode>> : public NativeValueTraitsBase<IDLStringBaseV2<mode>> { // https://heycam.github.io/webidl/#es-DOMString @@ -451,12 +646,11 @@ value.As<v8::Int32>()->Value()); } - if (mode == bindings::NativeValueTraitsStringConv::kNullable) { + if (mode == bindings::IDLStringConvMode::kNullable) { if (value->IsNullOrUndefined()) return bindings::NativeValueTraitsStringAdapter(); } - if (mode == - bindings::NativeValueTraitsStringConv::kTreatNullAsEmptyString) { + if (mode == bindings::IDLStringConvMode::kTreatNullAsEmptyString) { if (value->IsNull()) return bindings::NativeValueTraitsStringAdapter(g_empty_string); } @@ -469,9 +663,21 @@ } return bindings::NativeValueTraitsStringAdapter(v8_string); } + + static bindings::NativeValueTraitsStringAdapter ArgumentValue( + v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } + + static bindings::NativeValueTraitsStringAdapter NullValue() { + return bindings::NativeValueTraitsStringAdapter(); + } }; -template <bindings::NativeValueTraitsStringConv mode> +template <bindings::IDLStringConvMode mode> struct NativeValueTraits<IDLUSVStringBaseV2<mode>> : public NativeValueTraitsBase<IDLUSVStringBaseV2<mode>> { // http://heycam.github.io/webidl/#es-USVString @@ -485,6 +691,15 @@ return ReplaceUnmatchedSurrogates(string); } + + static String ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } + + static String NullValue() { return String(); } }; // Floats and doubles @@ -496,6 +711,13 @@ ExceptionState& exception_state) { return ToRestrictedDouble(isolate, value, exception_state); } + + static double ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -506,6 +728,13 @@ ExceptionState& exception_state) { return ToDouble(isolate, value, exception_state); } + + static double ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -516,6 +745,13 @@ ExceptionState& exception_state) { return ToRestrictedFloat(isolate, value, exception_state); } + + static float ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; template <> @@ -526,6 +762,13 @@ ExceptionState& exception_state) { return ToFloat(isolate, value, exception_state); } + + static float ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; // Buffer source types @@ -643,6 +886,13 @@ return result; } + static ImplType ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } + private: // Fast case: we're interating over an Array that adheres to // %ArrayIteratorPrototype%'s protocol. @@ -830,13 +1080,20 @@ // "5. Return result." return result; } + + static ImplType ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; // Callback functions template <typename T> struct NativeValueTraits< T, - std::enable_if_t<std::is_base_of<CallbackFunctionBase, T>::value>> + typename std::enable_if_t<std::is_base_of<CallbackFunctionBase, T>::value>> : public NativeValueTraitsBase<T> { static T* NativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, @@ -850,6 +1107,13 @@ << "is not yet implemented."; return nullptr; } + + static T* ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; // Dictionary @@ -864,6 +1128,13 @@ ExceptionState& exception_state) { return T::Create(isolate, value, exception_state); } + + static T* ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } }; // Interface @@ -880,6 +1151,16 @@ ->template ToImpl<T>(); } + static T* ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return bindings::NativeValueTraitsInterfaceArgumentValue( + isolate, T::GetStaticWrapperTypeInfo(), argument_index, value, + exception_state) + ->template ToImpl<T>(); + } + static constexpr T* NullValue() { return nullptr; } }; @@ -897,6 +1178,39 @@ return NativeValueTraits<InnerType>::NativeValue(isolate, v8_value, exception_state); } + + static typename IDLNullable<InnerType>::ResultType ArgumentValue( + v8::Isolate* isolate, + int argument_index, + v8::Local<v8::Value> value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } +}; + +// EventHandler +template <> +struct NativeValueTraits<IDLEventHandler> + : public NativeValueTraitsBase<IDLEventHandler> { + static EventListener* NativeValue(v8::Isolate* isolate, + v8::Local<v8::Value> value, + ExceptionState& exception_state); +}; + +template <> +struct NativeValueTraits<IDLOnBeforeUnloadEventHandler> + : public NativeValueTraitsBase<IDLOnBeforeUnloadEventHandler> { + static EventListener* NativeValue(v8::Isolate* isolate, + v8::Local<v8::Value> value, + ExceptionState& exception_state); +}; + +template <> +struct NativeValueTraits<IDLOnErrorEventHandler> + : public NativeValueTraitsBase<IDLOnErrorEventHandler> { + static EventListener* NativeValue(v8::Isolate* isolate, + v8::Local<v8::Value> value, + ExceptionState& exception_state); }; } // namespace blink
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_set_return_value_for_core.h b/third_party/blink/renderer/bindings/core/v8/v8_set_return_value_for_core.h new file mode 100644 index 0000000..c67d7eb --- /dev/null +++ b/third_party/blink/renderer/bindings/core/v8/v8_set_return_value_for_core.h
@@ -0,0 +1,28 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_SET_RETURN_VALUE_FOR_CORE_H_ +#define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_SET_RETURN_VALUE_FOR_CORE_H_ + +#include "third_party/blink/renderer/bindings/core/v8/js_event_handler.h" +#include "third_party/blink/renderer/platform/bindings/v8_set_return_value.h" + +namespace blink { + +namespace bindings { + +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, + EventListener* value, + v8::Isolate* isolate, + EventTarget* event_target) { + info.GetReturnValue().Set( + JSEventHandler::AsV8Value(isolate, event_target, value)); +} + +} // namespace bindings + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_SET_RETURN_VALUE_FOR_CORE_H_
diff --git a/third_party/blink/renderer/bindings/modules/BUILD.gn b/third_party/blink/renderer/bindings/modules/BUILD.gn index 98d206a53c..4d47a97 100644 --- a/third_party/blink/renderer/bindings/modules/BUILD.gn +++ b/third_party/blink/renderer/bindings/modules/BUILD.gn
@@ -86,9 +86,7 @@ make_event_factory("event_modules") { visibility = [ ":*" ] in_files = [ "$blink_modules_output_dir/event_interface_modules_names.json5" ] - outputs = [ - "$blink_modules_output_dir/event_modules_factory.cc", - ] + outputs = [ "$blink_modules_output_dir/event_modules_factory.cc" ] deps = make_core_generated_deps + [ "//third_party/blink/renderer/bindings/modules:modules_bindings_generated_event_interfaces" ] } @@ -126,9 +124,7 @@ sources = modules_idl_files sources_generated = [ "$bindings_core_output_dir/global_objects_core.pickle" ] output_file = "$bindings_modules_output_dir/global_objects_modules.pickle" - deps = [ - "//third_party/blink/renderer/bindings/core:core_global_objects", - ] + deps = [ "//third_party/blink/renderer/bindings/core:core_global_objects" ] } generate_global_constructors("modules_global_constructors_idls") { @@ -139,9 +135,7 @@ basenames = modules_global_constructors_original_interface_basenames component = "modules" output_dir = blink_modules_output_dir - deps = [ - ":modules_global_objects", - ] + deps = [ ":modules_global_objects" ] } # Compile the sources produced above. This will get linked into "modules".
diff --git a/third_party/blink/renderer/bindings/modules/v8/BUILD.gn b/third_party/blink/renderer/bindings/modules/v8/BUILD.gn index 6326b7a..6a4d757 100644 --- a/third_party/blink/renderer/bindings/modules/v8/BUILD.gn +++ b/third_party/blink/renderer/bindings/modules/v8/BUILD.gn
@@ -73,12 +73,8 @@ action("bindings_modules_v8_generated_init_partial") { script = "$bindings_scripts_dir/generate_init_partial_interfaces.py" - inputs = [ - "$bindings_output_dir/interfaces_info.pickle", - ] - outputs = [ - bindings_modules_generated_init_partial_interfaces_file, - ] + inputs = [ "$bindings_output_dir/interfaces_info.pickle" ] + outputs = [ bindings_modules_generated_init_partial_interfaces_file ] # Put the IDL file list in a response file to avoid command-line limits. response_file_contents = @@ -92,9 +88,7 @@ root_build_dir), ] - deps = [ - "//third_party/blink/renderer/bindings:interfaces_info", - ] + deps = [ "//third_party/blink/renderer/bindings:interfaces_info" ] } # Note that this intentionally depends on the generator target of the mojom @@ -149,9 +143,7 @@ output = bindings_generated_v8_context_snapshot_external_references_file inputs = idl_files + [ script ] - outputs = [ - output, - ] + outputs = [ output ] response_file_contents = rebase_path(idl_files, root_build_dir) args = [
diff --git a/third_party/blink/renderer/bindings/scripts/BUILD.gn b/third_party/blink/renderer/bindings/scripts/BUILD.gn index 8868829..a6cc714 100644 --- a/third_party/blink/renderer/bindings/scripts/BUILD.gn +++ b/third_party/blink/renderer/bindings/scripts/BUILD.gn
@@ -37,9 +37,7 @@ # Dummy file to track dependency. stamp_file = "$bindings_scripts_output_dir/cached_jinja_templates.stamp" - outputs = [ - stamp_file, - ] + outputs = [ stamp_file ] args = [ rebase_path(bindings_scripts_output_dir, root_build_dir),
diff --git a/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py b/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py index 839981fc..d15ccba 100644 --- a/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py +++ b/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py
@@ -173,13 +173,20 @@ """Returns the tag type of NativeValueTraits.""" assert isinstance(idl_type, web_idl.IdlType) - real_type = idl_type.unwrap(typedef=True) + if idl_type.is_typedef: + if idl_type.identifier in ("EventHandler", + "OnBeforeUnloadEventHandler", + "OnErrorEventHandler"): + return "IDL{}".format(idl_type.identifier) - if (real_type.is_boolean or real_type.is_numeric or real_type.is_any - or real_type.is_object): + real_type = idl_type.unwrap(typedef=True) + non_null_real_type = real_type.unwrap(nullable=True) + + if (real_type.is_boolean or real_type.is_numeric + or non_null_real_type.is_any or non_null_real_type.is_object): return "IDL{}".format(real_type.type_name) - if real_type.unwrap(nullable=True).is_string: + if non_null_real_type.is_string: return "IDL{}V2".format(real_type.type_name) if real_type.is_symbol: @@ -188,10 +195,10 @@ if real_type.is_void: assert False, "Blink does not support/accept IDL void type." - if real_type.type_definition_object is not None: - return blink_type_info(real_type).value_t + if non_null_real_type.type_definition_object: + return blink_class_name(non_null_real_type.type_definition_object) - if real_type.is_sequence: + if real_type.is_sequence or real_type.is_frozen_array: return "IDLSequence<{}>".format( native_value_tag(real_type.element_type)) @@ -209,7 +216,7 @@ if real_type.is_nullable: return "IDLNullable<{}>".format(native_value_tag(real_type.inner_type)) - assert False + assert False, "Unknown type: {}".format(idl_type.syntactic_form) def make_default_value_expr(idl_type, default_value): @@ -307,6 +314,7 @@ def make_v8_to_blink_value(blink_var_name, v8_value_expr, idl_type, + argument_index=None, default_value=None): """ Returns a SymbolNode whose definition converts a v8::Value to a Blink value. @@ -314,6 +322,7 @@ assert isinstance(blink_var_name, str) assert isinstance(v8_value_expr, str) assert isinstance(idl_type, web_idl.IdlType) + assert (argument_index is None or isinstance(argument_index, (int, long))) assert (default_value is None or isinstance(default_value, web_idl.LiteralConstant)) @@ -321,10 +330,22 @@ F = lambda *args, **kwargs: T(_format(*args, **kwargs)) def create_definition(symbol_node): - blink_value_expr = _format( - "NativeValueTraits<{_1}>::NativeValue({_2})", - _1=native_value_tag(idl_type), - _2=", ".join(["${isolate}", v8_value_expr, "${exception_state}"])) + if argument_index is None: + blink_value_expr = _format( + "NativeValueTraits<{_1}>::NativeValue({_2})", + _1=native_value_tag(idl_type), + _2=", ".join( + ["${isolate}", v8_value_expr, "${exception_state}"])) + else: + blink_value_expr = _format( + "NativeValueTraits<{_1}>::ArgumentValue({_2})", + _1=native_value_tag(idl_type), + _2=", ".join([ + "${isolate}", + str(argument_index), + v8_value_expr, + "${exception_state}", + ])) if default_value is None: return SymbolDefinitionNode(symbol_node, [
diff --git a/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py b/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py index 4123e4869..010a36e 100644 --- a/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py +++ b/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py
@@ -118,6 +118,21 @@ return name_style.constant(kind, property_name) +def custom_function_name(cg_context, overload_index=None): + assert isinstance(cg_context, CodeGenContext) + + if cg_context.attribute_get: + suffix = "AttributeGetterCustom" + elif cg_context.attribute_set: + suffix = "AttributeSetterCustom" + elif cg_context.operation_group: + suffix = "MethodCustom" + else: + assert False + + return name_style.func(cg_context.property_.identifier, suffix) + + # ---------------------------------------------------------------------------- # Callback functions # ---------------------------------------------------------------------------- @@ -147,8 +162,12 @@ else: v8_value = "${{info}}[{}]".format(argument.index) code_node.register_code_symbol( - make_v8_to_blink_value(name, v8_value, argument.idl_type, - argument.default_value)) + make_v8_to_blink_value( + name, + v8_value, + argument.idl_type, + argument_index=index, + default_value=argument.default_value)) def bind_callback_local_vars(code_node, cg_context): @@ -353,6 +372,9 @@ return "keywords::{}".format(name_style.constant(keyword)) branches = CxxMultiBranchesNode() + branches.accumulate( + CodeGenAccumulator.require_include_headers( + ["third_party/blink/renderer/core/keywords.h"])) nodes = [ T("// [ReflectOnly]"), T("const AtomicString reflect_value(${return_value}.LowerASCII());"), @@ -572,7 +594,7 @@ CxxLikelyIfNode( cond=("ConstructorMode::Current(${isolate}) == " "ConstructorMode::kWrapExistingObject"), - body=T("V8SetReturnValue(${info}, ${v8_receiver});\n" + body=T("bindings::V8SetReturnValue(${info}, ${v8_receiver});\n" "return;")), ]) @@ -628,7 +650,7 @@ "BindingSecurity::ErrorReportOption::kDoNotReport)") body = [ T(use_counter), - T("V8SetReturnValueNull(${info});\n" + T("bindings::V8SetReturnValue(${info}, nullptr);\n" "return;"), ] return SequenceNode([ @@ -1038,7 +1060,7 @@ v8::Local<v8::Value> v8_value; if (v8_private_cached_attribute.GetOrUndefined(${v8_receiver}) .ToLocal(&v8_value) && !v8_value->IsUndefined()) { - V8SetReturnValue(${info}, v8_value); + bindings::V8SetReturnValue(${info}, v8_value); return; } }""") @@ -1053,7 +1075,7 @@ v8::Local<v8::Value> v8_value; if (v8_private_save_same_object.GetOrUndefined(${v8_receiver}) .ToLocal(&v8_value) && !v8_value->IsUndefined()) { - V8SetReturnValue(${info}, v8_value); + bindings::V8SetReturnValue(${info}, v8_value); return; } }""") @@ -1147,7 +1169,7 @@ T("// [PutForwards]"), T("v8::Local<v8::Value> target;"), T("if (!${v8_receiver}->Get(${current_context}, " - "V8AtomicString(${isolate}, property_name))" + "V8AtomicString(${isolate}, ${property_name}))" ".ToLocal(&target)) {\n" " return;\n" "}"), @@ -1160,7 +1182,7 @@ ]), T("bool did_set;"), T("if (!target.As<v8::Object>()->Set(${current_context}, " - "V8AtomicString(" + "V8AtomicString(${isolate}, " "\"${attribute.extended_attributes.value_of(\"PutForwards\")}\"" "), ${info}[0]).To(&did_set)) {{\n" " return;\n" @@ -1177,7 +1199,7 @@ T("// [Replaceable]"), T("bool did_create;"), T("if (!${v8_receiver}->CreateDataProperty(${current_context}, " - "V8AtomicString(${isolate}, property_name), " + "V8AtomicString(${isolate}, ${property_name}), " "${info}[0]).To(&did_create)) {\n" " return;\n" "}"), @@ -1194,33 +1216,50 @@ # any text. return T("<% return_value.request_symbol_definition() %>") - return_type = cg_context.return_type.unwrap(typedef=True) + return_type = cg_context.return_type + if return_type.is_typedef: + if return_type.identifier in ("EventHandler", + "OnBeforeUnloadEventHandler", + "OnErrorEventHandler"): + return T("bindings::V8SetReturnValue(${info}, ${return_value}, " + "${isolate}, ${blink_receiver});") + + return_type = return_type.unwrap(typedef=True) return_type_body = return_type.unwrap() - if (cg_context.for_world == cg_context.MAIN_WORLD - and return_type_body.is_interface): - return T("V8SetReturnValueForMainWorld(${info}, ${return_value});") - - if return_type_body.is_interface: - return T("V8SetReturnValue(${info}, ${return_value}, " - "${creation_context_object});") + V8_RETURN_VALUE_FAST_TYPES = ("boolean", "byte", "octet", "short", + "unsigned short", "long", "unsigned long") + if return_type.keyword_typename in V8_RETURN_VALUE_FAST_TYPES: + return T("bindings::V8SetReturnValue(${info}, ${return_value});") if return_type_body.is_string: + args = ["${info}", "${return_value}", "${isolate}"] if return_type.is_nullable: - return T("V8SetReturnValueStringOrNull" - "(${info}, ${return_value}, ${isolate});") + args.append("bindings::V8ReturnValue::kNullable") else: - return T("V8SetReturnValueString" - "(${info}, ${return_value}, ${isolate});") + args.append("bindings::V8ReturnValue::kNonNullable") + return T("bindings::V8SetReturnValue({});".format(", ".join(args))) + + if return_type_body.is_interface: + args = ["${info}", "${return_value}"] + if cg_context.for_world == cg_context.MAIN_WORLD: + args.append("bindings::V8ReturnValue::kMainWorld") + elif cg_context.constructor or cg_context.member_like.is_static: + args.append("${creation_context}") + else: + args.append("${blink_receiver}") + return T("bindings::V8SetReturnValue({});".format(", ".join(args))) if return_type.is_frozen_array: - return T("V8SetReturnValue(${info}, FreezeV8Object(ToV8(" - "${return_value}, ${v8_receiver}, ${isolate}), ${isolate}));") + return T("bindings::V8SetReturnValue(${info}, FreezeV8Object(ToV8(" + "${return_value}, ${creation_context_object}, ${isolate})));") if return_type.is_promise: - return T("V8SetReturnValue(${info}, ${return_value}.V8Value());") + return T("bindings::V8SetReturnValue" + "(${info}, ${return_value}.V8Value());") - return T("V8SetReturnValue(${info}, ${return_value});") + return T("bindings::V8SetReturnValue(${info}, " + "ToV8(${return_value}, ${creation_context_object}, ${isolate}));") def _make_empty_callback_def(cg_context, function_name, arg_decls=None): @@ -1258,6 +1297,16 @@ make_report_measure_as(cg_context), make_log_activity(cg_context), EmptyNode(), + ]) + + if "Getter" in cg_context.property_.extended_attributes.values_of( + "Custom"): + text = _format("${class_name}::{}(${info});", + custom_function_name(cg_context)) + body.append(TextNode(text)) + return func_def + + body.extend([ make_check_receiver(cg_context), make_return_value_cache_return_early(cg_context), EmptyNode(), @@ -1292,6 +1341,16 @@ make_report_measure_as(cg_context), make_log_activity(cg_context), EmptyNode(), + ]) + + if "Setter" in cg_context.property_.extended_attributes.values_of( + "Custom"): + text = _format("${class_name}::{}(${info}[0], ${info});", + custom_function_name(cg_context)) + body.append(TextNode(text)) + return func_def + + body.extend([ make_check_receiver(cg_context), make_check_argument_length(cg_context), EmptyNode(), @@ -1336,7 +1395,7 @@ body = func_def.body v8_set_return_value = _format( - "V8SetReturnValue(${info}, ${class_name}::{});", + "bindings::V8SetReturnValue(${info}, ${class_name}::{});", constant_name(cg_context)) body.extend([ make_runtime_call_timer_scope(cg_context), @@ -1410,7 +1469,7 @@ T("v8::Local<v8::Object> v8_wrapper = " "${return_value}->AssociateWithWrapper(${isolate}, " "${class_name}::GetWrapperTypeInfo(), ${v8_receiver});")) - body.append(T("V8SetReturnValue(${info}, v8_wrapper);")) + body.append(T("bindings::V8SetReturnValue(${info}, v8_wrapper);")) return func_def @@ -1453,7 +1512,8 @@ body = func_def.body v8_set_return_value = _format( - "V8SetReturnValueInterfaceObject(${info}, {}::GetWrapperTypeInfo());", + "bindings::V8SetReturnValue" + "(${info}, {}::GetWrapperTypeInfo(), InterfaceObject);", v8_bridge_class_name(cg_context.exposed_construct)) body.extend([ make_runtime_call_timer_scope(cg_context), @@ -1480,6 +1540,15 @@ make_report_measure_as(cg_context), make_log_activity(cg_context), EmptyNode(), + ]) + + if "Custom" in cg_context.property_.extended_attributes: + text = _format("${class_name}::{}(${info});", + custom_function_name(cg_context)) + body.append(TextNode(text)) + return func_def + + body.extend([ make_check_receiver(cg_context), EmptyNode(), make_steps_of_ce_reactions(cg_context), @@ -1497,6 +1566,9 @@ operation_group = cg_context.operation_group + assert (not ("Custom" in operation_group.extended_attributes) + or len(operation_group) == 1) + if len(operation_group) == 1: return make_operation_function_def( cg_context.make_copy(operation=operation_group[0]), function_name) @@ -2709,6 +2781,42 @@ constant_defs.append( make_constant_constant_def(cgc, constant_name(cgc))) + # Custom callback implementations + custom_callback_impl_decls = ListNode() + for attribute in interface.attributes: + custom_values = attribute.extended_attributes.values_of("Custom") + if "Getter" in custom_values: + func_name = custom_function_name( + cg_context.make_copy(attribute=attribute, attribute_get=True)) + custom_callback_impl_decls.append( + CxxFuncDeclNode( + name=func_name, + arg_decls=["const v8::FunctionCallbackInfo<v8::Value>&"], + return_type="void", + static=True)) + if "Setter" in custom_values: + func_name = custom_function_name( + cg_context.make_copy(attribute=attribute, attribute_set=True)) + custom_callback_impl_decls.append( + CxxFuncDeclNode( + name=func_name, + arg_decls=[ + "v8::Local<v8::Value>", + "const v8::FunctionCallbackInfo<v8::Value>&" + ], + return_type="void", + static=True)) + for operation_group in interface.operation_groups: + if "Custom" in operation_group.extended_attributes: + func_name = custom_function_name( + cg_context.make_copy(operation_group=operation_group)) + custom_callback_impl_decls.append( + CxxFuncDeclNode( + name=func_name, + arg_decls=["const v8::FunctionCallbackInfo<v8::Value>&"], + return_type="void", + static=True)) + # Cross-component trampolines if is_cross_components: # tp_ = trampoline name @@ -2901,6 +3009,8 @@ "third_party/blink/renderer/bindings/core/v8/" "native_value_traits_impl.h", "third_party/blink/renderer/bindings/core/v8/v8_dom_configuration.h", + "third_party/blink/renderer/bindings/core/v8/" + "v8_set_return_value_for_core.h", "third_party/blink/renderer/platform/bindings/exception_messages.h", "third_party/blink/renderer/platform/bindings/runtime_call_stats.h", "third_party/blink/renderer/platform/bindings/v8_binding.h", @@ -2935,8 +3045,18 @@ api_class_def.public_section.append(installer_function_decls) if constant_defs: - api_class_def.public_section.append(EmptyNode()) - api_class_def.public_section.append(constant_defs) + api_class_def.public_section.extend([ + EmptyNode(), + TextNode("// Constants"), + constant_defs, + ]) + + if custom_callback_impl_decls: + api_class_def.public_section.extend([ + EmptyNode(), + TextNode("// Custom callback implementations"), + custom_callback_impl_decls, + ]) impl_source_blink_ns.body.extend([ CxxNamespaceNode(name="", body=callback_defs), @@ -2957,5 +3077,5 @@ def generate_interfaces(web_idl_database): - interface = web_idl_database.find("Navigator") + interface = web_idl_database.find("Element") generate_interface(interface)
diff --git a/third_party/blink/renderer/bindings/scripts/scripts.gni b/third_party/blink/renderer/bindings/scripts/scripts.gni index 00a0b2a5..b8c7ba1 100644 --- a/third_party/blink/renderer/bindings/scripts/scripts.gni +++ b/third_party/blink/renderer/bindings/scripts/scripts.gni
@@ -125,9 +125,7 @@ output_file = "$root_gen_dir/third_party/blink/renderer/" + invoker.output_file - outputs = [ - output_file, - ] + outputs = [ output_file ] script = "//third_party/blink/renderer/bindings/scripts/generate_event_interfaces.py" args = [ @@ -342,9 +340,7 @@ idl_files_list, ] + invoker.sources_generated + invoker.sources - outputs = [ - invoker.output_file, - ] + outputs = [ invoker.output_file ] args = [ "--idl-files-list",
diff --git a/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py b/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py index d5ba21f2..8c07899d 100644 --- a/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py +++ b/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py
@@ -223,14 +223,21 @@ def _determine_blink_headers(self): irs = self._ir_map.irs_of_kinds( - IRMap.IR.Kind.INTERFACE, IRMap.IR.Kind.NAMESPACE, - IRMap.IR.Kind.PARTIAL_INTERFACE, IRMap.IR.Kind.PARTIAL_NAMESPACE) + IRMap.IR.Kind.INTERFACE, IRMap.IR.Kind.INTERFACE_MIXIN, + IRMap.IR.Kind.NAMESPACE, IRMap.IR.Kind.PARTIAL_INTERFACE, + IRMap.IR.Kind.PARTIAL_INTERFACE_MIXIN, + IRMap.IR.Kind.PARTIAL_NAMESPACE) self._ir_map.move_to_new_phase() for old_ir in irs: new_ir = make_copy(old_ir) self._ir_map.add(new_ir) + + if (new_ir.is_mixin and "LegacyTreatAsPartialInterface" not in + new_ir.extended_attributes): + continue + basepath, _ = posixpath.splitext( new_ir.debug_info.location.filepath) dirpath, filename = posixpath.split(basepath) @@ -378,7 +385,7 @@ ] def _propagate_extattrs_to_overload_group(self): - ANY_OF = ("CrossOrigin", "LenientThis", "NotEnumerable", + ANY_OF = ("CrossOrigin", "Custom", "LenientThis", "NotEnumerable", "PerWorldBindings", "SecureContext", "Unforgeable", "Unscopable")
diff --git a/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py b/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py index 275d356..4af3c116 100644 --- a/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py +++ b/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py
@@ -60,6 +60,7 @@ WithDebugInfo.__init__(self, debug_info) self.is_partial = is_partial + self.is_mixin = False self.attributes = list(attributes) self.constants = list(constants) self.constructors = []
diff --git a/third_party/blink/renderer/core/animation/compositor_animations.cc b/third_party/blink/renderer/core/animation/compositor_animations.cc index 8dcec187..7f61825 100644 --- a/third_party/blink/renderer/core/animation/compositor_animations.cc +++ b/third_party/blink/renderer/core/animation/compositor_animations.cc
@@ -559,8 +559,10 @@ out.scaled_duration = timing.iteration_duration.value(); out.direction = timing.direction; // Compositor's time offset is positive for seeking into the animation. - out.scaled_time_offset = - -timing.start_delay / animation_playback_rate + time_offset.InSecondsF(); + DCHECK(animation_playback_rate); + out.scaled_time_offset = -base::TimeDelta::FromSecondsD( + timing.start_delay / animation_playback_rate) + + time_offset; out.playback_rate = animation_playback_rate; out.fill_mode = timing.fill_mode == Timing::FillMode::AUTO ? Timing::FillMode::NONE @@ -568,7 +570,7 @@ out.iteration_start = timing.iteration_start; DCHECK_GT(out.scaled_duration, AnimationTimeDelta()); - DCHECK(std::isfinite(out.scaled_time_offset)); + DCHECK(!out.scaled_time_offset.is_max() && !out.scaled_time_offset.is_min()); DCHECK(out.adjusted_iteration_count > 0 || out.adjusted_iteration_count == -1); DCHECK(std::isfinite(out.playback_rate) && out.playback_rate);
diff --git a/third_party/blink/renderer/core/animation/compositor_animations.h b/third_party/blink/renderer/core/animation/compositor_animations.h index 4596931..85aa7a2 100644 --- a/third_party/blink/renderer/core/animation/compositor_animations.h +++ b/third_party/blink/renderer/core/animation/compositor_animations.h
@@ -133,7 +133,7 @@ struct CompositorTiming { Timing::PlaybackDirection direction; AnimationTimeDelta scaled_duration; - double scaled_time_offset; + base::TimeDelta scaled_time_offset; double adjusted_iteration_count; double playback_rate; Timing::FillMode fill_mode;
diff --git a/third_party/blink/renderer/core/animation/compositor_animations_test.cc b/third_party/blink/renderer/core/animation/compositor_animations_test.cc index d2140b3..9f28c2d 100644 --- a/third_party/blink/renderer/core/animation/compositor_animations_test.cc +++ b/third_party/blink/renderer/core/animation/compositor_animations_test.cc
@@ -700,11 +700,11 @@ timing_.start_delay = 2.0; EXPECT_TRUE(ConvertTimingForCompositor(timing_, compositor_timing_)); - EXPECT_DOUBLE_EQ(-2.0, compositor_timing_.scaled_time_offset); + EXPECT_DOUBLE_EQ(-2.0, compositor_timing_.scaled_time_offset.InSecondsF()); timing_.start_delay = -2.0; EXPECT_TRUE(ConvertTimingForCompositor(timing_, compositor_timing_)); - EXPECT_DOUBLE_EQ(2.0, compositor_timing_.scaled_time_offset); + EXPECT_DOUBLE_EQ(2.0, compositor_timing_.scaled_time_offset.InSecondsF()); } TEST_P(AnimationCompositorAnimationsTest, @@ -731,7 +731,7 @@ timing_.iteration_duration = AnimationTimeDelta::FromSecondsD(5); timing_.start_delay = -6.0; EXPECT_TRUE(ConvertTimingForCompositor(timing_, compositor_timing_)); - EXPECT_DOUBLE_EQ(6.0, compositor_timing_.scaled_time_offset); + EXPECT_DOUBLE_EQ(6.0, compositor_timing_.scaled_time_offset.InSecondsF()); EXPECT_EQ(-1, compositor_timing_.adjusted_iteration_count); } @@ -742,12 +742,12 @@ timing_.start_delay = 6.0; EXPECT_TRUE(ConvertTimingForCompositor(timing_, compositor_timing_)); - EXPECT_DOUBLE_EQ(-6.0, compositor_timing_.scaled_time_offset); + EXPECT_DOUBLE_EQ(-6.0, compositor_timing_.scaled_time_offset.InSecondsF()); EXPECT_DOUBLE_EQ(4.0, compositor_timing_.adjusted_iteration_count); timing_.start_delay = -6.0; EXPECT_TRUE(ConvertTimingForCompositor(timing_, compositor_timing_)); - EXPECT_DOUBLE_EQ(6.0, compositor_timing_.scaled_time_offset); + EXPECT_DOUBLE_EQ(6.0, compositor_timing_.scaled_time_offset.InSecondsF()); EXPECT_DOUBLE_EQ(4.0, compositor_timing_.adjusted_iteration_count); timing_.start_delay = 21.0; @@ -781,7 +781,7 @@ timing_.iteration_duration = AnimationTimeDelta::FromSecondsD(5); timing_.start_delay = -6.0; EXPECT_TRUE(ConvertTimingForCompositor(timing_, compositor_timing_)); - EXPECT_DOUBLE_EQ(6.0, compositor_timing_.scaled_time_offset); + EXPECT_DOUBLE_EQ(6.0, compositor_timing_.scaled_time_offset.InSecondsF()); EXPECT_EQ(4, compositor_timing_.adjusted_iteration_count); EXPECT_EQ(compositor_timing_.direction, Timing::PlaybackDirection::ALTERNATE_NORMAL); @@ -791,7 +791,7 @@ timing_.iteration_duration = AnimationTimeDelta::FromSecondsD(5); timing_.start_delay = -11.0; EXPECT_TRUE(ConvertTimingForCompositor(timing_, compositor_timing_)); - EXPECT_DOUBLE_EQ(11.0, compositor_timing_.scaled_time_offset); + EXPECT_DOUBLE_EQ(11.0, compositor_timing_.scaled_time_offset.InSecondsF()); EXPECT_EQ(4, compositor_timing_.adjusted_iteration_count); EXPECT_EQ(compositor_timing_.direction, Timing::PlaybackDirection::ALTERNATE_NORMAL); @@ -801,7 +801,7 @@ timing_.iteration_duration = AnimationTimeDelta::FromSecondsD(5); timing_.start_delay = -6.0; EXPECT_TRUE(ConvertTimingForCompositor(timing_, compositor_timing_)); - EXPECT_DOUBLE_EQ(6.0, compositor_timing_.scaled_time_offset); + EXPECT_DOUBLE_EQ(6.0, compositor_timing_.scaled_time_offset.InSecondsF()); EXPECT_EQ(4, compositor_timing_.adjusted_iteration_count); EXPECT_EQ(compositor_timing_.direction, Timing::PlaybackDirection::ALTERNATE_REVERSE); @@ -811,7 +811,7 @@ timing_.iteration_duration = AnimationTimeDelta::FromSecondsD(5); timing_.start_delay = -11.0; EXPECT_TRUE(ConvertTimingForCompositor(timing_, compositor_timing_)); - EXPECT_DOUBLE_EQ(11.0, compositor_timing_.scaled_time_offset); + EXPECT_DOUBLE_EQ(11.0, compositor_timing_.scaled_time_offset.InSecondsF()); EXPECT_EQ(4, compositor_timing_.adjusted_iteration_count); EXPECT_EQ(compositor_timing_.direction, Timing::PlaybackDirection::ALTERNATE_REVERSE);
diff --git a/third_party/blink/renderer/core/css/BUILD.gn b/third_party/blink/renderer/core/css/BUILD.gn index bda1f9c..15b443a8 100644 --- a/third_party/blink/renderer/core/css/BUILD.gn +++ b/third_party/blink/renderer/core/css/BUILD.gn
@@ -605,6 +605,7 @@ "css_style_declaration_test.cc", "css_style_sheet_test.cc", "css_syntax_string_parser_test.cc", + "cssom/computed_style_property_map_test.cc", "cssom/cross_thread_style_value_test.cc", "cssom/css_math_invert_test.cc", "cssom/css_math_negate_test.cc",
diff --git a/third_party/blink/renderer/core/css/cssom/computed_style_property_map.cc b/third_party/blink/renderer/core/css/cssom/computed_style_property_map.cc index 6787613..04c53dd 100644 --- a/third_party/blink/renderer/core/css/cssom/computed_style_property_map.cc +++ b/third_party/blink/renderer/core/css/cssom/computed_style_property_map.cc
@@ -116,15 +116,16 @@ auto* result = MakeGarbageCollected<CSSFunctionValue>(CSSValueID::kPerspective); result->Append(*CSSNumericLiteralValue::Create( - perspective.Perspective(), CSSPrimitiveValue::UnitType::kPixels)); + perspective.Perspective() / zoom, + CSSPrimitiveValue::UnitType::kPixels)); return result; } case TransformOperation::kMatrix: { const auto& matrix = ToMatrixTransformOperation(operation).Matrix(); auto* result = MakeGarbageCollected<CSSFunctionValue>(CSSValueID::kMatrix); - double values[6] = {matrix.A(), matrix.B(), matrix.C(), - matrix.D(), matrix.E(), matrix.F()}; + double values[6] = {matrix.A(), matrix.B(), matrix.C(), + matrix.D(), matrix.E() / zoom, matrix.F() / zoom}; for (double value : values) { result->Append(*CSSNumericLiteralValue::Create( value, CSSPrimitiveValue::UnitType::kNumber)); @@ -136,10 +137,12 @@ CSSFunctionValue* result = MakeGarbageCollected<CSSFunctionValue>(CSSValueID::kMatrix3d); double values[16] = { - matrix.M11(), matrix.M12(), matrix.M13(), matrix.M14(), - matrix.M21(), matrix.M22(), matrix.M23(), matrix.M24(), - matrix.M31(), matrix.M32(), matrix.M33(), matrix.M34(), - matrix.M41(), matrix.M42(), matrix.M43(), matrix.M44()}; + matrix.M11(), matrix.M12(), matrix.M13(), + matrix.M14(), matrix.M21(), matrix.M22(), + matrix.M23(), matrix.M24(), matrix.M31(), + matrix.M32(), matrix.M33(), matrix.M34(), + matrix.M41() / zoom, matrix.M42() / zoom, matrix.M43() / zoom, + matrix.M44()}; for (double value : values) { result->Append(*CSSNumericLiteralValue::Create( value, CSSPrimitiveValue::UnitType::kNumber));
diff --git a/third_party/blink/renderer/core/css/cssom/computed_style_property_map_test.cc b/third_party/blink/renderer/core/css/cssom/computed_style_property_map_test.cc new file mode 100644 index 0000000..655fcc56 --- /dev/null +++ b/third_party/blink/renderer/core/css/cssom/computed_style_property_map_test.cc
@@ -0,0 +1,54 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/cssom/computed_style_property_map.h" + +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/core/html/html_element.h" +#include "third_party/blink/renderer/core/testing/page_test_base.h" + +namespace blink { + +class ComputedStylePropertyMapTest : public PageTestBase { + public: + ComputedStylePropertyMapTest() = default; + + protected: + ComputedStylePropertyMap* SetBodyStyle(const AtomicString& style) { + GetDocument().body()->setAttribute(html_names::kStyleAttr, style); + UpdateAllLifecyclePhasesForTest(); + return MakeGarbageCollected<ComputedStylePropertyMap>(GetDocument().body()); + } +}; + +TEST_F(ComputedStylePropertyMapTest, TransformMatrixZoom) { + ComputedStylePropertyMap* map = + SetBodyStyle("transform:matrix(1, 0, 0, 1, 100, 100);zoom:2"); + CSSStyleValue* style_value = + map->get(&GetDocument(), "transform", ASSERT_NO_EXCEPTION); + ASSERT_TRUE(style_value); + EXPECT_EQ("matrix(1, 0, 0, 1, 100, 100)", style_value->toString()); +} + +TEST_F(ComputedStylePropertyMapTest, TransformMatrix3DZoom) { + ComputedStylePropertyMap* map = SetBodyStyle( + "transform:matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 100, 100, 100, " + "1);zoom:2"); + CSSStyleValue* style_value = + map->get(&GetDocument(), "transform", ASSERT_NO_EXCEPTION); + ASSERT_TRUE(style_value); + EXPECT_EQ("matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 100, 100, 100, 1)", + style_value->toString()); +} + +TEST_F(ComputedStylePropertyMapTest, TransformPerspectiveZoom) { + ComputedStylePropertyMap* map = + SetBodyStyle("transform:perspective(100px);zoom:2"); + CSSStyleValue* style_value = + map->get(&GetDocument(), "transform", ASSERT_NO_EXCEPTION); + ASSERT_TRUE(style_value); + EXPECT_EQ("perspective(100px)", style_value->toString()); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/core/fetch/BUILD.gn b/third_party/blink/renderer/core/fetch/BUILD.gn index c1716b27..928f0fa 100644 --- a/third_party/blink/renderer/core/fetch/BUILD.gn +++ b/third_party/blink/renderer/core/fetch/BUILD.gn
@@ -50,7 +50,5 @@ jumbo_excluded_sources = [ "body.cc" ] } - public_deps = [ - "//third_party/blink/renderer/platform", - ] + public_deps = [ "//third_party/blink/renderer/platform" ] }
diff --git a/third_party/blink/renderer/core/fetch/form_data_bytes_consumer.cc b/third_party/blink/renderer/core/fetch/form_data_bytes_consumer.cc index c1db312..367a6e0 100644 --- a/third_party/blink/renderer/core/fetch/form_data_bytes_consumer.cc +++ b/third_party/blink/renderer/core/fetch/form_data_bytes_consumer.cc
@@ -497,12 +497,14 @@ UTF8Encoding().Encode(string, WTF::kNoUnencodables)))) {} FormDataBytesConsumer::FormDataBytesConsumer(DOMArrayBuffer* buffer) - : FormDataBytesConsumer(buffer->Data(), - buffer->DeprecatedByteLengthAsUnsigned()) {} + : FormDataBytesConsumer( + buffer->Data(), + base::checked_cast<wtf_size_t>(buffer->ByteLengthAsSizeT())) {} FormDataBytesConsumer::FormDataBytesConsumer(DOMArrayBufferView* view) - : FormDataBytesConsumer(view->BaseAddress(), - view->deprecatedByteLengthAsUnsigned()) {} + : FormDataBytesConsumer( + view->BaseAddress(), + base::checked_cast<wtf_size_t>(view->byteLengthAsSizeT())) {} FormDataBytesConsumer::FormDataBytesConsumer(const void* data, wtf_size_t size) : impl_(MakeGarbageCollected<SimpleFormDataBytesConsumer>(
diff --git a/third_party/blink/renderer/core/fetch/request.cc b/third_party/blink/renderer/core/fetch/request.cc index c5d4eef5..869d45868 100644 --- a/third_party/blink/renderer/core/fetch/request.cc +++ b/third_party/blink/renderer/core/fetch/request.cc
@@ -114,6 +114,12 @@ // Avoid calling into V8 from the following constructor parameters, which // is potentially unsafe. DOMArrayBuffer* array_buffer = V8ArrayBuffer::ToImpl(body.As<v8::Object>()); + if (!base::CheckedNumeric<wtf_size_t>(array_buffer->ByteLengthAsSizeT()) + .IsValid()) { + exception_state.ThrowRangeError( + "The provided ArrayBuffer exceeds the maximum supported size"); + return nullptr; + } return_buffer = BodyStreamBuffer::Create( script_state, MakeGarbageCollected<FormDataBytesConsumer>(array_buffer), nullptr /* AbortSignal */); @@ -122,6 +128,13 @@ // is potentially unsafe. DOMArrayBufferView* array_buffer_view = V8ArrayBufferView::ToImpl(body.As<v8::Object>()); + if (!base::CheckedNumeric<wtf_size_t>( + array_buffer_view->byteLengthAsSizeT()) + .IsValid()) { + exception_state.ThrowRangeError( + "The provided ArrayBufferView exceeds the maximum supported size"); + return nullptr; + } return_buffer = BodyStreamBuffer::Create( script_state, MakeGarbageCollected<FormDataBytesConsumer>(array_buffer_view),
diff --git a/third_party/blink/renderer/core/fetch/response.cc b/third_party/blink/renderer/core/fetch/response.cc index 70a3b28..9085298 100644 --- a/third_party/blink/renderer/core/fetch/response.cc +++ b/third_party/blink/renderer/core/fetch/response.cc
@@ -158,18 +158,32 @@ // Avoid calling into V8 from the following constructor parameters, which // is potentially unsafe. DOMArrayBuffer* array_buffer = V8ArrayBuffer::ToImpl(body.As<v8::Object>()); - body_buffer = BodyStreamBuffer::Create( - script_state, MakeGarbageCollected<FormDataBytesConsumer>(array_buffer), - nullptr /* AbortSignal */); + if (!base::CheckedNumeric<wtf_size_t>(array_buffer->ByteLengthAsSizeT()) + .IsValid()) { + exception_state.ThrowRangeError( + "The provided ArrayBuffer exceeds the maximum supported size"); + } else { + body_buffer = BodyStreamBuffer::Create( + script_state, + MakeGarbageCollected<FormDataBytesConsumer>(array_buffer), + nullptr /* AbortSignal */); + } } else if (body->IsArrayBufferView()) { // Avoid calling into V8 from the following constructor parameters, which // is potentially unsafe. DOMArrayBufferView* array_buffer_view = V8ArrayBufferView::ToImpl(body.As<v8::Object>()); - body_buffer = BodyStreamBuffer::Create( - script_state, - MakeGarbageCollected<FormDataBytesConsumer>(array_buffer_view), - nullptr /* AbortSignal */); + if (!base::CheckedNumeric<wtf_size_t>( + array_buffer_view->byteLengthAsSizeT()) + .IsValid()) { + exception_state.ThrowRangeError( + "The provided ArrayBufferView exceeds the maximum supported size"); + } else { + body_buffer = BodyStreamBuffer::Create( + script_state, + MakeGarbageCollected<FormDataBytesConsumer>(array_buffer_view), + nullptr /* AbortSignal */); + } } else if (V8FormData::HasInstance(body, isolate)) { scoped_refptr<EncodedFormData> form_data = V8FormData::ToImpl(body.As<v8::Object>())->EncodeMultiPartFormData();
diff --git a/third_party/blink/renderer/core/html/forms/search_input_type.cc b/third_party/blink/renderer/core/html/forms/search_input_type.cc index 5b964f1..74fff77 100644 --- a/third_party/blink/renderer/core/html/forms/search_input_type.cc +++ b/third_party/blink/renderer/core/html/forms/search_input_type.cc
@@ -31,6 +31,9 @@ #include "third_party/blink/renderer/core/html/forms/search_input_type.h" #include "third_party/blink/public/platform/task_type.h" +#include "third_party/blink/renderer/core/css/css_property_names.h" +#include "third_party/blink/renderer/core/css_value_keywords.h" +#include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/shadow_root.h" #include "third_party/blink/renderer/core/events/keyboard_event.h" #include "third_party/blink/renderer/core/frame/web_feature.h" @@ -39,7 +42,6 @@ #include "third_party/blink/renderer/core/html/shadow/shadow_element_names.h" #include "third_party/blink/renderer/core/html_names.h" #include "third_party/blink/renderer/core/input_type_names.h" -#include "third_party/blink/renderer/core/layout/layout_search_field.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/heap/heap.h" @@ -56,11 +58,6 @@ CountUsageIfVisible(WebFeature::kInputTypeSearch); } -LayoutObject* SearchInputType::CreateLayoutObject(const ComputedStyle&, - LegacyLayout) const { - return new LayoutSearchField(&GetElement()); -} - const AtomicString& SearchInputType::FormControlType() const { return input_type_names::kSearch; }
diff --git a/third_party/blink/renderer/core/html/forms/search_input_type.h b/third_party/blink/renderer/core/html/forms/search_input_type.h index 34a6f6b..dd1ff43 100644 --- a/third_party/blink/renderer/core/html/forms/search_input_type.h +++ b/third_party/blink/renderer/core/html/forms/search_input_type.h
@@ -42,8 +42,6 @@ private: void CountUsage() override; - LayoutObject* CreateLayoutObject(const ComputedStyle&, - LegacyLayout) const override; const AtomicString& FormControlType() const override; bool NeedsContainer() const override; void CreateShadowSubtree() override;
diff --git a/third_party/blink/renderer/core/inspector/inspector_css_agent.cc b/third_party/blink/renderer/core/inspector/inspector_css_agent.cc index a27174e..406a8d8 100644 --- a/third_party/blink/renderer/core/inspector/inspector_css_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_css_agent.cc
@@ -2411,19 +2411,23 @@ std::unique_ptr<protocol::Array<protocol::CSS::RuleUsage>>* result) { for (Document* document : dom_agent_->Documents()) document->UpdateStyleAndLayoutTree(); - Response response = takeCoverageDelta(result); + double timestamp; + Response response = takeCoverageDelta(result, ×tamp); SetCoverageEnabled(false); return response; } Response InspectorCSSAgent::takeCoverageDelta( - std::unique_ptr<protocol::Array<protocol::CSS::RuleUsage>>* result) { + std::unique_ptr<protocol::Array<protocol::CSS::RuleUsage>>* result, + double* out_timestamp) { if (!tracker_) return Response::Error("CSS rule usage tracking is not enabled"); StyleRuleUsageTracker::RuleListByStyleSheet coverage_delta = tracker_->TakeDelta(); + *out_timestamp = base::TimeTicks::Now().since_origin().InSecondsF(); + *result = std::make_unique<protocol::Array<protocol::CSS::RuleUsage>>(); for (const auto& entry : coverage_delta) {
diff --git a/third_party/blink/renderer/core/inspector/inspector_css_agent.h b/third_party/blink/renderer/core/inspector/inspector_css_agent.h index 481c6b3..e0b4c146 100644 --- a/third_party/blink/renderer/core/inspector/inspector_css_agent.h +++ b/third_party/blink/renderer/core/inspector/inspector_css_agent.h
@@ -202,8 +202,8 @@ protocol::Response startRuleUsageTracking() override; protocol::Response takeCoverageDelta( - std::unique_ptr<protocol::Array<protocol::CSS::RuleUsage>>* result) - override; + std::unique_ptr<protocol::Array<protocol::CSS::RuleUsage>>* result, + double* out_timestamp) override; protocol::Response stopRuleUsageTracking( std::unique_ptr<protocol::Array<protocol::CSS::RuleUsage>>* result) override;
diff --git a/third_party/blink/renderer/core/layout/BUILD.gn b/third_party/blink/renderer/core/layout/BUILD.gn index 65d73eb..b01e7be4 100644 --- a/third_party/blink/renderer/core/layout/BUILD.gn +++ b/third_party/blink/renderer/core/layout/BUILD.gn
@@ -176,8 +176,6 @@ "layout_ruby_run.h", "layout_ruby_text.cc", "layout_ruby_text.h", - "layout_search_field.cc", - "layout_search_field.h", "layout_shift_region.cc", "layout_shift_region.h", "layout_shift_tracker.cc",
diff --git a/third_party/blink/renderer/core/layout/layout_flexible_box_test.cc b/third_party/blink/renderer/core/layout/layout_flexible_box_test.cc index 781b9c7e..98c95e0 100644 --- a/third_party/blink/renderer/core/layout/layout_flexible_box_test.cc +++ b/third_party/blink/renderer/core/layout/layout_flexible_box_test.cc
@@ -500,7 +500,7 @@ auto* child1_box = ToLayoutBox(child1_element->GetLayoutObject()); ASSERT_TRUE(child1_box->HasSelfPaintingLayer()); - EXPECT_TRUE(child1_box->Layer()->NeedsVisualOverflowRecalcForTesting()); + EXPECT_TRUE(child1_box->Layer()->NeedsVisualOverflowRecalc()); UpdateAllLifecyclePhasesForTest();
diff --git a/third_party/blink/renderer/core/layout/layout_object.cc b/third_party/blink/renderer/core/layout/layout_object.cc index a958137b..862f6e88 100644 --- a/third_party/blink/renderer/core/layout/layout_object.cc +++ b/third_party/blink/renderer/core/layout/layout_object.cc
@@ -1958,7 +1958,9 @@ SetStyle(std::move(pseudo_style)); } -void LayoutObject::MarkContainerChainForOverflowRecalcIfNeeded() { +void LayoutObject::MarkContainerChainForOverflowRecalcIfNeeded( + bool mark_container_chain_layout_overflow_recalc, + bool mark_container_chain_visual_overflow_recalc) { LayoutObject* object = this; do { // Cell and row need to propagate the flag to their containing section and @@ -1968,25 +1970,42 @@ ? object->Parent() : object->Container(); if (object) { - object->SetChildNeedsLayoutOverflowRecalc(); - object->MarkSelfPaintingLayerForVisualOverflowRecalc(); + if (mark_container_chain_layout_overflow_recalc) + object->SetChildNeedsLayoutOverflowRecalc(); + if (mark_container_chain_visual_overflow_recalc) + object->MarkSelfPaintingLayerForVisualOverflowRecalc(); } } while (object); } -void LayoutObject::SetNeedsVisualOverflowAndPaintInvalidation() { +void LayoutObject::SetNeedsOverflowRecalc( + OverflowRecalcType overflow_recalc_type) { + bool mark_container_chain_layout_overflow_recalc = false; + bool mark_container_chain_visual_overflow_recalc = false; + + if (overflow_recalc_type == + OverflowRecalcType::kLayoutAndVisualOverflowRecalc) { + mark_container_chain_layout_overflow_recalc = + !SelfNeedsLayoutOverflowRecalc(); + SetSelfNeedsLayoutOverflowRecalc(); + } + + DCHECK(overflow_recalc_type == + OverflowRecalcType::kOnlyVisualOverflowRecalc || + overflow_recalc_type == + OverflowRecalcType::kLayoutAndVisualOverflowRecalc); SetShouldCheckForPaintInvalidation(); + mark_container_chain_visual_overflow_recalc = + !SelfPaintingLayerNeedsVisualOverflowRecalc(); MarkSelfPaintingLayerForVisualOverflowRecalc(); -} -void LayoutObject::SetNeedsOverflowRecalc() { - bool needed_recalc = SelfNeedsLayoutOverflowRecalc(); - SetSelfNeedsLayoutOverflowRecalc(); - SetNeedsVisualOverflowAndPaintInvalidation(); - - if (!needed_recalc) - MarkContainerChainForOverflowRecalcIfNeeded(); + if (mark_container_chain_layout_overflow_recalc || + mark_container_chain_visual_overflow_recalc) { + MarkContainerChainForOverflowRecalcIfNeeded( + mark_container_chain_layout_overflow_recalc, + mark_container_chain_visual_overflow_recalc); + } } DISABLE_CFI_PERF @@ -4071,6 +4090,15 @@ ->FlipForWritingMode(position, width); } +bool LayoutObject::SelfPaintingLayerNeedsVisualOverflowRecalc() const { + if (HasLayer()) { + auto* box_model_object = ToLayoutBoxModelObject(this); + if (box_model_object->HasSelfPaintingLayer()) + return box_model_object->Layer()->NeedsVisualOverflowRecalc(); + } + return false; +} + void LayoutObject::MarkSelfPaintingLayerForVisualOverflowRecalc() { if (HasLayer()) { auto* box_model_object = ToLayoutBoxModelObject(this);
diff --git a/third_party/blink/renderer/core/layout/layout_object.h b/third_party/blink/renderer/core/layout/layout_object.h index 37b7d2d1..3f97e7e 100644 --- a/third_party/blink/renderer/core/layout/layout_object.h +++ b/third_party/blink/renderer/core/layout/layout_object.h
@@ -2189,8 +2189,12 @@ // Returns the bounding box of the visual rects of all fragments. IntRect FragmentsVisualRectBoundingBox() const; - void SetNeedsOverflowRecalc(); - void SetNeedsVisualOverflowAndPaintInvalidation(); + enum OverflowRecalcType { + kOnlyVisualOverflowRecalc, + kLayoutAndVisualOverflowRecalc, + }; + void SetNeedsOverflowRecalc( + OverflowRecalcType = OverflowRecalcType::kLayoutAndVisualOverflowRecalc); void InvalidateClipPathCache(); @@ -2724,7 +2728,10 @@ // scroll anchoring on. void SetScrollAnchorDisablingStyleChangedOnAncestor(); - inline void MarkContainerChainForOverflowRecalcIfNeeded(); + bool SelfPaintingLayerNeedsVisualOverflowRecalc() const; + inline void MarkContainerChainForOverflowRecalcIfNeeded( + bool mark_container_chain_layout_overflow_recalc, + bool mark_container_chain_visual_overflow_recalc); inline void SetNeedsPaintOffsetAndVisualRectUpdate();
diff --git a/third_party/blink/renderer/core/layout/layout_object_test.cc b/third_party/blink/renderer/core/layout/layout_object_test.cc index bc06001..87b11ab 100644 --- a/third_party/blink/renderer/core/layout/layout_object_test.cc +++ b/third_party/blink/renderer/core/layout/layout_object_test.cc
@@ -1064,8 +1064,7 @@ UpdateAllLifecyclePhasesForTest(); } -// TODO(rego): Test is failing until we can fix https://crbug.com/941180. -TEST_F(LayoutObjectTest, DISABLED_NeedsLayoutOverflowRecalc) { +TEST_F(LayoutObjectTest, NeedsLayoutOverflowRecalc) { if (!RuntimeEnabledFeatures::LayoutNGEnabled()) return;
diff --git a/third_party/blink/renderer/core/layout/layout_search_field.cc b/third_party/blink/renderer/core/layout/layout_search_field.cc deleted file mode 100644 index eccbbb1..0000000 --- a/third_party/blink/renderer/core/layout/layout_search_field.cc +++ /dev/null
@@ -1,63 +0,0 @@ -/** - * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. - * (C) 2008 Torch Mobile Inc. All rights reserved. - * (http://www.torchmobile.com/) - * Copyright (C) 2010 Google Inc. All rights reserved. - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include "third_party/blink/renderer/core/layout/layout_search_field.h" - -#include "third_party/blink/renderer/core/dom/shadow_root.h" -#include "third_party/blink/renderer/core/html/forms/html_input_element.h" -#include "third_party/blink/renderer/core/html/shadow/shadow_element_names.h" -#include "third_party/blink/renderer/core/input_type_names.h" - -namespace blink { - -LayoutSearchField::LayoutSearchField(HTMLInputElement* element) - : LayoutTextControlSingleLine(element) { - DCHECK_EQ(element->type(), input_type_names::kSearch); -} - -LayoutSearchField::~LayoutSearchField() = default; - -inline Element* LayoutSearchField::CancelButtonElement() const { - return InputElement()->UserAgentShadowRoot()->getElementById( - shadow_element_names::ClearButton()); -} - -LayoutUnit LayoutSearchField::ComputeControlLogicalHeight( - LayoutUnit line_height, - LayoutUnit non_content_height) const { - Element* cancel_button = CancelButtonElement(); - if (LayoutBox* cancel_layout_object = - cancel_button ? cancel_button->GetLayoutBox() : nullptr) { - cancel_layout_object->UpdateLogicalHeight(); - non_content_height = - max(non_content_height, - cancel_layout_object->BorderAndPaddingLogicalHeight() + - cancel_layout_object->MarginLogicalHeight()); - line_height = max(line_height, cancel_layout_object->LogicalHeight()); - } - - return line_height + non_content_height; -} - -} // namespace blink
diff --git a/third_party/blink/renderer/core/layout/layout_search_field.h b/third_party/blink/renderer/core/layout/layout_search_field.h deleted file mode 100644 index f647d54..0000000 --- a/third_party/blink/renderer/core/layout/layout_search_field.h +++ /dev/null
@@ -1,50 +0,0 @@ -/* - * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. - * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. - * (http://www.torchmobile.com/) - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_SEARCH_FIELD_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_SEARCH_FIELD_H_ - -#include "third_party/blink/renderer/core/layout/layout_text_control_single_line.h" - -namespace blink { - -class HTMLInputElement; - -class LayoutSearchField final : public LayoutTextControlSingleLine { - public: - LayoutSearchField(HTMLInputElement*); - ~LayoutSearchField() override; - - private: - LayoutUnit ComputeControlLogicalHeight( - LayoutUnit line_height, - LayoutUnit non_content_height) const override; - - Element* CancelButtonElement() const; -}; - -DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSearchField, IsTextField()); - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_SEARCH_FIELD_H_
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc index 54cbc22..4800c5b 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc
@@ -771,9 +771,8 @@ return; } if (current_item_) { - do { + while (current_item_ && !IsLineBox()) MoveToPreviousItem(); - } while (current_item_ && !IsLineBox()); return; } NOTREACHED();
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc index d5dfe19f..f8ef64b 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc
@@ -896,9 +896,8 @@ // |ComputeOverflow()| below calls |AddVisualOverflowFromChildren()|, which // computes visual overflow from |RootInlineBox| if |ChildrenInline()| - // TODO(rego): This causes that ChildNeedsLayoutOverflowRecalc flags are not - // cleared after layout (see https://crbug.com/941180). - block->SetNeedsOverflowRecalc(); + block->SetNeedsOverflowRecalc( + LayoutObject::OverflowRecalcType::kOnlyVisualOverflowRecalc); block->ComputeLayoutOverflow(intrinsic_block_size - borders.block_end - scrollbars.block_end); }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.cc index b85b4d6..061a86ae 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.cc
@@ -212,9 +212,8 @@ // We need a constraint space for the child to determine resolvability and the // space for flex-basis is sufficient, even though it has some unnecessary // stuff (ShrinkToFit and fixed cross sizes). - NGConstraintSpace child_space = - BuildConstraintSpaceForDeterminingFlexBasis(child); - return !BlockLengthUnresolvable(child_space, child.Style().LogicalHeight(), + return !BlockLengthUnresolvable(BuildSpaceForFlexBasis(child), + child.Style().LogicalHeight(), LengthResolvePhase::kLayout); } @@ -229,9 +228,8 @@ if (!MainAxisIsInlineAxis(child)) return true; // If we get here, cross axis is block axis. - return !BlockLengthUnresolvable( - BuildConstraintSpaceForDeterminingFlexBasis(child), length, - LengthResolvePhase::kLayout); + return !BlockLengthUnresolvable(BuildSpaceForFlexBasis(child), length, + LengthResolvePhase::kLayout); } bool NGFlexLayoutAlgorithm::DoesItemCrossSizeComputeToAuto( @@ -287,8 +285,7 @@ DoesItemStretch(child); } -NGConstraintSpace -NGFlexLayoutAlgorithm::BuildConstraintSpaceForDeterminingFlexBasis( +NGConstraintSpace NGFlexLayoutAlgorithm::BuildSpaceForIntrinsicBlockSize( const NGBlockNode& flex_item) const { const ComputedStyle& child_style = flex_item.Style(); NGConstraintSpaceBuilder space_builder(ConstraintSpace(), @@ -313,9 +310,33 @@ FlexLayoutAlgorithm::AlignmentForChild(Style(), child_style) == ItemPosition::kBaseline); + // For determining the intrinsic block-size we make %-block-sizes resolve + // against an indefinite size. + LogicalSize child_percentage_size = child_percentage_size_; + if (is_column_) + child_percentage_size.block_size = kIndefiniteSize; + + // TODO(dgrogan): The SetReplacedPercentageResolutionSize calls in this file + // may be untested. Write a test or determine why they're unnecessary. + space_builder.SetAvailableSize(content_box_size_); + space_builder.SetPercentageResolutionSize(child_percentage_size); + space_builder.SetReplacedPercentageResolutionSize(child_percentage_size); + space_builder.SetTextDirection(child_style.Direction()); + return space_builder.ToConstraintSpace(); +} + +NGConstraintSpace NGFlexLayoutAlgorithm::BuildSpaceForFlexBasis( + const NGBlockNode& flex_item) const { + NGConstraintSpaceBuilder space_builder(ConstraintSpace(), + flex_item.Style().GetWritingMode(), + /* is_new_fc */ true); + SetOrthogonalFallbackInlineSizeIfNeeded(Style(), flex_item, &space_builder); + + // This space is only used for resolving lengths, not for layout. We only + // need the available and percentage sizes. space_builder.SetAvailableSize(content_box_size_); space_builder.SetPercentageResolutionSize(child_percentage_size_); - space_builder.SetTextDirection(child_style.Direction()); + space_builder.SetReplacedPercentageResolutionSize(child_percentage_size_); return space_builder.ToConstraintSpace(); } @@ -329,15 +350,15 @@ } const ComputedStyle& child_style = child.Style(); - NGConstraintSpace child_space = - BuildConstraintSpaceForDeterminingFlexBasis(child); + NGConstraintSpace flex_basis_space = BuildSpaceForFlexBasis(child); + NGConstraintSpace child_space = BuildSpaceForIntrinsicBlockSize(child); NGBoxStrut border_padding_in_child_writing_mode = - ComputeBorders(child_space, child) + - ComputePadding(child_space, child_style); + ComputeBorders(flex_basis_space, child) + + ComputePadding(flex_basis_space, child_style); NGBoxStrut border_scrollbar_padding_in_child_writing_mode = border_padding_in_child_writing_mode + - ComputeScrollbars(child_space, child); + ComputeScrollbars(flex_basis_space, child); NGPhysicalBoxStrut physical_border_padding( border_padding_in_child_writing_mode.ConvertToPhysical( @@ -392,13 +413,13 @@ if (MainAxisIsInlineAxis(child)) { flex_base_border_box = ResolveMainInlineLength( - child_space, child_style, border_padding_in_child_writing_mode, + flex_basis_space, child_style, border_padding_in_child_writing_mode, intrinsic_sizes_border_box, length_to_resolve); } else { // Flex container's main axis is in child's block direction. Child's // flex basis is in child's block direction. flex_base_border_box = ResolveMainBlockLength( - child_space, child_style, border_padding_in_child_writing_mode, + flex_basis_space, child_style, border_padding_in_child_writing_mode, length_to_resolve, layout_result->IntrinsicBlockSize(), LengthResolvePhase::kLayout); } @@ -426,28 +447,28 @@ : child.Style().MinWidth(); if (MainAxisIsInlineAxis(child)) { min_max_sizes_in_main_axis_direction.max_size = ResolveMaxInlineLength( - child_space, child_style, border_padding_in_child_writing_mode, + flex_basis_space, child_style, border_padding_in_child_writing_mode, intrinsic_sizes_border_box, max_property_in_main_axis, LengthResolvePhase::kLayout); min_max_sizes_in_cross_axis_direction.max_size = ResolveMaxBlockLength( - child_space, child_style, border_padding_in_child_writing_mode, + flex_basis_space, child_style, border_padding_in_child_writing_mode, max_property_in_cross_axis, layout_result->IntrinsicBlockSize(), LengthResolvePhase::kLayout); min_max_sizes_in_cross_axis_direction.min_size = ResolveMinBlockLength( - child_space, child_style, border_padding_in_child_writing_mode, + flex_basis_space, child_style, border_padding_in_child_writing_mode, min_property_in_cross_axis, layout_result->IntrinsicBlockSize(), LengthResolvePhase::kLayout); } else { min_max_sizes_in_main_axis_direction.max_size = ResolveMaxBlockLength( - child_space, child_style, border_padding_in_child_writing_mode, + flex_basis_space, child_style, border_padding_in_child_writing_mode, max_property_in_main_axis, layout_result->IntrinsicBlockSize(), LengthResolvePhase::kLayout); min_max_sizes_in_cross_axis_direction.max_size = ResolveMaxInlineLength( - child_space, child_style, border_padding_in_child_writing_mode, + flex_basis_space, child_style, border_padding_in_child_writing_mode, intrinsic_sizes_border_box, max_property_in_cross_axis, LengthResolvePhase::kLayout); min_max_sizes_in_cross_axis_direction.min_size = ResolveMinInlineLength( - child_space, child_style, border_padding_in_child_writing_mode, + flex_basis_space, child_style, border_padding_in_child_writing_mode, intrinsic_sizes_border_box, min_property_in_cross_axis, LengthResolvePhase::kLayout); } @@ -489,14 +510,16 @@ // resolved specified_length_in_main_axis in the flex basis // calculation. Reuse that if possible. specified_size_suggestion = ResolveMainInlineLength( - child_space, child_style, border_padding_in_child_writing_mode, + flex_basis_space, child_style, + border_padding_in_child_writing_mode, intrinsic_sizes_border_box, specified_length_in_main_axis); } - } else if (!BlockLengthUnresolvable(child_space, + } else if (!BlockLengthUnresolvable(flex_basis_space, specified_length_in_main_axis, LengthResolvePhase::kLayout)) { specified_size_suggestion = ResolveMainBlockLength( - child_space, child_style, border_padding_in_child_writing_mode, + flex_basis_space, child_style, + border_padding_in_child_writing_mode, specified_length_in_main_axis, layout_result->IntrinsicBlockSize(), LengthResolvePhase::kLayout); DCHECK_NE(specified_size_suggestion, kIndefiniteSize); @@ -511,18 +534,19 @@ } } else if (MainAxisIsInlineAxis(child)) { min_max_sizes_in_main_axis_direction.min_size = ResolveMinInlineLength( - child_space, child_style, border_padding_in_child_writing_mode, + flex_basis_space, child_style, border_padding_in_child_writing_mode, intrinsic_sizes_border_box, min, LengthResolvePhase::kLayout); } else { min_max_sizes_in_main_axis_direction.min_size = ResolveMinBlockLength( - child_space, child_style, border_padding_in_child_writing_mode, min, - layout_result->IntrinsicBlockSize(), LengthResolvePhase::kLayout); + flex_basis_space, child_style, border_padding_in_child_writing_mode, + min, layout_result->IntrinsicBlockSize(), + LengthResolvePhase::kLayout); } // TODO(dgrogan): Should this include scrollbar? min_max_sizes_in_main_axis_direction -= main_axis_border_scrollbar_padding; NGPhysicalBoxStrut physical_child_margins = - ComputePhysicalMargins(child_space, child_style); + ComputePhysicalMargins(flex_basis_space, child_style); algorithm_ ->emplace_back(child.GetLayoutBox(), child.Style(), flex_base_content_size, @@ -658,6 +682,7 @@ space_builder.SetAvailableSize(available_size); space_builder.SetPercentageResolutionSize(child_percentage_size_); + space_builder.SetReplacedPercentageResolutionSize(child_percentage_size_); // https://drafts.csswg.org/css-flexbox/#algo-cross-item // Determine the hypothetical cross size of each item by performing layout @@ -731,6 +756,7 @@ space_builder.SetTextDirection(child_style.Direction()); space_builder.SetAvailableSize(available_size); space_builder.SetPercentageResolutionSize(child_percentage_size_); + space_builder.SetReplacedPercentageResolutionSize(child_percentage_size_); space_builder.SetIsFixedInlineSize(true); space_builder.SetIsFixedBlockSize(true); NGConstraintSpace child_space = space_builder.ToConstraintSpace();
diff --git a/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.h b/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.h index 167a9d160..8850a40 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.h +++ b/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.h
@@ -47,7 +47,8 @@ bool IsColumnContainerMainSizeDefinite() const; bool IsContainerCrossSizeDefinite() const; - NGConstraintSpace BuildConstraintSpaceForDeterminingFlexBasis( + NGConstraintSpace BuildSpaceForFlexBasis(const NGBlockNode& flex_item) const; + NGConstraintSpace BuildSpaceForIntrinsicBlockSize( const NGBlockNode& flex_item) const; void ConstructAndAppendFlexItems(); void ApplyStretchAlignmentToChild(FlexItem& flex_item);
diff --git a/third_party/blink/renderer/core/paint/paint_layer.h b/third_party/blink/renderer/core/paint/paint_layer.h index 723a241..8bcc936e 100644 --- a/third_party/blink/renderer/core/paint/paint_layer.h +++ b/third_party/blink/renderer/core/paint/paint_layer.h
@@ -793,6 +793,9 @@ bool is_under_position_sticky = false; }; + bool NeedsVisualOverflowRecalc() const { + return needs_visual_overflow_recalc_; + } void SetNeedsVisualOverflowRecalc(); void SetNeedsCompositingInputsUpdate(bool mark_ancestor_flags = true); @@ -1123,10 +1126,6 @@ void DirtyStackingContextZOrderLists(); - bool NeedsVisualOverflowRecalcForTesting() const { - return needs_visual_overflow_recalc_; - } - PhysicalOffset OffsetForInFlowRelPosition() const { return rare_data_ ? rare_data_->offset_for_in_flow_rel_position : PhysicalOffset();
diff --git a/third_party/blink/renderer/modules/cache_storage/BUILD.gn b/third_party/blink/renderer/modules/cache_storage/BUILD.gn index af99e71..894123a 100644 --- a/third_party/blink/renderer/modules/cache_storage/BUILD.gn +++ b/third_party/blink/renderer/modules/cache_storage/BUILD.gn
@@ -24,7 +24,5 @@ "inspector_cache_storage_agent.h", ] - public_deps = [ - "//third_party/blink/renderer/platform", - ] + public_deps = [ "//third_party/blink/renderer/platform" ] }
diff --git a/third_party/blink/renderer/modules/cookie_store/BUILD.gn b/third_party/blink/renderer/modules/cookie_store/BUILD.gn index ae95192..412a1c4 100644 --- a/third_party/blink/renderer/modules/cookie_store/BUILD.gn +++ b/third_party/blink/renderer/modules/cookie_store/BUILD.gn
@@ -20,7 +20,5 @@ "service_worker_registration_cookies.h", ] - deps = [ - "//third_party/blink/renderer/platform", - ] + deps = [ "//third_party/blink/renderer/platform" ] }
diff --git a/third_party/blink/renderer/modules/device_orientation/device_motion_controller.cc b/third_party/blink/renderer/modules/device_orientation/device_motion_controller.cc index 5bbdf2e..2c0f8d0 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_motion_controller.cc +++ b/third_party/blink/renderer/modules/device_orientation/device_motion_controller.cc
@@ -110,7 +110,7 @@ } bool DeviceMotionController::IsNullEvent(Event* event) const { - DeviceMotionEvent* motion_event = ToDeviceMotionEvent(event); + auto* motion_event = To<DeviceMotionEvent>(event); return !motion_event->GetDeviceMotionData()->CanProvideEventData(); }
diff --git a/third_party/blink/renderer/modules/device_orientation/device_motion_event.h b/third_party/blink/renderer/modules/device_orientation/device_motion_event.h index 9ef6ccd..5e5ae00 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_motion_event.h +++ b/third_party/blink/renderer/modules/device_orientation/device_motion_event.h
@@ -28,6 +28,7 @@ #include "third_party/blink/renderer/modules/event_modules.h" #include "third_party/blink/renderer/platform/heap/handle.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" namespace blink { @@ -75,13 +76,12 @@ Member<const DeviceMotionData> device_motion_data_; }; -DEFINE_TYPE_CASTS(DeviceMotionEvent, - Event, - event, - event->InterfaceName() == - event_interface_names::kDeviceMotionEvent, - event.InterfaceName() == - event_interface_names::kDeviceMotionEvent); +template <> +struct DowncastTraits<DeviceMotionEvent> { + static bool AllowFrom(const Event& event) { + return event.InterfaceName() == event_interface_names::kDeviceMotionEvent; + } +}; } // namespace blink
diff --git a/third_party/blink/renderer/modules/device_orientation/device_orientation_controller.cc b/third_party/blink/renderer/modules/device_orientation/device_orientation_controller.cc index 876aacbf..883ae80 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_orientation_controller.cc +++ b/third_party/blink/renderer/modules/device_orientation/device_orientation_controller.cc
@@ -115,7 +115,7 @@ } bool DeviceOrientationController::IsNullEvent(Event* event) const { - DeviceOrientationEvent* orientation_event = ToDeviceOrientationEvent(event); + auto* orientation_event = To<DeviceOrientationEvent>(event); return !orientation_event->Orientation()->CanProvideEventData(); }
diff --git a/third_party/blink/renderer/modules/device_orientation/device_orientation_event.h b/third_party/blink/renderer/modules/device_orientation/device_orientation_event.h index 43a95fd..8a6cf44 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_orientation_event.h +++ b/third_party/blink/renderer/modules/device_orientation/device_orientation_event.h
@@ -28,6 +28,7 @@ #include "third_party/blink/renderer/modules/event_modules.h" #include "third_party/blink/renderer/platform/heap/handle.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" namespace blink { @@ -75,13 +76,13 @@ Member<DeviceOrientationData> orientation_; }; -DEFINE_TYPE_CASTS(DeviceOrientationEvent, - Event, - event, - event->InterfaceName() == - event_interface_names::kDeviceOrientationEvent, - event.InterfaceName() == - event_interface_names::kDeviceOrientationEvent); +template <> +struct DowncastTraits<DeviceOrientationEvent> { + static bool AllowFrom(const Event& event) { + return event.InterfaceName() == + event_interface_names::kDeviceOrientationEvent; + } +}; } // namespace blink
diff --git a/third_party/blink/renderer/modules/filesystem/directory_entry_sync.cc b/third_party/blink/renderer/modules/filesystem/directory_entry_sync.cc index 2165fd8..63ca135 100644 --- a/third_party/blink/renderer/modules/filesystem/directory_entry_sync.cc +++ b/third_party/blink/renderer/modules/filesystem/directory_entry_sync.cc
@@ -83,7 +83,7 @@ std::move(error_callback_wrapper), DOMFileSystemBase::kSynchronous); Entry* entry = sync_helper->GetResultOrThrow(exception_state); - return entry ? ToDirectoryEntrySync(EntrySync::Create(entry)) : nullptr; + return entry ? To<DirectoryEntrySync>(EntrySync::Create(entry)) : nullptr; } void DirectoryEntrySync::removeRecursively(ExceptionState& exception_state) {
diff --git a/third_party/blink/renderer/modules/filesystem/directory_entry_sync.h b/third_party/blink/renderer/modules/filesystem/directory_entry_sync.h index 7443936..4672f31 100644 --- a/third_party/blink/renderer/modules/filesystem/directory_entry_sync.h +++ b/third_party/blink/renderer/modules/filesystem/directory_entry_sync.h
@@ -32,6 +32,7 @@ #define THIRD_PARTY_BLINK_RENDERER_MODULES_FILESYSTEM_DIRECTORY_ENTRY_SYNC_H_ #include "third_party/blink/renderer/modules/filesystem/entry_sync.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink { @@ -61,11 +62,10 @@ void Trace(blink::Visitor*) override; }; -DEFINE_TYPE_CASTS(DirectoryEntrySync, - EntrySync, - entry, - entry->isDirectory(), - entry.isDirectory()); +template <> +struct DowncastTraits<DirectoryEntrySync> { + static bool AllowFrom(const EntrySync& entry) { return entry.isDirectory(); } +}; } // namespace blink
diff --git a/third_party/blink/renderer/modules/media_controls/media_controls_orientation_lock_delegate.cc b/third_party/blink/renderer/modules/media_controls/media_controls_orientation_lock_delegate.cc index f951212..e409d1e 100644 --- a/third_party/blink/renderer/modules/media_controls/media_controls_orientation_lock_delegate.cc +++ b/third_party/blink/renderer/modules/media_controls/media_controls_orientation_lock_delegate.cc
@@ -267,7 +267,7 @@ event->InterfaceName() == event_interface_names::kDeviceOrientationEvent) { MaybeLockToAnyIfDeviceOrientationMatchesVideo( - ToDeviceOrientationEvent(event)); + To<DeviceOrientationEvent>(event)); } return;
diff --git a/third_party/blink/renderer/modules/media_controls/media_controls_rotate_to_fullscreen_delegate.cc b/third_party/blink/renderer/modules/media_controls/media_controls_rotate_to_fullscreen_delegate.cc index 96eef5b..cca8a35 100644 --- a/third_party/blink/renderer/modules/media_controls/media_controls_rotate_to_fullscreen_delegate.cc +++ b/third_party/blink/renderer/modules/media_controls/media_controls_rotate_to_fullscreen_delegate.cc
@@ -111,7 +111,7 @@ if (event->isTrusted() && event->InterfaceName() == event_interface_names::kDeviceOrientationEvent) { - OnDeviceOrientationAvailable(ToDeviceOrientationEvent(event)); + OnDeviceOrientationAvailable(To<DeviceOrientationEvent>(event)); } return; }
diff --git a/third_party/blink/renderer/modules/mediarecorder/media_recorder.cc b/third_party/blink/renderer/modules/mediarecorder/media_recorder.cc index 5155c01..1996adb 100644 --- a/third_party/blink/renderer/modules/mediarecorder/media_recorder.cc +++ b/third_party/blink/renderer/modules/mediarecorder/media_recorder.cc
@@ -404,6 +404,12 @@ // never started. return; } + if (!recorder_handler_) { + // This may happen when ContextDestroyed has executed, but the + // MediaRecorderHandler still exists and all tracks + // have ended leading to a call to OnAllTracksEnded. + return; + } state_ = State::kInactive; recorder_handler_->Stop();
diff --git a/third_party/blink/renderer/modules/nfc/ndef_reader.cc b/third_party/blink/renderer/modules/nfc/ndef_reader.cc index 5275f9c..3c9c200 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_reader.cc +++ b/third_party/blink/renderer/modules/nfc/ndef_reader.cc
@@ -146,6 +146,8 @@ } UseCounter::Count(GetExecutionContext(), WebFeature::kWebNfcNdefReaderScan); + // TODO(https://crbug.com/994936) remove when origin trial is complete. + UseCounter::Count(GetExecutionContext(), WebFeature::kWebNfcAPI); GetNfcProxy()->StartReading( this, options,
diff --git a/third_party/blink/renderer/modules/nfc/ndef_writer.cc b/third_party/blink/renderer/modules/nfc/ndef_writer.cc index ca17b2fa..81c987d 100644 --- a/third_party/blink/renderer/modules/nfc/ndef_writer.cc +++ b/third_party/blink/renderer/modules/nfc/ndef_writer.cc
@@ -131,6 +131,8 @@ } UseCounter::Count(GetExecutionContext(), WebFeature::kWebNfcNdefWriterPush); + // TODO(https://crbug.com/994936) remove when origin trial is complete. + UseCounter::Count(GetExecutionContext(), WebFeature::kWebNfcAPI); auto callback = WTF::Bind(&NDEFWriter::OnRequestCompleted, WrapPersistent(this), WrapPersistent(resolver));
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc index 4e28b16..fc71a2c 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc
@@ -802,32 +802,6 @@ // Promptly clears a raw reference from content/ to an on-heap object // so that content/ doesn't access it in a lazy sweeping phase. peer_handler_.reset(); - - // UMA for CallSetupStates. This metric is reported regardless of whether or - // not getUserMedia() has been called in this document. - UMA_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.CallSetupState.OffererState", - call_setup_state_tracker_.offerer_state()); - UMA_HISTOGRAM_ENUMERATION( - "WebRTC.PeerConnection.CallSetupState.AnswererState", - call_setup_state_tracker_.answerer_state()); - UMA_HISTOGRAM_ENUMERATION( - "WebRTC.PeerConnection.CallSetupState.CallSetupState", - call_setup_state_tracker_.GetCallSetupState()); - // UMA for CallSetupStates only for documents that have performed - // getUserMedia(). This heuristic hints that the peer connection is likely - // used in a media/conferencing context, which is a use case that may be - // particularly sensitive to the Plan B vs Unified Plan switch. - if (call_setup_state_tracker_.document_uses_media()) { - UMA_HISTOGRAM_ENUMERATION( - "WebRTC.PeerConnection.CallSetupStateWithGum.OffererState", - call_setup_state_tracker_.offerer_state()); - UMA_HISTOGRAM_ENUMERATION( - "WebRTC.PeerConnection.CallSetupStateWithGum.AnswererState", - call_setup_state_tracker_.answerer_state()); - UMA_HISTOGRAM_ENUMERATION( - "WebRTC.PeerConnection.CallSetupStateWithGum.CallSetupState", - call_setup_state_tracker_.GetCallSetupState()); - } } ScriptPromise RTCPeerConnection::createOffer(ScriptState* script_state,
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.h b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.h index 9cc3cab..b7be3f9 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.h +++ b/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.h
@@ -525,6 +525,10 @@ webrtc::PeerConnectionInterface::IceGatheringState ice_gathering_state_; webrtc::PeerConnectionInterface::IceConnectionState ice_connection_state_; webrtc::PeerConnectionInterface::PeerConnectionState peer_connection_state_; + // TODO(https://crbug.com/857004): The trackers' metrics are currently not + // uploaded; either use the metrics it produces (i.e. revert + // https://chromium-review.googlesource.com/c/chromium/src/+/1991421) or + // delete all CallSetupStateTracker code for good. CallSetupStateTracker call_setup_state_tracker_; // A map containing any track that is in use by the peer connection. This
diff --git a/third_party/blink/renderer/modules/push_messaging/push_manager.cc b/third_party/blink/renderer/modules/push_messaging/push_manager.cc index fe5338e..0f356d3 100644 --- a/third_party/blink/renderer/modules/push_messaging/push_manager.cc +++ b/third_party/blink/renderer/modules/push_messaging/push_manager.cc
@@ -85,16 +85,6 @@ if (!ValidateOptions(options, exception_state)) return ScriptPromise(); - if (!options->IsApplicationServerKeyVapid()) { - ExecutionContext::From(script_state) - ->AddConsoleMessage(ConsoleMessage::Create( - mojom::ConsoleMessageSource::kJavaScript, - mojom::ConsoleMessageLevel::kWarning, - "The provided application server key is not a VAPID key. Only " - "VAPID keys will be supported in the future. For more information " - "check https://crbug.com/979235.")); - } - auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); ScriptPromise promise = resolver->Promise();
diff --git a/third_party/blink/renderer/modules/push_messaging/push_messaging_utils.cc b/third_party/blink/renderer/modules/push_messaging/push_messaging_utils.cc index 00950f8..f2faaa53 100644 --- a/third_party/blink/renderer/modules/push_messaging/push_messaging_utils.cc +++ b/third_party/blink/renderer/modules/push_messaging/push_messaging_utils.cc
@@ -68,6 +68,10 @@ case mojom::PushRegistrationStatus::RENDERER_SHUTDOWN: return "Registration failed - renderer shutdown"; + + case mojom::PushRegistrationStatus::UNSUPPORTED_GCM_SENDER_ID: + return "Registration failed - GCM Sender IDs are no longer supported, " + "please upgrade to VAPID authentication instead"; } NOTREACHED(); return String(); @@ -99,6 +103,7 @@ case mojom::PushRegistrationStatus::MANIFEST_EMPTY_OR_MISSING: case mojom::PushRegistrationStatus::STORAGE_CORRUPT: case mojom::PushRegistrationStatus::RENDERER_SHUTDOWN: + case mojom::PushRegistrationStatus::UNSUPPORTED_GCM_SENDER_ID: error_type = mojom::PushErrorType::ABORT; break; }
diff --git a/third_party/blink/renderer/modules/push_messaging/push_subscription_options.cc b/third_party/blink/renderer/modules/push_messaging/push_subscription_options.cc index f2c3c46..ae47431 100644 --- a/third_party/blink/renderer/modules/push_messaging/push_subscription_options.cc +++ b/third_party/blink/renderer/modules/push_messaging/push_subscription_options.cc
@@ -98,13 +98,6 @@ application_server_key.data(), SafeCast<unsigned>(application_server_key.size()))) {} -bool PushSubscriptionOptions::IsApplicationServerKeyVapid() const { - if (!application_server_key_) - return false; - return application_server_key_->ByteLengthAsSizeT() == 65 && - static_cast<uint8_t*>(application_server_key_->Data())[0] == 0x04; -} - void PushSubscriptionOptions::Trace(blink::Visitor* visitor) { visitor->Trace(application_server_key_); ScriptWrappable::Trace(visitor);
diff --git a/third_party/blink/renderer/modules/push_messaging/push_subscription_options.h b/third_party/blink/renderer/modules/push_messaging/push_subscription_options.h index 59c5fa1..49affc5 100644 --- a/third_party/blink/renderer/modules/push_messaging/push_subscription_options.h +++ b/third_party/blink/renderer/modules/push_messaging/push_subscription_options.h
@@ -37,9 +37,6 @@ return application_server_key_; } - // Whether the application server key follows the VAPID protocol. - bool IsApplicationServerKeyVapid() const; - void Trace(blink::Visitor* visitor) override; private:
diff --git a/third_party/blink/renderer/modules/vibration/BUILD.gn b/third_party/blink/renderer/modules/vibration/BUILD.gn index f4012cb7..a09c7f4 100644 --- a/third_party/blink/renderer/modules/vibration/BUILD.gn +++ b/third_party/blink/renderer/modules/vibration/BUILD.gn
@@ -12,7 +12,5 @@ "vibration_controller.h", ] - deps = [ - "//services/service_manager/public/cpp", - ] + deps = [ "//services/service_manager/public/cpp" ] }
diff --git a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc index 6e27861..60d166c 100644 --- a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc +++ b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc
@@ -587,19 +587,17 @@ void WebSocketChannelImpl::SendInternal( network::mojom::blink::WebSocketMessageType message_type, const char* data, - wtf_size_t total_size, + size_t total_size, uint64_t* consumed_buffered_amount) { network::mojom::blink::WebSocketMessageType frame_type = sent_size_of_top_message_ ? network::mojom::blink::WebSocketMessageType::CONTINUATION : message_type; DCHECK_GE(total_size, sent_size_of_top_message_); - // The first cast is safe since the result of min() never exceeds - // the range of wtf_size_t. The second cast is necessary to compile - // min() on ILP32. - wtf_size_t size = static_cast<wtf_size_t>( - std::min(sending_quota_, - static_cast<uint64_t>(total_size - sent_size_of_top_message_))); + // The cast is safe since the result of min() never exceeds the range of + // size_t. + size_t size = static_cast<size_t>(std::min<uint64_t>( + sending_quota_, total_size - sent_size_of_top_message_)); bool final = (sent_size_of_top_message_ + size == total_size); SendAndAdjustQuota(final, frame_type, @@ -658,8 +656,7 @@ switch (message->type) { case kMessageTypeText: SendInternal(network::mojom::blink::WebSocketMessageType::TEXT, - message->text.data(), - static_cast<wtf_size_t>(message->text.length()), + message->text.data(), message->text.length(), &consumed_buffered_amount); break; case kMessageTypeBlob: @@ -673,7 +670,7 @@ CHECK(message->array_buffer); SendInternal(network::mojom::blink::WebSocketMessageType::BINARY, static_cast<const char*>(message->array_buffer->Data()), - message->array_buffer->DeprecatedByteLengthAsUnsigned(), + message->array_buffer->ByteLengthAsSizeT(), &consumed_buffered_amount); break; case kMessageTypeClose: {
diff --git a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h index c5fa790..234bea5 100644 --- a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h +++ b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h
@@ -189,7 +189,7 @@ void SendInternal(network::mojom::blink::WebSocketMessageType, const char* data, - wtf_size_t total_size, + size_t total_size, uint64_t* consumed_buffered_amount); void SendAndAdjustQuota(bool final, network::mojom::blink::WebSocketMessageType, @@ -245,7 +245,7 @@ bool throttle_passed_ = false; bool has_initiated_opening_handshake_ = false; uint64_t sending_quota_ = 0; - wtf_size_t sent_size_of_top_message_ = 0; + size_t sent_size_of_top_message_ = 0; FrameScheduler::SchedulingAffectingFeatureHandle feature_handle_for_scheduler_;
diff --git a/third_party/blink/renderer/modules/webtransport/BUILD.gn b/third_party/blink/renderer/modules/webtransport/BUILD.gn index eafd2f7..dc3efbc 100644 --- a/third_party/blink/renderer/modules/webtransport/BUILD.gn +++ b/third_party/blink/renderer/modules/webtransport/BUILD.gn
@@ -13,9 +13,7 @@ jumbo_source_set("unit_tests") { testonly = true - sources = [ - "quic_transport_test.cc", - ] + sources = [ "quic_transport_test.cc" ] configs += [ "//third_party/blink/renderer:config",
diff --git a/third_party/blink/renderer/modules/webtransport/quic_transport.cc b/third_party/blink/renderer/modules/webtransport/quic_transport.cc index 114c9ba..1b3c5f2 100644 --- a/third_party/blink/renderer/modules/webtransport/quic_transport.cc +++ b/third_party/blink/renderer/modules/webtransport/quic_transport.cc
@@ -4,21 +4,120 @@ #include "third_party/blink/renderer/modules/webtransport/quic_transport.h" +#include <stdint.h> + #include <utility> +#include "base/numerics/safe_conversions.h" #include "mojo/public/cpp/bindings/remote.h" #include "third_party/blink/public/common/browser_interface_broker_proxy.h" #include "third_party/blink/public/mojom/webtransport/quic_transport_connector.mojom-blink.h" #include "third_party/blink/public/platform/task_type.h" +#include "third_party/blink/renderer/bindings/core/v8/script_promise.h" +#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_array_buffer.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_array_buffer_view.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" +#include "third_party/blink/renderer/core/streams/underlying_sink_base.h" +#include "third_party/blink/renderer/core/streams/writable_stream.h" +#include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h" #include "third_party/blink/renderer/platform/bindings/exception_code.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" +#include "third_party/blink/renderer/platform/heap/persistent.h" +#include "third_party/blink/renderer/platform/heap/visitor.h" +#include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink { +// Sends a datagram on write(). +class QuicTransport::DatagramUnderlyingSink final : public UnderlyingSinkBase { + public: + explicit DatagramUnderlyingSink(QuicTransport* quic_transport) + : quic_transport_(quic_transport) {} + + ScriptPromise start(ScriptState* script_state, + WritableStreamDefaultController*, + ExceptionState&) override { + return ScriptPromise::CastUndefined(script_state); + } + + ScriptPromise write(ScriptState* script_state, + ScriptValue chunk, + WritableStreamDefaultController*, + ExceptionState& exception_state) override { + auto v8chunk = chunk.V8Value(); + if (v8chunk->IsArrayBuffer()) { + DOMArrayBuffer* data = + V8ArrayBuffer::ToImpl(v8chunk.As<v8::ArrayBuffer>()); + return SendDatagram({static_cast<const uint8_t*>(data->Data()), + data->ByteLengthAsSizeT()}); + } + + auto* isolate = script_state->GetIsolate(); + if (v8chunk->IsArrayBufferView()) { + NotShared<DOMArrayBufferView> data = + ToNotShared<NotShared<DOMArrayBufferView>>(isolate, v8chunk, + exception_state); + if (exception_state.HadException()) { + return ScriptPromise(); + } + + return SendDatagram( + {static_cast<const uint8_t*>(data.View()->buffer()->Data()) + + data.View()->byteOffsetAsSizeT(), + data.View()->byteLengthAsSizeT()}); + } + + exception_state.ThrowTypeError( + "Datagram is not an ArrayBuffer or ArrayBufferView type."); + return ScriptPromise(); + } + + ScriptPromise close(ScriptState* script_state, ExceptionState&) override { + quic_transport_ = nullptr; + return ScriptPromise::CastUndefined(script_state); + } + + ScriptPromise abort(ScriptState* script_state, + ScriptValue reason, + ExceptionState&) override { + quic_transport_ = nullptr; + return ScriptPromise::CastUndefined(script_state); + } + + void Trace(Visitor* visitor) override { + visitor->Trace(quic_transport_); + UnderlyingSinkBase::Trace(visitor); + } + + private: + ScriptPromise SendDatagram(base::span<const uint8_t> data) { + if (!quic_transport_->quic_transport_) { + // Silently drop the datagram if we are not connected. + // TODO(ricea): Change the behaviour if the standard changes. See + // https://github.com/WICG/web-transport/issues/93. + return ScriptPromise::CastUndefined(quic_transport_->script_state_); + } + + auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>( + quic_transport_->script_state_); + quic_transport_->quic_transport_->SendDatagram( + data, WTF::Bind(&DatagramSent, WrapPersistent(resolver))); + return resolver->Promise(); + } + + // |sent| indicates whether the datagram was sent or dropped. Currently we + // |don't do anything with this information. + static void DatagramSent(ScriptPromiseResolver* resolver, bool sent) { + resolver->Resolve(); + } + + Member<QuicTransport> quic_transport_; +}; + QuicTransport* QuicTransport::Create(ScriptState* script_state, const String& url, ExceptionState& exception_state) { @@ -33,11 +132,21 @@ ScriptState* script_state, const String& url) : ContextLifecycleObserver(ExecutionContext::From(script_state)), + script_state_(script_state), url_(NullURL(), url) {} void QuicTransport::close(const WebTransportCloseInfo* close_info) { DVLOG(1) << "QuicTransport::close() this=" << this; // TODO(ricea): Send |close_info| to the network service. + + cleanly_closed_ = true; + // If we don't manage to close the writable stream here, then it will + // error when a write() is attempted. + if (!WritableStream::IsLocked(outgoing_datagrams_) && + !WritableStream::CloseQueuedOrInFlight(outgoing_datagrams_)) { + auto promise = WritableStream::Close(script_state_, outgoing_datagrams_); + promise->MarkAsHandled(); + } Dispose(); } @@ -65,7 +174,7 @@ void QuicTransport::OnHandshakeFailed() { DVLOG(1) << "QuicTransport::OnHandshakeFailed() this=" << this; - handshake_client_receiver_.reset(); + Dispose(); } void QuicTransport::ContextDestroyed(ExecutionContext* execution_context) { @@ -79,6 +188,8 @@ } void QuicTransport::Trace(Visitor* visitor) { + visitor->Trace(outgoing_datagrams_); + visitor->Trace(script_state_); ContextLifecycleObserver::Trace(visitor); ScriptWrappable::Trace(visitor); } @@ -140,6 +251,9 @@ WTF::Bind(&QuicTransport::OnConnectionError, WrapWeakPersistent(this))); // TODO(ricea): Report something to devtools. + + outgoing_datagrams_ = WritableStream::CreateWithCountQueueingStrategy( + script_state_, MakeGarbageCollected<DatagramUnderlyingSink>(this), 1); } void QuicTransport::Dispose() { @@ -151,6 +265,14 @@ void QuicTransport::OnConnectionError() { DVLOG(1) << "QuicTransport::OnConnectionError() this=" << this; + + if (!cleanly_closed_) { + v8::Local<v8::Value> reason = V8ThrowException::CreateTypeError( + script_state_->GetIsolate(), "Connection lost."); + WritableStreamDefaultController::Error( + script_state_, outgoing_datagrams_->Controller(), reason); + } + Dispose(); }
diff --git a/third_party/blink/renderer/modules/webtransport/quic_transport.h b/third_party/blink/renderer/modules/webtransport/quic_transport.h index 885958a..818f19d 100644 --- a/third_party/blink/renderer/modules/webtransport/quic_transport.h +++ b/third_party/blink/renderer/modules/webtransport/quic_transport.h
@@ -25,7 +25,9 @@ class ExecutionContext; class ScriptState; class WebTransportCloseInfo; +class WritableStream; +// https://wicg.github.io/web-transport/#quic-transport class MODULES_EXPORT QuicTransport final : public ScriptWrappable, public ActiveScriptWrappable<QuicTransport>, @@ -46,6 +48,8 @@ ~QuicTransport() override; // QuicTransport IDL implementation. + WritableStream* sendDatagrams() { return outgoing_datagrams_; } + void close(const WebTransportCloseInfo*); // QuicTransportHandshakeClient implementation @@ -55,6 +59,9 @@ override; void OnHandshakeFailed() override; + // QuicTransportClient implementation + // TODO(ricea): Add methods. + // Implementation of ContextLifecycleObserver void ContextDestroyed(ExecutionContext*) final; @@ -65,10 +72,19 @@ void Trace(Visitor* visitor) override; private: + class DatagramUnderlyingSink; + void Init(const String& url, ExceptionState&); void Dispose(); void OnConnectionError(); + bool cleanly_closed_ = false; + + // This corresponds to the [[SentDatagrams]] internal slot in the standard. + Member<WritableStream> outgoing_datagrams_; + + Member<ScriptState> script_state_; + const KURL url_; mojo::Remote<network::mojom::blink::QuicTransport> quic_transport_; mojo::Receiver<network::mojom::blink::QuicTransportHandshakeClient>
diff --git a/third_party/blink/renderer/modules/webtransport/quic_transport.idl b/third_party/blink/renderer/modules/webtransport/quic_transport.idl index f6a59958..ccfd484 100644 --- a/third_party/blink/renderer/modules/webtransport/quic_transport.idl +++ b/third_party/blink/renderer/modules/webtransport/quic_transport.idl
@@ -14,5 +14,9 @@ // QuicTransport includes, but we define all their methods/attributes here // for simplicity. + // From DatagramTransport mixin + WritableStream sendDatagrams(); + + // From WebTransport mixin void close(optional WebTransportCloseInfo closeInfo); };
diff --git a/third_party/blink/renderer/modules/webtransport/quic_transport_test.cc b/third_party/blink/renderer/modules/webtransport/quic_transport_test.cc index 4f9b380..0e3a07c 100644 --- a/third_party/blink/renderer/modules/webtransport/quic_transport_test.cc +++ b/third_party/blink/renderer/modules/webtransport/quic_transport_test.cc
@@ -4,19 +4,31 @@ #include "third_party/blink/renderer/modules/webtransport/quic_transport.h" +#include <array> #include <memory> #include <utility> #include "base/memory/weak_ptr.h" +#include "base/test/mock_callback.h" #include "mojo/public/cpp/bindings/receiver_set.h" #include "services/network/public/mojom/quic_transport.mojom-blink.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/browser_interface_broker_proxy.h" #include "third_party/blink/public/mojom/webtransport/quic_transport_connector.mojom-blink.h" +#include "third_party/blink/renderer/bindings/core/v8/script_promise_tester.h" +#include "third_party/blink/renderer/bindings/core/v8/script_value.h" +#include "third_party/blink/renderer/bindings/core/v8/to_v8_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" #include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_iterator_result_value.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_uint8_array.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" +#include "third_party/blink/renderer/core/streams/readable_stream.h" +#include "third_party/blink/renderer/core/streams/readable_stream_default_reader.h" +#include "third_party/blink/renderer/core/streams/writable_stream.h" +#include "third_party/blink/renderer/core/streams/writable_stream_default_writer.h" +#include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h" #include "third_party/blink/renderer/modules/webtransport/web_transport_close_info.h" #include "third_party/blink/renderer/platform/bindings/exception_code.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" @@ -28,6 +40,13 @@ namespace { +using ::testing::_; +using ::testing::ElementsAre; +using ::testing::Invoke; +using ::testing::Mock; +using ::testing::StrictMock; +using ::testing::Truly; + class QuicTransportConnector final : public mojom::blink::QuicTransportConnector { public: @@ -62,28 +81,30 @@ Vector<ConnectArgs> connect_args_; }; -class MockQuicTransport final : public network::mojom::blink::QuicTransport { +class MockQuicTransport : public network::mojom::blink::QuicTransport { public: MockQuicTransport(mojo::PendingReceiver<network::mojom::blink::QuicTransport> pending_receiver) : receiver_(this, std::move(pending_receiver)) {} - void SendDatagram(base::span<const uint8_t> data, - base::OnceCallback<void(bool)> callback) override {} + MOCK_METHOD2(SendDatagram, + void(base::span<const uint8_t> data, + base::OnceCallback<void(bool)> callback)); - void CreateStream( - mojo::ScopedDataPipeConsumerHandle readable, - mojo::ScopedDataPipeProducerHandle writable, - base::OnceCallback<void(bool, uint32_t)> callback) override {} + MOCK_METHOD3(CreateStream, + void(mojo::ScopedDataPipeConsumerHandle readable, + mojo::ScopedDataPipeProducerHandle writable, + base::OnceCallback<void(bool, uint32_t)> callback)); - void AcceptBidirectionalStream( - base::OnceCallback<void(uint32_t, - mojo::ScopedDataPipeConsumerHandle, - mojo::ScopedDataPipeProducerHandle)>) override {} + MOCK_METHOD1( + AcceptBidirectionalStream, + void(base::OnceCallback<void(uint32_t, + mojo::ScopedDataPipeConsumerHandle, + mojo::ScopedDataPipeProducerHandle)>)); - void AcceptUnidirectionalStream( - base::OnceCallback<void(uint32_t, mojo::ScopedDataPipeConsumerHandle)>) - override {} + MOCK_METHOD1(AcceptUnidirectionalStream, + void(base::OnceCallback< + void(uint32_t, mojo::ScopedDataPipeConsumerHandle)>)); private: mojo::Receiver<network::mojom::blink::QuicTransport> receiver_; @@ -100,20 +121,23 @@ weak_ptr_factory_.GetWeakPtr())); } - // Creates, connects and returns a QuicTransport object with the given |url|. - // Runs the event loop. - QuicTransport* ConnectSuccessfully(const V8TestingScope& scope, - const String& url) { + // Creates a QuicTransport object with the given |url|. + QuicTransport* Create(const V8TestingScope& scope, const String& url) { AddBinder(scope); - auto* quic_transport = - QuicTransport::Create(scope.GetScriptState(), url, ASSERT_NO_EXCEPTION); + return QuicTransport::Create(scope.GetScriptState(), url, + ASSERT_NO_EXCEPTION); + } + + // Connects a QuicTransport object. Runs the event loop. + void ConnectSuccessfully(QuicTransport* quic_transport) { + DCHECK(!mock_quic_transport_) << "Only one connection supported, sorry"; test::RunPendingTasks(); auto args = connector_.TakeConnectArgs(); if (args.size() != 1u) { ADD_FAILURE() << "args.size() should be 1, but is " << args.size(); - return nullptr; + return; } mojo::Remote<network::mojom::blink::QuicTransportHandshakeClient> @@ -124,15 +148,23 @@ mojo::PendingRemote<network::mojom::blink::QuicTransportClient> client_remote; - mock_quic_transport_ = std::make_unique<MockQuicTransport>( + mock_quic_transport_ = std::make_unique<StrictMock<MockQuicTransport>>( quic_transport_to_pass.InitWithNewPipeAndPassReceiver()); handshake_client->OnConnectionEstablished( std::move(quic_transport_to_pass), client_remote.InitWithNewPipeAndPassReceiver()); + client_remote_.Bind(std::move(client_remote)); test::RunPendingTasks(); + } + // Creates, connects and returns a QuicTransport object with the given |url|. + // Runs the event loop. + QuicTransport* CreateAndConnectSuccessfully(const V8TestingScope& scope, + const String& url) { + auto* quic_transport = Create(scope, url); + ConnectSuccessfully(quic_transport); return quic_transport; } @@ -151,6 +183,7 @@ BrowserInterfaceBrokerProxy* interface_broker_ = nullptr; QuicTransportConnector connector_; std::unique_ptr<MockQuicTransport> mock_quic_transport_; + mojo::Remote<network::mojom::blink::QuicTransportClient> client_remote_; base::WeakPtrFactory<QuicTransportTest> weak_ptr_factory_{this}; }; @@ -278,7 +311,7 @@ TEST_F(QuicTransportTest, SuccessfulConnect) { V8TestingScope scope; auto* quic_transport = - ConnectSuccessfully(scope, "quic-transport://example.com"); + CreateAndConnectSuccessfully(scope, "quic-transport://example.com"); EXPECT_TRUE(quic_transport->HasPendingActivity()); } @@ -325,7 +358,7 @@ TEST_F(QuicTransportTest, CloseAfterConnection) { V8TestingScope scope; auto* quic_transport = - ConnectSuccessfully(scope, "quic-transport://example.com"); + CreateAndConnectSuccessfully(scope, "quic-transport://example.com"); WebTransportCloseInfo close_info; close_info.setErrorCode(42); @@ -347,8 +380,17 @@ // When the underlying connection is shut down, the connection will be swept. TEST_F(QuicTransportTest, GarbageCollection) { V8TestingScope scope; - WeakPersistent<QuicTransport> quic_transport = - ConnectSuccessfully(scope, "quic-transport://example.com"); + + WeakPersistent<QuicTransport> quic_transport; + + { + // The streams created when creating a QuicTransport create some v8 handles. + // To ensure these are collected, we need to create a handle scope. This is + // not a problem for garbage collection in normal operation. + v8::HandleScope handle_scope(scope.GetIsolate()); + quic_transport = + CreateAndConnectSuccessfully(scope, "quic-transport://example.com"); + } // Pretend the stack is empty. This will avoid accidentally treating any // copies of the |quic_transport| pointer as references. @@ -369,11 +411,17 @@ TEST_F(QuicTransportTest, GarbageCollectMojoConnectionError) { V8TestingScope scope; - WeakPersistent<QuicTransport> quic_transport = - ConnectSuccessfully(scope, "quic-transport://example.com"); - // Deleting the server-side object causes a mojo connection error. - mock_quic_transport_ = nullptr; + WeakPersistent<QuicTransport> quic_transport; + + { + v8::HandleScope handle_scope(scope.GetIsolate()); + quic_transport = + CreateAndConnectSuccessfully(scope, "quic-transport://example.com"); + } + + // Closing the server-side of the pipe causes a mojo connection error. + client_remote_.reset(); test::RunPendingTasks(); @@ -383,6 +431,79 @@ EXPECT_FALSE(quic_transport); } +TEST_F(QuicTransportTest, SendDatagram) { + V8TestingScope scope; + auto* quic_transport = + CreateAndConnectSuccessfully(scope, "quic-transport://example.com"); + + EXPECT_CALL(*mock_quic_transport_, SendDatagram(ElementsAre('A'), _)) + .WillOnce(Invoke([](base::span<const uint8_t>, + MockQuicTransport::SendDatagramCallback callback) { + std::move(callback).Run(true); + })); + + auto* writable = quic_transport->sendDatagrams(); + auto* script_state = scope.GetScriptState(); + auto* writer = writable->getWriter(script_state, ASSERT_NO_EXCEPTION); + auto* chunk = DOMUint8Array::Create(1); + *chunk->Data() = 'A'; + ScriptPromise result = + writer->write(script_state, ScriptValue::From(script_state, chunk), + ASSERT_NO_EXCEPTION); + ScriptPromiseTester tester(script_state, result); + tester.WaitUntilSettled(); + EXPECT_TRUE(tester.IsFulfilled()); + EXPECT_TRUE(tester.Value().IsUndefined()); +} + +TEST_F(QuicTransportTest, SendDatagramBeforeConnect) { + V8TestingScope scope; + auto* quic_transport = Create(scope, "quic-transport://example.com"); + + auto* writable = quic_transport->sendDatagrams(); + auto* script_state = scope.GetScriptState(); + auto* writer = writable->getWriter(script_state, ASSERT_NO_EXCEPTION); + auto* chunk = DOMUint8Array::Create(1); + *chunk->Data() = 'A'; + ScriptPromise result = + writer->write(script_state, ScriptValue::From(script_state, chunk), + ASSERT_NO_EXCEPTION); + + ConnectSuccessfully(quic_transport); + + // No datagram is sent. + + ScriptPromiseTester tester(script_state, result); + tester.WaitUntilSettled(); + EXPECT_TRUE(tester.IsFulfilled()); + EXPECT_TRUE(tester.Value().IsUndefined()); +} + +TEST_F(QuicTransportTest, SendDatagramAfterClose) { + V8TestingScope scope; + auto* quic_transport = + CreateAndConnectSuccessfully(scope, "quic-transport://example.com"); + + quic_transport->close(nullptr); + test::RunPendingTasks(); + + auto* writable = quic_transport->sendDatagrams(); + auto* script_state = scope.GetScriptState(); + auto* writer = writable->getWriter(script_state, ASSERT_NO_EXCEPTION); + + auto* chunk = DOMUint8Array::Create(1); + *chunk->Data() = 'A'; + ScriptPromise result = + writer->write(script_state, ScriptValue::From(script_state, chunk), + ASSERT_NO_EXCEPTION); + + // No datagram is sent. + + ScriptPromiseTester tester(script_state, result); + tester.WaitUntilSettled(); + EXPECT_TRUE(tester.IsRejected()); +} + } // namespace } // namespace blink
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index deab500..a3e56a35 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -458,6 +458,7 @@ "bindings/v8_per_isolate_data.h", "bindings/v8_private_property.cc", "bindings/v8_private_property.h", + "bindings/v8_set_return_value.h", "bindings/v8_throw_exception.cc", "bindings/v8_throw_exception.h", "bindings/v8_value_cache.cc",
diff --git a/third_party/blink/renderer/platform/animation/compositor_keyframe_model.cc b/third_party/blink/renderer/platform/animation/compositor_keyframe_model.cc index 656f2f2..8aeb308 100644 --- a/third_party/blink/renderer/platform/animation/compositor_keyframe_model.cc +++ b/third_party/blink/renderer/platform/animation/compositor_keyframe_model.cc
@@ -90,9 +90,8 @@ return keyframe_model_->time_offset().InSecondsF(); } -void CompositorKeyframeModel::SetTimeOffset(double monotonic_time) { - keyframe_model_->set_time_offset( - base::TimeDelta::FromSecondsD(monotonic_time)); +void CompositorKeyframeModel::SetTimeOffset(base::TimeDelta monotonic_time) { + keyframe_model_->set_time_offset(monotonic_time); } blink::CompositorKeyframeModel::Direction
diff --git a/third_party/blink/renderer/platform/animation/compositor_keyframe_model.h b/third_party/blink/renderer/platform/animation/compositor_keyframe_model.h index 3002115a..7144083 100644 --- a/third_party/blink/renderer/platform/animation/compositor_keyframe_model.h +++ b/third_party/blink/renderer/platform/animation/compositor_keyframe_model.h
@@ -63,7 +63,7 @@ void SetStartTime(base::TimeTicks); double TimeOffset() const; - void SetTimeOffset(double monotonic_time); + void SetTimeOffset(base::TimeDelta monotonic_time); Direction GetDirection() const; void SetDirection(Direction);
diff --git a/third_party/blink/renderer/platform/animation/compositor_keyframe_model_test.cc b/third_party/blink/renderer/platform/animation/compositor_keyframe_model_test.cc index d6e98d70..98c3567 100644 --- a/third_party/blink/renderer/platform/animation/compositor_keyframe_model_test.cc +++ b/third_party/blink/renderer/platform/animation/compositor_keyframe_model_test.cc
@@ -28,7 +28,7 @@ *curve, compositor_target_property::OPACITY, 0, 1); keyframe_model->SetIterations(2); keyframe_model->SetStartTime(2); - keyframe_model->SetTimeOffset(2); + keyframe_model->SetTimeOffset(base::TimeDelta::FromSeconds(2)); keyframe_model->SetDirection(CompositorKeyframeModel::Direction::REVERSE); EXPECT_EQ(2, keyframe_model->Iterations());
diff --git a/third_party/blink/renderer/platform/bindings/v8_set_return_value.h b/third_party/blink/renderer/platform/bindings/v8_set_return_value.h new file mode 100644 index 0000000..431b1114 --- /dev/null +++ b/third_party/blink/renderer/platform/bindings/v8_set_return_value.h
@@ -0,0 +1,201 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_V8_SET_RETURN_VALUE_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_V8_SET_RETURN_VALUE_H_ + +#include "third_party/blink/renderer/platform/bindings/dom_data_store.h" +#include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h" +#include "third_party/blink/renderer/platform/bindings/script_wrappable.h" +#include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" +#include "third_party/blink/renderer/platform/bindings/v8_value_cache.h" +#include "v8/include/v8.h" + +namespace blink { + +namespace bindings { + +template <typename CallbackInfo, typename Value, typename... ExtraArgs> +void V8SetReturnValue(const CallbackInfo& info, + const Value& value, + ExtraArgs... extra_args); + +struct V8ReturnValue { + // Support compile-time overload resolution by making each value have its own + // type. + + // Nullable or not + enum NonNullable { kNonNullable }; + enum Nullable { kNullable }; + + // Main world or not + enum MainWorld { kMainWorld }; +}; + +// V8 handle types +template <typename CallbackInfo, typename S> +void V8SetReturnValue(const CallbackInfo& info, const v8::Global<S> value) { + info.GetReturnValue().Set(value); +} + +template <typename CallbackInfo, typename S> +void V8SetReturnValue(const CallbackInfo& info, const v8::Local<S> value) { + info.GetReturnValue().Set(value); +} + +// nullptr +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, nullptr_t) { + info.GetReturnValue().SetNull(); +} + +// Primitive types +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, bool value) { + info.GetReturnValue().Set(value); +} + +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, int32_t value) { + info.GetReturnValue().Set(value); +} + +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, uint32_t value) { + info.GetReturnValue().Set(value); +} + +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, double value) { + info.GetReturnValue().Set(value); +} + +// String types +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, + const AtomicString& string, + v8::Isolate* isolate, + V8ReturnValue::NonNullable) { + if (string.IsNull()) + return info.GetReturnValue().SetEmptyString(); + V8PerIsolateData::From(isolate)->GetStringCache()->SetReturnValueFromString( + info.GetReturnValue(), string.Impl()); +} + +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, + const String& string, + v8::Isolate* isolate, + V8ReturnValue::NonNullable) { + if (string.IsNull()) + return info.GetReturnValue().SetEmptyString(); + V8PerIsolateData::From(isolate)->GetStringCache()->SetReturnValueFromString( + info.GetReturnValue(), string.Impl()); +} + +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, + const AtomicString& string, + v8::Isolate* isolate, + V8ReturnValue::Nullable) { + if (string.IsNull()) + return info.GetReturnValue().SetNull(); + V8PerIsolateData::From(isolate)->GetStringCache()->SetReturnValueFromString( + info.GetReturnValue(), string.Impl()); +} + +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, + const String& string, + v8::Isolate* isolate, + V8ReturnValue::Nullable) { + if (string.IsNull()) + return info.GetReturnValue().SetNull(); + V8PerIsolateData::From(isolate)->GetStringCache()->SetReturnValueFromString( + info.GetReturnValue(), string.Impl()); +} + +// ScriptWrappable +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, + ScriptWrappable* value, + V8ReturnValue::MainWorld) { + DCHECK(DOMWrapperWorld::Current(info.GetIsolate()).IsMainWorld()); + if (UNLIKELY(!value)) + return info.GetReturnValue().SetNull(); + + if (DOMDataStore::SetReturnValueForMainWorld(info.GetReturnValue(), value)) + return; + + info.GetReturnValue().Set(value->Wrap(info.GetIsolate(), info.This())); +} + +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, + ScriptWrappable& value, + V8ReturnValue::MainWorld) { + DCHECK(DOMWrapperWorld::Current(info.GetIsolate()).IsMainWorld()); + if (DOMDataStore::SetReturnValueForMainWorld(info.GetReturnValue(), &value)) + return; + + info.GetReturnValue().Set(value.Wrap(info.GetIsolate(), info.This())); +} + +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, + ScriptWrappable* value, + const ScriptWrappable* receiver) { + if (UNLIKELY(!value)) + return info.GetReturnValue().SetNull(); + + if (DOMDataStore::SetReturnValueFast(info.GetReturnValue(), value, + info.This(), receiver)) { + return; + } + + info.GetReturnValue().Set(value->Wrap(info.GetIsolate(), info.This())); +} + +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, + ScriptWrappable& value, + const ScriptWrappable* receiver) { + if (DOMDataStore::SetReturnValueFast(info.GetReturnValue(), &value, + info.This(), receiver)) { + return; + } + + info.GetReturnValue().Set(value.Wrap(info.GetIsolate(), info.This())); +} + +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, + ScriptWrappable* value, + v8::Local<v8::Context> creation_context) { + if (UNLIKELY(!value)) + return info.GetReturnValue().SetNull(); + + if (DOMDataStore::SetReturnValue(info.GetReturnValue(), value)) + return; + + info.GetReturnValue().Set( + value->Wrap(info.GetIsolate(), creation_context->Global())); +} + +template <typename CallbackInfo> +void V8SetReturnValue(const CallbackInfo& info, + ScriptWrappable& value, + v8::Local<v8::Context> creation_context) { + if (DOMDataStore::SetReturnValue(info.GetReturnValue(), &value)) + return; + + info.GetReturnValue().Set( + value.Wrap(info.GetIsolate(), creation_context->Global())); +} + +} // namespace bindings + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_V8_SET_RETURN_VALUE_H_
diff --git a/third_party/blink/renderer/platform/fonts/mac/core_text_font_format_support.cc b/third_party/blink/renderer/platform/fonts/mac/core_text_font_format_support.cc index df03c3500..ef5984b 100644 --- a/third_party/blink/renderer/platform/fonts/mac/core_text_font_format_support.cc +++ b/third_party/blink/renderer/platform/fonts/mac/core_text_font_format_support.cc
@@ -13,6 +13,7 @@ // standard Chrome build configuration. static const uint32_t kBlinkLocalCTVersionNumber10_12 = 0x00090000; static const uint32_t kBlinkLocalCTVersionNumber10_13 = 0x000A0000; +static const uint32_t kBlinkLocalCTVersionNumber10_15 = 0x000C0000; bool CoreTextVersionSupportsVariations() { return &CTGetCoreTextVersion && @@ -26,4 +27,9 @@ CTGetCoreTextVersion() >= kBlinkLocalCTVersionNumber10_13; } +bool CoreTextVersionSupportsSystemFontMakeClone() { + return &CTGetCoreTextVersion && + CTGetCoreTextVersion() >= kBlinkLocalCTVersionNumber10_15; +} + } // namespace blink
diff --git a/third_party/blink/renderer/platform/fonts/mac/core_text_font_format_support.h b/third_party/blink/renderer/platform/fonts/mac/core_text_font_format_support.h index 1816f6f..a5e7709 100644 --- a/third_party/blink/renderer/platform/fonts/mac/core_text_font_format_support.h +++ b/third_party/blink/renderer/platform/fonts/mac/core_text_font_format_support.h
@@ -9,6 +9,11 @@ bool CoreTextVersionSupportsVariations(); bool CoreTextVersionSupportsColrCpal(); +// See https://bugs.chromium.org/p/skia/issues/detail?id=9747 - Depending on +// variation axes parameters Mac OS pre 10.15 produces broken SkTypefaces when +// using makeClone() on system fonts. +bool CoreTextVersionSupportsSystemFontMakeClone(); + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_MAC_CORE_TEXT_FONT_FORMAT_SUPPORT_H_
diff --git a/third_party/blink/renderer/platform/fonts/mac/font_cache_mac.mm b/third_party/blink/renderer/platform/fonts/mac/font_cache_mac.mm index f50fc362..82d95bea 100644 --- a/third_party/blink/renderer/platform/fonts/mac/font_cache_mac.mm +++ b/third_party/blink/renderer/platform/fonts/mac/font_cache_mac.mm
@@ -221,7 +221,7 @@ substitute_font, platform_data.size(), synthetic_bold, (traits & NSFontItalicTrait) && !(substitute_font_traits & NSFontItalicTrait), - platform_data.Orientation(), + platform_data.Orientation(), font_description.FontOpticalSizing(), nullptr); // No variation paramaters in fallback. return FontDataFromFontPlatformData(alternate_font.get(), kDoNotRetain); @@ -295,7 +295,8 @@ // the returned FontPlatformData since it will not have a valid SkTypeface. std::unique_ptr<FontPlatformData> platform_data = FontPlatformDataFromNSFont( platform_font, size, synthetic_bold, synthetic_italic, - font_description.Orientation(), font_description.VariationSettings()); + font_description.Orientation(), font_description.FontOpticalSizing(), + font_description.VariationSettings()); if (!platform_data->Typeface()) { return nullptr; }
diff --git a/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.h b/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.h index b1224be..cd0e338 100644 --- a/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.h +++ b/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.h
@@ -31,6 +31,8 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_MAC_FONT_PLATFORM_DATA_MAC_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_MAC_FONT_PLATFORM_DATA_MAC_H_ +#include "third_party/blink/renderer/platform/fonts/font_optical_sizing.h" + #include <memory> @class NSFont; @@ -47,6 +49,7 @@ bool synthetic_bold, bool synthetic_italic, FontOrientation, + OpticalSizing, FontVariationSettings*); } // namespace blink
diff --git a/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm b/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm index 16bcce4..e4d5920 100644 --- a/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm +++ b/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm
@@ -34,14 +34,20 @@ #import "third_party/blink/public/platform/platform.h" #import "third_party/blink/renderer/platform/fonts/font.h" #import "third_party/blink/renderer/platform/fonts/font_platform_data.h" +#import "third_party/blink/renderer/platform/fonts/mac/core_text_font_format_support.h" #import "third_party/blink/renderer/platform/fonts/opentype/font_settings.h" #import "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.h" #import "third_party/blink/renderer/platform/web_test_support.h" #import "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #import "third_party/skia/include/core/SkFont.h" #import "third_party/skia/include/core/SkStream.h" +#import "third_party/skia/include/core/SkTypes.h" #import "third_party/skia/include/ports/SkTypeface_mac.h" +namespace { +constexpr SkFourByteTag kOpszTag = SkSetFourByteTag('o', 'p', 's', 'z'); +} + namespace blink { static bool CanLoadInProcess(NSFont* ns_font) { @@ -117,6 +123,7 @@ bool synthetic_bold, bool synthetic_italic, FontOrientation orientation, + OpticalSizing optical_sizing, FontVariationSettings* variation_settings) { DCHECK(ns_font); sk_sp<SkTypeface> typeface; @@ -129,19 +136,82 @@ typeface = LoadFromBrowserProcess(ns_font, size); } - if (variation_settings && variation_settings->size() < UINT16_MAX) { - SkFontArguments::Axis axes[variation_settings->size()]; - for (size_t i = 0; i < variation_settings->size(); ++i) { - AtomicString feature_tag = variation_settings->at(i).Tag(); - axes[i] = {AtomicStringToFourByteTag(feature_tag), - SkFloatToScalar(variation_settings->at(i).Value())}; + wtf_size_t valid_configured_axes = + variation_settings && variation_settings->size() < UINT16_MAX + ? variation_settings->size() + : 0; + + // No variable font requested, return static font. + if (!valid_configured_axes) { + return std::make_unique<FontPlatformData>( + std::move(typeface), std::string(), size, synthetic_bold, + synthetic_italic, orientation); + } + + int existing_axes = typeface->getVariationDesignPosition(nullptr, 0); + // Don't apply variation parameters if the font does not have axes or we fail + // to retrieve the existing ones. + if (existing_axes <= 0) { + return std::make_unique<FontPlatformData>( + std::move(typeface), std::string(), size, synthetic_bold, + synthetic_italic, orientation); + } + + Vector<SkFontArguments::VariationPosition::Coordinate> coordinates_to_set; + coordinates_to_set.resize(existing_axes); + + if (typeface->getVariationDesignPosition(coordinates_to_set.data(), + existing_axes) != existing_axes) { + return std::make_unique<FontPlatformData>( + std::move(typeface), std::string(), size, synthetic_bold, + synthetic_italic, orientation); + } + + // Iterate over the font's axes and find a missing tag from variation + // settings, special case opsz, track the number of axes reconfigured. + size_t reconfigured_axes = 0; + for (auto& coordinate : coordinates_to_set) { + FontVariationAxis current_axis(AtomicString(), 0); + // Set opsz to font size but allow having it overriden by + // font-variation-settings in case it has 'opsz'. + if (coordinate.axis == kOpszTag) { + if (coordinate.value != SkFloatToScalar(size)) { + coordinate.value = SkFloatToScalar(size); + reconfigured_axes++; + } } + if (variation_settings->FindPair(FourByteTagToAtomicString(coordinate.axis), + ¤t_axis)) { + if (coordinate.value != current_axis.Value() && + coordinate.axis != kOpszTag) { + coordinate.value = current_axis.Value(); + reconfigured_axes++; + } + } + } + + if (!reconfigured_axes) { + // No variable axes touched, return the previous typeface. + return std::make_unique<FontPlatformData>( + std::move(typeface), std::string(), size, synthetic_bold, + synthetic_italic, orientation); + } + + SkFontArguments::VariationPosition variation_design_position{ + coordinates_to_set.data(), coordinates_to_set.size()}; + + // See https://bugs.chromium.org/p/skia/issues/detail?id=9747 - Depending on + // variation axes parameters Mac OS pre 10.15 produces broken SkTypefaces when + // using makeClone() on system fonts. Work around this issue by only using the + // more efficient makeClone() on supported versions. + if (CoreTextVersionSupportsSystemFontMakeClone()) { + typeface = typeface->makeClone(SkFontArguments().setVariationDesignPosition( + variation_design_position)); + } else { sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); - // TODO crbug.com/670246: Refactor this to a future Skia API that acccepts - // axis parameters on system fonts directly. - typeface = fm->makeFromStream( - typeface->openStream(nullptr)->duplicate(), - SkFontArguments().setAxes(axes, variation_settings->size())); + typeface = fm->makeFromStream(typeface->openStream(nullptr)->duplicate(), + SkFontArguments().setVariationDesignPosition( + variation_design_position)); } return std::make_unique<FontPlatformData>(
diff --git a/third_party/blink/renderer/platform/fonts/opentype/font_settings.cc b/third_party/blink/renderer/platform/fonts/opentype/font_settings.cc index 733d76d..84c34be7 100644 --- a/third_party/blink/renderer/platform/fonts/opentype/font_settings.cc +++ b/third_party/blink/renderer/platform/fonts/opentype/font_settings.cc
@@ -5,6 +5,7 @@ #include "third_party/blink/renderer/platform/fonts/opentype/font_settings.h" #include "third_party/blink/renderer/platform/wtf/hash_functions.h" +#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string_hash.h" #include "third_party/blink/renderer/platform/wtf/text/string_hash.h" #include "third_party/blink/renderer/platform/wtf/text/string_hasher.h" @@ -16,6 +17,13 @@ return (((tag[0]) << 24) | ((tag[1]) << 16) | ((tag[2]) << 8) | (tag[3])); } +AtomicString FourByteTagToAtomicString(uint32_t tag) { + constexpr size_t tag_size = 4; + LChar tag_string[tag_size] = {(tag >> 24) & 0xFF, (tag >> 16) & 0xFF, + (tag >> 8) & 0xFF, tag & 0xFF}; + return AtomicString(tag_string, tag_size); +} + unsigned FontVariationSettings::GetHash() const { unsigned computed_hash = size() ? 5381 : 0; unsigned num_features = size();
diff --git a/third_party/blink/renderer/platform/fonts/opentype/font_settings.h b/third_party/blink/renderer/platform/fonts/opentype/font_settings.h index 10ab2aec..61b3469 100644 --- a/third_party/blink/renderer/platform/fonts/opentype/font_settings.h +++ b/third_party/blink/renderer/platform/fonts/opentype/font_settings.h
@@ -17,6 +17,7 @@ namespace blink { uint32_t AtomicStringToFourByteTag(AtomicString tag); +AtomicString FourByteTagToAtomicString(uint32_t tag); template <typename T> class FontTagValuePair { @@ -34,7 +35,7 @@ private: AtomicString tag_; - const T value_; + T value_; }; template <typename T> @@ -60,6 +61,20 @@ } return builder.ToString(); } + + bool FindPair(AtomicString tag, T* found_pair) const { + if (!found_pair) + return false; + + for (auto& pair : list_) { + if (pair.Tag() == tag) { + *found_pair = pair; + return true; + } + } + return false; + } + const T* begin() const { return list_.begin(); } const T* end() const { return list_.end(); } T* begin() { return list_.begin(); }
diff --git a/third_party/blink/renderer/platform/fonts/opentype/font_settings_test.cc b/third_party/blink/renderer/platform/fonts/opentype/font_settings_test.cc index 5c2fa7d9..d39ce6ee 100644 --- a/third_party/blink/renderer/platform/fonts/opentype/font_settings_test.cc +++ b/third_party/blink/renderer/platform/fonts/opentype/font_settings_test.cc
@@ -61,4 +61,23 @@ } } +TEST(FontSettingsTest, FindTest) { + { + scoped_refptr<FontVariationSettings> settings = + MakeSettings<FontVariationSettings, FontVariationAxis>( + {FontVariationAxis{"a", 42}, FontVariationAxis{"b", 8118}}); + FontVariationAxis found_axis(AtomicString(), 0); + ASSERT_FALSE(settings->FindPair("c", &found_axis)); + ASSERT_FALSE(settings->FindPair("ddddd", &found_axis)); + ASSERT_FALSE(settings->FindPair("", &found_axis)); + ASSERT_EQ(found_axis.Value(), 0); + ASSERT_TRUE(settings->FindPair("a", &found_axis)); + ASSERT_EQ(found_axis.Tag(), AtomicString("a")); + ASSERT_EQ(found_axis.Value(), 42); + ASSERT_TRUE(settings->FindPair("b", &found_axis)); + ASSERT_EQ(found_axis.Tag(), AtomicString("b")); + ASSERT_EQ(found_axis.Value(), 8118); + } +} + } // namespace blink
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 5431e1c9..2828d0a 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -1816,6 +1816,8 @@ }, { name: "WebNFC", + origin_trial_feature_name: "WebNFC", + origin_trial_os: ["android"], status: "experimental", }, {
diff --git a/third_party/blink/web_tests/NeverFixTests b/third_party/blink/web_tests/NeverFixTests index 96fc21d..67d87a4 100644 --- a/third_party/blink/web_tests/NeverFixTests +++ b/third_party/blink/web_tests/NeverFixTests
@@ -2102,6 +2102,11 @@ [ Linux ] virtual/origin-trials-runtimeflags-disabled/http/tests/origin_trials/webexposed/sms-receiver-origin-trial-interfaces.html [ Skip ] [ Mac ] virtual/origin-trials-runtimeflags-disabled/http/tests/origin_trials/webexposed/sms-receiver-origin-trial-interfaces.html [ Skip ] +# Chrome Win/Linux/Mac don't support WebNFC origin trial +[ Win ] virtual/origin-trials-runtimeflags-disabled/http/tests/origin_trials/webexposed/web-nfc-origin-trial-interfaces.html [ Skip ] +[ Linux ] virtual/origin-trials-runtimeflags-disabled/http/tests/origin_trials/webexposed/web-nfc-origin-trial-interfaces.html [ Skip ] +[ Mac ] virtual/origin-trials-runtimeflags-disabled/http/tests/origin_trials/webexposed/web-nfc-origin-trial-interfaces.html [ Skip ] + # Chrome Win/Linux/Mac don't support Contacts Picker API yet. [ Win ] virtual/origin-trials-runtimeflags-disabled/http/tests/origin_trials/webexposed/contacts-manager-extra-properties-trial-interfaces.html [ Skip ] [ Linux ] virtual/origin-trials-runtimeflags-disabled/http/tests/origin_trials/webexposed/contacts-manager-extra-properties-trial-interfaces.html [ Skip ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index c76da9d2..ff95fa8 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -1036,7 +1036,7 @@ crbug.com/829028 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-span-all-dynamic-add-004.html [ Failure ] crbug.com/988015 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-span-all-dynamic-add-002.html [ Failure ] crbug.com/988015 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-span-all-dynamic-add-003.html [ Failure ] -crbug.com/994172 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-span-all-dynamic-add-007.html [ Failure Crash ] +crbug.com/994172 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-span-all-dynamic-add-007.html [ Pass Crash ] crbug.com/924142 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-span-all-dynamic-add-010.html [ Crash Pass ] crbug.com/874051 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-span-all-fieldset-001.html [ Failure ] crbug.com/874051 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-span-all-fieldset-002.html [ Failure ] @@ -1330,8 +1330,6 @@ crbug.com/845235 virtual/layout_ng_flex_box/css3/flexbox/overflow-auto-resizes-correctly.html [ Failure ] crbug.com/845235 virtual/layout_ng_flex_box/css3/flexbox/relpos-with-percentage-top.html [ Failure ] crbug.com/845235 virtual/layout_ng_flex_box/external/wpt/css/css-flexbox/flex-aspect-ratio-img-column-004.html [ Failure ] -crbug.com/845235 virtual/layout_ng_flex_box/external/wpt/css/css-flexbox/flex-minimum-height-flex-items-012.html [ Failure ] -crbug.com/845235 virtual/layout_ng_flex_box/external/wpt/css/css-flexbox/flex-minimum-height-flex-items-015.html [ Failure ] crbug.com/845235 virtual/layout_ng_flex_box/external/wpt/css/css-flexbox/hittest-overlapping-margin.html [ Failure ] crbug.com/845235 virtual/layout_ng_flex_box/external/wpt/css/css-flexbox/hittest-overlapping-order.html [ Failure ] crbug.com/845235 virtual/layout_ng_flex_box/external/wpt/css/css-flexbox/quirks-auto-block-size-with-percentage-item.html [ Pass Failure ]
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_7.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_7.json index b94f330..8ddb6cf 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_7.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_7.json
@@ -520545,7 +520545,7 @@ "support" ], "tools/wptrunner/requirements.txt": [ - "3cd01446e25bceb4dadef48259117bd057ea6f48", + "74a358ed10b54d1482b4732fdc9c97e01c75c22d", "support" ], "tools/wptrunner/requirements_android_webview.txt": [ @@ -526813,7 +526813,7 @@ "testharness" ], "web-nfc/NDEFRecord_constructor.https.html": [ - "0e0f1a771394570747117980c824c133ca3b060d", + "ef38a27a0506dfbef88edc16aa13797af64438d1", "testharness" ], "web-nfc/NDEFWriter-document-hidden-manual.https-expected.txt": [
diff --git a/third_party/blink/web_tests/external/wpt/tools/wptrunner/requirements.txt b/third_party/blink/web_tests/external/wpt/tools/wptrunner/requirements.txt index 3cd0144..74a358e 100644 --- a/third_party/blink/web_tests/external/wpt/tools/wptrunner/requirements.txt +++ b/third_party/blink/web_tests/external/wpt/tools/wptrunner/requirements.txt
@@ -2,7 +2,8 @@ mozinfo==1.1.0 mozlog==5.0 mozdebug==0.1.1 -pillow==6.2.1 +# Pillow 7 requires Python 3 +pillow==6.2.1 # pyup: <7.0 urllib3[secure]==1.25.7 requests==2.22.0 six==1.13.0
diff --git a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/overflow/overflow-delete-line-expected.txt b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/overflow/overflow-delete-line-expected.txt index d75ffed..cc7e03fe 100644 --- a/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/overflow/overflow-delete-line-expected.txt +++ b/third_party/blink/web_tests/flag-specific/composite-after-paint/paint/invalidation/overflow/overflow-delete-line-expected.txt
@@ -12,19 +12,9 @@ "reason": "appeared" }, { - "object": "InlineTextBox ' '", + "object": "LayoutBlockFlow DIV id='dv'", "rect": [8, 74, 46, 36], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'Lorem'", - "rect": [8, 74, 46, 36], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'ipsum'", - "rect": [8, 74, 46, 36], - "reason": "disappeared" + "reason": "chunk disappeared" } ] }
diff --git a/third_party/blink/web_tests/http/tests/devtools/sources/debugger/source-frame-breakpoint-decorations-expected.txt b/third_party/blink/web_tests/http/tests/devtools/sources/debugger/source-frame-breakpoint-decorations-expected.txt index 52c2b75..3392af6b 100644 --- a/third_party/blink/web_tests/http/tests/devtools/sources/debugger/source-frame-breakpoint-decorations-expected.txt +++ b/third_party/blink/web_tests/http/tests/devtools/sources/debugger/source-frame-breakpoint-decorations-expected.txt
@@ -25,11 +25,13 @@ inline breakpoint at (2, 4) inline breakpoint at (2, 13) disabled Adding conditional enabled breakpoint -breakpoint at 2 +breakpoint at 2 conditional inline breakpoint at (2, 4) inline breakpoint at (2, 13) disabled Disable breakpoints -breakpoint at 2 disabled +breakpoint at 2 disabled conditional + inline breakpoint at (2, 4) disabled + inline breakpoint at (2, 13) disabled Enable breakpoints breakpoint at 2 conditional inline breakpoint at (2, 4)
diff --git a/third_party/blink/web_tests/http/tests/devtools/sources/debugger/source-frame-breakpoint-decorations.js b/third_party/blink/web_tests/http/tests/devtools/sources/debugger/source-frame-breakpoint-decorations.js index 137a1ac1..f64ba47 100644 --- a/third_party/blink/web_tests/http/tests/devtools/sources/debugger/source-frame-breakpoint-decorations.js +++ b/third_party/blink/web_tests/http/tests/devtools/sources/debugger/source-frame-breakpoint-decorations.js
@@ -8,9 +8,11 @@ await TestRunner.showPanel('sources'); await TestRunner.addScriptTag('resources/edit-me-breakpoints.js'); - function waitAndDumpDecorations(sourceFrame) { - return SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrame).then( - () => SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame)); + async function runAsyncBreakpointActionAndDumpDecorations(sourceFrame, action) { + const waitPromise = SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrame); + await action(); + await waitPromise; + SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame); } Bindings.breakpointManager._storage._breakpoints = new Map(); @@ -22,15 +24,16 @@ function addBreakpoint(sourceFrame) { javaScriptSourceFrame = sourceFrame; TestRunner.addResult('Setting breakpoint'); - SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true) - .then(() => waitAndDumpDecorations(javaScriptSourceFrame)) - .then(removeBreakpoint); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true) + ).then(removeBreakpoint); } function removeBreakpoint() { TestRunner.addResult('Toggle breakpoint'); - SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2); - waitAndDumpDecorations(javaScriptSourceFrame).then(() => next()); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2) + ).then(next); } }, @@ -43,15 +46,16 @@ TestRunner.addResult('Setting breakpoint'); SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true) .then(() => SourcesTestRunner.waitBreakpointSidebarPane(true)) - .then(() => SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true)) - .then(() => waitAndDumpDecorations(javaScriptSourceFrame)) - .then(removeBreakpoint); + .then(() => runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true) + )).then(removeBreakpoint); } function removeBreakpoint() { TestRunner.addResult('Toggle breakpoint'); - SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2); - waitAndDumpDecorations(javaScriptSourceFrame).then(() => next()); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2) + ).then(next); } }, @@ -62,44 +66,51 @@ function addRegularDisabled(sourceFrame) { javaScriptSourceFrame = sourceFrame; TestRunner.addResult('Adding regular disabled breakpoint'); - waitAndDumpDecorations(javaScriptSourceFrame).then(addConditionalDisabled); - SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', false); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', false) + ).then(addConditionalDisabled); } function addConditionalDisabled() { TestRunner.addResult('Adding conditional disabled breakpoint'); - waitAndDumpDecorations(javaScriptSourceFrame).then(addRegularEnabled); - SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', false); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', false) + ).then(addRegularEnabled); } - function addRegularEnabled() { + async function addRegularEnabled() { TestRunner.addResult('Adding regular enabled breakpoint'); - waitAndDumpDecorations(javaScriptSourceFrame).then(addConditionalEnabled); - SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true) + ).then(addConditionalEnabled); } function addConditionalEnabled() { TestRunner.addResult('Adding conditional enabled breakpoint'); - waitAndDumpDecorations(javaScriptSourceFrame).then(disableAll); - SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true) + ).then(disableAll); } function disableAll() { TestRunner.addResult('Disable breakpoints'); - waitAndDumpDecorations(javaScriptSourceFrame).then(enabledAll); - SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true) + ).then(enabledAll); } function enabledAll() { TestRunner.addResult('Enable breakpoints'); - waitAndDumpDecorations(javaScriptSourceFrame).then(removeAll); - SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true) + ).then(removeAll); } function removeAll() { TestRunner.addResult('Remove breakpoints'); - waitAndDumpDecorations(javaScriptSourceFrame).then(next); - SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, false); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, false) + ).then(next); } } ]);
diff --git a/third_party/blink/web_tests/http/tests/devtools/sources/debugger/source-frame-inline-breakpoint-decorations.js b/third_party/blink/web_tests/http/tests/devtools/sources/debugger/source-frame-inline-breakpoint-decorations.js index 50fef3f..32f3c44 100644 --- a/third_party/blink/web_tests/http/tests/devtools/sources/debugger/source-frame-inline-breakpoint-decorations.js +++ b/third_party/blink/web_tests/http/tests/devtools/sources/debugger/source-frame-inline-breakpoint-decorations.js
@@ -30,10 +30,11 @@ //# sourceURL=foo.js `); - function waitAndDumpDecorations(sourceFrame) { - return SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrame) - .then( - () => SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame)); + async function runAsyncBreakpointActionAndDumpDecorations(sourceFrame, action) { + const waitPromise = SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrame); + await action(); + await waitPromise; + SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame); } Bindings.breakpointManager._storage._breakpoints = new Map(); @@ -45,14 +46,16 @@ function addBreakpoint(sourceFrame) { javaScriptSourceFrame = sourceFrame; TestRunner.addResult('Setting breakpoint'); - SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true) - .then(() => waitAndDumpDecorations(javaScriptSourceFrame).then(removeBreakpoint)); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true) + ).then(removeBreakpoint); } function removeBreakpoint() { TestRunner.addResult('Toggle breakpoint'); - waitAndDumpDecorations(javaScriptSourceFrame).then(() => next()); - SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11) + ).then(next); } }, @@ -63,14 +66,16 @@ function addBreakpoint(sourceFrame) { javaScriptSourceFrame = sourceFrame; TestRunner.addResult('Setting breakpoint'); - SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 13, '', true) - .then(() => waitAndDumpDecorations(javaScriptSourceFrame).then(removeBreakpoint)); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 13, '', true) + ).then(removeBreakpoint); } function removeBreakpoint() { TestRunner.addResult('Toggle breakpoint'); - SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 13); - waitAndDumpDecorations(javaScriptSourceFrame).then(() => next()); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 13) + ).then(next); } }, @@ -81,29 +86,33 @@ function addBreakpoint(sourceFrame) { javaScriptSourceFrame = sourceFrame; TestRunner.addResult('Setting breakpoint'); - SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true) - .then(() => waitAndDumpDecorations(javaScriptSourceFrame).then(clickBySecondLocation)); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true) + ).then(clickBySecondLocation); } function clickBySecondLocation() { TestRunner.addResult('Click by second breakpoint'); - waitAndDumpDecorations(javaScriptSourceFrame).then(clickByFirstLocation); - SourcesTestRunner.clickDebuggerPluginBreakpoint( - javaScriptSourceFrame, 11, 1, next); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.clickDebuggerPluginBreakpoint( + javaScriptSourceFrame, 11, 1, next) + ).then(clickByFirstLocation); } function clickByFirstLocation() { TestRunner.addResult('Click by first breakpoint'); - waitAndDumpDecorations(javaScriptSourceFrame).then(clickBySecondLocationAgain); - SourcesTestRunner.clickDebuggerPluginBreakpoint( - javaScriptSourceFrame, 11, 0, next); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.clickDebuggerPluginBreakpoint( + javaScriptSourceFrame, 11, 0, next) + ).then(clickBySecondLocationAgain); } function clickBySecondLocationAgain() { TestRunner.addResult('Click by second breakpoint'); - waitAndDumpDecorations(javaScriptSourceFrame).then(() => next()); - SourcesTestRunner.clickDebuggerPluginBreakpoint( - javaScriptSourceFrame, 11, 1, next); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.clickDebuggerPluginBreakpoint( + javaScriptSourceFrame, 11, 1, next) + ).then(next); } }, @@ -114,23 +123,26 @@ function addBreakpoint(sourceFrame) { javaScriptSourceFrame = sourceFrame; TestRunner.addResult('Setting breakpoint in line 4'); - SourcesTestRunner.toggleBreakpoint(sourceFrame, 12, false); - waitAndDumpDecorations(javaScriptSourceFrame).then(toggleBreakpointInAnotherLine); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 12, false) + ).then(toggleBreakpointInAnotherLine); } function toggleBreakpointInAnotherLine() { TestRunner.addResult('Setting breakpoint in line 3'); - waitAndDumpDecorations(javaScriptSourceFrame).then(removeBreakpoints); - SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11, false); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11, false) + ).then(removeBreakpoints); } function removeBreakpoints() { TestRunner.addResult('Click by first inline breakpoints'); - waitAndDumpDecorations(javaScriptSourceFrame).then(() => next()); - SourcesTestRunner.clickDebuggerPluginBreakpoint( - javaScriptSourceFrame, 11, 0, next); - SourcesTestRunner.clickDebuggerPluginBreakpoint( - javaScriptSourceFrame, 12, 0, next); + runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => { + SourcesTestRunner.clickDebuggerPluginBreakpoint( + javaScriptSourceFrame, 11, 0, next); + SourcesTestRunner.clickDebuggerPluginBreakpoint( + javaScriptSourceFrame, 12, 0, next); + }).then(next); } }, @@ -138,13 +150,14 @@ let javaScriptSourceFrame = await SourcesTestRunner.showScriptSourcePromise('foo.js'); TestRunner.addResult('Setting breakpoint'); - await SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 16, '', true) - await waitAndDumpDecorations(javaScriptSourceFrame); + await runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 16, '', true) + ); TestRunner.addResult('Toggle breakpoint'); - let decorationsPromise = waitAndDumpDecorations(javaScriptSourceFrame); - SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 28); - await decorationsPromise; + await runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => + SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 28) + ); next(); } ]);
diff --git a/third_party/blink/web_tests/http/tests/origin_trials/webexposed/web-nfc-origin-trial-interfaces.html b/third_party/blink/web_tests/http/tests/origin_trials/webexposed/web-nfc-origin-trial-interfaces.html new file mode 100644 index 0000000..f72344a --- /dev/null +++ b/third_party/blink/web_tests/http/tests/origin_trials/webexposed/web-nfc-origin-trial-interfaces.html
@@ -0,0 +1,24 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<!-- Generate token with the command: +generate_token.py http://127.0.0.1:8000 WebNFC --expire-timestamp=2000000000 +-- --> +<meta http-equiv="origin-trial" content="Aqf7eFO7NmOkdlMoZ/n0ptqFGPH5WMzwB8x9cwISBw1gM6FYOW+YwVuol8dAbAhjdZxPoz43qDsWnqeuAk9rmQgAAABOeyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiV2ViTkZDIiwgImV4cGlyeSI6IDIwMDAwMDAwMDB9" /> +<title>WebNFC - interfaces exposed by origin trial</title> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="../../resources/origin-trials-helper.js"></script> +<script> +test(t => { + OriginTrialsHelper.check_properties_exist(this, + { + 'NDEFMessage': ['records'], + 'NDEFReader': ['scan', 'onreading', 'onerror'], + 'NDEFReadingEvent': ['serialNumber', 'message'], + 'NDEFRecord': ['recordType', 'mediaType', 'id', 'encoding', 'lang', 'data', 'toRecords'], + 'NDEFWriter': ['push'], + }, + ); +}, "WebNFC related interfaces in Origin-Trial enabled document."); + +</script>
diff --git a/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index 952014e..ba536c7a 100644 --- a/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/blink/web_tests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -1236,6 +1236,7 @@ attribute @@toStringTag method close method constructor + method sendDatagrams interface ReadableStream attribute @@toStringTag getter locked
diff --git a/third_party/blink/web_tests/platform/linux/paint/invalidation/overflow/overflow-delete-line-expected.txt b/third_party/blink/web_tests/platform/linux/paint/invalidation/overflow/overflow-delete-line-expected.txt index a4eae6c0..0616b790 100644 --- a/third_party/blink/web_tests/platform/linux/paint/invalidation/overflow/overflow-delete-line-expected.txt +++ b/third_party/blink/web_tests/platform/linux/paint/invalidation/overflow/overflow-delete-line-expected.txt
@@ -12,19 +12,9 @@ "reason": "appeared" }, { - "object": "InlineTextBox ' '", + "object": "LayoutBlockFlow DIV id='dv'", "rect": [8, 74, 46, 36], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'Lorem'", - "rect": [8, 74, 46, 36], - "reason": "disappeared" - }, - { - "object": "InlineTextBox 'ipsum'", - "rect": [8, 74, 46, 36], - "reason": "disappeared" + "reason": "chunk disappeared" } ] }
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt index a0a8bdf..4143aef 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -1166,6 +1166,7 @@ [Worker] attribute @@toStringTag [Worker] method close [Worker] method constructor +[Worker] method sendDatagrams [Worker] interface ReadableStream [Worker] attribute @@toStringTag [Worker] getter locked
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt index 74c2984e..a488a22 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-expected.txt
@@ -6174,6 +6174,7 @@ attribute @@toStringTag method close method constructor + method sendDatagrams interface RTCCertificate attribute @@toStringTag getter expires
diff --git a/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt index 12fc23c..f510b58 100644 --- a/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/blink/web_tests/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -1148,6 +1148,7 @@ [Worker] attribute @@toStringTag [Worker] method close [Worker] method constructor +[Worker] method sendDatagrams [Worker] interface ReadableStream [Worker] attribute @@toStringTag [Worker] getter locked
diff --git a/third_party/breakpad/BUILD.gn b/third_party/breakpad/BUILD.gn index d203f49..72e171e2 100644 --- a/third_party/breakpad/BUILD.gn +++ b/third_party/breakpad/BUILD.gn
@@ -206,9 +206,7 @@ "breakpad/src/processor/microdump_stackwalk.cc", ] - deps = [ - ":stackwalk_common", - ] + deps = [ ":stackwalk_common" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] @@ -223,9 +221,7 @@ "breakpad/src/processor/minidump_stackwalk.cc", ] - deps = [ - ":stackwalk_common", - ] + deps = [ ":stackwalk_common" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] @@ -424,9 +420,7 @@ "Foundation.framework", ] - deps = [ - ":utilities", - ] + deps = [ ":utilities" ] } # TODO(GYP) this target has some mac_bundle_resources stuff. @@ -754,12 +748,8 @@ executable("linux_dumper_unittest_helper") { set_sources_assignment_filter([]) testonly = true - sources = [ - "breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc", - ] - deps = [ - ":processor_support", - ] + sources = [ "breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc" ] + deps = [ ":processor_support" ] configs += [ ":client_config" ] @@ -771,9 +761,7 @@ executable("generate_test_dump") { set_sources_assignment_filter([]) testonly = true - sources = [ - "linux/generate-test-dump.cc", - ] + sources = [ "linux/generate-test-dump.cc" ] # This file has an unused variable warning. configs -= [ "//build/config/compiler:chromium_code" ] @@ -782,9 +770,7 @@ "//build/config/compiler:no_chromium_code", ] - deps = [ - ":client", - ] + deps = [ ":client" ] if (is_android) { libs = [ "log" ] @@ -801,20 +787,14 @@ include_dirs = [ "breakpad/src" ] - deps = [ - ":client", - ] + deps = [ ":client" ] } executable("core-2-minidump") { set_sources_assignment_filter([]) - sources = [ - "breakpad/src/tools/linux/core2md/core2md.cc", - ] + sources = [ "breakpad/src/tools/linux/core2md/core2md.cc" ] - deps = [ - ":client", - ] + deps = [ ":client" ] include_dirs = [ "breakpad/src" ] } @@ -862,9 +842,7 @@ "breakpad/src/tools/windows/converter/ms_symbol_server_converter.cc", ] - deps = [ - "//third_party/breakpad:common_windows", - ] + deps = [ "//third_party/breakpad:common_windows" ] libs = [ "Pathcch.lib" ] } @@ -877,13 +855,9 @@ "breakpad/src", ] - sources = [ - "breakpad/src/tools/windows/dump_syms/dump_syms.cc", - ] + sources = [ "breakpad/src/tools/windows/dump_syms/dump_syms.cc" ] - deps = [ - "//third_party/breakpad:common_windows", - ] + deps = [ "//third_party/breakpad:common_windows" ] lib_dirs = [] if (current_cpu == "x64") { @@ -910,13 +884,9 @@ "breakpad/src", ] - sources = [ - "breakpad/src/tools/windows/symupload/symupload.cc", - ] + sources = [ "breakpad/src/tools/windows/symupload/symupload.cc" ] - deps = [ - "//third_party/breakpad:common_windows", - ] + deps = [ "//third_party/breakpad:common_windows" ] ldflags = [ "/LARGEADDRESSAWARE" ]
diff --git a/third_party/brotli/BUILD.gn b/third_party/brotli/BUILD.gn index 020bc01..f2c816f 100644 --- a/third_party/brotli/BUILD.gn +++ b/third_party/brotli/BUILD.gn
@@ -35,17 +35,13 @@ static_library("common") { sources = common_sources public_configs = [ ":includes" ] - deps = [ - ":headers", - ] + deps = [ ":headers" ] } static_library("common_no_dictionary_data") { sources = common_sources public_configs = [ ":includes" ] - deps = [ - ":headers", - ] + deps = [ ":headers" ] defines = [ "BROTLI_EXTERNAL_DICTIONARY_DATA" ] } @@ -126,12 +122,8 @@ static_library("dec") { sources = dec_sources public_configs = [ ":includes" ] - public_deps = [ - ":headers", - ] - deps = [ - ":common", - ] + public_deps = [ ":headers" ] + deps = [ ":common" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] @@ -144,12 +136,8 @@ static_library("dec_no_dictionary_data") { sources = dec_sources public_configs = [ ":includes" ] - public_deps = [ - ":headers", - ] - deps = [ - ":common_no_dictionary_data", - ] + public_deps = [ ":headers" ] + deps = [ ":common_no_dictionary_data" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] @@ -163,12 +151,8 @@ sources = enc_sources public_configs = [ ":includes" ] - public_deps = [ - ":headers", - ] - deps = [ - ":common", - ] + public_deps = [ ":headers" ] + deps = [ ":common" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] @@ -180,9 +164,7 @@ if (current_toolchain == host_toolchain) { executable("brotli") { - sources = [ - "tools/brotli.c", - ] + sources = [ "tools/brotli.c" ] public_configs = [ ":includes" ] deps = [ @@ -208,11 +190,7 @@ } fuzzer_test("brotli_fuzzer") { - sources = [ - "fuzz/decode_fuzzer.cc", - ] - deps = [ - ":dec", - ] + sources = [ "fuzz/decode_fuzzer.cc" ] + deps = [ ":dec" ] libfuzzer_options = [ "max_len=1280" ] }
diff --git a/third_party/crashpad/README.chromium b/third_party/crashpad/README.chromium index 6b1d7af..6becf5c 100644 --- a/third_party/crashpad/README.chromium +++ b/third_party/crashpad/README.chromium
@@ -2,7 +2,7 @@ Short Name: crashpad URL: https://crashpad.chromium.org/ Version: unknown -Revision: 558b7ea43ff5c9ccda03ce946364cdff15401575 +Revision: 4367e9df172c579ca232ef98d76b1a00d7333e8a License: Apache 2.0 License File: crashpad/LICENSE Security Critical: yes
diff --git a/third_party/crashpad/crashpad/build/ios/Default.png b/third_party/crashpad/crashpad/build/ios/Default.png new file mode 100644 index 0000000..8c9089d5 --- /dev/null +++ b/third_party/crashpad/crashpad/build/ios/Default.png Binary files differ
diff --git a/third_party/crashpad/crashpad/build/ios/Unittest-Info.plist b/third_party/crashpad/crashpad/build/ios/Unittest-Info.plist new file mode 100644 index 0000000..9256fb44 --- /dev/null +++ b/third_party/crashpad/crashpad/build/ios/Unittest-Info.plist
@@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleIdentifier</key> + <string>${IOS_BUNDLE_ID_PREFIX}.gtest.${GTEST_BUNDLE_ID_SUFFIX:rfc1034identifier}</string> + <key>UIApplicationDelegate</key> + <string>CrashpadUnitTestDelegate</string> +</dict> +</plist>
diff --git a/third_party/crashpad/crashpad/build/test.gni b/third_party/crashpad/crashpad/build/test.gni index f46520b7..24c343d 100644 --- a/third_party/crashpad/crashpad/build/test.gni +++ b/third_party/crashpad/crashpad/build/test.gni
@@ -18,9 +18,35 @@ import("//testing/test.gni") } else { template("test") { - executable(target_name) { - testonly = true - forward_variables_from(invoker, "*") + if (crashpad_is_ios) { + import("//third_party/mini_chromium/mini_chromium/build/ios/rules.gni") + + _launch_image_bundle_target = target_name + "_launch_image" + bundle_data(_launch_image_bundle_target) { + forward_variables_from(invoker, [ "testonly" ]) + sources = [ + "//build/ios/Default.png", + ] + outputs = [ + "{{bundle_contents_dir}}/{{source_file_part}}", + ] + } + + ios_app_bundle(target_name) { + testonly = true + info_plist = "//build/ios/Unittest-Info.plist" + extra_substitutions = [ "GTEST_BUNDLE_ID_SUFFIX=$target_name" ] + forward_variables_from(invoker, "*") + if (!defined(deps)) { + deps = [] + } + deps += [ ":$_launch_image_bundle_target" ] + } + } else { + executable(target_name) { + testonly = true + forward_variables_from(invoker, "*") + } } } }
diff --git a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h index 37fbc432..9f46a48 100644 --- a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h +++ b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
@@ -170,7 +170,7 @@ memcpy(&context->fpregs, &float_context.fpregs, sizeof(context->fpregs)); context->fpcsr = float_context.fpcsr; context->fir = float_context.fpu_id; -}; +} #endif // ARCH_CPU_MIPS_FAMILY || DOXYGEN
diff --git a/third_party/crashpad/crashpad/snapshot/win/exception_snapshot_win_test.cc b/third_party/crashpad/crashpad/snapshot/win/exception_snapshot_win_test.cc index 2d4e909..07a25a8 100644 --- a/third_party/crashpad/crashpad/snapshot/win/exception_snapshot_win_test.cc +++ b/third_party/crashpad/crashpad/snapshot/win/exception_snapshot_win_test.cc
@@ -102,7 +102,12 @@ // Verify the exception happened at the expected location with a bit of // slop space to allow for reading the current PC before the exception // happens. See TestCrashingChild(). +#if !defined(NDEBUG) + // Debug build is likely not optimized and contains more instructions. + constexpr uint64_t kAllowedOffset = 200; +#else constexpr uint64_t kAllowedOffset = 100; +#endif EXPECT_GT(snapshot.Exception()->ExceptionAddress(), break_near_); EXPECT_LT(snapshot.Exception()->ExceptionAddress(), break_near_ + kAllowedOffset); @@ -215,7 +220,7 @@ constexpr uint64_t kAllowedOffset = 500; #elif !defined(NDEBUG) // Debug build is likely not optimized and contains more instructions. - constexpr uint64_t kAllowedOffset = 150; + constexpr uint64_t kAllowedOffset = 200; #else constexpr uint64_t kAllowedOffset = 100; #endif
diff --git a/third_party/crashpad/crashpad/test/BUILD.gn b/third_party/crashpad/crashpad/test/BUILD.gn index 5159744b..f9c8132 100644 --- a/third_party/crashpad/crashpad/test/BUILD.gn +++ b/third_party/crashpad/crashpad/test/BUILD.gn
@@ -243,6 +243,21 @@ } } +if (crashpad_is_ios) { + source_set("test_runner_ios") { + testonly = true + sources = [ + "gtest_runner_ios.h", + "gtest_runner_ios.mm", + ] + configs += [ "..:crashpad_config" ] + deps = [ + "../third_party/gtest:gtest", + ] + libs = [ "UIKit.framework" ] + } +} + static_library("gmock_main") { testonly = true sources = [ @@ -257,6 +272,9 @@ "../third_party/mini_chromium:base", "../third_party/mini_chromium:base_test_support", ] + if (crashpad_is_ios) { + deps += [ ":test_runner_ios" ] + } } static_library("gtest_main") { @@ -272,4 +290,7 @@ "../third_party/mini_chromium:base", "../third_party/mini_chromium:base_test_support", ] + if (crashpad_is_ios) { + deps += [ ":test_runner_ios" ] + } }
diff --git a/third_party/crashpad/crashpad/test/gtest_main.cc b/third_party/crashpad/crashpad/test/gtest_main.cc index 0a7a2d3a..f6b6a69 100644 --- a/third_party/crashpad/crashpad/test/gtest_main.cc +++ b/third_party/crashpad/crashpad/test/gtest_main.cc
@@ -21,6 +21,10 @@ #include "gmock/gmock.h" #endif // CRASHPAD_TEST_LAUNCHER_GMOCK +#if defined(OS_IOS) +#include "test/gtest_runner_ios.h" +#endif + #if defined(OS_WIN) #include "test/win/win_child_process.h" #endif // OS_WIN @@ -93,5 +97,12 @@ #error #define CRASHPAD_TEST_LAUNCHER_GTEST or CRASHPAD_TEST_LAUNCHER_GMOCK #endif // CRASHPAD_TEST_LAUNCHER_GMOCK +#if defined(OS_IOS) + // iOS needs to run tests within the context of an app, so call a helper that + // invokes UIApplicationMain(). The application delegate will call + // RUN_ALL_TESTS() and exit before returning control to this function. + crashpad::test::IOSLaunchApplicationAndRunTests(argc, argv); +#else return RUN_ALL_TESTS(); +#endif }
diff --git a/third_party/crashpad/crashpad/test/gtest_runner_ios.h b/third_party/crashpad/crashpad/test/gtest_runner_ios.h new file mode 100644 index 0000000..564fe5c --- /dev/null +++ b/third_party/crashpad/crashpad/test/gtest_runner_ios.h
@@ -0,0 +1,33 @@ +// Copyright 2019 The Crashpad Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef CRASHPAD_TEST_GTEST_RUNNER_IOS_ +#define CRASHPAD_TEST_GTEST_RUNNER_IOS_ + +namespace crashpad { +namespace test { + +//! \brief Runs all registered tests in the context of a UIKit application. +//! +//! Invokes UIApplicationMain() to launch the iOS application and runs all +//! registered tests after the application finishes +//! launching. UIApplicationMain() brings up the main runloop and never returns, +//! so therefore this function never returns either. It invokes _exit() to +//! terminate the application after tests have completed. +void IOSLaunchApplicationAndRunTests(int argc, char* argv[]); + +} // namespace test +} // namespace crashpad + +#endif // CRASHPAD_TEST_GTEST_RUNNER_IOS_
diff --git a/third_party/crashpad/crashpad/test/gtest_runner_ios.mm b/third_party/crashpad/crashpad/test/gtest_runner_ios.mm new file mode 100644 index 0000000..8738fcb9 --- /dev/null +++ b/third_party/crashpad/crashpad/test/gtest_runner_ios.mm
@@ -0,0 +1,114 @@ +// Copyright 2019 The Crashpad Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "test/gtest_runner_ios.h" + +#import <UIKit/UIKit.h> + +#include "gtest/gtest.h" + +@interface UIApplication (Testing) +- (void)_terminateWithStatus:(int)status; +@end + +namespace { + +// The iOS watchdog timer will kill an app that doesn't spin the main event +// loop often enough. This uses a Gtest TestEventListener to spin the current +// loop after each test finishes. However, if any individual test takes too +// long, it is still possible that the app will get killed. +class IOSRunLoopListener : public testing::EmptyTestEventListener { + public: + virtual void OnTestEnd(const testing::TestInfo& test_info) { + @autoreleasepool { + // At the end of the test, spin the default loop for a moment. + NSDate* stop_date = [NSDate dateWithTimeIntervalSinceNow:0.001]; + [[NSRunLoop currentRunLoop] runUntilDate:stop_date]; + } + } +}; + +void RegisterTestEndListener() { + testing::TestEventListeners& listeners = + testing::UnitTest::GetInstance()->listeners(); + listeners.Append(new IOSRunLoopListener); +} + +} // namespace + +@interface CrashpadUnitTestDelegate : NSObject +@property(nonatomic, readwrite, strong) UIWindow* window; +- (void)runTests; +@end + +@implementation CrashpadUnitTestDelegate + +- (BOOL)application:(UIApplication*)application + didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { + self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds]; + self.window.backgroundColor = UIColor.whiteColor; + [self.window makeKeyAndVisible]; + + UIViewController* controller = [[UIViewController alloc] init]; + [self.window setRootViewController:controller]; + + // Add a label with the app name. + UILabel* label = [[UILabel alloc] initWithFrame:controller.view.bounds]; + label.text = [[NSProcessInfo processInfo] processName]; + label.textAlignment = NSTextAlignmentCenter; + label.textColor = UIColor.blackColor; + [controller.view addSubview:label]; + + // Queue up the test run. + [self performSelector:@selector(runTests) withObject:nil afterDelay:0.1]; + + return YES; +} + +- (void)runTests { + RegisterTestEndListener(); + + int exitStatus = RUN_ALL_TESTS(); + + // If a test app is too fast, it will exit before Instruments has has a + // a chance to initialize and no test results will be seen. + // TODO(crbug.com/137010): Figure out how much time is actually needed, and + // sleep only to make sure that much time has elapsed since launch. + [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:2.0]]; + self.window = nil; + + // Use the hidden selector to try and cleanly take down the app (otherwise + // things can think the app crashed even on a zero exit status). + UIApplication* application = [UIApplication sharedApplication]; + [application _terminateWithStatus:exitStatus]; + + exit(exitStatus); +} + +@end + + +namespace crashpad { +namespace test { + +void IOSLaunchApplicationAndRunTests(int argc, char* argv[]) { + @autoreleasepool { + int exit_status = + UIApplicationMain(argc, argv, nil, @"CrashpadUnitTestDelegate"); + exit(exit_status); + } +} + +} // namespace crashpad +} // namespace test
diff --git a/third_party/crc32c/BUILD.gn b/third_party/crc32c/BUILD.gn index e8312a9..5ea81e4 100644 --- a/third_party/crc32c/BUILD.gn +++ b/third_party/crc32c/BUILD.gn
@@ -93,9 +93,7 @@ } } - deps = [ - ":crc32c_internal_headers", - ] + deps = [ ":crc32c_internal_headers" ] } source_set("crc32c_arm64") { @@ -130,9 +128,7 @@ } } - deps = [ - ":crc32c_internal_headers", - ] + deps = [ ":crc32c_internal_headers" ] } source_set("crc32c_internal_headers") { @@ -170,9 +166,7 @@ if (enable_google_benchmarks) { test("crc32c_benchmark") { - sources = [ - "src/src/crc32c_benchmark.cc", - ] + sources = [ "src/src/crc32c_benchmark.cc" ] configs += [ ":crc32c_config" ] deps = [ ":crc32c",
diff --git a/third_party/harfbuzz-ng/README.chromium b/third_party/harfbuzz-ng/README.chromium index f9dae6a..d31652a 100644 --- a/third_party/harfbuzz-ng/README.chromium +++ b/third_party/harfbuzz-ng/README.chromium
@@ -1,9 +1,9 @@ Name: harfbuzz-ng Short Name: harfbuzz-ng URL: http://harfbuzz.org -Version: 2.6.4-9 -Date: 20191111 -Revision: 64a45be5198f6e22c91454bda7bd9a9294552dff +Version: 2.6.4-38 +Date: 20200113 +Revision: 82545c5e2ba2067f2eb117c7358ed6d5b50ca942 Security Critical: yes License: MIT License File: src/COPYING
diff --git a/third_party/ijar/BUILD.gn b/third_party/ijar/BUILD.gn index ea4eb4d..127fb96 100644 --- a/third_party/ijar/BUILD.gn +++ b/third_party/ijar/BUILD.gn
@@ -20,9 +20,7 @@ "zlib_client.h", ] - deps = [ - "//third_party/zlib", - ] + deps = [ "//third_party/zlib" ] # Always build release since this is a build tool. if (is_debug) {
diff --git a/third_party/jsoncpp/BUILD.gn b/third_party/jsoncpp/BUILD.gn index fd203e9..af4a1f1 100644 --- a/third_party/jsoncpp/BUILD.gn +++ b/third_party/jsoncpp/BUILD.gn
@@ -53,13 +53,9 @@ if (build_with_chromium) { fuzzer_test("jsoncpp_fuzzer") { - sources = [ - "fuzzers/json_fuzzer.cc", - ] + sources = [ "fuzzers/json_fuzzer.cc" ] - deps = [ - ":jsoncpp", - ] + deps = [ ":jsoncpp" ] include_dirs = [ "generated" ]
diff --git a/third_party/libjingle_xmpp/BUILD.gn b/third_party/libjingle_xmpp/BUILD.gn index 5c8e824..fc6ddbb 100644 --- a/third_party/libjingle_xmpp/BUILD.gn +++ b/third_party/libjingle_xmpp/BUILD.gn
@@ -51,12 +51,8 @@ "xmllite/xmlprinter.h", ] - deps = [ - "//base", - ] - public_deps = [ - "//third_party/expat", - ] + deps = [ "//base" ] + public_deps = [ "//third_party/expat" ] all_dependent_configs = [ ":libjingle_xmpp_common_config" ] } @@ -111,12 +107,8 @@ } fuzzer_test("libjingle_xmpp_xmlparser_fuzzer") { - sources = [ - "xmllite/xmlparser_fuzzer.cc", - ] - deps = [ - ":libjingle_xmpp", - ] + sources = [ "xmllite/xmlparser_fuzzer.cc" ] + deps = [ ":libjingle_xmpp" ] } test("libjingle_xmpp_unittests") {
diff --git a/third_party/libvpx/BUILD.gn b/third_party/libvpx/BUILD.gn index 599b9d1..31a26e5 100644 --- a/third_party/libvpx/BUILD.gn +++ b/third_party/libvpx/BUILD.gn
@@ -267,9 +267,7 @@ gen_file = get_label_info("//third_party/libvpx/source/libvpx", "root_gen_dir") + "/{{source_root_relative_dir}}/{{source_file_part}}.S" - outputs = [ - gen_file, - ] + outputs = [ gen_file ] if (is_ios) { ads2gas_script = "//third_party/libvpx/source/libvpx/build/make/ads2gas_apple.pl" @@ -300,9 +298,7 @@ include_dirs = [ get_label_info("//third_party/libvpx/source/libvpx", "target_gen_dir") ] } - deps = [ - ":convert_arm_assembly", - ] + deps = [ ":convert_arm_assembly" ] } }
diff --git a/third_party/libwebp/BUILD.gn b/third_party/libwebp/BUILD.gn index 95117103..7721d38 100644 --- a/third_party/libwebp/BUILD.gn +++ b/third_party/libwebp/BUILD.gn
@@ -84,9 +84,7 @@ } static_library("libwebp_demux") { - sources = [ - "src/demux/demux.c", - ] + sources = [ "src/demux/demux.c" ] all_dependent_configs = [ ":libwebp_config" ] configs += [ ":libwebp_config_internal" ] configs -= [ "//build/config/compiler:chromium_code" ] @@ -377,9 +375,7 @@ public_configs = [ ":libwebp_utils_warnings" ] - deps = [ - ":libwebp_webp", - ] + deps = [ ":libwebp_webp" ] } group("libwebp") { @@ -391,9 +387,7 @@ ":libwebp_mux", ":libwebp_utils", ] - public_deps = [ - ":libwebp_webp", - ] + public_deps = [ ":libwebp_webp" ] public_configs = [ ":libwebp_config" ] if (use_dsp_neon) { deps += [ ":libwebp_dsp_neon" ] @@ -438,9 +432,7 @@ configs += [ "//build/config/compiler:optimize_max" ] } - deps = [ - ":libwebp_webp", - ] + deps = [ ":libwebp_webp" ] configs += [ ":libwebp_config" ] configs += [ ":libwebp_config_internal" ] visibility = [ ":*" ] @@ -565,9 +557,7 @@ # Eliminated need for cflags_cc. fuzzer_test("libwebp_simple_api_fuzzer") { - sources = [ - "fuzzing/fuzz_simple_api.cc", - ] + sources = [ "fuzzing/fuzz_simple_api.cc" ] dict = "fuzzing/fuzz.dict" seed_corpus = "fuzzing/fuzz_seed_corpus" deps = [ @@ -580,9 +570,7 @@ } fuzzer_test("libwebp_advanced_api_fuzzer") { - sources = [ - "fuzzing/fuzz_advanced_api.cc", - ] + sources = [ "fuzzing/fuzz_advanced_api.cc" ] dict = "fuzzing/fuzz.dict" seed_corpus = "fuzzing/fuzz_seed_corpus" deps = [ @@ -611,9 +599,7 @@ } fuzzer_test("libwebp_demux_api_fuzzer") { - sources = [ - "fuzzing/fuzz_demux_api.cc", - ] + sources = [ "fuzzing/fuzz_demux_api.cc" ] dict = "fuzzing/fuzz.dict" seed_corpus = "fuzzing/fuzz_seed_corpus" deps = [ @@ -626,9 +612,7 @@ } fuzzer_test("libwebp_enc_dec_api_fuzzer") { - sources = [ - "fuzzing/fuzz_webp_enc_dec.cc", - ] + sources = [ "fuzzing/fuzz_webp_enc_dec.cc" ] dict = "fuzzing/fuzz.dict" seed_corpus = "fuzzing/fuzz_seed_corpus" deps = [
diff --git a/third_party/lzma_sdk/BUILD.gn b/third_party/lzma_sdk/BUILD.gn index b0329b8..34b10ac5 100644 --- a/third_party/lzma_sdk/BUILD.gn +++ b/third_party/lzma_sdk/BUILD.gn
@@ -90,9 +90,7 @@ "XzDec.c", ] - deps = [ - ":lzma_sdk", - ] + deps = [ ":lzma_sdk" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [
diff --git a/third_party/lzma_sdk/Util/SfxSetup/BUILD.gn b/third_party/lzma_sdk/Util/SfxSetup/BUILD.gn index d1380450..95b4b582 100644 --- a/third_party/lzma_sdk/Util/SfxSetup/BUILD.gn +++ b/third_party/lzma_sdk/Util/SfxSetup/BUILD.gn
@@ -15,7 +15,5 @@ ".", "../..", ] - public_deps = [ - "//third_party/lzma_sdk:lzma_sdk", - ] + public_deps = [ "//third_party/lzma_sdk:lzma_sdk" ] }
diff --git a/third_party/openh264/BUILD.gn b/third_party/openh264/BUILD.gn index cdb946f6..62102fca 100644 --- a/third_party/openh264/BUILD.gn +++ b/third_party/openh264/BUILD.gn
@@ -159,9 +159,7 @@ configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ ":config" ] - deps = [ - ":common", - ] + deps = [ ":common" ] if (use_assembler) { defines = [ "X86_ASM" ] deps += [ ":openh264_processing_yasm" ]
diff --git a/third_party/ots/BUILD.gn b/third_party/ots/BUILD.gn index 55c03bb..08ff4f8 100644 --- a/third_party/ots/BUILD.gn +++ b/third_party/ots/BUILD.gn
@@ -87,12 +87,8 @@ } fuzzer_test("ots_fuzzer") { - sources = [ - "fuzz/ots_fuzzer.cc", - ] - deps = [ - ":ots", - ] + sources = [ "fuzz/ots_fuzzer.cc" ] + deps = [ ":ots" ] libfuzzer_options = [ "max_len=16800" ] seed_corpus = "//third_party/harfbuzz-ng/fuzz/seed_corpus" }
diff --git a/third_party/protobuf/BUILD.gn b/third_party/protobuf/BUILD.gn index a9750425..8f804d6 100644 --- a/third_party/protobuf/BUILD.gn +++ b/third_party/protobuf/BUILD.gn
@@ -138,12 +138,8 @@ # component will result in an immediate crash. (crbug.com/700120) if (is_component_build && is_desktop_linux) { shared_library("mirclient") { - inputs = [ - "mirclient.map", - ] - sources = [ - "mirclient.cc", - ] + inputs = [ "mirclient.map" ] + sources = [ "mirclient.cc" ] ldflags = [ "-Wl,--version-script=" + rebase_path("//third_party/protobuf/mirclient.map", root_build_dir) ] @@ -187,9 +183,7 @@ cflags = protobuf_lite_cflags if (is_component_build && is_desktop_linux) { - deps = [ - ":mirclient", - ] + deps = [ ":mirclient" ] } # Required for component builds. See http://crbug.com/172800. @@ -227,6 +221,10 @@ # Not included in production code. "//chrome/test:usage_time_limit_unittests", + # Catapult converts protos to JSON. Only used in tests. + "//third_party/catapult/tracing/tracing:histogram", + "//third_party/catapult/tracing/tracing:proto_test_driver", + # The protobuf-based SQLite and GPU fuzzers need protobuf_full and are not # included in Chrome. "//third_party/sqlite:sqlite3_lpm_corpus_gen", @@ -352,9 +350,7 @@ "src/google/protobuf/wrappers.pb.h", ] - deps = [ - "//third_party/zlib", - ] + deps = [ "//third_party/zlib" ] if (is_android) { libs = [ "log" ] # Used by src/google/protobuf/stubs/common.cc @@ -582,15 +578,11 @@ cflags = protobuf_lite_cflags - public_deps = [ - ":protobuf_full", - ] + public_deps = [ ":protobuf_full" ] } executable("protoc") { - sources = [ - "src/google/protobuf/compiler/main.cc", - ] + sources = [ "src/google/protobuf/compiler/main.cc" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] @@ -609,21 +601,13 @@ google_python_dir = "$root_out_dir/pyproto/google" copy("copy_google") { - sources = [ - "__init__.py", - ] - outputs = [ - "$google_python_dir/{{source_file_part}}", - ] + sources = [ "__init__.py" ] + outputs = [ "$google_python_dir/{{source_file_part}}" ] } copy("copy_six") { - sources = [ - "third_party/six/six.py", - ] - outputs = [ - "$google_python_dir/third_party/six/{{source_file_part}}", - ] + sources = [ "third_party/six/six.py" ] + outputs = [ "$google_python_dir/third_party/six/{{source_file_part}}" ] } copy("copy_google_protobuf") { @@ -650,9 +634,7 @@ # descriptor_pb2.py. "python/google/protobuf/descriptor_pb2.py", ] - outputs = [ - "$google_python_dir/protobuf/{{source_file_part}}", - ] + outputs = [ "$google_python_dir/protobuf/{{source_file_part}}" ] } copy("copy_google_protobuf_internal") { @@ -671,9 +653,7 @@ "python/google/protobuf/internal/well_known_types.py", "python/google/protobuf/internal/wire_format.py", ] - outputs = [ - "$google_python_dir/protobuf/internal/{{source_file_part}}", - ] + outputs = [ "$google_python_dir/protobuf/internal/{{source_file_part}}" ] } # Build time dependency for action rules. @@ -688,9 +668,7 @@ # Runtime dependency if the target needs the python scripts. group("py_proto_runtime") { - deps = [ - ":py_proto", - ] + deps = [ ":py_proto" ] # Targets that depend on this should depend on the copied data files. data = get_target_outputs(":copy_google")
diff --git a/third_party/protobuf/proto_library.gni b/third_party/protobuf/proto_library.gni index 3591b53b..f552894c 100644 --- a/third_party/protobuf/proto_library.gni +++ b/third_party/protobuf/proto_library.gni
@@ -311,12 +311,8 @@ } # System protoc is not used so it's necessary to build a chromium one. - inputs = [ - _protoc_path, - ] - deps = [ - _protoc_label, - ] + inputs = [ _protoc_path ] + deps = [ _protoc_label ] if (generate_with_plugin) { inputs += [ plugin_path ] @@ -485,16 +481,12 @@ inputs = invoker.inputs - deps = [ - _protoc_label, - ] + deps = [ _protoc_label ] if (defined(invoker.deps)) { deps += invoker.deps } - outputs = [ - invoker.output_pattern, - ] + outputs = [ invoker.output_pattern ] args = [ "--protoc",
diff --git a/third_party/unrar/BUILD.gn b/third_party/unrar/BUILD.gn index 5716ad0..96756a8a 100644 --- a/third_party/unrar/BUILD.gn +++ b/third_party/unrar/BUILD.gn
@@ -100,7 +100,5 @@ "UNRAR_NO_EXCEPTIONS", ] - deps = [ - "//base", - ] + deps = [ "//base" ] }
diff --git a/third_party/woff2/BUILD.gn b/third_party/woff2/BUILD.gn index 17e3b29..fa70960 100644 --- a/third_party/woff2/BUILD.gn +++ b/third_party/woff2/BUILD.gn
@@ -28,9 +28,7 @@ configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] - deps = [ - "//third_party/brotli:dec", - ] + deps = [ "//third_party/brotli:dec" ] public_configs = [ ":woff2_includes" ]
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 0327b1e..4028b292 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -5967,6 +5967,7 @@ <int value="0" label="Specifics have a GUID"/> <int value="1" label="originator_client_item_id is a valid GUID"/> <int value="2" label="GUID field left empty"/> + <int value="3" label="GUID was inferred"/> </enum> <enum name="BookmarkLaunchLocation"> @@ -8017,6 +8018,9 @@ </enum> <enum name="CheckerImagingDecision"> + <obsolete> + Removed from code Jan 2020. + </obsolete> <int value="0" label="Can decode asynchronously."/> <int value="1" label="Image is animated."/> <int value="2" label="Image is a video frame."/> @@ -25905,6 +25909,7 @@ <int value="3124" label="WebkitBoxPackCenterDoesSomething"/> <int value="3125" label="WebkitBoxPackEndDoesSomething"/> <int value="3126" label="V8KeyframeEffect_Constructor"/> + <int value="3127" label="WebNfcAPI"/> </enum> <enum name="FeaturePolicyAllowlistType"> @@ -52970,6 +52975,7 @@ <int value="14" label="Storage corrupt"/> <int value="15" label="Renderer shutdown"/> <int value="16" label="Successful - cached, but invalidated on server"/> + <int value="17" label="GCM Sender ID provided, but disallowed"/> </enum> <enum name="PushUnregistrationReason"> @@ -54403,6 +54409,9 @@ <int value="7" label="Parent node not found locally when processing a conflict"/> <int value="8" label="Failed to create a bookmark"/> + <int value="9" + label="The bookmark's GUID did not match the originator client item ID + or client tag"/> </enum> <enum name="RemoteHungProcessTerminateReason">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index d0d5f91..9d44acb 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -24187,6 +24187,9 @@ <histogram name="Compositing.Renderer.CheckerImagingDecision" enum="CheckerImagingDecision" expires_after="M81"> + <obsolete> + Deprecated 01/2020. + </obsolete> <owner>khushalsagar@chromium.org</owner> <summary> The outcome for whether an image could be sucessfully deferred for @@ -152014,7 +152017,7 @@ </histogram> <histogram name="Sync.DirectoryVsPrefsConsistency" - enum="SyncDirectoryVsPrefsConsistency" expires_after="2020-01-26"> + enum="SyncDirectoryVsPrefsConsistency" expires_after="2020-07-26"> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> <summary> @@ -160846,7 +160849,6 @@ enum="UnifiedConsentSyncAndGoogleServicesSettings" expires_after="2019-12-21"> <owner>msarda@chromium.org</owner> - <owner>tangltom@chromium.org</owner> <owner>droger@chromium.org</owner> <summary> State of the user settings for Sync and Google services, recorded at @@ -160858,8 +160860,9 @@ <histogram name="UnifiedConsent.SyncAndGoogleServicesSettings.AfterAdvancedOptIn.SyncDataTypesOff" enum="UnifiedConsentSyncDataTypesOffAfterAdvancedOptIn" - expires_after="2020-01-31"> - <owner>tangltom@chromium.org</owner> + expires_after="never"> +<!-- expires-never: Core metric for monitoring sync data types. --> + <owner>droger@chromium.org</owner> <owner>msarda@chromium.org</owner> <summary> @@ -169091,8 +169094,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.ActiveRender" enum="Boolean" - expires_after="M81"> + expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs a value indicating whether the WebRTC echo canceller detects that there is active content in the render signal. A new value is @@ -169100,8 +169104,10 @@ </summary> </histogram> -<histogram name="WebRTC.Audio.EchoCanceller.BufferDelay" units="Blocks"> +<histogram name="WebRTC.Audio.EchoCanceller.BufferDelay" units="Blocks" + expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs the applied render buffer delay used in the WebRTC echo canceller. A new value is logged every 10 seconds and the logged value @@ -169110,8 +169116,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.CaptureSaturation" enum="Boolean" - expires_after="M84"> + expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs a value every time the WebRTC echo canceller has detected saturation in the capture signal. A new value is logged every 10 @@ -169121,8 +169128,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.Clockdrift" enum="ClockdriftLevel" - expires_after="2019-11-30"> + expires_after="2020-12-01"> <owner>gustaf@chromium.org</owner> + <owner>peah@chromium.org</owner> <summary> This histogram logs whether clockdrift is detected in the WebRTC echo canceller. A new value is logged every 10 seconds. @@ -169131,6 +169139,9 @@ <histogram name="WebRTC.Audio.EchoCanceller.ComfortNoiseBand0" units="dBFS (negated)" expires_after="M81"> + <obsolete> + Deprecated in M81 as the metric is no longer used for analysis. + </obsolete> <owner>peah@chromium.org</owner> <summary> This histogram logs the level of the comfort noise in the WebRTC echo @@ -169140,6 +169151,9 @@ <histogram name="WebRTC.Audio.EchoCanceller.ComfortNoiseBand1" units="dBFS (negated)" expires_after="M81"> + <obsolete> + Deprecated in M81 as the metric is no longer used for analysis. + </obsolete> <owner>peah@chromium.org</owner> <summary> This histogram logs the level of the comfort noise in the WebRTC echo @@ -169148,8 +169162,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.DelayChanges" - enum="WebRTCEventFrequency" expires_after="2020-05-31"> + enum="WebRTCEventFrequency" expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs the frequency of echo path delay changes that are detected by the delay estimator in the WebRTC echo canceller. A new value is @@ -169159,8 +169174,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.EchoPathDelay" units="Blocks" - expires_after="2020-05-31"> + expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs the estimated echo path delay in 64 sample blocks as seen by the delay estimator in the WebRTC echo canceller. A new value is @@ -169170,8 +169186,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.Erl" units="dB (shifted)" - expires_after="M81"> + expires_after="2020-12-01"> <owner>gustaf@chromium.org</owner> + <owner>peah@chromium.org</owner> <summary> This histogram logs the echo return loss achieved by the WebRTC echo canceller as described in ITU G.168. When the echo canceller is being used, @@ -169180,8 +169197,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.ErlBand0" units="dB (shifted)" - expires_after="M81"> + expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs the echo return loss achieved by the WebRTC echo canceller in the lower 4 kHz. A new value is logged every 10 seconds. @@ -169189,8 +169207,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.ErlBand1" units="dB (shifted)" - expires_after="M81"> + expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs the echo return loss achieved by the WebRTC echo canceller between 4 and 8 kHz. A new value is logged every 10 seconds. @@ -169198,8 +169217,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.Erle" units="dB" - expires_after="M81"> + expires_after="2020-12-01"> <owner>gustaf@chromium.org</owner> + <owner>peah@chromium.org</owner> <summary> This histogram logs the echo return loss enhancement achieved by the WebRTC echo canceller as described in ITU G.168. When the echo canceller is being @@ -169208,8 +169228,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.ErleBand0" units="dB (shifted)" - expires_after="M81"> + expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs the echo return loss enhancement achieved by the WebRTC echo canceller in the lower 4 kHz. A new value is logged every 10 seconds. @@ -169217,8 +169238,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.ErleBand1" units="dB (shifted)" - expires_after="M81"> + expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs the echo return loss enhancement achieved by the WebRTC echo canceller between 4 and 8 kHz. A new value is logged every 10 seconds. @@ -169226,8 +169248,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.FilterDelay" units="Blocks" - expires_after="M84"> + expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs the estimated echo path delay in 64 sample blocks as seen by the linear filter delay in the WebRTC echo canceller. The value 0 @@ -169239,7 +169262,7 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.MaxCaptureJitter" - units="frames (10 ms)" expires_after="2020-05-01"> + units="frames (10 ms)" expires_after="2020-12-01"> <owner>peah@chromium.org</owner> <owner>gustaf@chromium.org</owner> <summary> @@ -169249,7 +169272,7 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.MaxRenderJitter" - units="frames (10 ms)" expires_after="2020-05-01"> + units="frames (10 ms)" expires_after="2020-12-01"> <owner>peah@chromium.org</owner> <owner>gustaf@chromium.org</owner> <summary> @@ -169259,8 +169282,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.MaxSkewShiftCount" - units="events/minute"> + units="events/minute" expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs the number of times per minute that the WebRTC echo canceller detects a shift in the skew between the total number of render and @@ -169275,7 +169299,7 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.MinCaptureJitter" - units="frames (10 ms)" expires_after="2020-05-01"> + units="frames (10 ms)" expires_after="2020-12-01"> <owner>peah@chromium.org</owner> <owner>gustaf@chromium.org</owner> <summary> @@ -169285,7 +169309,7 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.MinRenderJitter" - units="frames (10 ms)" expires_after="2020-05-01"> + units="frames (10 ms)" expires_after="2020-12-01"> <owner>peah@chromium.org</owner> <owner>gustaf@chromium.org</owner> <summary> @@ -169295,8 +169319,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.ModelBasedAecFeasible" - enum="Boolean"> + enum="Boolean" expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs a value every time the WebRTC echo canceller deems that echo path is possible to model using any of the the echo canceller echo path @@ -169306,8 +169331,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.ReliableDelayEstimates" - enum="WebRTCAecDelayEstimateReliability" expires_after="M84"> + enum="WebRTCAecDelayEstimateReliability" expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs the assessed reliability of the delay estimates produced by the delay estimator in the WebRTC echo canceller. A new value is logged @@ -169317,8 +169343,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.RenderOverruns" - enum="WebRTCEventFrequency" expires_after="2020-05-31"> + enum="WebRTCEventFrequency" expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs the frequency of overruns in the render buffer of the WebRTC echo canceller. A new value is logged every 10 seconds and the logged @@ -169327,8 +169354,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.RenderUnderruns" - enum="WebRTCEventFrequency" expires_after="2020-06-07"> + enum="WebRTCEventFrequency" expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs the frequency of underruns in the render buffer of the WebRTC echo canceller. A new value is logged every 10 seconds and the logged @@ -169337,7 +169365,10 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.SuppressorGainBand0" - units="dB (negated)" expires_after="M81"> + units="dB (negated)" expires_after="2020-12-01"> + <obsolete> + Deprecated in M81 as the metric is no longer used for analysis. + </obsolete> <owner>peah@chromium.org</owner> <summary> This histogram logs the echo suppressor gain in the WebRTC echo canceller in @@ -169346,7 +169377,10 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.SuppressorGainBand1" - units="dB (negated)" expires_after="M81"> + units="dB (negated)" expires_after="2020-12-01"> + <obsolete> + Deprecated in M81 as the metric is no longer used for analysis. + </obsolete> <owner>peah@chromium.org</owner> <summary> This histogram logs the echo suppressor gain in the WebRTC echo canceller @@ -169355,8 +169389,9 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.UsableLinearEstimate" - enum="Boolean" expires_after="M84"> + enum="Boolean" expires_after="2020-12-01"> <owner>peah@chromium.org</owner> + <owner>saza@chromium.org</owner> <summary> This histogram logs a value every time the WebRTC echo canceller deems that the linear filter in the echo canceller is sufficiently well adapted to be @@ -169962,8 +169997,14 @@ </histogram> <histogram name="WebRTC.PeerConnection.CallSetupState.AnswererState" - enum="PeerConnectionAnswererState" expires_after="M82"> + enum="PeerConnectionAnswererState" expires_after="M80"> + <obsolete> + These metrics were useful when Unified Plan was made the default SDP + semantics. They will again become useful when Plan B is becoming deprecated. + Until then, these are of little value and are temporarily disabled. + </obsolete> <owner>hbos@chromium.org</owner> + <owner>hta@chromium.org</owner> <summary> Setting up a call involves a number of steps; this enum describes which "answerer step" the peer connection reached in its most successful @@ -169972,8 +170013,14 @@ </histogram> <histogram name="WebRTC.PeerConnection.CallSetupState.CallSetupState" - enum="PeerConnectionCallSetupState" expires_after="2020-06-28"> + enum="PeerConnectionCallSetupState" expires_after="M80"> + <obsolete> + These metrics were useful when Unified Plan was made the default SDP + semantics. They will again become useful when Plan B is becoming deprecated. + Until then, these are of little value and are temporarily disabled. + </obsolete> <owner>hbos@chromium.org</owner> + <owner>hta@chromium.org</owner> <summary> Setting up a call involves a number of steps; this enum describes the status of the most successful attempt. See blink::CallSetupState for more @@ -169982,8 +170029,14 @@ </histogram> <histogram name="WebRTC.PeerConnection.CallSetupState.OffererState" - enum="PeerConnectionOffererState" expires_after="2020-06-28"> + enum="PeerConnectionOffererState" expires_after="M80"> + <obsolete> + These metrics were useful when Unified Plan was made the default SDP + semantics. They will again become useful when Plan B is becoming deprecated. + Until then, these are of little value and are temporarily disabled. + </obsolete> <owner>hbos@chromium.org</owner> + <owner>hta@chromium.org</owner> <summary> Setting up a call involves a number of steps; this enum describes which "answerer step" the peer connection reached in its most successful @@ -169992,8 +170045,14 @@ </histogram> <histogram name="WebRTC.PeerConnection.CallSetupStateWithGum.AnswererState" - enum="PeerConnectionAnswererState" expires_after="M81"> + enum="PeerConnectionAnswererState" expires_after="M80"> + <obsolete> + These metrics were useful when Unified Plan was made the default SDP + semantics. They will again become useful when Plan B is becoming deprecated. + Until then, these are of little value and are temporarily disabled. + </obsolete> <owner>hbos@chromium.org</owner> + <owner>hta@chromium.org</owner> <summary> Setting up a call involves a number of steps; this enum describes which "answerer step" the peer connection reached in its most successful @@ -170005,8 +170064,14 @@ </histogram> <histogram name="WebRTC.PeerConnection.CallSetupStateWithGum.CallSetupState" - enum="PeerConnectionCallSetupState" expires_after="M81"> + enum="PeerConnectionCallSetupState" expires_after="M80"> + <obsolete> + These metrics were useful when Unified Plan was made the default SDP + semantics. They will again become useful when Plan B is becoming deprecated. + Until then, these are of little value and are temporarily disabled. + </obsolete> <owner>hbos@chromium.org</owner> + <owner>hta@chromium.org</owner> <summary> Setting up a call involves a number of steps; this enum describes the status of the most successful attempt. See blink::CallSetupState for more @@ -170018,8 +170083,14 @@ </histogram> <histogram name="WebRTC.PeerConnection.CallSetupStateWithGum.OffererState" - enum="PeerConnectionOffererState" expires_after="M81"> + enum="PeerConnectionOffererState" expires_after="M80"> + <obsolete> + These metrics were useful when Unified Plan was made the default SDP + semantics. They will again become useful when Plan B is becoming deprecated. + Until then, these are of little value and are temporarily disabled. + </obsolete> <owner>hbos@chromium.org</owner> + <owner>hta@chromium.org</owner> <summary> Setting up a call involves a number of steps; this enum describes which "answerer step" the peer connection reached in its most successful
diff --git a/tools/perf/BUILD.gn b/tools/perf/BUILD.gn index c4736fa..6875704 100644 --- a/tools/perf/BUILD.gn +++ b/tools/perf/BUILD.gn
@@ -5,9 +5,7 @@ # Keep in sync with group("perf_without_chrome"). group("perf") { testonly = true - deps = [ - "//tools/perf/chrome_telemetry_build:telemetry_chrome_test", - ] + deps = [ "//tools/perf/chrome_telemetry_build:telemetry_chrome_test" ] data = [ "//tools/perf/", @@ -35,9 +33,7 @@ # Runs a script which generates the ad tagging ruleset. if (!is_ios) { - data_deps = [ - "//components/subresource_filter/tools:index_ruleset", - ] + data_deps = [ "//components/subresource_filter/tools:index_ruleset" ] } } @@ -89,8 +85,6 @@ # Runs a script which generates the ad tagging ruleset. if (!is_ios) { - data_deps = [ - "//components/subresource_filter/tools:index_ruleset", - ] + data_deps = [ "//components/subresource_filter/tools:index_ruleset" ] } }
diff --git a/tools/perf/clear_system_cache/BUILD.gn b/tools/perf/clear_system_cache/BUILD.gn index dd4db91..87d8a31b 100644 --- a/tools/perf/clear_system_cache/BUILD.gn +++ b/tools/perf/clear_system_cache/BUILD.gn
@@ -5,9 +5,7 @@ executable("clear_system_cache") { testonly = true - sources = [ - "clear_system_cache_main.cc", - ] + sources = [ "clear_system_cache_main.cc" ] deps = [ "//base",
diff --git a/tools/perf/cli_tools/pinboard/pinboard.py b/tools/perf/cli_tools/pinboard/pinboard.py index edf59783..4ec71bf 100644 --- a/tools/perf/cli_tools/pinboard/pinboard.py +++ b/tools/perf/cli_tools/pinboard/pinboard.py
@@ -58,22 +58,23 @@ # Compute averages over a fixed set of active stories. These may need to be # periodically updated. ACTIVE_STORIES = set([ - 'browse:chrome:newtab', - 'browse:chrome:omnibox', - 'browse:media:facebook_photos', + 'browse:chrome:newtab:2019', + 'browse:chrome:omnibox:2019', + 'browse:media:facebook_photos:2019', 'browse:media:googleplaystore:2019', - 'browse:media:imgur', - 'browse:media:youtube', - 'browse:news:cricbuzz', - 'browse:news:toi', - 'browse:shopping:amazon', - 'browse:shopping:lazada', - 'browse:social:facebook', - 'browse:social:instagram', - 'browse:tools:maps', - 'load:media:facebook_photos', + 'browse:media:imgur:2019', + 'browse:media:youtube:2019', + 'browse:news:cricbuzz:2019', + 'browse:news:globo:2019', + 'browse:news:toi:2019', + 'browse:shopping:amazon:2019', + 'browse:shopping:lazada:2019', + 'browse:social:facebook:2019', + 'browse:social:instagram:2019', + 'browse:tools:maps:2019', + 'load:media:facebook_photos:2019', 'load:media:youtube:2018', - 'load:news:irctc', + 'load:news:irctc:2019', 'load:news:wikipedia:2018', 'intent:coldish:bbc', 'Speedometer2',
diff --git a/tools/polymer/polymer.gni b/tools/polymer/polymer.gni index 417ccf0c..dacf563 100644 --- a/tools/polymer/polymer.gni +++ b/tools/polymer/polymer.gni
@@ -24,9 +24,7 @@ action(target_name + "_module") { script = "//tools/polymer/polymer.py" - inputs = [ - invoker.html_file, - ] + inputs = [ invoker.html_file ] if (invoker.html_type == "dom-module" || invoker.html_type == "v3-ready") { inputs += [ invoker.js_file ] @@ -36,9 +34,7 @@ if (invoker.html_type == "dom-module") { output_js_file = get_path_info(invoker.js_file, "name") + ".m.js" } - outputs = [ - "$target_gen_dir/" + output_js_file, - ] + outputs = [ "$target_gen_dir/" + output_js_file ] args = [ "--js_file",
diff --git a/tools/v8_context_snapshot/BUILD.gn b/tools/v8_context_snapshot/BUILD.gn index 7cd1597a..400a2de 100644 --- a/tools/v8_context_snapshot/BUILD.gn +++ b/tools/v8_context_snapshot/BUILD.gn
@@ -19,13 +19,9 @@ group("v8_context_snapshot") { if (use_v8_context_snapshot) { - public_deps = [ - ":generate_v8_context_snapshot", - ] + public_deps = [ ":generate_v8_context_snapshot" ] if (!is_android) { - data = [ - "$root_out_dir/v8_context_snapshot.bin", - ] + data = [ "$root_out_dir/v8_context_snapshot.bin" ] } } } @@ -39,9 +35,7 @@ if (use_v8_context_snapshot) { if (is_android && enable_java_templates) { android_assets("v8_context_snapshot_assets") { - deps = [ - ":v8_context_snapshot", - ] + deps = [ ":v8_context_snapshot" ] renaming_sources = [ "$root_out_dir/v8_context_snapshot.bin" ] if (current_cpu == "arm" || current_cpu == "x86" || current_cpu == "mipsel") { @@ -67,24 +61,18 @@ "--output_file=$output_path", ] - deps = [ - ":v8_context_snapshot_generator($v8_snapshot_toolchain)", - ] + deps = [ ":v8_context_snapshot_generator($v8_snapshot_toolchain)" ] if (is_component_build) { # In component builds, this forces the generator to rerun whenever the v8 # shared library is rebuilt. Without it would only regenerate if the # generator itself was rebuilt. - inputs = [ - "$root_out_dir/${shlib_prefix}v8${shlib_extension}", - ] + inputs = [ "$root_out_dir/${shlib_prefix}v8${shlib_extension}" ] deps += [ "//v8" ] } - outputs = [ - output_file, - ] + outputs = [ output_file ] } # This config disables a link time optimization "ICF", which may merge different @@ -102,9 +90,7 @@ } executable("v8_context_snapshot_generator") { - sources = [ - "v8_context_snapshot_generator.cc", - ] + sources = [ "v8_context_snapshot_generator.cc" ] deps = [ "//gin:gin",
diff --git a/ui/android/BUILD.gn b/ui/android/BUILD.gn index 757ded4..d7c1d21 100644 --- a/ui/android/BUILD.gn +++ b/ui/android/BUILD.gn
@@ -195,9 +195,7 @@ resource_dirs += [ "//ui/android/java/res_night" ] } - deps = [ - ":ui_strings_grd", - ] + deps = [ ":ui_strings_grd" ] } java_group("ui_java") {
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn index 97673b6..db608373 100644 --- a/ui/base/BUILD.gn +++ b/ui/base/BUILD.gn
@@ -758,9 +758,7 @@ ] } - public_deps = [ - ":base", - ] + public_deps = [ ":base" ] deps = [ "//base", "//base/test:test_config", @@ -837,21 +835,15 @@ } java_cpp_enum("ui_base_cursor_type_java_enums_srcjar") { - sources = [ - "./cursor/types/cursor_types.h", - ] + sources = [ "./cursor/types/cursor_types.h" ] } } bundle_data("ui_base_unittests_bundle_data") { testonly = true - sources = [ - "test/data/data_pack_unittest/truncated-header.pak", - ] - outputs = [ - "{{bundle_resources_dir}}/" + - "{{source_root_relative_dir}}/{{source_file_part}}", - ] + sources = [ "test/data/data_pack_unittest/truncated-header.pak" ] + outputs = [ "{{bundle_resources_dir}}/" + + "{{source_root_relative_dir}}/{{source_file_part}}" ] } # The resource labels below should not end with "_resources" or the Android @@ -867,15 +859,9 @@ copy("ui_base_test_resources_pak") { testonly = true - sources = [ - "$target_gen_dir/ui_base_test_resources.pak", - ] - outputs = [ - "$root_out_dir/ui_base_test_resources.pak", - ] - public_deps = [ - ":ui_base_test_resources_grit", - ] + sources = [ "$target_gen_dir/ui_base_test_resources.pak" ] + outputs = [ "$root_out_dir/ui_base_test_resources.pak" ] + public_deps = [ ":ui_base_test_resources_grit" ] } if (is_android) { @@ -883,27 +869,17 @@ testonly = true # Use $target_gen_dir so the associated .pak.info file is available. - sources = [ - "$target_gen_dir/ui_base_test_resources.pak", - ] - deps = [ - ":ui_base_test_resources_grit", - ] + sources = [ "$target_gen_dir/ui_base_test_resources.pak" ] + deps = [ ":ui_base_test_resources_grit" ] } } if (is_ios) { bundle_data("ui_base_test_bundle_data") { testonly = true - public_deps = [ - ":ui_base_test_resources_grit", - ] - sources = [ - "$target_gen_dir/ui_base_test_resources.pak", - ] - outputs = [ - "{{bundle_resources_dir}}/{{source_file_part}}", - ] + public_deps = [ ":ui_base_test_resources_grit" ] + sources = [ "$target_gen_dir/ui_base_test_resources.pak" ] + outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] } } @@ -1200,9 +1176,7 @@ testonly = true framework_version = "U" framework_contents = [ "Resources" ] - deps = [ - "//ui/resources:ui_test_pak_bundle_data", - ] + deps = [ "//ui/resources:ui_test_pak_bundle_data" ] info_plist = "test/framework-Info.plist" extra_substitutions = [ "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id" ] output_name = "ui_unittests Framework" @@ -1226,9 +1200,8 @@ source_set("base_interactive_ui_tests") { testonly = true if (is_win) { - sources = [ - "accelerators/global_media_keys_listener_win_interactive_test.cc", - ] + sources = + [ "accelerators/global_media_keys_listener_win_interactive_test.cc" ] deps = [ ":base",
diff --git a/ui/base/ime/chromeos/BUILD.gn b/ui/base/ime/chromeos/BUILD.gn index 379a221..4baf929 100644 --- a/ui/base/ime/chromeos/BUILD.gn +++ b/ui/base/ime/chromeos/BUILD.gn
@@ -7,9 +7,7 @@ assert(is_chromeos) source_set("ime_types") { - sources = [ - "ime_keyset.h", - ] + sources = [ "ime_keyset.h" ] } jumbo_component("chromeos") {
diff --git a/ui/base/ime/init/BUILD.gn b/ui/base/ime/init/BUILD.gn index 57c1503..0aad80f 100644 --- a/ui/base/ime/init/BUILD.gn +++ b/ui/base/ime/init/BUILD.gn
@@ -23,9 +23,7 @@ "//ui/gfx:native_widget_types", ] - deps = [ - "//ui/base", - ] + deps = [ "//ui/base" ] if (is_win) { deps += [ "//ui/base/ime/win" ]
diff --git a/ui/base/ime/linux/BUILD.gn b/ui/base/ime/linux/BUILD.gn index 6065ebc..01c9b24 100644 --- a/ui/base/ime/linux/BUILD.gn +++ b/ui/base/ime/linux/BUILD.gn
@@ -27,9 +27,7 @@ defines = [ "IS_UI_BASE_IME_LINUX_IMPL" ] - public_deps = [ - "//ui/base/ime", - ] + public_deps = [ "//ui/base/ime" ] if (use_pangocairo) { configs += [ "//build/config/linux/pangocairo" ]
diff --git a/ui/base/ime/mac/BUILD.gn b/ui/base/ime/mac/BUILD.gn index 30bab06..7d10cc82 100644 --- a/ui/base/ime/mac/BUILD.gn +++ b/ui/base/ime/mac/BUILD.gn
@@ -16,9 +16,7 @@ defines = [ "IS_UI_BASE_IME_MAC_IMPL" ] - public_deps = [ - "//ui/base/ime", - ] + public_deps = [ "//ui/base/ime" ] libs = [ "AppKit.framework" ] }
diff --git a/ui/base/ime/mojom/BUILD.gn b/ui/base/ime/mojom/BUILD.gn index c7467f1..e32beab 100644 --- a/ui/base/ime/mojom/BUILD.gn +++ b/ui/base/ime/mojom/BUILD.gn
@@ -6,21 +6,13 @@ mojom("mojom") { generate_java = true - sources = [ - "ime_types.mojom", - ] + sources = [ "ime_types.mojom" ] - public_deps = [ - "//mojo/public/mojom/base", - ] + public_deps = [ "//mojo/public/mojom/base" ] } mojom("test_interfaces") { - sources = [ - "ime_mojom_traits_test.mojom", - ] + sources = [ "ime_mojom_traits_test.mojom" ] - public_deps = [ - ":mojom", - ] + public_deps = [ ":mojom" ] }
diff --git a/ui/base/ime/win/BUILD.gn b/ui/base/ime/win/BUILD.gn index 34333cf6..4502991 100644 --- a/ui/base/ime/win/BUILD.gn +++ b/ui/base/ime/win/BUILD.gn
@@ -33,9 +33,7 @@ defines = [ "IS_UI_BASE_IME_WIN_IMPL" ] - public_deps = [ - "//ui/base/ime", - ] + public_deps = [ "//ui/base/ime" ] deps = [ "//ui/base",
diff --git a/ui/chromeos/resources/default_100_percent/fingerprint/fingerprint_scanner_laptop_bottom_left.png b/ui/chromeos/resources/default_100_percent/fingerprint/fingerprint_scanner_laptop_bottom_left.png new file mode 100644 index 0000000..573a5a8 --- /dev/null +++ b/ui/chromeos/resources/default_100_percent/fingerprint/fingerprint_scanner_laptop_bottom_left.png Binary files differ
diff --git a/ui/chromeos/resources/default_200_percent/fingerprint/fingerprint_scanner_laptop_bottom_left.png b/ui/chromeos/resources/default_200_percent/fingerprint/fingerprint_scanner_laptop_bottom_left.png new file mode 100644 index 0000000..5395473b --- /dev/null +++ b/ui/chromeos/resources/default_200_percent/fingerprint/fingerprint_scanner_laptop_bottom_left.png Binary files differ
diff --git a/ui/chromeos/resources/ui_chromeos_resources.grd b/ui/chromeos/resources/ui_chromeos_resources.grd index 1cf445b..144db7d 100644 --- a/ui/chromeos/resources/ui_chromeos_resources.grd +++ b/ui/chromeos/resources/ui_chromeos_resources.grd
@@ -92,6 +92,7 @@ <structure type="chrome_scaled_image" name="IDR_PRINT_NOTIFICATION_HELP" file="print_notification/help.png" /> <!-- Fingerprint images. --> + <structure type="chrome_scaled_image" name="IDR_LOGIN_FINGERPRINT_SCANNER_LAPTOP_BOTTOM_LEFT_ANIMATION" file="fingerprint/fingerprint_scanner_laptop_bottom_left.png" /> <structure type="chrome_scaled_image" name="IDR_LOGIN_FINGERPRINT_SCANNER_LAPTOP_BOTTOM_RIGHT_ANIMATION" file="fingerprint/fingerprint_scanner_laptop_bottom_right.png" /> <structure type="chrome_scaled_image" name="IDR_LOGIN_FINGERPRINT_SCANNER_LAPTOP_TOP_RIGHT_ANIMATION" file="fingerprint/fingerprint_scanner_laptop_top_right.png" /> <structure type="chrome_html" name="IDR_LOGIN_FINGER_PRINT_TABLET_ANIMATION" file="vector/finger_print.json" compress="gzip" />
diff --git a/ui/file_manager/BUILD.gn b/ui/file_manager/BUILD.gn index 07b064b7..10e11de 100644 --- a/ui/file_manager/BUILD.gn +++ b/ui/file_manager/BUILD.gn
@@ -48,6 +48,7 @@ "gallery/js:closure_compile", "gallery/js/image_editor:closure_compile", "image_loader:closure_compile", + "integration_tests:closure_compile", "video_player/js:closure_compile", "video_player/js/cast:closure_compile", ]
diff --git a/ui/file_manager/integration_tests/BUILD.gn b/ui/file_manager/integration_tests/BUILD.gn new file mode 100644 index 0000000..6fa2bffd --- /dev/null +++ b/ui/file_manager/integration_tests/BUILD.gn
@@ -0,0 +1,28 @@ +# Copyright 2020 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/closure_compiler/compile_js.gni") + +js_type_check("closure_compile") { + testonly = true + deps = [ + ":remote_call", + ":test_util", + "//ui/file_manager/base/js:volume_manager_types", + ] +} + +js_library("remote_call") { + testonly = true + deps = [ ":test_util" ] + externs_list = [ "$externs_path/command_line_private.js" ] +} + +js_library("test_util") { + testonly = true + externs_list = [ + "$externs_path/chrome_extensions.js", + "//ui/file_manager/externs/chrome_test.js", + ] +}
diff --git a/ui/file_manager/integration_tests/file_manager/quick_view.js b/ui/file_manager/integration_tests/file_manager/quick_view.js index ca69eb7..841efd4 100644 --- a/ui/file_manager/integration_tests/file_manager/quick_view.js +++ b/ui/file_manager/integration_tests/file_manager/quick_view.js
@@ -1277,7 +1277,8 @@ await remoteCall.fakeKeyDown(appId, ...ctrlA); // Use selection menu button to open Quick View. - await simulateUiClick(appId, '#selection-menu-button:not([hidden])'); + await remoteCall.simulateUiClick( + appId, '#selection-menu-button:not([hidden])'); // Wait because WebUI Menu ignores the following click if it happens in // <200ms from the previous click. @@ -1286,7 +1287,7 @@ // Click the Menu item to show the Quick View. const getInfoMenuItem = '#file-context-menu:not([hidden]) ' + ' [command="#get-info"]:not([hidden])'; - await simulateUiClick(appId, getInfoMenuItem); + await remoteCall.simulateUiClick(appId, getInfoMenuItem); // Check: the Quick View dialog should be shown. const caller = getCaller();
diff --git a/ui/file_manager/integration_tests/remote_call.js b/ui/file_manager/integration_tests/remote_call.js index 8e691fb..9d65335 100644 --- a/ui/file_manager/integration_tests/remote_call.js +++ b/ui/file_manager/integration_tests/remote_call.js
@@ -11,10 +11,10 @@ */ function autoStep() { window.autostep = window.autostep || false; - if (!autostep) { - autostep = true; + if (!window.autostep) { + window.autostep = true; } - if (autostep && typeof window.step == 'function') { + if (window.autostep && typeof window.step == 'function') { window.step(); } } @@ -30,7 +30,7 @@ /** * Tristate holding the cached result of isStepByStepEnabled_(). - * @type{?bool} + * @type {?boolean} */ this.cachedStepByStepEnabled_ = null; } @@ -38,7 +38,7 @@ /** * Checks whether step by step tests are enabled or not. * @private - * @return {Promise<bool>} + * @return {!Promise<boolean>} */ RemoteCall.prototype.isStepByStepEnabled_ = async function() { if (this.cachedStepByStepEnabled_ === null) { @@ -59,7 +59,7 @@ * not requiring a window. * @param {Array<*>} args Array of arguments. * @param {function(*)=} opt_callback Callback handling the function's result. - * @return {Promise} Promise to be fulfilled with the result of the remote + * @return {!Promise} Promise to be fulfilled with the result of the remote * utility. */ RemoteCall.prototype.callRemoteTestUtil = @@ -81,6 +81,7 @@ if (window.autostep !== true) { await new Promise((onFulfilled) => { console.info('Type step() to continue...'); + /** @type {?function()} */ window.step = function() { window.step = null; onFulfilled(); @@ -113,10 +114,10 @@ * @return {Promise} promise Promise to be fulfilled with a found window's ID. */ RemoteCall.prototype.waitForWindow = function(windowIdPrefix) { - var caller = getCaller(); + const caller = getCaller(); return repeatUntil(async () => { const windows = await this.callRemoteTestUtil('getWindows', null, []); - for (var id in windows) { + for (const id in windows) { if (id.indexOf(windowIdPrefix) === 0) { return id; } @@ -134,7 +135,7 @@ * success, false: failed). */ RemoteCall.prototype.closeWindowAndWait = async function(windowId) { - var caller = getCaller(); + const caller = getCaller(); // Closes the window. if (!await this.callRemoteTestUtil('closeWindow', null, [windowId])) { @@ -144,7 +145,7 @@ return repeatUntil(async () => { const windows = await this.callRemoteTestUtil('getWindows', null, []); - for (var id in windows) { + for (const id in windows) { if (id === windowId) { // Window is still available. Continues waiting. return pending( @@ -163,7 +164,7 @@ * @param {number} height Requested height in pixels. */ RemoteCall.prototype.waitForWindowGeometry = function(windowId, width, height) { - var caller = getCaller(); + const caller = getCaller(); return repeatUntil(async () => { const windows = await this.callRemoteTestUtil('getWindows', null, []); if (!windows[windowId]) { @@ -200,11 +201,12 @@ * the first element, and so on. * @param {!Array<string>} styleNames List of CSS property name to be * obtained. NOTE: Causes element style re-calculation. + * TODO(lucmult): Add a typedef for the returned object. * @return {Promise} Promise to be fulfilled when the element appears. */ RemoteCall.prototype.waitForElementStyles = function( windowId, query, styleNames) { - var caller = getCaller(); + const caller = getCaller(); return repeatUntil(async () => { const elements = await this.callRemoteTestUtil( 'deepQueryAllElements', windowId, [query, styleNames]); @@ -258,7 +260,7 @@ * @return {Promise} Promise to be fulfilled when the element is lost. */ RemoteCall.prototype.waitForElementLost = function(windowId, query) { - var caller = getCaller(); + const caller = getCaller(); return repeatUntil(async () => { const elements = await this.callRemoteTestUtil( 'deepQueryAllElements', windowId, [query]); @@ -314,7 +316,7 @@ * @return {!Promise} Promise to be fulfilled when the file had found. */ RemoteCall.prototype.waitForAFile = function(volumeType, name) { - var caller = getCaller(); + const caller = getCaller(); return repeatUntil(async () => { if ((await this.getFilesUnderVolume(volumeType, [name])).length === 1) { return true; @@ -325,14 +327,14 @@ /** * Shorthand for clicking an element. - * @param {AppWindow} appWindow Application window. + * @param {string} windowId Window id. * @param {string|!Array<string>} query Query to specify the element. * If query is an array, |query[0]| specifies the first * element(s), |query[1]| specifies elements inside the shadow DOM of * the first element, and so on. * @param {{shift: boolean, alt: boolean, ctrl: boolean}=} opt_keyModifiers * Object - * @param {Promise} Promise to be fulfilled with the clicked element. + * @return {Promise} Promise to be fulfilled with the clicked element. */ RemoteCall.prototype.waitAndClickElement = async function(windowId, query, opt_keyModifiers) { @@ -345,14 +347,14 @@ /** * Shorthand for right-clicking an element. - * @param {AppWindow} appWindow Application window. + * @param {string} windowId Window id. * @param {string|!Array<string>} query Query to specify the element. * If query is an array, |query[0]| specifies the first * element(s), |query[1]| specifies elements inside the shadow DOM of * the first element, and so on. * @param {{shift: boolean, alt: boolean, ctrl: boolean}=} opt_keyModifiers * Object - * @param {Promise} Promise to be fulfilled with the clicked element. + * @return {Promise} Promise to be fulfilled with the clicked element. */ RemoteCall.prototype.waitAndRightClick = async function(windowId, query, opt_keyModifiers) { @@ -365,9 +367,9 @@ /** * Shorthand for focusing an element. - * @param {AppWindow} appWindow Application window. + * @param {string} windowId Window id. * @param {!Array<string>} query Query to specify the element to be focused. - * @param {Promise} Promise to be fulfilled with the focused element. + * @return {Promise} Promise to be fulfilled with the focused element. */ RemoteCall.prototype.focus = async function(windowId, query) { const element = await this.waitForElement(windowId, query); @@ -377,9 +379,29 @@ }; /** + * Simulate Click in the UI in the middle of the element. + * @param{string} appId ID of the app that contains the element. NOTE: The click + * is simulated on most recent window in the window system. + * @param {string|!Array<string>} query Query to the element to be clicked. + * @return {!Promise} A promise fulfilled after the click event. + */ +RemoteCall.prototype.simulateUiClick = async function(appId, query) { + const element = /* @type {!Object} */ ( + await this.waitForElementStyles(appId, query, ['display'])); + chrome.test.assertTrue(!!element, 'element for simulateUiClick not found'); + + // Find the middle of the element. + const x = + Math.floor(element['renderedLeft'] + (element['renderedWidth'] / 2)); + const y = + Math.floor(element['renderedTop'] + (element['renderedHeight'] / 2)); + + return sendTestMessage({name: 'simulateClick', 'clickX': x, 'clickY': y}); +}; + +/** * Class to manipulate the window in the remote extension. * - * @param {string} extensionId ID of extension to be manipulated. * @extends {RemoteCall} * @constructor */ @@ -393,7 +415,7 @@ * Waits for the file list turns to the given contents. * @param {string} windowId Target window ID. * @param {Array<Array<string>>} expected Expected contents of file list. - * @param {{orderCheck:boolean=, ignoreLastModifiedTime:boolean=}=} opt_options + * @param {{orderCheck:?boolean, ignoreLastModifiedTime:?boolean}=} opt_options * Options of the comparison. If orderCheck is true, it also compares the * order of files. If ignoreLastModifiedTime is true, it compares the file * without its last modified time. @@ -402,15 +424,15 @@ */ RemoteCallFilesApp.prototype.waitForFiles = function( windowId, expected, opt_options) { - var options = opt_options || {}; - var caller = getCaller(); + const options = opt_options || {}; + const caller = getCaller(); return repeatUntil(async () => { const files = await this.callRemoteTestUtil('getFileList', windowId, []); if (!options.orderCheck) { files.sort(); expected.sort(); } - for (var i = 0; i < Math.min(files.length, expected.length); i++) { + for (let i = 0; i < Math.min(files.length, expected.length); i++) { // Change the value received from the UI to match when comparing. if (options.ignoreFileSize) { files[i][1] = expected[i][1]; @@ -443,12 +465,12 @@ */ RemoteCallFilesApp.prototype.waitForFileListChange = function( windowId, lengthBefore) { - var caller = getCaller(); + const caller = getCaller(); return repeatUntil(async () => { const files = await this.callRemoteTestUtil('getFileList', windowId, []); files.sort(); - var notReadyRows = + const notReadyRows = files.filter((row) => row.filter((cell) => cell == '...').length); if (notReadyRows.length === 0 && files.length !== lengthBefore && @@ -470,7 +492,7 @@ */ RemoteCallFilesApp.prototype.waitUntilTaskExecutes = function( windowId, taskId) { - var caller = getCaller(); + const caller = getCaller(); return repeatUntil(async () => { const executedTasks = await this.callRemoteTestUtil('getExecutedTasks', windowId, []); @@ -492,10 +514,10 @@ const result = await sendTestMessage({name: 'dispatchTabKey'}); chrome.test.assertEq(result, 'tabKeyDispatched', 'Tab key dispatch failure'); - var caller = getCaller(); + const caller = getCaller(); return repeatUntil(async () => { - var element = - await remoteCall.callRemoteTestUtil('getActiveElement', windowId, []); + const element = + await this.callRemoteTestUtil('getActiveElement', windowId, []); if (element && element.attributes['id'] === elementId) { return true; } @@ -515,7 +537,7 @@ */ RemoteCallFilesApp.prototype.waitUntilCurrentDirectoryIsChanged = function( windowId, expectedPath) { - var caller = getCaller(); + const caller = getCaller(); return repeatUntil(async () => { const path = await this.callRemoteTestUtil('getBreadcrumbPath', windowId, []); @@ -636,7 +658,6 @@ /** * Class to manipulate the window in the remote extension. * - * @param {string} extensionId ID of extension to be manipulated. * @extends {RemoteCall} * @constructor */ @@ -649,7 +670,7 @@ /** * Waits until the expected image is shown. * - * @param {document} document Document. + * @param {string} windowId Window id. * @param {number} width Expected width of the image. * @param {number} height Expected height of the image. * @param {string|null} name Expected name of the image. @@ -657,7 +678,7 @@ */ RemoteCallGallery.prototype.waitForSlideImage = function( windowId, width, height, name) { - var expected = {}; + const expected = {}; if (width) { expected.width = width; } @@ -667,15 +688,15 @@ if (name) { expected.name = name; } - var caller = getCaller(); + const caller = getCaller(); return repeatUntil(async () => { - var query = '.gallery[mode="slide"] .image-container > .image'; + const query = '.gallery[mode="slide"] .image-container > .image'; const [nameBox, image] = await Promise.all([ this.waitForElement(windowId, '#rename-input'), this.waitForElementStyles(windowId, query, ['any']) ]); - var actual = {}; + const actual = {}; if (width && image) { actual.width = image.imageWidth; } @@ -704,7 +725,7 @@ /** * Waits for the "Press Enter" message. * - * @param {AppWindow} appWindow App window. + * @param {string} appId App id. * @return {Promise} Promise to be fulfilled when the element appears. */ RemoteCallGallery.prototype.waitForPressEnterMessage = async function(appId) {
diff --git a/ui/file_manager/integration_tests/test_util.js b/ui/file_manager/integration_tests/test_util.js index 74e551d..0e583f76 100644 --- a/ui/file_manager/integration_tests/test_util.js +++ b/ui/file_manager/integration_tests/test_util.js
@@ -48,7 +48,7 @@ * Verifies if there are no Javascript errors in the given app window by * asserting the count returned by the app.getErrorCount remote call. * @param {!RemoteCall} app RemoteCall interface to the app window. - * @param {function()} callback Completion callback. + * @param {function()=} callback Completion callback. * @return {Promise} Promise to be fulfilled on completion. */ async function checkIfNoErrorsOccuredOnApp(app, callback) { @@ -113,11 +113,11 @@ /** * Returns a pending marker. See also the repeatUntil function. - * @param {string} name of test function that originated the operation, + * @param {string} caller name of test function that originated the operation, * it's the return of getCaller() function. * @param {string} message Pending reason including %s, %d, or %j markers. %j * format an object as JSON. - * @param {Array<*>} var_args Values to be assigined to %x markers. + * @param {...*} var_args Values to be assigined to %x markers. * @return {Object} Object which returns true for the expression: obj instanceof * pending. */ @@ -149,7 +149,7 @@ * Waits until the checkFunction returns a value but a pending marker. * @param {function():*} checkFunction Function to check a condition. It can * return a pending marker created by a pending function. - * @return {Promise} Promise to be fulfilled with the return value of + * @return {!Promise} Promise to be fulfilled with the return value of * checkFunction when the checkFunction reutrns a value but a pending * marker. */ @@ -230,7 +230,8 @@ const command = {'name': 'countAppWindows', 'appId': appId}; return repeatUntil(async () => { if (await sendTestMessage(command) != expectedCount) { - return pending(caller, 'waitForAppWindowCount ' + appId + ' ' + result); + return pending( + caller, 'waitForAppWindowCount ' + appId + ' ' + expectedCount); } return true; }); @@ -263,7 +264,7 @@ */ async function addEntries(volumeNames, entries, opt_callback) { if (volumeNames.length == 0) { - callback(true); + opt_callback && opt_callback(true); return; } const volumeResultPromises = volumeNames.map(function(volume) { @@ -289,33 +290,38 @@ * @enum {string} * @const */ -const EntryType = Object.freeze({ +const EntryType = { FILE: 'file', DIRECTORY: 'directory', LINK: 'link', SHARED_DRIVE: 'team_drive', COMPUTER: 'Computer' -}); +}; +Object.freeze(EntryType); /** * @enum {string} * @const */ -const SharedOption = Object.freeze({ + +const SharedOption = { NONE: 'none', SHARED: 'shared', SHARED_WITH_ME: 'sharedWithMe', NESTED_SHARED_WITH_ME: 'nestedSharedWithMe', -}); +}; +Object.freeze(SharedOption); /** * @enum {string} */ -const RootPath = Object.seal({ + +const RootPath = { DOWNLOADS: '/must-be-filled-in-test-setup', DRIVE: '/must-be-filled-in-test-setup', ANDROID_FILES: '/must-be-filled-in-test-setup', -}); +}; +Object.seal(RootPath); /** @@ -323,130 +329,79 @@ * TestEntryCapabilities in file_manager_browsertest_base.cc. All capabilities * default to true if not specified. * - * @record - * @struct + * @typedef {{ + * canCopy: (boolean|undefined), + * canDelete: (boolean|undefined), + * canRename: (boolean|undefined), + * canAddChildren: (boolean|undefined), + * canShare: (boolean|undefined), + * }} */ -function TestEntryCapabilities() {} - -/** - * @type {boolean|undefined} - */ -TestEntryCapabilities.prototype.canCopy = true; - -/** - * @type {boolean|undefined} - */ -TestEntryCapabilities.prototype.canDelete = true; - -/** - * @type {boolean|undefined} - */ -TestEntryCapabilities.prototype.canRename = true; - -/** - * @type {boolean|undefined} - */ -TestEntryCapabilities.prototype.canAddChildren = true; - -/** - * @type {boolean|undefined} - */ -TestEntryCapabilities.prototype.canShare = true; +let TestEntryCapabilities; /** * The folder features for the test entry. Structure should match * TestEntryFolderFeature in file_manager_browsertest_base.cc. All features * default to false is not specified. * - * @record - * @struct + * @typedef {{ + * isMachineRoot: (boolean|undefined), + * isArbitrarySyncFolder: (boolean|undefined), + * isExternalMedia: (boolean|undefined), + * }} */ -function TestEntryFolderFeature() {} - -/** - * @type {boolean|undefined} - */ -TestEntryFolderFeature.prototype.isMachineRoot = false; - -/** - * @type {boolean|undefined} - */ -TestEntryFolderFeature.prototype.isArbitrarySyncFolder = false; - -/** - * @type {boolean|undefined} - */ -TestEntryFolderFeature.prototype.isExternalMedia = false; +let TestEntryFolderFeature; /** * Parameters to creat a Test Entry in the file manager. Structure should match * TestEntryInfo in file_manager_browsertest_base.cc. * - * @record - * @struct + * Field details: + * + * sourceFileName: Source file name that provides file contents (file location + * relative to /chrome/test/data/chromeos/file_manager/). + * + * targetPath: Name of entry on the test file system. Used to determine the + * actual name of the file. + * + * teamDriveName: Name of the team drive this entry is in. Defaults to a blank + * string (no team drive). Team Drive names must be unique. + * + * computerName: Name of the computer this entry is in. Defaults to a blank + * string (no computer). Computer names must be unique. + * + * lastModifiedTime: Last modified time as a text to be shown in the last + * modified column. + * + * nameText: File name to be shown in the name column. + * + * sizeText: Size text to be shown in the size column. + * + * typeText: Type name to be shown in the type column. + * + * capabilities: Capabilities of this file. Defaults to all capabilities + * available (read-write access). + * + * folderFeature: Folder features of this file. Defaults to all features + * disabled. + * + * @typedef {{ + * type: EntryType, + * sourceFileName: (string|undefined), + * targetPath: (string|undefined), + * teamDriveName: (string|undefined), + * computerName: (string|undefined), + * mimeType: (string|undefined), + * sharedOption: (SharedOption|undefined), + * lastModifiedTime: (string|undefined), + * nameText: (string|undefined), + * sizeText: (string|undefined), + * typeText: (string|undefined), + * capabilities: (TestEntryCapabilities|undefined), + * folderFeature: (TestEntryFolderFeature|undefined), + * }} */ -function TestEntryInfoOptions() {} - -/** - * @type {EntryType} Entry type. - */ -TestEntryInfoOptions.prototype.type; -/** - * @type {string|undefined} Source file name that provides file contents - * (file location relative to /chrome/test/data/chromeos/file_manager/). - */ -TestEntryInfoOptions.prototype.sourceFileName; -/** - * @type {string} Name of entry on the test file system. Used to determine the - * actual name of the file. - */ -TestEntryInfoOptions.prototype.targetPath; -/** - * @type {string} Name of the team drive this entry is in. Defaults to a blank - * string (no team drive). Team Drive names must be unique. - */ -TestEntryInfoOptions.prototype.teamDriveName; -/** - * @type {string} Name of the computer this entry is in. Defaults to a blank - * string (no computer). Computer names must be unique. - */ -TestEntryInfoOptions.prototype.computerName; -/** - * @type {string|undefined} Mime type. - */ -TestEntryInfoOptions.prototype.mimeType; -/** - * @type {SharedOption|undefined} Shared option. Defaults to NONE (not shared). - */ -TestEntryInfoOptions.prototype.sharedOption; -/** - * @type {string} Last modified time as a text to be shown in the last modified - * column. - */ -TestEntryInfoOptions.prototype.lastModifiedTime; -/** - * @type {string} File name to be shown in the name column. - */ -TestEntryInfoOptions.prototype.nameText; -/** - * @type {string} Size text to be shown in the size column. - */ -TestEntryInfoOptions.prototype.sizeText; -/** - * @type {string} Type name to be shown in the type column. - */ -TestEntryInfoOptions.prototype.typeText; -/** - * @type {TestEntryCapabilities|undefined} Capabilities of this file. Defaults - * to all capabilities available (read-write access). - */ -TestEntryInfoOptions.prototype.capabilities; - -/** - * @type {TestEntryFolderFeature|undefined} Foder features of this file. - * Defaults to all features disabled. - */ -TestEntryInfoOptions.prototype.folderFeature; +let TestEntryInfoOptions; /** * File system entry information for tests. Structure should match TestEntryInfo @@ -454,6 +409,7 @@ * TODO(sashab): Remove this, rename TestEntryInfoOptions to TestEntryInfo and * set the defaults in the record definition above. * + * @constructor * @param {TestEntryInfoOptions} options Parameters to create the TestEntryInfo. */ function TestEntryInfo(options) { @@ -1346,11 +1302,12 @@ * @return {!Promise<number>} A promise fulfilled with the count. */ async function getHistogramCount(name, value) { - return JSON.parse(await sendTestMessage({ + const result = await sendTestMessage({ 'name': 'getHistogramCount', 'histogramName': name, 'value': value, - })); + }); + return /** @type {number} */ (JSON.parse(result)); } /** @@ -1359,27 +1316,9 @@ * @return {!Promise<number>} A promise fulfilled with the count. */ async function getUserActionCount(name) { - return JSON.parse(await sendTestMessage({ + const result = await sendTestMessage({ 'name': 'getUserActionCount', 'userActionName': name, - })); -} - -/** - * Simulate Click in the UI in the middle of the element. - * @param{string} appId ID of the app that contains the element. NOTE: The click - * is simulated on most recent window in the window system. - * @param {string|!Array<string>} query Query to the element to be clicked. - * @return {!Promise} A promise fulfilled after the click event. - */ -async function simulateUiClick(appId, query) { - const element = - await remoteCall.waitForElementStyles(appId, query, ['display']); - chrome.test.assertTrue(!!element, 'element for simulateUiClick not found'); - - // Find the middle of the element. - const x = Math.floor(element.renderedLeft + (element.renderedWidth / 2)); - const y = Math.floor(element.renderedTop + (element.renderedHeight / 2)); - - return sendTestMessage({name: 'simulateClick', 'clickX': x, 'clickY': y}); + }); + return /** @type {number} */ (JSON.parse(result)); }
diff --git a/ui/gl/gl_image.cc b/ui/gl/gl_image.cc index b39a26d..12388ec 100644 --- a/ui/gl/gl_image.cc +++ b/ui/gl/gl_image.cc
@@ -12,36 +12,14 @@ namespace gl { -bool GLImage::BindTexImageWithInternalformat(unsigned target, - unsigned internalformat) { - return false; +gfx::Size GLImage::GetSize() { + NOTREACHED(); + return gfx::Size(); } -void GLImage::SetColorSpace(const gfx::ColorSpace& color_space) { - color_space_ = color_space; -} - -bool GLImage::EmulatingRGB() const { - return false; -} - -GLImage::Type GLImage::GetType() const { - return Type::NONE; -} - -#if defined(OS_ANDROID) -std::unique_ptr<base::android::ScopedHardwareBufferFenceSync> -GLImage::GetAHardwareBuffer() { - return nullptr; -} - -gfx::Rect GLImage::GetCropRect() { - return gfx::Rect(); -} -#endif - -bool GLImage::HasMutableState() const { - return true; +unsigned GLImage::GetInternalFormat() { + NOTREACHED(); + return GL_NONE; } unsigned GLImage::GetDataFormat() { @@ -70,6 +48,91 @@ } } +unsigned GLImage::GetDataType() { + NOTREACHED(); + return GL_NONE; +} + +GLImage::BindOrCopy GLImage::ShouldBindOrCopy() { + NOTREACHED(); + return BIND; +} + +bool GLImage::BindTexImage(unsigned target) { + NOTREACHED(); + return false; +} + +bool GLImage::BindTexImageWithInternalformat(unsigned target, + unsigned internalformat) { + NOTREACHED(); + return false; +} + +void GLImage::ReleaseTexImage(unsigned target) { + NOTREACHED(); +} + +bool GLImage::CopyTexImage(unsigned target) { + NOTREACHED(); + return false; +} + +bool GLImage::CopyTexSubImage(unsigned target, + const gfx::Point& offset, + const gfx::Rect& rect) { + NOTREACHED(); + return false; +} + +bool GLImage::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, + int z_order, + gfx::OverlayTransform transform, + const gfx::Rect& bounds_rect, + const gfx::RectF& crop_rect, + bool enable_blend, + std::unique_ptr<gfx::GpuFence> gpu_fence) { + NOTREACHED(); + return false; +} + +void GLImage::SetColorSpace(const gfx::ColorSpace& color_space) { + color_space_ = color_space; +} + +void GLImage::Flush() { + NOTREACHED(); +} + +void GLImage::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, + uint64_t process_tracing_id, + const std::string& dump_name) { + NOTREACHED(); +} + +bool GLImage::EmulatingRGB() const { + return false; +} + +GLImage::Type GLImage::GetType() const { + return Type::NONE; +} + +#if defined(OS_ANDROID) +std::unique_ptr<base::android::ScopedHardwareBufferFenceSync> +GLImage::GetAHardwareBuffer() { + return nullptr; +} + +gfx::Rect GLImage::GetCropRect() { + return gfx::Rect(); +} +#endif + +bool GLImage::HasMutableState() const { + return true; +} + scoped_refptr<gfx::NativePixmap> GLImage::GetNativePixmap() { return nullptr; }
diff --git a/ui/gl/gl_image.h b/ui/gl/gl_image.h index 1d9ff29..2df15a9 100644 --- a/ui/gl/gl_image.h +++ b/ui/gl/gl_image.h
@@ -51,29 +51,29 @@ // platform specific management. class GL_EXPORT GLImage : public base::RefCounted<GLImage> { public: - GLImage() {} + GLImage() = default; // Get the size of the image. - virtual gfx::Size GetSize() = 0; + virtual gfx::Size GetSize(); // Get the GL internal format, format, type of the image. // They are aligned with glTexImage{2|3}D's parameters |internalformat|, // |format|, and |type|. // The returned enums are based on ES2 contexts and are mostly ES3 // compatible, except for GL_HALF_FLOAT_OES. - virtual unsigned GetInternalFormat() = 0; + virtual unsigned GetInternalFormat(); virtual unsigned GetDataFormat(); - virtual unsigned GetDataType() = 0; + virtual unsigned GetDataType(); enum BindOrCopy { BIND, COPY }; // Returns whether this image is meant to be bound or copied to textures. The // suggested method is not guaranteed to succeed, but the alternative will // definitely fail. - virtual BindOrCopy ShouldBindOrCopy() = 0; + virtual BindOrCopy ShouldBindOrCopy(); // Bind image to texture currently bound to |target|. Returns true on success. // It is valid for an implementation to always return false. - virtual bool BindTexImage(unsigned target) = 0; + virtual bool BindTexImage(unsigned target); // Bind image to texture currently bound to |target|, forcing the texture's // internal format to the specified one. This is a feature not available on @@ -83,42 +83,41 @@ unsigned internalformat); // Release image from texture currently bound to |target|. - virtual void ReleaseTexImage(unsigned target) = 0; + virtual void ReleaseTexImage(unsigned target); // Define texture currently bound to |target| by copying image into it. // Returns true on success. It is valid for an implementation to always // return false. - virtual bool CopyTexImage(unsigned target) = 0; + virtual bool CopyTexImage(unsigned target); // Copy |rect| of image to |offset| in texture currently bound to |target|. // Returns true on success. It is valid for an implementation to always // return false. virtual bool CopyTexSubImage(unsigned target, const gfx::Point& offset, - const gfx::Rect& rect) = 0; + const gfx::Rect& rect); // Schedule image as an overlay plane to be shown at swap time for |widget|. - virtual bool ScheduleOverlayPlane( - gfx::AcceleratedWidget widget, - int z_order, - gfx::OverlayTransform transform, - const gfx::Rect& bounds_rect, - const gfx::RectF& crop_rect, - bool enable_blend, - std::unique_ptr<gfx::GpuFence> gpu_fence) = 0; + virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, + int z_order, + gfx::OverlayTransform transform, + const gfx::Rect& bounds_rect, + const gfx::RectF& crop_rect, + bool enable_blend, + std::unique_ptr<gfx::GpuFence> gpu_fence); // Set the color space when image is used as an overlay. virtual void SetColorSpace(const gfx::ColorSpace& color_space); const gfx::ColorSpace& color_space() const { return color_space_; } // Flush any preceding rendering for the image. - virtual void Flush() = 0; + virtual void Flush(); // Dumps information about the memory backing the GLImage to a dump named // |dump_name|. virtual void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, uint64_t process_tracing_id, - const std::string& dump_name) = 0; + const std::string& dump_name); // If this returns true, then the command buffer client has requested a // CHROMIUM image with internalformat GL_RGB, but the platform only supports @@ -159,7 +158,7 @@ virtual scoped_refptr<gfx::NativePixmap> GetNativePixmap(); protected: - virtual ~GLImage() {} + virtual ~GLImage() = default; gfx::ColorSpace color_space_;
diff --git a/weblayer/BUILD.gn b/weblayer/BUILD.gn index fcaa4c8..e38b8b9 100644 --- a/weblayer/BUILD.gn +++ b/weblayer/BUILD.gn
@@ -195,12 +195,14 @@ "//components/embedder_support:switches", "//components/network_time", "//components/prefs", + "//components/resources", "//components/security_interstitials/content:security_interstitial_page", "//components/security_interstitials/content/renderer:security_interstitial_page_controller", "//components/security_interstitials/core", "//components/spellcheck:buildflags", "//components/ssl_errors", "//components/startup_metric_utils/browser", + "//components/strings", "//components/user_prefs", "//components/version_info", "//components/web_cache/browser",
diff --git a/weblayer/browser/DEPS b/weblayer/browser/DEPS index 25e797f4..09f1972 100644 --- a/weblayer/browser/DEPS +++ b/weblayer/browser/DEPS
@@ -1,9 +1,4 @@ include_rules = [ - # This is needed for error page strings/resources. - # TODO(1024326): If WebLayer stays with WebView's error pages implementation - # long-term, componentize these strings/resources as part of componentizing - # that implementation and remove the need for this dependency. - "+android_webview/grit", "+cc", "+components/autofill/content/browser", "+components/autofill/core/browser", @@ -18,6 +13,7 @@ "+components/spellcheck/browser", "+components/ssl_errors", "+components/startup_metric_utils", + "+components/strings", "+components/version_info", "+components/web_cache/browser", "+content/public",
diff --git a/weblayer/browser/errorpage_browsertest.cc b/weblayer/browser/errorpage_browsertest.cc index 4b13608..1104066 100644 --- a/weblayer/browser/errorpage_browsertest.cc +++ b/weblayer/browser/errorpage_browsertest.cc
@@ -10,7 +10,7 @@ #include "weblayer/test/weblayer_browser_test_utils.h" #if defined(OS_ANDROID) -#include "android_webview/grit/aw_strings.h" +#include "components/strings/grit/components_strings.h" #include "ui/base/l10n/l10n_util.h" #endif @@ -27,7 +27,7 @@ // Currently, interstitials for error pages are displayed only on Android. #if defined(OS_ANDROID) base::string16 expected_title = - l10n_util::GetStringUTF16(IDS_AW_WEBPAGE_NOT_AVAILABLE); + l10n_util::GetStringUTF16(IDS_ANDROID_ERROR_PAGE_WEBPAGE_NOT_AVAILABLE); EXPECT_EQ(expected_title, GetTitle(shell())); #endif }
diff --git a/weblayer/renderer/DEPS b/weblayer/renderer/DEPS index c16a8717..564d187 100644 --- a/weblayer/renderer/DEPS +++ b/weblayer/renderer/DEPS
@@ -1,15 +1,12 @@ include_rules = [ - # This is needed for error page strings/resources. - # TODO(1024326): If WebLayer stays with WebView's error pages implementation - # long-term, componentize these strings/resources as part of componentizing - # that implementation and remove the need for this dependency. - "+android_webview/grit", "+components/autofill/content/renderer", + "+components/grit", "+components/safe_browsing/content/renderer", "+components/safe_browsing/core/common", "+components/security_interstitials/content/renderer", "+components/security_interstitials/core/common", "+components/spellcheck/renderer", + "+components/strings", "+content/public/renderer", # needed for safebrowsing "+mojo/public/cpp/bindings",
diff --git a/weblayer/renderer/content_renderer_client_impl.cc b/weblayer/renderer/content_renderer_client_impl.cc index d56a7cf..96ab66c4d 100644 --- a/weblayer/renderer/content_renderer_client_impl.cc +++ b/weblayer/renderer/content_renderer_client_impl.cc
@@ -20,10 +20,10 @@ #include "weblayer/renderer/weblayer_render_frame_observer.h" #if defined(OS_ANDROID) -#include "android_webview/grit/aw_resources.h" -#include "android_webview/grit/aw_strings.h" +#include "components/grit/components_resources.h" #include "components/spellcheck/renderer/spellcheck.h" // nogncheck #include "components/spellcheck/renderer/spellcheck_provider.h" // nogncheck +#include "components/strings/grit/components_strings.h" #include "content/public/renderer/render_thread.h" #include "services/service_manager/public/cpp/local_interface_provider.h" #include "weblayer/renderer/url_loader_throttle_provider.h" @@ -57,22 +57,22 @@ // Create the error page based on the error reason. GURL gurl(error.url()); std::string url_string = gurl.possibly_invalid_spec(); - int reason_id = IDS_AW_WEBPAGE_CAN_NOT_BE_LOADED; + int reason_id = IDS_ANDROID_ERROR_PAGE_WEBPAGE_CAN_NOT_BE_LOADED; if (err.empty()) - reason_id = IDS_AW_WEBPAGE_TEMPORARILY_DOWN; + reason_id = IDS_ANDROID_ERROR_PAGE_WEBPAGE_TEMPORARILY_DOWN; std::string escaped_url = net::EscapeForHTML(url_string); std::vector<std::string> replacements; replacements.push_back( - l10n_util::GetStringUTF8(IDS_AW_WEBPAGE_NOT_AVAILABLE)); + l10n_util::GetStringUTF8(IDS_ANDROID_ERROR_PAGE_WEBPAGE_NOT_AVAILABLE)); replacements.push_back( l10n_util::GetStringFUTF8(reason_id, base::UTF8ToUTF16(escaped_url))); // Having chosen the base reason, chose what extra information to add. - if (reason_id == IDS_AW_WEBPAGE_TEMPORARILY_DOWN) { - replacements.push_back( - l10n_util::GetStringUTF8(IDS_AW_WEBPAGE_TEMPORARILY_DOWN_SUGGESTIONS)); + if (reason_id == IDS_ANDROID_ERROR_PAGE_WEBPAGE_TEMPORARILY_DOWN) { + replacements.push_back(l10n_util::GetStringUTF8( + IDS_ANDROID_ERROR_PAGE_WEBPAGE_TEMPORARILY_DOWN_SUGGESTIONS)); } else { replacements.push_back(err); } @@ -82,7 +82,7 @@ replacements.push_back(""); *error_html = base::ReplaceStringPlaceholders( ui::ResourceBundle::GetSharedInstance().LoadDataResourceString( - IDR_AW_LOAD_ERROR_HTML), + IDR_ANDROID_ERROR_PAGE_LOAD_ERROR_HTML), replacements, nullptr); } #endif // OS_ANDROID
diff --git a/weblayer/test/BUILD.gn b/weblayer/test/BUILD.gn index e8fd0cf..e30e5f6 100644 --- a/weblayer/test/BUILD.gn +++ b/weblayer/test/BUILD.gn
@@ -81,6 +81,7 @@ "//components/autofill/core/common", "//components/network_time", "//components/security_interstitials/content:security_interstitial_page", + "//components/strings", "//content/public/browser", "//content/test:test_support", "//net:test_support",