diff --git a/BUILD.gn b/BUILD.gn index f50c122..b1fd306 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -142,7 +142,7 @@ "//printing:printing_unittests", "//third_party/cacheinvalidation:cacheinvalidation_unittests", "//third_party/pdfium/samples:pdfium_test", - "//third_party/webrtc/tools:frame_analyzer", + "//third_party/webrtc/rtc_tools:frame_analyzer", "//tools/battor_agent", "//tools/battor_agent:battor_agent_unittests", "//tools/gn",
diff --git a/DEPS b/DEPS index d9378bf6..d0a79b6 100644 --- a/DEPS +++ b/DEPS
@@ -40,11 +40,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '6b59bf424c9d9d8a72d3c002871f143e6aff623e', + 'skia_revision': '9d5dcda7818abfb1443400b391d3b35f18ffd96a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '7bed2acecb47d97bfea387717ec4f1afa32f1b76', + 'v8_revision': '948ce482978e10f47ae333720114359b77a5e298', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -52,7 +52,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': 'f0be43fee2a89588a63d4d7beb82ea18db7431e8', + 'angle_revision': 'e145def0fc48ed4b1c3ae1dd3ea2e6969e56bd45', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling build tools # and whatever else without interference from each other. @@ -64,7 +64,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': 'cb50b5fd0d52bc5766da4173f385dac52cf0b8be', + 'pdfium_revision': 'ea7555ae8cae2f50dfb2322d5c19384f43212bd5', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling openmax_dl # and whatever else without interference from each other.
diff --git a/WATCHLISTS b/WATCHLISTS index 9d7a0012..0863816 100644 --- a/WATCHLISTS +++ b/WATCHLISTS
@@ -1326,8 +1326,8 @@ '|third_party/WebKit/LayoutTests/platform/chromium.*/fast/regions/' }, 'blink_custom_elements': { - 'filepath': 'third_party/WebKit/Source/core/dom/custom/' \ - '|third_party/WebKit/Source/bindings/v8/.*CustomElement', + 'filepath': 'third_party/WebKit/Source/core/html/custom/' \ + '|third_party/WebKit/Source/bindings/core/v8/.*CustomElement', }, 'blink_device_orientation': { 'filepath': 'third_party/WebKit/Source/modules/device_orientation/' \ @@ -1341,6 +1341,16 @@ 'blink_dom': { 'filepath': 'third_party/WebKit/Source/core/dom/' }, + 'blink_dom_events': { + 'filepath': 'third_party/WebKit/Source/core/events/Event\.' \ + '|third_party/WebKit/Source/core/events/EventInit' \ + '|third_party/WebKit/Source/core/events/EventPath' \ + '|third_party/WebKit/Source/core/events/EventListener' \ + '|third_party/WebKit/Source/core/events/EventDispatcher' \ + '|third_party/WebKit/Source/core/events/EventDispatchMediator' \ + '|third_party/WebKit/Source/core/events/EventTarget' \ + '|third_party/WebKit/Source/core/events/.*EventContext' + }, 'blink_events': { 'filepath': 'third_party/WebKit/Source/core/page/.*Event' \ '|third_party/WebKit/Source/core/dom/.*Event' \ @@ -1541,6 +1551,12 @@ 'blink_spellcheck' : { 'filepath': 'third_party/WebKit/Source/core/editing/spellcheck' }, + 'blink_shadow_dom': { + 'filepath': 'third_party/WebKit/Source/core/dom/.*Shadow' \ + '|third_party/WebKit/Source/core/dom/.*Slot' \ + '|third_party/WebKit/Source/core/dom/.*InsertionPoint' \ + '|third_party/WebKit/Source/core/dom/.*FlatTree' + }, 'blink_spv2_layout_tests': { 'filepath': 'third_party/WebKit/LayoutTests/virtual/spv2' }, @@ -1569,11 +1585,13 @@ 'filepath': 'third_party/WebKit/Source/web' }, 'blink_webcomponents': { - 'filepath': 'third_party/WebKit/Source/core/dom/shadow/' \ - '|third_party/WebKit/Source/core/dom/custom/' \ + 'filepath': 'third_party/WebKit/Source/core/dom/.*Shadow' \ + '|third_party/WebKit/Source/core/dom/.*Slot' \ + '|third_party/WebKit/Source/core/dom/.*InsertionPoint' \ + '|third_party/WebKit/Source/core/dom/.*FlatTree' \ + '|third_party/WebKit/Source/core/html/custom/' \ '|third_party/WebKit/Source/core/html/imports/' \ - '|third_party/WebKit/Source/bindings/v8/custom/V8CustomElementConstructorCustom' \ - '|third_party/WebKit/Source/bindings/v8/CustomElementHelpers' + '|third_party/WebKit/Source/bindings/core/v8/.*CustomElement' }, 'blink_webp': { 'filepath': 'third_party/WebKit/Source/platform/image-decoders/webp' \ @@ -1753,6 +1771,7 @@ 'eae+blinkwatch@chromium.org', 'rob.buis@samsung.com', 'sigbjornf@opera.com'], + 'blink_dom_events': ['hayato@chromium.org'], 'blink_events': ['blink-reviews-events@chromium.org', 'dglazkov+blink@chromium.org', 'dtapuska+blinkwatch@chromium.org', @@ -1853,6 +1872,7 @@ 'shimazu+serviceworker@chromium.org', 'tzik@chromium.org'], 'blink_serviceworkers_tests': ['kenjibaheux+watch@chromium.org'], + 'blink_shadow_dom': ['hayato@chromium.org'], 'blink_spellcheck' : ['groby+blinkspell@chromium.org', 'timvolodine@chromium.org', 'xiaochengh@chromium.org'],
diff --git a/android_webview/system_webview_apk_tmpl.gni b/android_webview/system_webview_apk_tmpl.gni index 29c7374..0842a29 100644 --- a/android_webview/system_webview_apk_tmpl.gni +++ b/android_webview/system_webview_apk_tmpl.gni
@@ -32,6 +32,13 @@ } aapt_locale_whitelist = locales + # Whitelist rationale in https://crbug.com/691733. + exclude_xxxhdpi = true + xxxhdpi_whitelist = [ + "*shadow*", # Combination of gradient & transparency cause pixelation. + "*.9.*", # Most nine-patches contain shadows. + ] + if (is_java_debug) { enable_multidex = true } else {
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc index 1bfcffc..51fddbf6 100644 --- a/base/metrics/histogram.cc +++ b/base/metrics/histogram.cc
@@ -118,6 +118,7 @@ virtual BucketRanges* CreateRanges() { BucketRanges* ranges = new BucketRanges(bucket_count_ + 1); Histogram::InitializeBucketRanges(minimum_, maximum_, ranges); + base::debug::Alias(&ranges); // TODO(bcwhite): Remove after crbug/586622. return ranges; } @@ -782,6 +783,7 @@ BucketRanges* CreateRanges() override { BucketRanges* ranges = new BucketRanges(bucket_count_ + 1); LinearHistogram::InitializeBucketRanges(minimum_, maximum_, ranges); + base::debug::Alias(&ranges); // TODO(bcwhite): Remove after crbug/586622. return ranges; } @@ -977,6 +979,7 @@ BucketRanges* CreateRanges() override { BucketRanges* ranges = new BucketRanges(3 + 1); LinearHistogram::InitializeBucketRanges(1, 2, ranges); + base::debug::Alias(&ranges); // TODO(bcwhite): Remove after crbug/586622. return ranges; }
diff --git a/base/metrics/persistent_memory_allocator.cc b/base/metrics/persistent_memory_allocator.cc index f569efa..b46dcfa3 100644 --- a/base/metrics/persistent_memory_allocator.cc +++ b/base/metrics/persistent_memory_allocator.cc
@@ -18,6 +18,7 @@ #include "base/memory/shared_memory.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/sparse_histogram.h" +#include "base/numerics/safe_conversions.h" #include "base/threading/thread_restrictions.h" namespace { @@ -1123,8 +1124,8 @@ bool make_iterable) : allocator_(allocator), type_(type), - size_(size), - offset_(offset), + size_(checked_cast<uint32_t>(size)), + offset_(checked_cast<uint32_t>(offset)), make_iterable_(make_iterable), reference_(ref) { DCHECK(allocator_);
diff --git a/base/metrics/persistent_memory_allocator.h b/base/metrics/persistent_memory_allocator.h index 14f7a507..905d4ee 100644 --- a/base/metrics/persistent_memory_allocator.h +++ b/base/metrics/persistent_memory_allocator.h
@@ -850,8 +850,8 @@ // The desired type and size of the allocated segment plus the offset // within it for the defined request. const uint32_t type_; - const size_t size_; - const size_t offset_; + const uint32_t size_; + const uint32_t offset_; // Flag indicating if allocation should be made iterable when done. const bool make_iterable_;
diff --git a/build/android/lint/suppress.py b/build/android/lint/suppress.py index 3277458..1e3514a 100755 --- a/build/android/lint/suppress.py +++ b/build/android/lint/suppress.py
@@ -76,8 +76,12 @@ issue_id = issue.attributes['id'].value severity = issue.attributes['severity'].value path = issue.getElementsByTagName('location')[0].attributes['file'].value - # Strip temporary file path and use regex instead of path. - regexp = re.sub(_TMP_DIR_RE, '', path) + # Strip temporary file path. + path = re.sub(_TMP_DIR_RE, '', path) + # Escape Java inner class name separator and suppress with regex instead + # of path. Doesn't use re.escape() as it is a bit too aggressive and + # escapes '_', causing trouble with PRODUCT_DIR. + regexp = path.replace('$', r'\$') if issue_id not in issues_dict: issues_dict[issue_id] = _Issue(severity, set(), set()) issues_dict[issue_id].regexps.add(regexp)
diff --git a/build/check_gn_headers_whitelist.txt b/build/check_gn_headers_whitelist.txt index 2556084..e52c606 100644 --- a/build/check_gn_headers_whitelist.txt +++ b/build/check_gn_headers_whitelist.txt
@@ -276,7 +276,6 @@ third_party/WebKit/Source/platform/text/TabSize.h third_party/WebKit/Source/platform/text/TextDirection.h third_party/WebKit/Source/platform/transforms/TransformOperation.h -third_party/WebKit/public/platform/WebFeature.h third_party/WebKit/public/platform/WebFeaturePolicyFeature.h third_party/WebKit/public/platform/WebSourceLocation.h third_party/WebKit/public/platform/WebTouchInfo.h
diff --git a/build/config/ios/rules.gni b/build/config/ios/rules.gni index 3d3f0cfd..d520f5a 100644 --- a/build/config/ios/rules.gni +++ b/build/config/ios/rules.gni
@@ -136,6 +136,10 @@ # (optional) string, base name of the binary generated by the # bundle_binary_target target, defaults to the target name. # +# output_name: +# (optional) string, name of the generated application, if omitted, +# defaults to the target_name. +# # extra_system_frameworks # (optional) list of system framework to copy to the bundle. # @@ -173,6 +177,10 @@ _bundle_binary_output = invoker.bundle_binary_output } + _bundle_binary_path = + get_label_info(_bundle_binary_target, "target_out_dir") + + "/$_bundle_binary_output" + _bundle_extension = invoker.bundle_extension _bundle_root_dir = "$root_out_dir/$_output_name$_bundle_extension" @@ -235,8 +243,7 @@ code_signing_script = "//build/config/ios/codesign.py" code_signing_sources = [ _entitlements_path, - get_label_info(_bundle_binary_target, "target_out_dir") + - "/$_bundle_binary_output", + _bundle_binary_path, ] code_signing_outputs = [ "$_bundle_root_dir/$_output_name" ] if (_enable_code_signing) { @@ -266,7 +273,7 @@ "-t=" + ios_sdk_name, "-i=" + ios_code_signing_identity, "-e=" + rebase_path(_entitlements_path, root_build_dir), - "-b=" + rebase_path("$target_out_dir/$_output_name", root_build_dir), + "-b=" + rebase_path(_bundle_binary_path, root_build_dir), rebase_path(bundle_root_dir, root_build_dir), ] if (!_enable_code_signing) {
diff --git a/build/config/jumbo.gni b/build/config/jumbo.gni index baf19f1..4a5f22f 100644 --- a/build/config/jumbo.gni +++ b/build/config/jumbo.gni
@@ -86,6 +86,23 @@ current_file_index += 1 } + has_objective_c_file = false + has_c_file = false + foreach(source_file, invoker.sources) { + source_ext = get_path_info(source_file, "extension") + if (source_ext == "c") { + has_c_file = true + } else if (source_ext == "mm") { + has_objective_c_file = true + } + } + if (has_c_file) { + jumbo_files += [ "$gen_target_dir/" + target_name + "_jumbo_c.c" ] + } + if (has_objective_c_file) { + jumbo_files += [ "$gen_target_dir/" + target_name + "_jumbo_mm.mm" ] + } + merge_action_name = target_name + "__jumbo_merge" # Create an action that calls a script that merges all the source files. @@ -125,11 +142,9 @@ sources = jumbo_files + excluded_sources # Need to keep the headers in sources so that dependency checks - # work, and we need to keep Objective-C code since they - # cannot be merged into a cc file (FIXME). + # work. foreach(source_file, invoker.sources) { - source_ext = get_path_info(source_file, "extension") - if (source_ext == "h" || source_ext == "mm") { + if (get_path_info(source_file, "extension") == "h") { sources += [ source_file ] } }
diff --git a/build/config/merge_for_jumbo.py b/build/config/merge_for_jumbo.py index f6eb87dc..b3146ba 100755 --- a/build/config/merge_for_jumbo.py +++ b/build/config/merge_for_jumbo.py
@@ -12,6 +12,38 @@ from __future__ import print_function import argparse +import cStringIO +import os + + +def write_jumbo_files(inputs, outputs, written_input_set, written_output_set): + output_count = len(outputs) + input_count = len(inputs) + + written_inputs = 0 + for output_index, output_file in enumerate(outputs): + written_output_set.add(output_file) + if os.path.isfile(output_file): + with open(output_file, "r") as current: + current_jumbo_file = current.read() + else: + current_jumbo_file = None + + out = cStringIO.StringIO() + out.write("/* This is a Jumbo file. Don't edit. */\n\n") + out.write("/* Generated with merge_for_jumbo.py. */\n\n") + input_limit = (output_index + 1) * input_count / output_count + while written_inputs < input_limit: + filename = inputs[written_inputs] + written_inputs += 1 + out.write("#include \"%s\"\n" % filename) + written_input_set.add(filename) + new_jumbo_file = out.getvalue() + out.close() + + if new_jumbo_file != current_jumbo_file: + with open(output_file, "w") as out: + out.write(new_jumbo_file) def main(): @@ -22,41 +54,39 @@ parser.add_argument("--verbose", action="store_true") args = parser.parse_args() - output_count = len(args.outputs) - lines = [] # If written with gn |write_file| each file is on its own line. with open(args.file_list) as file_list_file: lines = [line.strip() for line in file_list_file if line.strip()] # If written with gn |response_file_contents| the files are space separated. - inputs = [] + all_inputs = [] for line in lines: - inputs.extend(line.split()) - input_count = len(inputs) + all_inputs.extend(line.split()) - written_inputs = 0 - for output_index, output_file in enumerate(args.outputs): - # TODO: Check if the file is right already and then do not update it. - with open(output_file, "w") as out: - out.write("/* This is a Jumbo file. Don't edit. */\n\n") - out.write("/* Generated with merge_for_jumbo.py. */\n\n") - input_limit = (output_index + 1) * input_count / output_count - while written_inputs < input_limit: - filename = inputs[written_inputs] - written_inputs += 1 - # The source list includes headers which should not be - # compiled, and Objective C files which will be special cased - # later since they will not compile correctly if included in a - # C++ file. We will just skip them here for now. - if filename.endswith((".h", ".mm")): - continue + written_output_set = set() # Just for double checking + written_input_set = set() # Just for double checking + for language_ext in (".cc", ".c", ".mm"): + if language_ext == ".cc": + ext_pattern = (".cc", ".cpp") + else: + ext_pattern = tuple([language_ext]) - out.write("#include \"%s\"\n" % filename) + outputs = [x for x in args.outputs if x.endswith(ext_pattern)] + inputs = [x for x in all_inputs if x.endswith(ext_pattern)] + if not outputs: + assert not inputs + continue + + write_jumbo_files(inputs, outputs, written_input_set, written_output_set) + + header_files = set([x for x in all_inputs if x.endswith(".h")]) + assert set(args.outputs) == written_output_set, "Did not fill all outputs" + files_not_included = set(all_inputs) - written_input_set - header_files + assert not files_not_included, "Did not include files: " + files_not_included if args.verbose: - print("Generated %s (%d files) based on %s" % (str(args.outputs), - written_inputs, - args.file_list)) + print("Generated %s (%d files) based on %s" % ( + str(args.outputs), len(written_input_set), args.file_list)) if __name__ == "__main__": - main() + main()
diff --git a/cc/BUILD.gn b/cc/BUILD.gn index bb6312a..ea261d1e 100644 --- a/cc/BUILD.gn +++ b/cc/BUILD.gn
@@ -758,6 +758,7 @@ "layers/surface_layer_unittest.cc", "layers/texture_layer_impl_unittest.cc", "layers/texture_layer_unittest.cc", + "layers/touch_action_region_unittest.cc", "layers/ui_resource_layer_impl_unittest.cc", "layers/ui_resource_layer_unittest.cc", "layers/video_frame_provider_client_impl_unittest.cc",
diff --git a/cc/animation/animation_curve.cc b/cc/animation/animation_curve.cc index 9e8cae9..b7c5891 100644 --- a/cc/animation/animation_curve.cc +++ b/cc/animation/animation_curve.cc
@@ -57,4 +57,13 @@ return static_cast<ScrollOffsetAnimationCurve*>(this); } +const SizeAnimationCurve* AnimationCurve::ToSizeAnimationCurve() const { + DCHECK(Type() == AnimationCurve::SIZE); + return static_cast<const SizeAnimationCurve*>(this); +} + +AnimationCurve::CurveType SizeAnimationCurve::Type() const { + return SIZE; +} + } // namespace cc
diff --git a/cc/animation/animation_curve.h b/cc/animation/animation_curve.h index 72b8e63..c021762 100644 --- a/cc/animation/animation_curve.h +++ b/cc/animation/animation_curve.h
@@ -10,6 +10,7 @@ #include "base/time/time.h" #include "cc/animation/animation_export.h" #include "cc/base/filter_operations.h" +#include "ui/gfx/geometry/size_f.h" #include "ui/gfx/transform.h" namespace gfx { @@ -22,12 +23,14 @@ class FilterAnimationCurve; class FloatAnimationCurve; class ScrollOffsetAnimationCurve; +class SizeAnimationCurve; class TransformAnimationCurve; +class TransformOperations; // An animation curve is a function that returns a value given a time. class CC_ANIMATION_EXPORT AnimationCurve { public: - enum CurveType { COLOR, FLOAT, TRANSFORM, FILTER, SCROLL_OFFSET }; + enum CurveType { COLOR, FLOAT, TRANSFORM, FILTER, SCROLL_OFFSET, SIZE }; virtual ~AnimationCurve() {} @@ -40,6 +43,7 @@ const TransformAnimationCurve* ToTransformAnimationCurve() const; const FilterAnimationCurve* ToFilterAnimationCurve() const; const ScrollOffsetAnimationCurve* ToScrollOffsetAnimationCurve() const; + const SizeAnimationCurve* ToSizeAnimationCurve() const; ScrollOffsetAnimationCurve* ToScrollOffsetAnimationCurve(); }; @@ -68,7 +72,7 @@ public: ~TransformAnimationCurve() override {} - virtual gfx::Transform GetValue(base::TimeDelta t) const = 0; + virtual TransformOperations GetValue(base::TimeDelta t) const = 0; // Sets |bounds| to be the bounding box for the region within which |box| // will move during this animation. If this region cannot be computed, @@ -109,6 +113,16 @@ CurveType Type() const override; }; +class CC_ANIMATION_EXPORT SizeAnimationCurve : public AnimationCurve { + public: + ~SizeAnimationCurve() override {} + + virtual gfx::SizeF GetValue(base::TimeDelta t) const = 0; + + // Partial Animation implementation. + CurveType Type() const override; +}; + } // namespace cc #endif // CC_ANIMATION_ANIMATION_CURVE_H_
diff --git a/cc/animation/animation_player.cc b/cc/animation/animation_player.cc index 3174dcb..4213773 100644 --- a/cc/animation/animation_player.cc +++ b/cc/animation/animation_player.cc
@@ -12,6 +12,7 @@ #include "cc/animation/animation_host.h" #include "cc/animation/animation_timeline.h" #include "cc/animation/scroll_offset_animation_curve.h" +#include "cc/animation/transform_operations.h" #include "cc/trees/property_animation_state.h" namespace cc { @@ -739,10 +740,10 @@ case TargetProperty::TRANSFORM: { const TransformAnimationCurve* transform_animation_curve = animations_[i]->curve()->ToTransformAnimationCurve(); - const gfx::Transform transform = + const TransformOperations operations = transform_animation_curve->GetValue(trimmed); - element_animations_->NotifyClientTransformAnimated( - transform, animations_[i]->affects_active_elements(), + element_animations_->NotifyClientTransformOperationsAnimated( + operations, animations_[i]->affects_active_elements(), animations_[i]->affects_pending_elements()); break; } @@ -784,6 +785,16 @@ animations_[i]->affects_pending_elements()); break; } + + case TargetProperty::BOUNDS: { + const SizeAnimationCurve* size_animation_curve = + animations_[i]->curve()->ToSizeAnimationCurve(); + const gfx::SizeF size = size_animation_curve->GetValue(trimmed); + element_animations_->NotifyClientBoundsAnimated( + size, animations_[i]->affects_active_elements(), + animations_[i]->affects_pending_elements()); + break; + } } } }
diff --git a/cc/animation/element_animations.cc b/cc/animation/element_animations.cc index ebb9c3f..322530ba 100644 --- a/cc/animation/element_animations.cc +++ b/cc/animation/element_animations.cc
@@ -15,6 +15,7 @@ #include "cc/animation/animation_host.h" #include "cc/animation/animation_player.h" #include "cc/animation/keyframed_animation_curve.h" +#include "cc/animation/transform_operations.h" #include "cc/base/filter_operations.h" #include "cc/trees/mutator_host_client.h" #include "ui/gfx/geometry/box_f.h" @@ -200,14 +201,18 @@ bool notify_active_elements = true; bool notify_pending_elements = true; switch (event.target_property) { - case TargetProperty::OPACITY: + case TargetProperty::OPACITY: { NotifyClientOpacityAnimated(event.opacity, notify_active_elements, notify_pending_elements); break; - case TargetProperty::TRANSFORM: - NotifyClientTransformAnimated(event.transform, notify_active_elements, - notify_pending_elements); + } + case TargetProperty::TRANSFORM: { + TransformOperations operations; + operations.AppendMatrix(event.transform); + NotifyClientTransformOperationsAnimated( + operations, notify_active_elements, notify_pending_elements); break; + } default: NOTREACHED(); } @@ -324,10 +329,11 @@ OnOpacityAnimated(ElementListType::PENDING, opacity); } -void ElementAnimations::NotifyClientTransformAnimated( - const gfx::Transform& transform, +void ElementAnimations::NotifyClientTransformOperationsAnimated( + const TransformOperations& operations, bool notify_active_elements, bool notify_pending_elements) { + gfx::Transform transform = operations.Apply(); if (notify_active_elements && has_element_in_active_list()) OnTransformAnimated(ElementListType::ACTIVE, transform); if (notify_pending_elements && has_element_in_pending_list()) @@ -354,6 +360,15 @@ OnScrollOffsetAnimated(ElementListType::PENDING, scroll_offset); } +void ElementAnimations::NotifyClientBoundsAnimated( + const gfx::SizeF& size, + bool notify_active_elements, + bool notify_pending_elements) { + // TODO(vollick): once we have an animation observer, we can remove client + // animated notifications we do not use in element animations, such as this + // one. +} + void ElementAnimations::UpdateClientAnimationState() { if (!element_id()) return;
diff --git a/cc/animation/element_animations.h b/cc/animation/element_animations.h index 81ce7af..95929cf 100644 --- a/cc/animation/element_animations.h +++ b/cc/animation/element_animations.h
@@ -20,6 +20,7 @@ namespace gfx { class BoxF; +class SizeF; } namespace cc { @@ -27,6 +28,7 @@ class AnimationHost; class AnimationPlayer; class FilterOperations; +class TransformOperations; enum class ElementListType; struct AnimationEvent; @@ -148,15 +150,20 @@ void NotifyClientOpacityAnimated(float opacity, bool notify_active_elements, bool notify_pending_elements); - void NotifyClientTransformAnimated(const gfx::Transform& transform, - bool notify_active_elements, - bool notify_pending_elements); + void NotifyClientTransformOperationsAnimated( + const TransformOperations& operations, + bool notify_active_elements, + bool notify_pending_elements); void NotifyClientFilterAnimated(const FilterOperations& filter, bool notify_active_elements, bool notify_pending_elements); void NotifyClientScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset, bool notify_active_elements, bool notify_pending_elements); + void NotifyClientBoundsAnimated(const gfx::SizeF& size, + bool notify_active_elements, + bool notify_pending_elements); + gfx::ScrollOffset ScrollOffsetForAnimation() const; private:
diff --git a/cc/animation/keyframed_animation_curve.cc b/cc/animation/keyframed_animation_curve.cc index 9094546..48515273 100644 --- a/cc/animation/keyframed_animation_curve.cc +++ b/cc/animation/keyframed_animation_curve.cc
@@ -204,6 +204,32 @@ return FilterKeyframe::Create(Time(), Value(), std::move(func)); } +std::unique_ptr<SizeKeyframe> SizeKeyframe::Create( + base::TimeDelta time, + const gfx::SizeF& value, + std::unique_ptr<TimingFunction> timing_function) { + return base::WrapUnique( + new SizeKeyframe(time, value, std::move(timing_function))); +} + +SizeKeyframe::SizeKeyframe(base::TimeDelta time, + const gfx::SizeF& value, + std::unique_ptr<TimingFunction> timing_function) + : Keyframe(time, std::move(timing_function)), value_(value) {} + +SizeKeyframe::~SizeKeyframe() {} + +const gfx::SizeF& SizeKeyframe::Value() const { + return value_; +} + +std::unique_ptr<SizeKeyframe> SizeKeyframe::Clone() const { + std::unique_ptr<TimingFunction> func; + if (timing_function()) + func = timing_function()->Clone(); + return SizeKeyframe::Create(Time(), Value(), std::move(func)); +} + std::unique_ptr<KeyframedColorAnimationCurve> KeyframedColorAnimationCurve::Create() { return base::WrapUnique(new KeyframedColorAnimationCurve); @@ -255,8 +281,6 @@ progress, keyframes_[i]->Value(), keyframes_[i + 1]->Value()); } -// KeyframedFloatAnimationCurve - std::unique_ptr<KeyframedFloatAnimationCurve> KeyframedFloatAnimationCurve::Create() { return base::WrapUnique(new KeyframedFloatAnimationCurve); @@ -343,13 +367,13 @@ return std::move(to_return); } -gfx::Transform KeyframedTransformAnimationCurve::GetValue( +TransformOperations KeyframedTransformAnimationCurve::GetValue( base::TimeDelta t) const { if (t <= TimeUtil::Scale(keyframes_.front()->Time(), scaled_duration())) - return keyframes_.front()->Value().Apply(); + return keyframes_.front()->Value(); if (t >= TimeUtil::Scale(keyframes_.back()->Time(), scaled_duration())) - return keyframes_.back()->Value().Apply(); + return keyframes_.back()->Value(); t = TransformedAnimationTime(keyframes_, timing_function_, scaled_duration(), t); @@ -495,4 +519,55 @@ return false; } +std::unique_ptr<KeyframedSizeAnimationCurve> +KeyframedSizeAnimationCurve::Create() { + return base::WrapUnique(new KeyframedSizeAnimationCurve); +} + +KeyframedSizeAnimationCurve::KeyframedSizeAnimationCurve() + : scaled_duration_(1.0) {} + +KeyframedSizeAnimationCurve::~KeyframedSizeAnimationCurve() {} + +void KeyframedSizeAnimationCurve::AddKeyframe( + std::unique_ptr<SizeKeyframe> keyframe) { + InsertKeyframe(std::move(keyframe), &keyframes_); +} + +base::TimeDelta KeyframedSizeAnimationCurve::Duration() const { + return TimeUtil::Scale(keyframes_.back()->Time() - keyframes_.front()->Time(), + scaled_duration()); +} + +std::unique_ptr<AnimationCurve> KeyframedSizeAnimationCurve::Clone() const { + std::unique_ptr<KeyframedSizeAnimationCurve> to_return = + KeyframedSizeAnimationCurve::Create(); + for (size_t i = 0; i < keyframes_.size(); ++i) + to_return->AddKeyframe(keyframes_[i]->Clone()); + + if (timing_function_) + to_return->SetTimingFunction(timing_function_->Clone()); + + to_return->set_scaled_duration(scaled_duration()); + + return std::move(to_return); +} + +gfx::SizeF KeyframedSizeAnimationCurve::GetValue(base::TimeDelta t) const { + if (t <= TimeUtil::Scale(keyframes_.front()->Time(), scaled_duration())) + return keyframes_.front()->Value(); + + if (t >= TimeUtil::Scale(keyframes_.back()->Time(), scaled_duration())) + return keyframes_.back()->Value(); + + t = TransformedAnimationTime(keyframes_, timing_function_, scaled_duration(), + t); + size_t i = GetActiveKeyframe(keyframes_, scaled_duration(), t); + double progress = + TransformedKeyframeProgress(keyframes_, scaled_duration(), t, i); + + return gfx::Tween::SizeValueBetween(progress, keyframes_[i]->Value(), + keyframes_[i + 1]->Value()); +} + } // namespace cc
diff --git a/cc/animation/keyframed_animation_curve.h b/cc/animation/keyframed_animation_curve.h index 1033868..0378056 100644 --- a/cc/animation/keyframed_animation_curve.h +++ b/cc/animation/keyframed_animation_curve.h
@@ -13,6 +13,7 @@ #include "cc/animation/animation_export.h" #include "cc/animation/timing_function.h" #include "cc/animation/transform_operations.h" +#include "ui/gfx/geometry/size_f.h" namespace cc { @@ -115,6 +116,26 @@ FilterOperations value_; }; +class CC_ANIMATION_EXPORT SizeKeyframe : public Keyframe { + public: + static std::unique_ptr<SizeKeyframe> Create( + base::TimeDelta time, + const gfx::SizeF& bounds, + std::unique_ptr<TimingFunction> timing_function); + ~SizeKeyframe() override; + + const gfx::SizeF& Value() const; + + std::unique_ptr<SizeKeyframe> Clone() const; + + private: + SizeKeyframe(base::TimeDelta time, + const gfx::SizeF& value, + std::unique_ptr<TimingFunction> timing_function); + + gfx::SizeF value_; +}; + class CC_ANIMATION_EXPORT KeyframedColorAnimationCurve : public ColorAnimationCurve { public: @@ -216,7 +237,7 @@ std::unique_ptr<AnimationCurve> Clone() const override; // TransformAnimationCurve implementation - gfx::Transform GetValue(base::TimeDelta t) const override; + TransformOperations GetValue(base::TimeDelta t) const override; bool AnimatedBoundsForBox(const gfx::BoxF& box, gfx::BoxF* bounds) const override; bool PreservesAxisAlignment() const override; @@ -275,6 +296,42 @@ DISALLOW_COPY_AND_ASSIGN(KeyframedFilterAnimationCurve); }; +class CC_ANIMATION_EXPORT KeyframedSizeAnimationCurve + : public SizeAnimationCurve { + public: + // It is required that the keyframes be sorted by time. + static std::unique_ptr<KeyframedSizeAnimationCurve> Create(); + + ~KeyframedSizeAnimationCurve() override; + + void AddKeyframe(std::unique_ptr<SizeKeyframe> keyframe); + void SetTimingFunction(std::unique_ptr<TimingFunction> timing_function) { + timing_function_ = std::move(timing_function); + } + double scaled_duration() const { return scaled_duration_; } + void set_scaled_duration(double scaled_duration) { + scaled_duration_ = scaled_duration; + } + + // AnimationCurve implementation + base::TimeDelta Duration() const override; + std::unique_ptr<AnimationCurve> Clone() const override; + + // SizeAnimationCurve implementation + gfx::SizeF GetValue(base::TimeDelta t) const override; + + private: + KeyframedSizeAnimationCurve(); + + // Always sorted in order of increasing time. No two keyframes have the + // same time. + std::vector<std::unique_ptr<SizeKeyframe>> keyframes_; + std::unique_ptr<TimingFunction> timing_function_; + double scaled_duration_; + + DISALLOW_COPY_AND_ASSIGN(KeyframedSizeAnimationCurve); +}; + } // namespace cc #endif // CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_
diff --git a/cc/animation/keyframed_animation_curve_unittest.cc b/cc/animation/keyframed_animation_curve_unittest.cc index c050404..f714b283 100644 --- a/cc/animation/keyframed_animation_curve_unittest.cc +++ b/cc/animation/keyframed_animation_curve_unittest.cc
@@ -14,8 +14,9 @@ namespace cc { namespace { -void ExpectTranslateX(SkMScalar translate_x, const gfx::Transform& transform) { - EXPECT_FLOAT_EQ(translate_x, transform.matrix().get(0, 3)); +void ExpectTranslateX(SkMScalar translate_x, + const TransformOperations& operations) { + EXPECT_FLOAT_EQ(translate_x, operations.Apply().matrix().get(0, 3)); } void ExpectBrightness(double brightness, const FilterOperations& filter) { @@ -293,7 +294,8 @@ ExpectTranslateX(4.f, curve->GetValue(base::TimeDelta::FromSecondsD(0.5f))); // There is a discontinuity at 1. Any value between 4 and 6 is valid. - gfx::Transform value = curve->GetValue(base::TimeDelta::FromSecondsD(1.f)); + gfx::Transform value = + curve->GetValue(base::TimeDelta::FromSecondsD(1.f)).Apply(); EXPECT_GE(value.matrix().get(0, 3), 4.f); EXPECT_LE(value.matrix().get(0, 3), 6.f); @@ -986,5 +988,93 @@ curve->GetValue(base::TimeDelta::FromSecondsD(scale * 5.f))); } +// Tests that a size animation with one keyframe works as expected. +TEST(KeyframedAnimationCurveTest, OneSizeKeyFrame) { + gfx::SizeF size = gfx::SizeF(100, 100); + std::unique_ptr<KeyframedSizeAnimationCurve> curve( + KeyframedSizeAnimationCurve::Create()); + curve->AddKeyframe(SizeKeyframe::Create(base::TimeDelta(), size, nullptr)); + + EXPECT_SIZEF_EQ(size, curve->GetValue(base::TimeDelta::FromSecondsD(-1.f))); + EXPECT_SIZEF_EQ(size, curve->GetValue(base::TimeDelta::FromSecondsD(0.f))); + EXPECT_SIZEF_EQ(size, curve->GetValue(base::TimeDelta::FromSecondsD(0.5f))); + EXPECT_SIZEF_EQ(size, curve->GetValue(base::TimeDelta::FromSecondsD(1.f))); + EXPECT_SIZEF_EQ(size, curve->GetValue(base::TimeDelta::FromSecondsD(2.f))); +} + +// Tests that a size animation with two keyframes works as expected. +TEST(KeyframedAnimationCurveTest, TwoSizeKeyFrame) { + gfx::SizeF size_a = gfx::SizeF(100, 100); + gfx::SizeF size_b = gfx::SizeF(100, 0); + gfx::SizeF size_midpoint = gfx::Tween::SizeValueBetween(0.5, size_a, size_b); + std::unique_ptr<KeyframedSizeAnimationCurve> curve( + KeyframedSizeAnimationCurve::Create()); + curve->AddKeyframe(SizeKeyframe::Create(base::TimeDelta(), size_a, nullptr)); + curve->AddKeyframe(SizeKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), + size_b, nullptr)); + + EXPECT_SIZEF_EQ(size_a, curve->GetValue(base::TimeDelta::FromSecondsD(-1.f))); + EXPECT_SIZEF_EQ(size_a, curve->GetValue(base::TimeDelta::FromSecondsD(0.f))); + EXPECT_SIZEF_EQ(size_midpoint, + curve->GetValue(base::TimeDelta::FromSecondsD(0.5f))); + EXPECT_SIZEF_EQ(size_b, curve->GetValue(base::TimeDelta::FromSecondsD(1.f))); + EXPECT_SIZEF_EQ(size_b, curve->GetValue(base::TimeDelta::FromSecondsD(2.f))); +} + +// Tests that a size animation with three keyframes works as expected. +TEST(KeyframedAnimationCurveTest, ThreeSizeKeyFrame) { + gfx::SizeF size_a = gfx::SizeF(100, 100); + gfx::SizeF size_b = gfx::SizeF(100, 0); + gfx::SizeF size_c = gfx::SizeF(200, 0); + gfx::SizeF size_midpoint1 = gfx::Tween::SizeValueBetween(0.5, size_a, size_b); + gfx::SizeF size_midpoint2 = gfx::Tween::SizeValueBetween(0.5, size_b, size_c); + std::unique_ptr<KeyframedSizeAnimationCurve> curve( + KeyframedSizeAnimationCurve::Create()); + curve->AddKeyframe(SizeKeyframe::Create(base::TimeDelta(), size_a, nullptr)); + curve->AddKeyframe(SizeKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), + size_b, nullptr)); + curve->AddKeyframe(SizeKeyframe::Create(base::TimeDelta::FromSecondsD(2.0), + size_c, nullptr)); + + EXPECT_SIZEF_EQ(size_a, curve->GetValue(base::TimeDelta::FromSecondsD(-1.f))); + EXPECT_SIZEF_EQ(size_a, curve->GetValue(base::TimeDelta::FromSecondsD(0.f))); + EXPECT_SIZEF_EQ(size_midpoint1, + curve->GetValue(base::TimeDelta::FromSecondsD(0.5f))); + EXPECT_SIZEF_EQ(size_b, curve->GetValue(base::TimeDelta::FromSecondsD(1.f))); + EXPECT_SIZEF_EQ(size_midpoint2, + curve->GetValue(base::TimeDelta::FromSecondsD(1.5f))); + EXPECT_SIZEF_EQ(size_c, curve->GetValue(base::TimeDelta::FromSecondsD(2.f))); + EXPECT_SIZEF_EQ(size_c, curve->GetValue(base::TimeDelta::FromSecondsD(3.f))); +} + +// Tests that a size animation with multiple keys at a given time works sanely. +TEST(KeyframedAnimationCurveTest, RepeatedSizeKeyFrame) { + gfx::SizeF size_a = gfx::SizeF(100, 64); + gfx::SizeF size_b = gfx::SizeF(100, 192); + + std::unique_ptr<KeyframedSizeAnimationCurve> curve( + KeyframedSizeAnimationCurve::Create()); + curve->AddKeyframe(SizeKeyframe::Create(base::TimeDelta(), size_a, nullptr)); + curve->AddKeyframe(SizeKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), + size_a, nullptr)); + curve->AddKeyframe(SizeKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), + size_b, nullptr)); + curve->AddKeyframe(SizeKeyframe::Create(base::TimeDelta::FromSecondsD(2.0), + size_b, nullptr)); + + EXPECT_SIZEF_EQ(size_a, curve->GetValue(base::TimeDelta::FromSecondsD(-1.f))); + EXPECT_SIZEF_EQ(size_a, curve->GetValue(base::TimeDelta::FromSecondsD(0.f))); + EXPECT_SIZEF_EQ(size_a, curve->GetValue(base::TimeDelta::FromSecondsD(0.5f))); + + gfx::SizeF value = curve->GetValue(base::TimeDelta::FromSecondsD(1.0f)); + EXPECT_FLOAT_EQ(100.0f, value.width()); + EXPECT_LE(64.0f, value.height()); + EXPECT_GE(192.0f, value.height()); + + EXPECT_SIZEF_EQ(size_b, curve->GetValue(base::TimeDelta::FromSecondsD(1.5f))); + EXPECT_SIZEF_EQ(size_b, curve->GetValue(base::TimeDelta::FromSecondsD(2.f))); + EXPECT_SIZEF_EQ(size_b, curve->GetValue(base::TimeDelta::FromSecondsD(3.f))); +} + } // namespace } // namespace cc
diff --git a/cc/animation/transform_operation.cc b/cc/animation/transform_operation.cc index 465429d..84156241 100644 --- a/cc/animation/transform_operation.cc +++ b/cc/animation/transform_operation.cc
@@ -90,11 +90,37 @@ return from * (1 - progress) + to * progress; } +void TransformOperation::Bake() { + matrix.MakeIdentity(); + switch (type) { + case TransformOperation::TRANSFORM_OPERATION_TRANSLATE: + matrix.Translate3d(translate.x, translate.y, translate.z); + break; + case TransformOperation::TRANSFORM_OPERATION_ROTATE: + matrix.RotateAbout( + gfx::Vector3dF(rotate.axis.x, rotate.axis.y, rotate.axis.z), + rotate.angle); + break; + case TransformOperation::TRANSFORM_OPERATION_SCALE: + matrix.Scale3d(scale.x, scale.y, scale.z); + break; + case TransformOperation::TRANSFORM_OPERATION_SKEW: + matrix.Skew(skew.x, skew.y); + break; + case TransformOperation::TRANSFORM_OPERATION_PERSPECTIVE: + matrix.ApplyPerspectiveDepth(perspective_depth); + break; + case TransformOperation::TRANSFORM_OPERATION_MATRIX: + case TransformOperation::TRANSFORM_OPERATION_IDENTITY: + break; + } +} + bool TransformOperation::BlendTransformOperations( const TransformOperation* from, const TransformOperation* to, SkMScalar progress, - gfx::Transform* result) { + TransformOperation* result) { if (IsOperationIdentity(from) && IsOperationIdentity(to)) return true; @@ -104,97 +130,101 @@ interpolation_type = from->type; else interpolation_type = to->type; + result->type = interpolation_type; switch (interpolation_type) { case TransformOperation::TRANSFORM_OPERATION_TRANSLATE: { - SkMScalar from_x = IsOperationIdentity(from) ? 0 : from->translate.x; - SkMScalar from_y = IsOperationIdentity(from) ? 0 : from->translate.y; - SkMScalar from_z = IsOperationIdentity(from) ? 0 : from->translate.z; - SkMScalar to_x = IsOperationIdentity(to) ? 0 : to->translate.x; - SkMScalar to_y = IsOperationIdentity(to) ? 0 : to->translate.y; - SkMScalar to_z = IsOperationIdentity(to) ? 0 : to->translate.z; - result->Translate3d(BlendSkMScalars(from_x, to_x, progress), - BlendSkMScalars(from_y, to_y, progress), - BlendSkMScalars(from_z, to_z, progress)); - break; - } - case TransformOperation::TRANSFORM_OPERATION_ROTATE: { - SkMScalar axis_x = 0; - SkMScalar axis_y = 0; - SkMScalar axis_z = 1; - SkMScalar from_angle = 0; - SkMScalar to_angle = IsOperationIdentity(to) ? 0 : to->rotate.angle; - if (ShareSameAxis(from, to, &axis_x, &axis_y, &axis_z, &from_angle)) { - result->RotateAbout(gfx::Vector3dF(axis_x, axis_y, axis_z), - BlendSkMScalars(from_angle, to_angle, progress)); - } else { - gfx::Transform to_matrix; + SkMScalar from_x = IsOperationIdentity(from) ? 0 : from->translate.x; + SkMScalar from_y = IsOperationIdentity(from) ? 0 : from->translate.y; + SkMScalar from_z = IsOperationIdentity(from) ? 0 : from->translate.z; + SkMScalar to_x = IsOperationIdentity(to) ? 0 : to->translate.x; + SkMScalar to_y = IsOperationIdentity(to) ? 0 : to->translate.y; + SkMScalar to_z = IsOperationIdentity(to) ? 0 : to->translate.z; + result->translate.x = BlendSkMScalars(from_x, to_x, progress), + result->translate.y = BlendSkMScalars(from_y, to_y, progress), + result->translate.z = BlendSkMScalars(from_z, to_z, progress), + result->Bake(); + break; + } + case TransformOperation::TRANSFORM_OPERATION_ROTATE: { + SkMScalar axis_x = 0; + SkMScalar axis_y = 0; + SkMScalar axis_z = 1; + SkMScalar from_angle = 0; + SkMScalar to_angle = IsOperationIdentity(to) ? 0 : to->rotate.angle; + if (ShareSameAxis(from, to, &axis_x, &axis_y, &axis_z, &from_angle)) { + result->rotate.axis.x = axis_x; + result->rotate.axis.y = axis_y; + result->rotate.axis.z = axis_z; + result->rotate.angle = BlendSkMScalars(from_angle, to_angle, progress); + result->Bake(); + } else { + if (!IsOperationIdentity(to)) + result->matrix = to->matrix; + gfx::Transform from_matrix; + if (!IsOperationIdentity(from)) + from_matrix = from->matrix; + if (!result->matrix.Blend(from_matrix, progress)) + return false; + } + break; + } + case TransformOperation::TRANSFORM_OPERATION_SCALE: { + SkMScalar from_x = IsOperationIdentity(from) ? 1 : from->scale.x; + SkMScalar from_y = IsOperationIdentity(from) ? 1 : from->scale.y; + SkMScalar from_z = IsOperationIdentity(from) ? 1 : from->scale.z; + SkMScalar to_x = IsOperationIdentity(to) ? 1 : to->scale.x; + SkMScalar to_y = IsOperationIdentity(to) ? 1 : to->scale.y; + SkMScalar to_z = IsOperationIdentity(to) ? 1 : to->scale.z; + result->scale.x = BlendSkMScalars(from_x, to_x, progress); + result->scale.y = BlendSkMScalars(from_y, to_y, progress); + result->scale.z = BlendSkMScalars(from_z, to_z, progress); + result->Bake(); + break; + } + case TransformOperation::TRANSFORM_OPERATION_SKEW: { + SkMScalar from_x = IsOperationIdentity(from) ? 0 : from->skew.x; + SkMScalar from_y = IsOperationIdentity(from) ? 0 : from->skew.y; + SkMScalar to_x = IsOperationIdentity(to) ? 0 : to->skew.x; + SkMScalar to_y = IsOperationIdentity(to) ? 0 : to->skew.y; + result->skew.x = BlendSkMScalars(from_x, to_x, progress); + result->skew.y = BlendSkMScalars(from_y, to_y, progress); + result->Bake(); + break; + } + case TransformOperation::TRANSFORM_OPERATION_PERSPECTIVE: { + SkMScalar from_perspective_depth = + IsOperationIdentity(from) ? std::numeric_limits<SkMScalar>::max() + : from->perspective_depth; + SkMScalar to_perspective_depth = + IsOperationIdentity(to) ? std::numeric_limits<SkMScalar>::max() + : to->perspective_depth; + if (from_perspective_depth == 0.f || to_perspective_depth == 0.f) + return false; + + SkMScalar blended_perspective_depth = BlendSkMScalars( + 1.f / from_perspective_depth, 1.f / to_perspective_depth, progress); + + if (blended_perspective_depth == 0.f) + return false; + + result->perspective_depth = 1.f / blended_perspective_depth; + result->Bake(); + break; + } + case TransformOperation::TRANSFORM_OPERATION_MATRIX: { if (!IsOperationIdentity(to)) - to_matrix = to->matrix; + result->matrix = to->matrix; gfx::Transform from_matrix; if (!IsOperationIdentity(from)) from_matrix = from->matrix; - *result = to_matrix; - if (!result->Blend(from_matrix, progress)) + if (!result->matrix.Blend(from_matrix, progress)) return false; + break; } - break; - } - case TransformOperation::TRANSFORM_OPERATION_SCALE: { - SkMScalar from_x = IsOperationIdentity(from) ? 1 : from->scale.x; - SkMScalar from_y = IsOperationIdentity(from) ? 1 : from->scale.y; - SkMScalar from_z = IsOperationIdentity(from) ? 1 : from->scale.z; - SkMScalar to_x = IsOperationIdentity(to) ? 1 : to->scale.x; - SkMScalar to_y = IsOperationIdentity(to) ? 1 : to->scale.y; - SkMScalar to_z = IsOperationIdentity(to) ? 1 : to->scale.z; - result->Scale3d(BlendSkMScalars(from_x, to_x, progress), - BlendSkMScalars(from_y, to_y, progress), - BlendSkMScalars(from_z, to_z, progress)); - break; - } - case TransformOperation::TRANSFORM_OPERATION_SKEW: { - SkMScalar from_x = IsOperationIdentity(from) ? 0 : from->skew.x; - SkMScalar from_y = IsOperationIdentity(from) ? 0 : from->skew.y; - SkMScalar to_x = IsOperationIdentity(to) ? 0 : to->skew.x; - SkMScalar to_y = IsOperationIdentity(to) ? 0 : to->skew.y; - result->Skew(BlendSkMScalars(from_x, to_x, progress), - BlendSkMScalars(from_y, to_y, progress)); - break; - } - case TransformOperation::TRANSFORM_OPERATION_PERSPECTIVE: { - SkMScalar from_perspective_depth = - IsOperationIdentity(from) ? std::numeric_limits<SkMScalar>::max() - : from->perspective_depth; - SkMScalar to_perspective_depth = - IsOperationIdentity(to) ? std::numeric_limits<SkMScalar>::max() - : to->perspective_depth; - if (from_perspective_depth == 0.f || to_perspective_depth == 0.f) - return false; - - SkMScalar blended_perspective_depth = BlendSkMScalars( - 1.f / from_perspective_depth, 1.f / to_perspective_depth, progress); - - if (blended_perspective_depth == 0.f) - return false; - - result->ApplyPerspectiveDepth(1.f / blended_perspective_depth); - break; - } - case TransformOperation::TRANSFORM_OPERATION_MATRIX: { - gfx::Transform to_matrix; - if (!IsOperationIdentity(to)) - to_matrix = to->matrix; - gfx::Transform from_matrix; - if (!IsOperationIdentity(from)) - from_matrix = from->matrix; - *result = to_matrix; - if (!result->Blend(from_matrix, progress)) - return false; - break; - } - case TransformOperation::TRANSFORM_OPERATION_IDENTITY: - // Do nothing. - break; + case TransformOperation::TRANSFORM_OPERATION_IDENTITY: + // Do nothing. + break; } return true; @@ -389,17 +419,17 @@ case TransformOperation::TRANSFORM_OPERATION_SKEW: case TransformOperation::TRANSFORM_OPERATION_PERSPECTIVE: case TransformOperation::TRANSFORM_OPERATION_SCALE: { - gfx::Transform from_transform; - gfx::Transform to_transform; - if (!BlendTransformOperations(from, to, min_progress, &from_transform) || - !BlendTransformOperations(from, to, max_progress, &to_transform)) + TransformOperation from_operation; + TransformOperation to_operation; + if (!BlendTransformOperations(from, to, min_progress, &from_operation) || + !BlendTransformOperations(from, to, max_progress, &to_operation)) return false; *bounds = box; - from_transform.TransformBox(bounds); + from_operation.matrix.TransformBox(bounds); gfx::BoxF to_box = box; - to_transform.TransformBox(&to_box); + to_operation.matrix.TransformBox(&to_box); bounds->ExpandTo(to_box); return true;
diff --git a/cc/animation/transform_operation.h b/cc/animation/transform_operation.h index 3ea5fc2..1a6a816 100644 --- a/cc/animation/transform_operation.h +++ b/cc/animation/transform_operation.h
@@ -54,10 +54,14 @@ }; bool IsIdentity() const; + + // Sets |matrix| based on type and the union values. + void Bake(); + static bool BlendTransformOperations(const TransformOperation* from, const TransformOperation* to, SkMScalar progress, - gfx::Transform* result); + TransformOperation* result); static bool BlendedBoundsForBox(const gfx::BoxF& box, const TransformOperation* from,
diff --git a/cc/animation/transform_operations.cc b/cc/animation/transform_operations.cc index f43cddd..616c31a 100644 --- a/cc/animation/transform_operations.cc +++ b/cc/animation/transform_operations.cc
@@ -37,6 +37,17 @@ TransformOperations::~TransformOperations() { } +TransformOperations& TransformOperations::operator=( + const TransformOperations& other) { + operations_ = other.operations_; + decomposed_transform_dirty_ = other.decomposed_transform_dirty_; + if (!decomposed_transform_dirty_) { + decomposed_transform_.reset( + new gfx::DecomposedTransform(*other.decomposed_transform_.get())); + } + return *this; +} + gfx::Transform TransformOperations::Apply() const { gfx::Transform to_return; for (size_t i = 0; i < operations_.size(); ++i) @@ -44,9 +55,9 @@ return to_return; } -gfx::Transform TransformOperations::Blend(const TransformOperations& from, - SkMScalar progress) const { - gfx::Transform to_return; +TransformOperations TransformOperations::Blend(const TransformOperations& from, + SkMScalar progress) const { + TransformOperations to_return; BlendInternal(from, progress, &to_return); return to_return; } @@ -192,7 +203,7 @@ bool TransformOperations::CanBlendWith( const TransformOperations& other) const { - gfx::Transform dummy; + TransformOperations dummy; return BlendInternal(other, 0.5, &dummy); } @@ -214,42 +225,42 @@ SkMScalar z, SkMScalar degrees) { TransformOperation to_add; - to_add.matrix.RotateAbout(gfx::Vector3dF(x, y, z), degrees); to_add.type = TransformOperation::TRANSFORM_OPERATION_ROTATE; to_add.rotate.axis.x = x; to_add.rotate.axis.y = y; to_add.rotate.axis.z = z; to_add.rotate.angle = degrees; + to_add.Bake(); operations_.push_back(to_add); decomposed_transform_dirty_ = true; } void TransformOperations::AppendScale(SkMScalar x, SkMScalar y, SkMScalar z) { TransformOperation to_add; - to_add.matrix.Scale3d(x, y, z); to_add.type = TransformOperation::TRANSFORM_OPERATION_SCALE; to_add.scale.x = x; to_add.scale.y = y; to_add.scale.z = z; + to_add.Bake(); operations_.push_back(to_add); decomposed_transform_dirty_ = true; } void TransformOperations::AppendSkew(SkMScalar x, SkMScalar y) { TransformOperation to_add; - to_add.matrix.Skew(x, y); to_add.type = TransformOperation::TRANSFORM_OPERATION_SKEW; to_add.skew.x = x; to_add.skew.y = y; + to_add.Bake(); operations_.push_back(to_add); decomposed_transform_dirty_ = true; } void TransformOperations::AppendPerspective(SkMScalar depth) { TransformOperation to_add; - to_add.matrix.ApplyPerspectiveDepth(depth); to_add.type = TransformOperation::TRANSFORM_OPERATION_PERSPECTIVE; to_add.perspective_depth = depth; + to_add.Bake(); operations_.push_back(to_add); decomposed_transform_dirty_ = true; } @@ -274,9 +285,13 @@ return true; } +void TransformOperations::Append(const TransformOperation& operation) { + operations_.push_back(operation); +} + bool TransformOperations::BlendInternal(const TransformOperations& from, SkMScalar progress, - gfx::Transform* result) const { + TransformOperations* result) const { bool from_identity = from.IsIdentity(); bool to_identity = IsIdentity(); if (from_identity && to_identity) @@ -287,14 +302,13 @@ std::max(from_identity ? 0 : from.operations_.size(), to_identity ? 0 : operations_.size()); for (size_t i = 0; i < num_operations; ++i) { - gfx::Transform blended; + TransformOperation blended; if (!TransformOperation::BlendTransformOperations( - from_identity ? 0 : &from.operations_[i], - to_identity ? 0 : &operations_[i], - progress, - &blended)) - return false; - result->PreconcatTransform(blended); + from_identity ? 0 : &from.operations_[i], + to_identity ? 0 : &operations_[i], progress, &blended)) { + return false; + } + result->Append(blended); } return true; } @@ -307,7 +321,7 @@ *from.decomposed_transform_.get(), progress); - *result = ComposeTransform(to_return); + result->AppendMatrix(ComposeTransform(to_return)); return true; }
diff --git a/cc/animation/transform_operations.h b/cc/animation/transform_operations.h index c4138c30..0b91d87 100644 --- a/cc/animation/transform_operations.h +++ b/cc/animation/transform_operations.h
@@ -36,6 +36,8 @@ TransformOperations(const TransformOperations& other); ~TransformOperations(); + TransformOperations& operator=(const TransformOperations& other); + // Returns a transformation matrix representing these transform operations. gfx::Transform Apply() const; @@ -46,8 +48,8 @@ // transforms are baked to matrices (using apply), and the matrices are // then decomposed and interpolated. For more information, see // http://www.w3.org/TR/2011/WD-css3-2d-transforms-20111215/#matrix-decomposition. - gfx::Transform Blend(const TransformOperations& from, - SkMScalar progress) const; + TransformOperations Blend(const TransformOperations& from, + SkMScalar progress) const; // Sets |bounds| be the bounding box for the region within which |box| will // exist when it is transformed by the result of calling Blend on |from| and @@ -86,6 +88,7 @@ void AppendPerspective(SkMScalar depth); void AppendMatrix(const gfx::Transform& matrix); void AppendIdentity(); + void Append(const TransformOperation& operation); bool IsIdentity() const; size_t size() const { return operations_.size(); } @@ -98,7 +101,7 @@ private: bool BlendInternal(const TransformOperations& from, SkMScalar progress, - gfx::Transform* result) const; + TransformOperations* result) const; std::vector<TransformOperation> operations_; @@ -107,8 +110,6 @@ // For efficiency, we cache the decomposed transform. mutable std::unique_ptr<gfx::DecomposedTransform> decomposed_transform_; mutable bool decomposed_transform_dirty_; - - DISALLOW_ASSIGN(TransformOperations); }; } // namespace cc
diff --git a/cc/animation/transform_operations_unittest.cc b/cc/animation/transform_operations_unittest.cc index 052b0f2ae..33576a5 100644 --- a/cc/animation/transform_operations_unittest.cc +++ b/cc/animation/transform_operations_unittest.cc
@@ -20,6 +20,40 @@ namespace cc { namespace { +void ExpectTransformOperationEqual(const TransformOperation& lhs, + const TransformOperation& rhs) { + EXPECT_EQ(lhs.type, rhs.type); + EXPECT_TRANSFORMATION_MATRIX_EQ(lhs.matrix, rhs.matrix); + switch (lhs.type) { + case TransformOperation::TRANSFORM_OPERATION_TRANSLATE: + EXPECT_FLOAT_EQ(lhs.translate.x, rhs.translate.x); + EXPECT_FLOAT_EQ(lhs.translate.y, rhs.translate.y); + EXPECT_FLOAT_EQ(lhs.translate.z, rhs.translate.z); + break; + case TransformOperation::TRANSFORM_OPERATION_ROTATE: + EXPECT_FLOAT_EQ(lhs.rotate.axis.x, rhs.rotate.axis.x); + EXPECT_FLOAT_EQ(lhs.rotate.axis.y, rhs.rotate.axis.y); + EXPECT_FLOAT_EQ(lhs.rotate.axis.z, rhs.rotate.axis.z); + EXPECT_FLOAT_EQ(lhs.rotate.angle, rhs.rotate.angle); + break; + case TransformOperation::TRANSFORM_OPERATION_SCALE: + EXPECT_FLOAT_EQ(lhs.scale.x, rhs.scale.x); + EXPECT_FLOAT_EQ(lhs.scale.y, rhs.scale.y); + EXPECT_FLOAT_EQ(lhs.scale.z, rhs.scale.z); + break; + case TransformOperation::TRANSFORM_OPERATION_SKEW: + EXPECT_FLOAT_EQ(lhs.skew.x, rhs.skew.x); + EXPECT_FLOAT_EQ(lhs.skew.y, rhs.skew.y); + break; + case TransformOperation::TRANSFORM_OPERATION_PERSPECTIVE: + EXPECT_FLOAT_EQ(lhs.perspective_depth, rhs.perspective_depth); + break; + case TransformOperation::TRANSFORM_OPERATION_MATRIX: + case TransformOperation::TRANSFORM_OPERATION_IDENTITY: + break; + } +} + TEST(TransformOperationTest, TransformTypesAreUnique) { std::vector<std::unique_ptr<TransformOperations>> transforms; @@ -303,6 +337,17 @@ SkMScalar progress = 0.25f; + TransformOperations operations_expected; + operations_expected.AppendScale( + gfx::Tween::FloatValueBetween(progress, sx1, sx2), + gfx::Tween::FloatValueBetween(progress, sy1, sy2), + gfx::Tween::FloatValueBetween(progress, sz1, sz2)); + + operations_expected.AppendTranslate( + gfx::Tween::FloatValueBetween(progress, dx1, dx2), + gfx::Tween::FloatValueBetween(progress, dy1, dy2), + gfx::Tween::FloatValueBetween(progress, dz1, dz2)); + gfx::Transform blended_scale = scale_to; blended_scale.Blend(scale_from, progress); @@ -312,8 +357,38 @@ gfx::Transform expected = blended_scale; expected.PreconcatTransform(blended_translate); - EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations_to.Blend(operations_from, progress)); + TransformOperations blended = operations_to.Blend(operations_from, progress); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, blended.Apply()); + EXPECT_TRANSFORMATION_MATRIX_EQ(operations_expected.Apply(), blended.Apply()); + EXPECT_EQ(operations_expected.size(), blended.size()); + for (size_t i = 0; i < operations_expected.size(); ++i) { + TransformOperation expected_op = operations_expected.at(i); + TransformOperation blended_op = blended.at(i); + SCOPED_TRACE(i); + ExpectTransformOperationEqual(expected_op, blended_op); + } + + // Create a mismatch, forcing matrix interpolation. + operations_to.AppendMatrix(gfx::Transform()); + + blended = operations_to.Blend(operations_from, progress); + + expected = operations_to.Apply(); + expected.Blend(operations_from.Apply(), progress); + + operations_expected = TransformOperations(); + operations_expected.AppendMatrix(expected); + + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, blended.Apply()); + EXPECT_TRANSFORMATION_MATRIX_EQ(operations_expected.Apply(), blended.Apply()); + EXPECT_EQ(operations_expected.size(), blended.size()); + for (size_t i = 0; i < operations_expected.size(); ++i) { + TransformOperation expected_op = operations_expected.at(i); + TransformOperation blended_op = blended.at(i); + SCOPED_TRACE(i); + ExpectTransformOperationEqual(expected_op, blended_op); + } } static void CheckProgress(SkMScalar progress, @@ -324,7 +399,7 @@ gfx::Transform expected_matrix = to_matrix; expected_matrix.Blend(from_matrix, progress); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected_matrix, to_transform.Blend(from_transform, progress)); + expected_matrix, to_transform.Blend(from_transform, progress).Apply()); } TEST(TransformOperationTest, BlendProgress) { @@ -393,7 +468,7 @@ expected.Blend(from, progress); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations_to.Blend(operations_from, progress)); + expected, operations_to.Blend(operations_from, progress).Apply()); } TEST(TransformOperationTest, LargeRotationsWithSameAxis) { @@ -409,7 +484,7 @@ expected.RotateAbout(gfx::Vector3dF(0, 0, 1), 180); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations_to.Blend(operations_from, progress)); + expected, operations_to.Blend(operations_from, progress).Apply()); } TEST(TransformOperationTest, LargeRotationsWithSameAxisInDifferentDirection) { @@ -424,7 +499,7 @@ gfx::Transform expected; EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations_to.Blend(operations_from, progress)); + expected, operations_to.Blend(operations_from, progress).Apply()); } TEST(TransformOperationTest, LargeRotationsWithDifferentAxes) { @@ -445,7 +520,7 @@ expected.Blend(matrix_from, progress); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations_to.Blend(operations_from, progress)); + expected, operations_to.Blend(operations_from, progress).Apply()); } TEST(TransformOperationTest, RotationFromZeroDegDifferentAxes) { @@ -459,7 +534,7 @@ gfx::Transform expected; expected.RotateAbout(gfx::Vector3dF(0, 1, 0), 225); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations_to.Blend(operations_from, progress)); + expected, operations_to.Blend(operations_from, progress).Apply()); } TEST(TransformOperationTest, RotationFromZeroDegSameAxes) { @@ -473,7 +548,7 @@ gfx::Transform expected; expected.RotateAbout(gfx::Vector3dF(0, 0, 1), 225); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations_to.Blend(operations_from, progress)); + expected, operations_to.Blend(operations_from, progress).Apply()); } TEST(TransformOperationTest, RotationToZeroDegDifferentAxes) { @@ -487,7 +562,7 @@ gfx::Transform expected; expected.RotateAbout(gfx::Vector3dF(0, 1, 0), 225); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations_to.Blend(operations_from, progress)); + expected, operations_to.Blend(operations_from, progress).Apply()); } TEST(TransformOperationTest, RotationToZeroDegSameAxes) { @@ -501,7 +576,7 @@ gfx::Transform expected; expected.RotateAbout(gfx::Vector3dF(0, 0, 1), 225); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations_to.Blend(operations_from, progress)); + expected, operations_to.Blend(operations_from, progress).Apply()); } TEST(TransformOperationTest, BlendRotationFromIdentity) { @@ -518,7 +593,7 @@ expected.RotateAbout(gfx::Vector3dF(0, 0, 1), 45); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations.Blend(*identity_operations[i], progress)); + expected, operations.Blend(*identity_operations[i], progress).Apply()); progress = -0.5f; @@ -526,7 +601,7 @@ expected.RotateAbout(gfx::Vector3dF(0, 0, 1), -45); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations.Blend(*identity_operations[i], progress)); + expected, operations.Blend(*identity_operations[i], progress).Apply()); progress = 1.5f; @@ -534,7 +609,7 @@ expected.RotateAbout(gfx::Vector3dF(0, 0, 1), 135); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations.Blend(*identity_operations[i], progress)); + expected, operations.Blend(*identity_operations[i], progress).Apply()); } } @@ -552,7 +627,7 @@ expected.Translate3d(1, 1, 1); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations.Blend(*identity_operations[i], progress)); + expected, operations.Blend(*identity_operations[i], progress).Apply()); progress = -0.5f; @@ -560,7 +635,7 @@ expected.Translate3d(-1, -1, -1); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations.Blend(*identity_operations[i], progress)); + expected, operations.Blend(*identity_operations[i], progress).Apply()); progress = 1.5f; @@ -568,7 +643,7 @@ expected.Translate3d(3, 3, 3); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations.Blend(*identity_operations[i], progress)); + expected, operations.Blend(*identity_operations[i], progress).Apply()); } } @@ -586,7 +661,7 @@ expected.Scale3d(2, 2, 2); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations.Blend(*identity_operations[i], progress)); + expected, operations.Blend(*identity_operations[i], progress).Apply()); progress = -0.5f; @@ -594,7 +669,7 @@ expected.Scale3d(0, 0, 0); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations.Blend(*identity_operations[i], progress)); + expected, operations.Blend(*identity_operations[i], progress).Apply()); progress = 1.5f; @@ -602,7 +677,7 @@ expected.Scale3d(4, 4, 4); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations.Blend(*identity_operations[i], progress)); + expected, operations.Blend(*identity_operations[i], progress).Apply()); } } @@ -617,24 +692,24 @@ gfx::Transform expected; expected.Skew(1, 1); - EXPECT_TRANSFORMATION_MATRIX_EQ(expected, - operations.Blend(empty_operation, progress)); + EXPECT_TRANSFORMATION_MATRIX_EQ( + expected, operations.Blend(empty_operation, progress).Apply()); progress = -0.5f; expected.MakeIdentity(); expected.Skew(-1, -1); - EXPECT_TRANSFORMATION_MATRIX_EQ(expected, - operations.Blend(empty_operation, progress)); + EXPECT_TRANSFORMATION_MATRIX_EQ( + expected, operations.Blend(empty_operation, progress).Apply()); progress = 1.5f; expected.MakeIdentity(); expected.Skew(3, 3); - EXPECT_TRANSFORMATION_MATRIX_EQ(expected, - operations.Blend(empty_operation, progress)); + EXPECT_TRANSFORMATION_MATRIX_EQ( + expected, operations.Blend(empty_operation, progress).Apply()); } TEST(TransformOperationTest, BlendPerspectiveFromIdentity) { @@ -651,7 +726,7 @@ expected.ApplyPerspectiveDepth(2000); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations.Blend(*identity_operations[i], progress)); + expected, operations.Blend(*identity_operations[i], progress).Apply()); } } @@ -669,7 +744,7 @@ expected.RotateAbout(gfx::Vector3dF(0, 0, 1), 45); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, identity_operations[i]->Blend(operations, progress)); + expected, identity_operations[i]->Blend(operations, progress).Apply()); } } @@ -687,7 +762,7 @@ expected.Translate3d(1, 1, 1); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, identity_operations[i]->Blend(operations, progress)); + expected, identity_operations[i]->Blend(operations, progress).Apply()); } } @@ -705,7 +780,7 @@ expected.Scale3d(2, 2, 2); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, identity_operations[i]->Blend(operations, progress)); + expected, identity_operations[i]->Blend(operations, progress).Apply()); } } @@ -720,8 +795,8 @@ gfx::Transform expected; expected.Skew(1, 1); - EXPECT_TRANSFORMATION_MATRIX_EQ(expected, - empty_operation.Blend(operations, progress)); + EXPECT_TRANSFORMATION_MATRIX_EQ( + expected, empty_operation.Blend(operations, progress).Apply()); } TEST(TransformOperationTest, BlendPerspectiveToIdentity) { @@ -738,7 +813,7 @@ expected.ApplyPerspectiveDepth(2000); EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, identity_operations[i]->Blend(operations, progress)); + expected, identity_operations[i]->Blend(operations, progress).Apply()); } } @@ -752,14 +827,14 @@ gfx::Transform expected; expected.ApplyPerspectiveDepth(400); - EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations1.Blend(operations2, -0.5)); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, + operations1.Blend(operations2, -0.5).Apply()); expected.MakeIdentity(); expected.ApplyPerspectiveDepth(2000); - EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations1.Blend(operations2, 1.5)); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, + operations1.Blend(operations2, 1.5).Apply()); } TEST(TransformOperationTest, ExtrapolateMatrixBlending) { @@ -774,12 +849,12 @@ operations2.AppendMatrix(transform2); gfx::Transform expected; - EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations1.Blend(operations2, 1.5)); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, + operations1.Blend(operations2, 1.5).Apply()); expected.Translate3d(4, 4, 4); - EXPECT_TRANSFORMATION_MATRIX_EQ( - expected, operations1.Blend(operations2, -0.5)); + EXPECT_TRANSFORMATION_MATRIX_EQ(expected, + operations1.Blend(operations2, -0.5).Apply()); } TEST(TransformOperationTest, BlendedBoundsWhenTypesDoNotMatch) { @@ -1067,7 +1142,7 @@ for (size_t step = 0; step < kNumSteps; ++step) { float t = step / (kNumSteps - 1.f); t = gfx::Tween::FloatValueBetween(t, min_progress, max_progress); - gfx::Transform partial_transform = to.Blend(from, t); + gfx::Transform partial_transform = to.Blend(from, t).Apply(); gfx::BoxF transformed = box; partial_transform.TransformBox(&transformed); @@ -1202,7 +1277,7 @@ EXPECT_TRUE(blended_matrix.Blend(from_transform, progress)); gfx::Transform blended_transform = - to_operations.Blend(from_operations, progress); + to_operations.Blend(from_operations, progress).Apply(); EXPECT_TRANSFORMATION_MATRIX_EQ(blended_matrix, blended_transform); } @@ -1286,7 +1361,7 @@ EXPECT_TRUE(operations_to.BlendedBoundsForBox( box, operations_from, min_progress, max_progress, &bounds)); gfx::Transform blended_transform = - operations_to.Blend(operations_from, max_progress); + operations_to.Blend(operations_from, max_progress).Apply(); gfx::Point3F blended_point(0.9f, 0.9f, 0.0f); blended_transform.TransformPoint(&blended_point); gfx::BoxF expanded_bounds = bounds;
diff --git a/cc/input/input_handler.h b/cc/input/input_handler.h index 2c9a0ebd..899aca2c 100644 --- a/cc/input/input_handler.h +++ b/cc/input/input_handler.h
@@ -14,6 +14,7 @@ #include "cc/input/main_thread_scrolling_reason.h" #include "cc/input/scroll_state.h" #include "cc/input/scrollbar.h" +#include "cc/input/touch_action.h" #include "cc/trees/swap_promise_monitor.h" namespace gfx { @@ -198,8 +199,13 @@ // suppress scrolling by consuming touch events that started at // |viewport_point|, and whether |viewport_point| is on the currently // scrolling layer. + // |out_touch_action| is assigned the whitelisted touch action for the + // |viewport_point|. In the case there are no touch handlers or touch action + // regions, |out_touch_action| is assigned kTouchActionAuto since the default + // touch action is auto. virtual TouchStartOrMoveEventListenerType - EventListenerTypeForTouchStartOrMoveAt(const gfx::Point& viewport_point) = 0; + EventListenerTypeForTouchStartOrMoveAt(const gfx::Point& viewport_point, + TouchAction* out_touch_action) = 0; // Calling CreateLatencyInfoSwapPromiseMonitor() to get a scoped // LatencyInfoSwapPromiseMonitor. During the life time of the
diff --git a/cc/layers/touch_action_region.cc b/cc/layers/touch_action_region.cc index 5d0be4da..8e26b369 100644 --- a/cc/layers/touch_action_region.cc +++ b/cc/layers/touch_action_region.cc
@@ -32,6 +32,17 @@ return it->second; } +TouchAction TouchActionRegion::GetWhiteListedTouchAction( + const gfx::Point& point) const { + TouchAction white_listed_touch_action = kTouchActionAuto; + for (const auto& pair : map_) { + if (!pair.second.Contains(point)) + continue; + white_listed_touch_action &= pair.first; + } + return white_listed_touch_action; +} + TouchActionRegion& TouchActionRegion::operator=( const TouchActionRegion& other) { *region_ = *other.region_;
diff --git a/cc/layers/touch_action_region.h b/cc/layers/touch_action_region.h index cd64318..3c4a477 100644 --- a/cc/layers/touch_action_region.h +++ b/cc/layers/touch_action_region.h
@@ -25,6 +25,12 @@ const Region& region() const { return *region_; } const Region& GetRegionForTouchAction(TouchAction); + // Returns the touch actions that we are sure will be allowed at the point + // by finding the intersection of all touch actions whose regions contain the + // given point. If the map is empty, |kTouchActionAuto| is returned since no + // touch actions have been explicitly defined and the default touch action + // is auto. + TouchAction GetWhiteListedTouchAction(const gfx::Point&) const; TouchActionRegion& operator=(const TouchActionRegion& other); TouchActionRegion& operator=(TouchActionRegion&& other); bool operator==(const TouchActionRegion& other) const;
diff --git a/cc/layers/touch_action_region_unittest.cc b/cc/layers/touch_action_region_unittest.cc new file mode 100644 index 0000000..4695b0e --- /dev/null +++ b/cc/layers/touch_action_region_unittest.cc
@@ -0,0 +1,67 @@ +// Copyright 2017 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 "cc/layers/touch_action_region.h" + +#include "testing/gtest/include/gtest/gtest.h" + +namespace cc { +namespace { + +TEST(TouchActionRegionTest, GetWhiteListedTouchActionMapOverlapToZero) { + TouchActionRegion touch_action_region; + touch_action_region.Union(kTouchActionPanLeft, gfx::Rect(0, 0, 50, 50)); + touch_action_region.Union(kTouchActionPanRight, gfx::Rect(25, 25, 25, 25)); + // The point is only in PanLeft, so the result is PanLeft. + EXPECT_EQ(kTouchActionPanLeft, + touch_action_region.GetWhiteListedTouchAction(gfx::Point(10, 10))); + // The point is in both PanLeft and PanRight, and those actions have no + // common components, so the result is None. + EXPECT_EQ(kTouchActionNone, + touch_action_region.GetWhiteListedTouchAction(gfx::Point(30, 30))); + // The point is in neither PanLeft nor PanRight, so the result is Auto since + // the default touch action is auto. + EXPECT_EQ(kTouchActionAuto, + touch_action_region.GetWhiteListedTouchAction(gfx::Point(60, 60))); +} + +TEST(TouchActionRegionTest, GetWhiteListedTouchActionMapOverlapToNonZero) { + TouchActionRegion touch_action_region; + touch_action_region.Union(kTouchActionPanX, gfx::Rect(0, 0, 50, 50)); + touch_action_region.Union(kTouchActionPanRight, gfx::Rect(25, 25, 25, 25)); + // The point is only in PanX, so the result is PanX. + EXPECT_EQ(kTouchActionPanX, + touch_action_region.GetWhiteListedTouchAction(gfx::Point(10, 10))); + // The point is in both PanX and PanRight, and PanRight is a common component, + // so the result is PanRight. + EXPECT_EQ(kTouchActionPanRight, + touch_action_region.GetWhiteListedTouchAction(gfx::Point(30, 30))); + // The point is neither PanX nor PanRight, so the result is Auto since the + // default touch action is auto. + EXPECT_EQ(kTouchActionAuto, + touch_action_region.GetWhiteListedTouchAction(gfx::Point(60, 60))); +} + +TEST(TouchActionRegionTest, GetWhiteListedTouchActionEmptyMap) { + TouchActionRegion touch_action_region; + // The result is Auto since the map is empty and the default touch + // action is auto. + EXPECT_EQ(kTouchActionAuto, + touch_action_region.GetWhiteListedTouchAction(gfx::Point(10, 10))); +} + +TEST(TouchActionRegionTest, GetWhiteListedTouchActionSingleMapEntry) { + TouchActionRegion touch_action_region; + touch_action_region.Union(kTouchActionPanUp, gfx::Rect(0, 0, 50, 50)); + // The point is only in PanUp, so the result is PanUp. + EXPECT_EQ(kTouchActionPanUp, + touch_action_region.GetWhiteListedTouchAction(gfx::Point(10, 10))); + // The point is not in PanUp, so the result is Auto since the default touch + // action is auto. + EXPECT_EQ(kTouchActionAuto, + touch_action_region.GetWhiteListedTouchAction(gfx::Point(60, 60))); +} + +} // namespace +} // namespace cc
diff --git a/cc/test/animation_test_common.cc b/cc/test/animation_test_common.cc index cadf120..c5f34e0 100644 --- a/cc/test/animation_test_common.cc +++ b/cc/test/animation_test_common.cc
@@ -159,8 +159,9 @@ return duration_; } -gfx::Transform FakeTransformTransition::GetValue(base::TimeDelta time) const { - return gfx::Transform(); +TransformOperations FakeTransformTransition::GetValue( + base::TimeDelta time) const { + return TransformOperations(); } bool FakeTransformTransition::AnimatedBoundsForBox(const gfx::BoxF& box,
diff --git a/cc/test/animation_test_common.h b/cc/test/animation_test_common.h index 6485532..37853c7e 100644 --- a/cc/test/animation_test_common.h +++ b/cc/test/animation_test_common.h
@@ -43,7 +43,7 @@ ~FakeTransformTransition() override; base::TimeDelta Duration() const override; - gfx::Transform GetValue(base::TimeDelta time) const override; + TransformOperations GetValue(base::TimeDelta time) const override; bool AnimatedBoundsForBox(const gfx::BoxF& box, gfx::BoxF* bounds) const override; bool IsTranslation() const override;
diff --git a/cc/test/animation_timelines_test_common.h b/cc/test/animation_timelines_test_common.h index 968a05c..0ed3a34d 100644 --- a/cc/test/animation_timelines_test_common.h +++ b/cc/test/animation_timelines_test_common.h
@@ -14,6 +14,7 @@ #include "cc/trees/mutator_host_client.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/geometry/scroll_offset.h" +#include "ui/gfx/transform.h" namespace cc {
diff --git a/cc/test/geometry_test_utils.cc b/cc/test/geometry_test_utils.cc index 9bf5811..df61c53 100644 --- a/cc/test/geometry_test_utils.cc +++ b/cc/test/geometry_test_utils.cc
@@ -16,22 +16,23 @@ void ExpectTransformationMatrixEq(const gfx::Transform& expected, const gfx::Transform& actual) { - EXPECT_FLOAT_EQ((expected).matrix().get(0, 0), (actual).matrix().get(0, 0)); - EXPECT_FLOAT_EQ((expected).matrix().get(1, 0), (actual).matrix().get(1, 0)); - EXPECT_FLOAT_EQ((expected).matrix().get(2, 0), (actual).matrix().get(2, 0)); - EXPECT_FLOAT_EQ((expected).matrix().get(3, 0), (actual).matrix().get(3, 0)); - EXPECT_FLOAT_EQ((expected).matrix().get(0, 1), (actual).matrix().get(0, 1)); - EXPECT_FLOAT_EQ((expected).matrix().get(1, 1), (actual).matrix().get(1, 1)); - EXPECT_FLOAT_EQ((expected).matrix().get(2, 1), (actual).matrix().get(2, 1)); - EXPECT_FLOAT_EQ((expected).matrix().get(3, 1), (actual).matrix().get(3, 1)); - EXPECT_FLOAT_EQ((expected).matrix().get(0, 2), (actual).matrix().get(0, 2)); - EXPECT_FLOAT_EQ((expected).matrix().get(1, 2), (actual).matrix().get(1, 2)); - EXPECT_FLOAT_EQ((expected).matrix().get(2, 2), (actual).matrix().get(2, 2)); - EXPECT_FLOAT_EQ((expected).matrix().get(3, 2), (actual).matrix().get(3, 2)); - EXPECT_FLOAT_EQ((expected).matrix().get(0, 3), (actual).matrix().get(0, 3)); - EXPECT_FLOAT_EQ((expected).matrix().get(1, 3), (actual).matrix().get(1, 3)); - EXPECT_FLOAT_EQ((expected).matrix().get(2, 3), (actual).matrix().get(2, 3)); - EXPECT_FLOAT_EQ((expected).matrix().get(3, 3), (actual).matrix().get(3, 3)); + for (int row = 0; row < 4; ++row) { + for (int col = 0; col < 4; ++col) { + EXPECT_FLOAT_EQ(expected.matrix().get(row, col), + actual.matrix().get(row, col)); + } + } +} + +void ExpectTransformationMatrixNear(const gfx::Transform& expected, + const gfx::Transform& actual, + float abs_error) { + for (int row = 0; row < 4; ++row) { + for (int col = 0; col < 4; ++col) { + EXPECT_NEAR(expected.matrix().get(row, col), + actual.matrix().get(row, col), abs_error); + } + } } gfx::Transform Inverse(const gfx::Transform& transform) {
diff --git a/cc/test/geometry_test_utils.h b/cc/test/geometry_test_utils.h index 6e015131..18618d1 100644 --- a/cc/test/geometry_test_utils.h +++ b/cc/test/geometry_test_utils.h
@@ -5,6 +5,8 @@ #ifndef CC_TEST_GEOMETRY_TEST_UTILS_H_ #define CC_TEST_GEOMETRY_TEST_UTILS_H_ +#include "cc/cc_export.h" + namespace gfx { class Transform; } @@ -96,6 +98,16 @@ ExpectTransformationMatrixEq(expected, actual); \ } while (false) +void ExpectTransformationMatrixNear(const gfx::Transform& expected, + const gfx::Transform& actual, + float abs_error); + +#define EXPECT_TRANSFORMATION_MATRIX_NEAR(expected, actual, abs_error) \ + do { \ + SCOPED_TRACE(""); \ + ExpectTransformationMatrixNear(expected, actual, abs_error); \ + } while (false) + // Should be used in test code only, for convenience. Production code should use // the gfx::Transform::GetInverse() API. gfx::Transform Inverse(const gfx::Transform& transform);
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 3a1744a4..707d7a75 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -624,7 +624,8 @@ InputHandler::TouchStartOrMoveEventListenerType LayerTreeHostImpl::EventListenerTypeForTouchStartOrMoveAt( - const gfx::Point& viewport_point) { + const gfx::Point& viewport_point, + TouchAction* out_touch_action) { gfx::PointF device_viewport_point = gfx::ScalePoint( gfx::PointF(viewport_point), active_tree_->device_scale_factor()); @@ -633,8 +634,18 @@ LayerImpl* layer_impl_with_touch_handler = active_tree_->FindLayerThatIsHitByPointInTouchHandlerRegion( device_viewport_point); - if (layer_impl_with_touch_handler == NULL) + + if (layer_impl_with_touch_handler == nullptr) { + if (out_touch_action) + *out_touch_action = kTouchActionAuto; return InputHandler::TouchStartOrMoveEventListenerType::NO_HANDLER; + } + + if (out_touch_action) { + const auto& region = layer_impl_with_touch_handler->touch_action_region(); + gfx::Point point = gfx::ToRoundedPoint(device_viewport_point); + *out_touch_action = region.GetWhiteListedTouchAction(point); + } if (!CurrentlyScrollingNode()) return InputHandler::TouchStartOrMoveEventListenerType::HANDLER;
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index 8728ac57..a4c481a 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h
@@ -205,7 +205,8 @@ EventListenerClass event_class) const override; InputHandler::TouchStartOrMoveEventListenerType EventListenerTypeForTouchStartOrMoveAt( - const gfx::Point& viewport_port) override; + const gfx::Point& viewport_port, + TouchAction* out_touch_action) override; std::unique_ptr<SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( ui::LatencyInfo* latency) override; ScrollElasticityHelper* CreateScrollElasticityHelper() override;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index afb6683..ea14f33 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -1034,12 +1034,15 @@ } // Touch handler regions determine whether touch events block scroll. + TouchAction touch_action; TouchActionRegion touch_action_region; - touch_action_region.Union(kTouchActionNone, gfx::Rect(0, 0, 100, 100)); + touch_action_region.Union(kTouchActionPanLeft, gfx::Rect(0, 0, 100, 100)); + touch_action_region.Union(kTouchActionPanRight, gfx::Rect(25, 25, 100, 100)); root->SetTouchActionRegion(std::move(touch_action_region)); - EXPECT_EQ( - InputHandler::TouchStartOrMoveEventListenerType::HANDLER, - host_impl_->EventListenerTypeForTouchStartOrMoveAt(gfx::Point(10, 10))); + EXPECT_EQ(InputHandler::TouchStartOrMoveEventListenerType::HANDLER, + host_impl_->EventListenerTypeForTouchStartOrMoveAt( + gfx::Point(10, 10), &touch_action)); + EXPECT_EQ(kTouchActionPanLeft, touch_action); // But they don't influence the actual handling of the scroll gestures. InputHandler::ScrollStatus status = host_impl_->ScrollBegin( @@ -1049,19 +1052,21 @@ status.main_thread_scrolling_reasons); host_impl_->ScrollEnd(EndState().get()); - EXPECT_EQ( - InputHandler::TouchStartOrMoveEventListenerType::HANDLER, - host_impl_->EventListenerTypeForTouchStartOrMoveAt(gfx::Point(10, 30))); + EXPECT_EQ(InputHandler::TouchStartOrMoveEventListenerType::HANDLER, + host_impl_->EventListenerTypeForTouchStartOrMoveAt( + gfx::Point(10, 30), &touch_action)); root->SetTouchActionRegion(TouchActionRegion()); - EXPECT_EQ( - InputHandler::TouchStartOrMoveEventListenerType::NO_HANDLER, - host_impl_->EventListenerTypeForTouchStartOrMoveAt(gfx::Point(10, 30))); + EXPECT_EQ(InputHandler::TouchStartOrMoveEventListenerType::NO_HANDLER, + host_impl_->EventListenerTypeForTouchStartOrMoveAt( + gfx::Point(10, 30), &touch_action)); + EXPECT_EQ(kTouchActionAuto, touch_action); touch_action_region = TouchActionRegion(); - touch_action_region.Union(kTouchActionNone, gfx::Rect(0, 0, 50, 50)); + touch_action_region.Union(kTouchActionPanX, gfx::Rect(0, 0, 50, 50)); child->SetTouchActionRegion(std::move(touch_action_region)); - EXPECT_EQ( - InputHandler::TouchStartOrMoveEventListenerType::HANDLER, - host_impl_->EventListenerTypeForTouchStartOrMoveAt(gfx::Point(10, 30))); + EXPECT_EQ(InputHandler::TouchStartOrMoveEventListenerType::HANDLER, + host_impl_->EventListenerTypeForTouchStartOrMoveAt( + gfx::Point(10, 30), &touch_action)); + EXPECT_EQ(kTouchActionPanX, touch_action); } TEST_F(LayerTreeHostImplTest, FlingOnlyWhenScrollingTouchscreen) { @@ -10447,16 +10452,17 @@ DrawFrame(); { + TouchAction touch_action; // Touch on a layer which does not have a handler will return kNone. - EXPECT_EQ( - InputHandler::TouchStartOrMoveEventListenerType::NO_HANDLER, - host_impl_->EventListenerTypeForTouchStartOrMoveAt(gfx::Point(10, 10))); + EXPECT_EQ(InputHandler::TouchStartOrMoveEventListenerType::NO_HANDLER, + host_impl_->EventListenerTypeForTouchStartOrMoveAt( + gfx::Point(10, 10), &touch_action)); TouchActionRegion touch_action_region; touch_action_region.Union(kTouchActionNone, gfx::Rect(0, 0, 100, 100)); child_layer->SetTouchActionRegion(touch_action_region); - EXPECT_EQ( - InputHandler::TouchStartOrMoveEventListenerType::HANDLER, - host_impl_->EventListenerTypeForTouchStartOrMoveAt(gfx::Point(10, 10))); + EXPECT_EQ(InputHandler::TouchStartOrMoveEventListenerType::HANDLER, + host_impl_->EventListenerTypeForTouchStartOrMoveAt( + gfx::Point(10, 10), &touch_action)); // Flinging the grand_child layer. EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, host_impl_ @@ -10469,10 +10475,10 @@ host_impl_->CurrentlyScrollingNode()->id); // Touch on the grand_child layer, which is an active fling layer, the touch // event handler will force to be passive. - EXPECT_EQ( - InputHandler::TouchStartOrMoveEventListenerType:: - HANDLER_ON_SCROLLING_LAYER, - host_impl_->EventListenerTypeForTouchStartOrMoveAt(gfx::Point(70, 80))); + EXPECT_EQ(InputHandler::TouchStartOrMoveEventListenerType:: + HANDLER_ON_SCROLLING_LAYER, + host_impl_->EventListenerTypeForTouchStartOrMoveAt( + gfx::Point(70, 80), &touch_action)); } } @@ -10531,16 +10537,17 @@ host_impl_->CurrentlyScrollingNode()->id); // Touch on the grand_child layer, which is an active fling layer, the touch // event handler will force to be passive. - EXPECT_EQ( - InputHandler::TouchStartOrMoveEventListenerType:: - HANDLER_ON_SCROLLING_LAYER, - host_impl_->EventListenerTypeForTouchStartOrMoveAt(gfx::Point(70, 80))); + TouchAction touch_action; + EXPECT_EQ(InputHandler::TouchStartOrMoveEventListenerType:: + HANDLER_ON_SCROLLING_LAYER, + host_impl_->EventListenerTypeForTouchStartOrMoveAt( + gfx::Point(70, 80), &touch_action)); // Touch on the great_grand_child_layer layer, which is the child of the // active fling layer, the touch event handler will force to be passive. - EXPECT_EQ( - InputHandler::TouchStartOrMoveEventListenerType:: - HANDLER_ON_SCROLLING_LAYER, - host_impl_->EventListenerTypeForTouchStartOrMoveAt(gfx::Point(20, 30))); + EXPECT_EQ(InputHandler::TouchStartOrMoveEventListenerType:: + HANDLER_ON_SCROLLING_LAYER, + host_impl_->EventListenerTypeForTouchStartOrMoveAt( + gfx::Point(20, 30), &touch_action)); // Now flinging on the great_grand_child_layer. EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, @@ -10553,9 +10560,9 @@ EXPECT_EQ(great_grand_child_layer->scroll_tree_index(), host_impl_->CurrentlyScrollingNode()->id); // Touch on the child layer, the touch event handler will be blocked. - EXPECT_EQ( - InputHandler::TouchStartOrMoveEventListenerType::HANDLER, - host_impl_->EventListenerTypeForTouchStartOrMoveAt(gfx::Point(60, 60))); + EXPECT_EQ(InputHandler::TouchStartOrMoveEventListenerType::HANDLER, + host_impl_->EventListenerTypeForTouchStartOrMoveAt( + gfx::Point(60, 60), &touch_action)); } }
diff --git a/cc/trees/target_property.cc b/cc/trees/target_property.cc index cabff92..d4539a3 100644 --- a/cc/trees/target_property.cc +++ b/cc/trees/target_property.cc
@@ -15,7 +15,8 @@ // This should match the TargetProperty enum. static const char* const s_targetPropertyNames[] = { - "TRANSFORM", "OPACITY", "FILTER", "SCROLL_OFFSET", "BACKGROUND_COLOR"}; + "TRANSFORM", "OPACITY", "FILTER", + "SCROLL_OFFSET", "BACKGROUND_COLOR", "BOUNDS"}; static_assert(static_cast<int>(TargetProperty::LAST_TARGET_PROPERTY) + 1 == arraysize(s_targetPropertyNames),
diff --git a/cc/trees/target_property.h b/cc/trees/target_property.h index 177ef965..55f31708 100644 --- a/cc/trees/target_property.h +++ b/cc/trees/target_property.h
@@ -19,9 +19,10 @@ FILTER, SCROLL_OFFSET, BACKGROUND_COLOR, + BOUNDS, // These sentinels must be last FIRST_TARGET_PROPERTY = TRANSFORM, - LAST_TARGET_PROPERTY = BACKGROUND_COLOR + LAST_TARGET_PROPERTY = BOUNDS }; CC_EXPORT const char* GetName(TargetProperty::Type property);
diff --git a/chrome/VERSION b/chrome/VERSION index 0bb1b4c..fb47ad7b 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=61 MINOR=0 -BUILD=3149 +BUILD=3150 PATCH=0
diff --git a/chrome/android/java/res/layout/new_tab_page_snippets_card.xml b/chrome/android/java/res/layout/new_tab_page_snippets_card.xml index e0b5053d..a6221e5 100644 --- a/chrome/android/java/res/layout/new_tab_page_snippets_card.xml +++ b/chrome/android/java/res/layout/new_tab_page_snippets_card.xml
@@ -24,7 +24,7 @@ android:ellipsize="end" android:textSize="16sp" android:textColor="@color/snippets_headline_text_color" - chrome:leading="24dp" /> + chrome:leading="24sp" /> <org.chromium.ui.widget.TextViewWithLeading android:id="@+id/article_snippet" @@ -38,7 +38,7 @@ android:ellipsize="end" android:textSize="14sp" android:textColor="@color/snippets_text_color" - chrome:leading="20dp" /> + chrome:leading="20sp" /> <LinearLayout tools:ignore="UseCompoundDrawables"
diff --git a/chrome/android/java/res/layout/new_tab_page_snippets_card_large_thumbnail.xml b/chrome/android/java/res/layout/new_tab_page_snippets_card_large_thumbnail.xml index ec68ec3d..db6e0dd 100644 --- a/chrome/android/java/res/layout/new_tab_page_snippets_card_large_thumbnail.xml +++ b/chrome/android/java/res/layout/new_tab_page_snippets_card_large_thumbnail.xml
@@ -33,7 +33,7 @@ android:ellipsize="end" android:textSize="16sp" android:textColor="@color/snippets_headline_text_color" - chrome:leading="22dp" /> + chrome:leading="22sp" /> <org.chromium.ui.widget.TextViewWithLeading android:id="@+id/article_snippet" @@ -44,7 +44,7 @@ android:ellipsize="end" android:textSize="14sp" android:textColor="@color/snippets_text_color" - chrome:leading="20dp" /> + chrome:leading="20sp" /> <LinearLayout tools:ignore="UseCompoundDrawables"
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/MostVisitedSitesBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/MostVisitedSitesBridge.java index 0d0fe2c..90572dd 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/MostVisitedSitesBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/MostVisitedSitesBridge.java
@@ -117,10 +117,12 @@ removeBlacklistedUrl( HomepageManager.getHomepageUri(ContextUtils.getApplicationContext())); } + nativeOnHomePageStateChanged(mNativeMostVisitedSitesBridge); } private native long nativeInit(Profile profile); private native void nativeDestroy(long nativeMostVisitedSitesBridge); + private native void nativeOnHomePageStateChanged(long nativeMostVisitedSitesBridge); private native void nativeSetObserver( long nativeMostVisitedSitesBridge, MostVisitedSites.Observer observer, int numSites); private native void nativeSetHomePageClient(
diff --git a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/GmsCoreSyncListenerTest.java b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/GmsCoreSyncListenerTest.java index 7ec4fbb..e340cdd 100644 --- a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/GmsCoreSyncListenerTest.java +++ b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/GmsCoreSyncListenerTest.java
@@ -78,12 +78,12 @@ @MediumTest @Feature({"Sync"}) public void testClearData() throws Throwable { - setUpTestAccountAndSignIn(); + Account account = setUpTestAccountAndSignIn(); assertEquals(0, mListener.callCount()); encryptWithPassphrase(PASSPHRASE); waitForCallCount(1); clearServerData(); - setUpTestAccountAndSignIn(); + signIn(account); encryptWithPassphrase(PASSPHRASE); waitForCallCount(2); }
diff --git a/chrome/android/webapk/shell_apk/shell_apk_version.gni b/chrome/android/webapk/shell_apk/shell_apk_version.gni index de66dac..f9b3db1 100644 --- a/chrome/android/webapk/shell_apk/shell_apk_version.gni +++ b/chrome/android/webapk/shell_apk/shell_apk_version.gni
@@ -6,7 +6,7 @@ # (including AndroidManifest.xml) is updated. This version should be incremented # prior to uploading a new ShellAPK to the WebAPK Minting Server. # Does not affect Chrome.apk -template_shell_apk_version = 13 +template_shell_apk_version = 14 # The ShellAPK version expected by Chrome. Chrome will try to update the WebAPK # if the WebAPK's ShellAPK version is less than |expected_shell_apk_version|.
diff --git a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/HostBrowserClassLoader.java b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/HostBrowserClassLoader.java index 2bf97d8e..f358e621 100644 --- a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/HostBrowserClassLoader.java +++ b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/HostBrowserClassLoader.java
@@ -20,6 +20,9 @@ * Creates ClassLoader for WebAPK-specific dex file in Chrome APK's assets. */ public class HostBrowserClassLoader { + /** Directory for storing cached dex files. */ + public static final String DEX_DIR_NAME = "dex"; + private static final String TAG = "cr_HostBrowserClassLoader"; /** @@ -80,7 +83,7 @@ if (newRuntimeDexVersion == -1) { newRuntimeDexVersion = runtimeDexVersion; } - File localDexDir = context.getDir("dex", Context.MODE_PRIVATE); + File localDexDir = context.getDir(DEX_DIR_NAME, Context.MODE_PRIVATE); if (newRuntimeDexVersion != runtimeDexVersion) { Log.w(TAG, "Delete cached dex files."); dexLoader.deleteCachedDexes(localDexDir); @@ -88,7 +91,7 @@ String dexAssetName = WebApkVersionUtils.getRuntimeDexName(newRuntimeDexVersion); File remoteDexFile = - new File(remoteContext.getDir("dex", Context.MODE_PRIVATE), dexAssetName); + new File(remoteContext.getDir(DEX_DIR_NAME, Context.MODE_PRIVATE), dexAssetName); return dexLoader.load( remoteContext, dexAssetName, canaryClassName, remoteDexFile, localDexDir); }
diff --git a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java index 70e1b180..7084f3f 100644 --- a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java +++ b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java
@@ -11,7 +11,6 @@ import android.content.SharedPreferences; import android.content.pm.ResolveInfo; import android.net.Uri; -import android.os.AsyncTask; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; @@ -100,7 +99,7 @@ if (!TextUtils.isEmpty(runtimeHostInPreferences) && !runtimeHostInPreferences.equals(runtimeHost)) { deleteSharedPref(this); - deleteInternalStorageAsync(); + deleteInternalStorage(); } if (!TextUtils.isEmpty(runtimeHost)) { @@ -126,16 +125,11 @@ editor.apply(); } - /** Deletes the internal storage asynchronously. */ - private void deleteInternalStorageAsync() { - new AsyncTask<Void, Void, Void>() { - @Override - protected Void doInBackground(Void... params) { - deletePath(getCacheDir()); - deletePath(getFilesDir()); - return null; - } - }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + /** Deletes the internal storage. */ + private void deleteInternalStorage() { + deletePath(getCacheDir()); + deletePath(getFilesDir()); + deletePath(getDir(HostBrowserClassLoader.DEX_DIR_NAME, Context.MODE_PRIVATE)); } private void deletePath(File file) {
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 663e394f..9196b25 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -383,6 +383,10 @@ "download/drag_download_item.h", "download/save_package_file_picker.cc", "download/save_package_file_picker.h", + "download/trusted_sources_manager.cc", + "download/trusted_sources_manager.h", + "download/trusted_sources_manager_posix.cc", + "download/trusted_sources_manager_win.cc", "engagement/important_sites_usage_counter.cc", "engagement/important_sites_usage_counter.h", "engagement/important_sites_util.cc", @@ -574,6 +578,8 @@ "media/media_device_id_salt.h", "media/media_engagement_contents_observer.cc", "media/media_engagement_contents_observer.h", + "media/media_engagement_score.cc", + "media/media_engagement_score.h", "media/media_engagement_service.cc", "media/media_engagement_service.h", "media/media_engagement_service_factory.cc",
diff --git a/chrome/browser/android/ntp/most_visited_sites_bridge.cc b/chrome/browser/android/ntp/most_visited_sites_bridge.cc index 4bc86d1..42135b7 100644 --- a/chrome/browser/android/ntp/most_visited_sites_bridge.cc +++ b/chrome/browser/android/ntp/most_visited_sites_bridge.cc
@@ -141,6 +141,12 @@ delete this; } +void MostVisitedSitesBridge::OnHomePageStateChanged( + JNIEnv* env, + const JavaParamRef<jobject>& obj) { + most_visited_->OnHomePageStateChanged(); +} + void MostVisitedSitesBridge::SetObserver( JNIEnv* env, const JavaParamRef<jobject>& obj,
diff --git a/chrome/browser/android/ntp/most_visited_sites_bridge.h b/chrome/browser/android/ntp/most_visited_sites_bridge.h index bda4050c..fe8fd5f 100644 --- a/chrome/browser/android/ntp/most_visited_sites_bridge.h +++ b/chrome/browser/android/ntp/most_visited_sites_bridge.h
@@ -25,6 +25,9 @@ void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); + void OnHomePageStateChanged(JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj); + void SetObserver(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj, const base::android::JavaParamRef<jobject>& j_observer,
diff --git a/chrome/browser/android/payments/service_worker_payment_app_bridge.cc b/chrome/browser/android/payments/service_worker_payment_app_bridge.cc index 50d6745..0c005766 100644 --- a/chrome/browser/android/payments/service_worker_payment_app_bridge.cc +++ b/chrome/browser/android/payments/service_worker_payment_app_bridge.cc
@@ -42,12 +42,15 @@ content::PaymentAppProvider::PaymentApps apps) { JNIEnv* env = AttachCurrentThread(); + // TODO(gogerald): Present payment app instead of instruments to user, + // crbug.com/735063. for (const auto& app_info : apps) { ScopedJavaLocalRef<jobject> java_instruments = Java_ServiceWorkerPaymentAppBridge_createInstrumentList(env); - for (const auto& instrument : app_info.second) { + for (const auto& instrument : app_info.second->instruments) { Java_ServiceWorkerPaymentAppBridge_addInstrument( - env, java_instruments, jweb_contents, instrument->registration_id, + env, java_instruments, jweb_contents, + app_info.second->registration_id, ConvertUTF8ToJavaString(env, instrument->instrument_key), ConvertUTF8ToJavaString(env, instrument->name), ToJavaArrayOfStrings(env, instrument->enabled_methods),
diff --git a/chrome/browser/android/preferences/website_preference_bridge.cc b/chrome/browser/android/preferences/website_preference_bridge.cc index 66e4753..d751493a 100644 --- a/chrome/browser/android/preferences/website_preference_bridge.cc +++ b/chrome/browser/android/preferences/website_preference_bridge.cc
@@ -187,7 +187,15 @@ jstring embedder, jboolean is_incognito) { GURL url(ConvertJavaStringToUTF8(env, origin)); - GURL embedder_url(ConvertJavaStringToUTF8(env, embedder)); + std::string embedder_str = ConvertJavaStringToUTF8(env, embedder); + GURL embedder_url; + // TODO(raymes): This check to see if '*' is the embedder is a hack that fixes + // crbug.com/738377. In general querying the settings for patterns is broken + // and needs to be fixed. See crbug.com/738757. + if (embedder_str == "*") + embedder_url = url; + else + embedder_url = GURL(embedder_str); return PermissionManager::Get(GetActiveUserProfile(is_incognito)) ->GetPermissionStatus(content_type, url, embedder_url) .content_setting;
diff --git a/chrome/browser/android/signin/signin_manager_android.cc b/chrome/browser/android/signin/signin_manager_android.cc index c2d7593..a42225df 100644 --- a/chrome/browser/android/signin/signin_manager_android.cc +++ b/chrome/browser/android/signin/signin_manager_android.cc
@@ -299,8 +299,7 @@ const GoogleServiceAuthError& error) {} void SigninManagerAndroid::GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) {} + const std::string& username) {} void SigninManagerAndroid::GoogleSignedOut(const std::string& account_id, const std::string& username) {
diff --git a/chrome/browser/android/signin/signin_manager_android.h b/chrome/browser/android/signin/signin_manager_android.h index 7bf556b..0faee77 100644 --- a/chrome/browser/android/signin/signin_manager_android.h +++ b/chrome/browser/android/signin/signin_manager_android.h
@@ -85,8 +85,7 @@ // SigninManagerBase::Observer implementation. void GoogleSigninFailed(const GoogleServiceAuthError& error) override; void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + const std::string& username) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override;
diff --git a/chrome/browser/android/vr_shell/ui_elements/textured_element.cc b/chrome/browser/android/vr_shell/ui_elements/textured_element.cc index e0a7a16..afe2ae8 100644 --- a/chrome/browser/android/vr_shell/ui_elements/textured_element.cc +++ b/chrome/browser/android/vr_shell/ui_elements/textured_element.cc
@@ -29,7 +29,7 @@ } void TexturedElement::UpdateTexture() { - if (!initialized_ || !GetTexture()->dirty()) + if (!initialized_ || !GetTexture()->dirty() || !IsVisible()) return; sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul( texture_size_.width(), texture_size_.height()); @@ -50,6 +50,7 @@ gfx::Transform view_proj_matrix) const { if (!initialized_) return; + DCHECK(!GetTexture()->dirty()); gfx::SizeF drawn_size = GetTexture()->GetDrawnSize(); gfx::RectF copy_rect(0, 0, drawn_size.width() / texture_size_.width(), drawn_size.height() / texture_size_.height()); @@ -77,4 +78,8 @@ UpdateTexture(); } +void TexturedElement::OnBeginFrame(const base::TimeTicks& begin_frame_time) { + UpdateTexture(); +} + } // namespace vr_shell
diff --git a/chrome/browser/android/vr_shell/ui_elements/textured_element.h b/chrome/browser/android/vr_shell/ui_elements/textured_element.h index f3e1411..3c009a0 100644 --- a/chrome/browser/android/vr_shell/ui_elements/textured_element.h +++ b/chrome/browser/android/vr_shell/ui_elements/textured_element.h
@@ -30,6 +30,8 @@ void Render(UiElementRenderer* renderer, gfx::Transform view_proj_matrix) const final; + void OnBeginFrame(const base::TimeTicks& begin_frame_time) override; + protected: virtual UiTexture* GetTexture() const = 0; virtual void UpdateTexture();
diff --git a/chrome/browser/android/vr_shell/vr_shell_renderer.cc b/chrome/browser/android/vr_shell/vr_shell_renderer.cc index f43a98a5..cde75103 100644 --- a/chrome/browser/android/vr_shell/vr_shell_renderer.cc +++ b/chrome/browser/android/vr_shell/vr_shell_renderer.cc
@@ -8,6 +8,7 @@ #include <algorithm> #include <string> +#include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/trace_event/trace_event.h" #include "chrome/browser/android/vr_shell/vr_gl_util.h" @@ -16,24 +17,20 @@ namespace { static constexpr float kHalfSize = 0.5f; + /* clang-format off */ -static constexpr float kTextureQuadVertices[30] = { - // x y z, u, v - -kHalfSize, kHalfSize, 0.0f, 0.0f, 0.0f, - -kHalfSize, -kHalfSize, 0.0f, 0.0f, 1.0f, - kHalfSize, kHalfSize, 0.0f, 1.0f, 0.0f, - -kHalfSize, -kHalfSize, 0.0f, 0.0f, 1.0f, - kHalfSize, -kHalfSize, 0.0f, 1.0f, 1.0f, - kHalfSize, kHalfSize, 0.0f, 1.0f, 0.0f }; +static constexpr float kTexturedQuadVertices[8] = { + // x y + -kHalfSize, kHalfSize, + -kHalfSize, -kHalfSize, + kHalfSize, kHalfSize, + kHalfSize, -kHalfSize, +}; + +static constexpr GLushort kTexturedQuadIndices[6] = { 0, 1, 2, 1, 3, 2 }; /* clang-format on */ -static constexpr size_t kTextureQuadVerticesSize = sizeof(float) * 30; -static constexpr size_t kTextureQuadDataStride = sizeof(float) * 5; -static constexpr int kPositionDataSize = 3; -static constexpr size_t kPositionDataOffset = 0; -static constexpr int kTextureCoordinateDataSize = 2; -static constexpr size_t kTextureCoordinateDataOffset = sizeof(float) * 3; -// Number of vertices passed to glDrawArrays(). -static constexpr int kVerticesNumber = 6; + +static constexpr int kTexturedQuadPositionDataSize = 2; // Reticle constants static constexpr float kRingDiameter = 1.0f; @@ -76,13 +73,25 @@ case vr_shell::ShaderID::EXTERNAL_TEXTURED_QUAD_VERTEX_SHADER: case vr_shell::ShaderID::RETICLE_VERTEX_SHADER: case vr_shell::ShaderID::LASER_VERTEX_SHADER: - case vr_shell::ShaderID::CONTROLLER_VERTEX_SHADER: case vr_shell::ShaderID::TEXTURED_QUAD_VERTEX_SHADER: return SHADER( /* clang-format off */ precision mediump float; uniform mat4 u_ModelViewProjMatrix; attribute vec4 a_Position; + varying vec2 v_TexCoordinate; + + void main() { + v_TexCoordinate = vec2(0.5 + a_Position[0], 0.5 - a_Position[1]); + gl_Position = u_ModelViewProjMatrix * a_Position; + } + /* clang-format on */); + case vr_shell::ShaderID::CONTROLLER_VERTEX_SHADER: + return SHADER( + /* clang-format off */ + precision mediump float; + uniform mat4 u_ModelViewProjMatrix; + attribute vec4 a_Position; attribute vec2 a_TexCoordinate; varying vec2 v_TexCoordinate; @@ -325,7 +334,6 @@ glDeleteShader(fragment_shader_handle); position_handle_ = glGetAttribLocation(program_handle_, "a_Position"); - tex_coord_handle_ = glGetAttribLocation(program_handle_, "a_TexCoordinate"); } BaseRenderer::~BaseRenderer() = default; @@ -333,8 +341,6 @@ BaseQuadRenderer::BaseQuadRenderer(ShaderID vertex_id, ShaderID fragment_id) : BaseRenderer(vertex_id, fragment_id) {} -GLuint BaseQuadRenderer::vertex_buffer_ = 0; - BaseQuadRenderer::~BaseQuadRenderer() = default; void BaseQuadRenderer::PrepareToDraw(GLuint view_proj_matrix_handle, @@ -348,26 +354,32 @@ glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer_); // Set up position attribute. - glVertexAttribPointer(position_handle_, kPositionDataSize, GL_FLOAT, false, - kTextureQuadDataStride, - VOID_OFFSET(kPositionDataOffset)); + glVertexAttribPointer(position_handle_, kTexturedQuadPositionDataSize, + GL_FLOAT, false, 0, 0); glEnableVertexAttribArray(position_handle_); - // Set up texture coordinate attribute. - glVertexAttribPointer(tex_coord_handle_, kTextureCoordinateDataSize, GL_FLOAT, - false, kTextureQuadDataStride, - VOID_OFFSET(kTextureCoordinateDataOffset)); - glEnableVertexAttribArray(tex_coord_handle_); - glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } +GLuint BaseQuadRenderer::vertex_buffer_ = 0; +GLuint BaseQuadRenderer::index_buffer_ = 0; + void BaseQuadRenderer::SetVertexBuffer() { - glGenBuffersARB(1, &vertex_buffer_); + GLuint buffers[2]; + glGenBuffersARB(2, buffers); + vertex_buffer_ = buffers[0]; + index_buffer_ = buffers[1]; + glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer_); - glBufferData(GL_ARRAY_BUFFER, kTextureQuadVerticesSize, kTextureQuadVertices, - GL_STATIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, + arraysize(kTexturedQuadVertices) * sizeof(float), + kTexturedQuadVertices, GL_STATIC_DRAW); + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer_); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, + arraysize(kTexturedQuadIndices) * sizeof(GLushort), + kTexturedQuadIndices, GL_STATIC_DRAW); } ExternalTexturedQuadRenderer::ExternalTexturedQuadRenderer() @@ -400,10 +412,11 @@ reinterpret_cast<const float*>(©_rect)); glUniform1f(opacity_handle_, opacity); - glDrawArrays(GL_TRIANGLES, 0, kVerticesNumber); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer_); + glDrawElements(GL_TRIANGLES, arraysize(kTexturedQuadIndices), + GL_UNSIGNED_SHORT, 0); glDisableVertexAttribArray(position_handle_); - glDisableVertexAttribArray(tex_coord_handle_); } ExternalTexturedQuadRenderer::~ExternalTexturedQuadRenderer() = default; @@ -445,17 +458,10 @@ glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer_); // Set up position attribute. - glVertexAttribPointer(position_handle_, kPositionDataSize, GL_FLOAT, false, - kTextureQuadDataStride, - VOID_OFFSET(kPositionDataOffset)); + glVertexAttribPointer(position_handle_, kTexturedQuadPositionDataSize, + GL_FLOAT, false, 0, 0); glEnableVertexAttribArray(position_handle_); - // Set up texture coordinate attribute. - glVertexAttribPointer(tex_coord_handle_, kTextureCoordinateDataSize, GL_FLOAT, - false, kTextureQuadDataStride, - VOID_OFFSET(kTextureCoordinateDataOffset)); - glEnableVertexAttribArray(tex_coord_handle_); - glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); @@ -488,13 +494,14 @@ glUniform4fv(copy_rect_uniform_handle_, 1, reinterpret_cast<const float*>(&quad.copy_rect)); - glDrawArrays(GL_TRIANGLES, 0, kVerticesNumber); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer_); + glDrawElements(GL_TRIANGLES, arraysize(kTexturedQuadIndices), + GL_UNSIGNED_SHORT, 0); quad_queue_.pop(); } glDisableVertexAttribArray(position_handle_); - glDisableVertexAttribArray(tex_coord_handle_); } TexturedQuadRenderer::~TexturedQuadRenderer() = default; @@ -512,17 +519,10 @@ glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer_); // Set up position attribute. - glVertexAttribPointer(position_handle_, kPositionDataSize, GL_FLOAT, false, - kTextureQuadDataStride, - VOID_OFFSET(kPositionDataOffset)); + glVertexAttribPointer(position_handle_, kTexturedQuadPositionDataSize, + GL_FLOAT, false, 0, 0); glEnableVertexAttribArray(position_handle_); - // Set up texture coordinate attribute. - glVertexAttribPointer(tex_coord_handle_, kTextureCoordinateDataSize, GL_FLOAT, - false, kTextureQuadDataStride, - VOID_OFFSET(kTextureCoordinateDataOffset)); - glEnableVertexAttribArray(tex_coord_handle_); - // Bind texture. This is a 1:1 pixel copy since the source surface // and renderbuffer destination size are resized to match, so use // GL_NEAREST. @@ -535,10 +535,11 @@ glUniform1i(tex_uniform_handle_, 0); // Blit texture to buffer - glDrawArrays(GL_TRIANGLES, 0, kVerticesNumber); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer_); + glDrawElements(GL_TRIANGLES, arraysize(kTexturedQuadIndices), + GL_UNSIGNED_SHORT, 0); glDisableVertexAttribArray(position_handle_); - glDisableVertexAttribArray(tex_coord_handle_); } // Note that we don't explicitly delete gl objects here, they're deleted @@ -575,10 +576,11 @@ glUniform1f(mid_ring_end_handle_, kMidRingEnd); glUniform1f(mid_ring_opacity_handle_, kMidRingOpacity); - glDrawArrays(GL_TRIANGLES, 0, kVerticesNumber); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer_); + glDrawElements(GL_TRIANGLES, arraysize(kTexturedQuadIndices), + GL_UNSIGNED_SHORT, 0); glDisableVertexAttribArray(position_handle_); - glDisableVertexAttribArray(tex_coord_handle_); } ReticleRenderer::~ReticleRenderer() = default; @@ -620,10 +622,11 @@ glUniform1f(fade_end_handle_, kFadeEnd); glUniform1f(opacity_handle_, opacity); - glDrawArrays(GL_TRIANGLES, 0, kVerticesNumber); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer_); + glDrawElements(GL_TRIANGLES, arraysize(kTexturedQuadIndices), + GL_UNSIGNED_SHORT, 0); glDisableVertexAttribArray(position_handle_); - glDisableVertexAttribArray(tex_coord_handle_); } LaserRenderer::~LaserRenderer() = default; @@ -633,6 +636,7 @@ texture_handles_(VrControllerModel::STATE_COUNT) { model_view_proj_matrix_handle_ = glGetUniformLocation(program_handle_, "u_ModelViewProjMatrix"); + tex_coord_handle_ = glGetAttribLocation(program_handle_, "a_TexCoordinate"); tex_uniform_handle_ = glGetUniformLocation(program_handle_, "u_Texture"); opacity_handle_ = glGetUniformLocation(program_handle_, "u_Opacity"); } @@ -746,10 +750,11 @@ SetColorUniform(center_color_handle_, center_color); glUniform1f(opacity_handle_, opacity); - glDrawArrays(GL_TRIANGLES, 0, kVerticesNumber); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer_); + glDrawElements(GL_TRIANGLES, arraysize(kTexturedQuadIndices), + GL_UNSIGNED_SHORT, 0); glDisableVertexAttribArray(position_handle_); - glDisableVertexAttribArray(tex_coord_handle_); } GradientQuadRenderer::~GradientQuadRenderer() = default; @@ -785,10 +790,11 @@ SetColorUniform(grid_color_handle_, grid_color); glUniform1f(opacity_handle_, opacity); - glDrawArrays(GL_TRIANGLES, 0, kVerticesNumber); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer_); + glDrawElements(GL_TRIANGLES, arraysize(kTexturedQuadIndices), + GL_UNSIGNED_SHORT, 0); glDisableVertexAttribArray(position_handle_); - glDisableVertexAttribArray(tex_coord_handle_); } GradientGridRenderer::~GradientGridRenderer() = default;
diff --git a/chrome/browser/android/vr_shell/vr_shell_renderer.h b/chrome/browser/android/vr_shell/vr_shell_renderer.h index eb11c06e..9ac13c14 100644 --- a/chrome/browser/android/vr_shell/vr_shell_renderer.h +++ b/chrome/browser/android/vr_shell/vr_shell_renderer.h
@@ -17,7 +17,6 @@ namespace vr_shell { -// TODO(tiborg): set background color through JS API. constexpr float kFogBrightness = 0.57f; enum ShaderID { @@ -75,7 +74,6 @@ GLuint program_handle_; GLuint position_handle_; - GLuint tex_coord_handle_; DISALLOW_COPY_AND_ASSIGN(BaseRenderer); }; @@ -92,6 +90,7 @@ const gfx::Transform& view_proj_matrix); static GLuint vertex_buffer_; + static GLuint index_buffer_; DISALLOW_COPY_AND_ASSIGN(BaseQuadRenderer); }; @@ -206,6 +205,7 @@ private: GLuint model_view_proj_matrix_handle_; + GLuint tex_coord_handle_; GLuint tex_uniform_handle_; GLuint opacity_handle_; GLuint indices_buffer_ = 0;
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index 1f691a5a..88e31e6 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd
@@ -266,7 +266,7 @@ <include name="IDR_MD_BOOKMARKS_ACTIONS_JS" file="resources\md_bookmarks\actions.js" type="BINDATA" /> <include name="IDR_MD_BOOKMARKS_API_LISTENER_HTML" file="resources\md_bookmarks\api_listener.html" type="BINDATA" /> <include name="IDR_MD_BOOKMARKS_API_LISTENER_JS" file="resources\md_bookmarks\api_listener.js" type="BINDATA" /> - <include name="IDR_MD_BOOKMARKS_APP_HTML" file="resources\md_bookmarks\app.html" type="BINDATA" /> + <include name="IDR_MD_BOOKMARKS_APP_HTML" file="resources\md_bookmarks\app.html" type="BINDATA" flattenhtml="true" /> <include name="IDR_MD_BOOKMARKS_APP_JS" file="resources\md_bookmarks\app.js" type="BINDATA" /> <include name="IDR_MD_BOOKMARKS_BOOKMARKS_HTML" file="resources\md_bookmarks\bookmarks.html" type="BINDATA" /> <include name="IDR_MD_BOOKMARKS_COMMAND_MANAGER_HTML" file="resources\md_bookmarks\command_manager.html" type="BINDATA" />
diff --git a/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.cc b/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.cc index 3717476..f591fb6 100644 --- a/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.cc +++ b/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.cc
@@ -17,8 +17,11 @@ #include "base/files/file_path.h" #include "base/files/file_path_watcher.h" #include "base/memory/ptr_util.h" +#include "base/sequence_checker.h" #include "base/strings/string_util.h" #include "base/task_scheduler/post_task.h" +#include "base/task_scheduler/task_traits.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "base/time/time.h" #include "chrome/browser/download/download_prefs.h" #include "chrome/browser/profiles/profile_manager.h" @@ -217,6 +220,8 @@ // Whether or not there is an outstanding task to update last_timestamp_map_. bool outstanding_task_; + SEQUENCE_CHECKER(sequence_checker_); + // Note: This should remain the last member so it'll be destroyed and // invalidate the weak pointers before any other members are destroyed. base::WeakPtrFactory<DownloadsWatcher> weak_ptr_factory_; @@ -231,6 +236,7 @@ outstanding_task_(false), weak_ptr_factory_(this) { DCHECK_CURRENTLY_ON(BrowserThread::UI); + DETACH_FROM_SEQUENCE(sequence_checker_); downloads_dir_ = DownloadPrefs(ProfileManager::GetActiveUserProfile()) .GetDefaultDownloadDirectoryForProfile() @@ -238,11 +244,11 @@ } ArcDownloadsWatcherService::DownloadsWatcher::~DownloadsWatcher() { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } void ArcDownloadsWatcherService::DownloadsWatcher::Start() { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Initialize with the current timestamp map and avoid initial notification. // It is not needed since MediaProvider scans whole storage area on boot. @@ -261,11 +267,11 @@ bool error) { // On Linux, |error| is always false. Also, |path| is always the same path // as one given to FilePathWatcher::Watch(). - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!outstanding_task_) { outstanding_task_ = true; - BrowserThread::PostDelayedTask( - BrowserThread::FILE, FROM_HERE, + base::SequencedTaskRunnerHandle::Get()->PostDelayedTask( + FROM_HERE, base::BindOnce(&DownloadsWatcher::DelayBuildTimestampMap, weak_ptr_factory_.GetWeakPtr()), kBuildTimestampMapDelay); @@ -275,7 +281,7 @@ } void ArcDownloadsWatcherService::DownloadsWatcher::DelayBuildTimestampMap() { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(outstanding_task_); base::PostTaskWithTraitsAndReplyWithResult( FROM_HERE, {base::MayBlock()}, @@ -286,7 +292,7 @@ void ArcDownloadsWatcherService::DownloadsWatcher::OnBuildTimestampMap( std::pair<base::TimeTicks, TimestampMap> timestamp_and_map) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(outstanding_task_); base::TimeTicks snapshot_time = timestamp_and_map.first; TimestampMap current_timestamp_map = std::move(timestamp_and_map.second); @@ -310,7 +316,10 @@ ArcDownloadsWatcherService::ArcDownloadsWatcherService( ArcBridgeService* bridge_service) - : ArcService(bridge_service), weak_ptr_factory_(this) { + : ArcService(bridge_service), + file_task_runner_( + base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()})), + weak_ptr_factory_(this) { DCHECK_CURRENTLY_ON(BrowserThread::UI); arc_bridge_service()->file_system()->AddObserver(this); } @@ -339,17 +348,15 @@ watcher_ = base::MakeUnique<DownloadsWatcher>( base::Bind(&ArcDownloadsWatcherService::OnDownloadsChanged, weak_ptr_factory_.GetWeakPtr())); - BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, - base::BindOnce(&DownloadsWatcher::Start, - base::Unretained(watcher_.get()))); + file_task_runner_->PostTask(FROM_HERE, + base::BindOnce(&DownloadsWatcher::Start, + base::Unretained(watcher_.get()))); } void ArcDownloadsWatcherService::StopWatchingDownloads() { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (watcher_) { - BrowserThread::DeleteSoon(BrowserThread::FILE, FROM_HERE, - watcher_.release()); - } + if (watcher_) + file_task_runner_->DeleteSoon(FROM_HERE, watcher_.release()); } void ArcDownloadsWatcherService::OnDownloadsChanged(
diff --git a/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.h b/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.h index 7709c78a..dabadc3 100644 --- a/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.h +++ b/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.h
@@ -10,6 +10,7 @@ #include <vector> #include "base/macros.h" +#include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "components/arc/arc_service.h" #include "components/arc/common/file_system.mojom.h" @@ -17,6 +18,7 @@ namespace base { class FilePath; +class SequencedTaskRunner; } // namespace base namespace arc { @@ -49,6 +51,8 @@ std::unique_ptr<DownloadsWatcher> watcher_; + scoped_refptr<base::SequencedTaskRunner> file_task_runner_; + // Note: This should remain the last member so it'll be destroyed and // invalidate the weak pointers before any other members are destroyed. base::WeakPtrFactory<ArcDownloadsWatcherService> weak_ptr_factory_;
diff --git a/chrome/browser/chromeos/extensions/default_app_order.cc b/chrome/browser/chromeos/extensions/default_app_order.cc index 2c40827..fbd4211 100644 --- a/chrome/browser/chromeos/extensions/default_app_order.cc +++ b/chrome/browser/chromeos/extensions/default_app_order.cc
@@ -132,7 +132,7 @@ if (async) { base::PostTaskWithTraits( FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE}, - base::Bind(&ExternalLoader::Load, base::Unretained(this))); + base::BindOnce(&ExternalLoader::Load, base::Unretained(this))); } else { Load(); }
diff --git a/chrome/browser/chromeos/extensions/echo_private_apitest.cc b/chrome/browser/chromeos/extensions/echo_private_apitest.cc index 0714c63e..c701b26 100644 --- a/chrome/browser/chromeos/extensions/echo_private_apitest.cc +++ b/chrome/browser/chromeos/extensions/echo_private_apitest.cc
@@ -84,13 +84,13 @@ if (dialog_action == DIALOG_TEST_ACTION_ACCEPT) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, - base::Bind(base::IgnoreResult(&chromeos::EchoDialogView::Accept), - base::Unretained(dialog))); + base::BindOnce(base::IgnoreResult(&chromeos::EchoDialogView::Accept), + base::Unretained(dialog))); } else if (dialog_action == DIALOG_TEST_ACTION_CANCEL) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, - base::Bind(base::IgnoreResult(&chromeos::EchoDialogView::Cancel), - base::Unretained(dialog))); + base::BindOnce(base::IgnoreResult(&chromeos::EchoDialogView::Cancel), + base::Unretained(dialog))); } }
diff --git a/chrome/browser/chromeos/extensions/external_cache.cc b/chrome/browser/chromeos/extensions/external_cache.cc index 65788fe..9736948 100644 --- a/chrome/browser/chromeos/extensions/external_cache.cc +++ b/chrome/browser/chromeos/extensions/external_cache.cc
@@ -306,8 +306,9 @@ const base::FilePath& file_path, bool file_ownership_passed) { if (local_cache_.is_shutdown() || file_ownership_passed) { - backend_task_runner_->PostTask(FROM_HERE, - base::Bind(base::IgnoreResult(&base::DeleteFile), file_path, true)); + backend_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(base::IgnoreResult(&base::DeleteFile), file_path, true)); return; } @@ -333,7 +334,7 @@ if (flush_on_put_) { backend_task_runner_->PostTask(FROM_HERE, - base::Bind(&FlushFile, file_path)); + base::BindOnce(&FlushFile, file_path)); } std::string update_url;
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc index 9e476e8..ecc4be1 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc
@@ -13,6 +13,7 @@ #include "base/bind.h" #include "base/files/scoped_temp_dir.h" #include "base/macros.h" +#include "base/task_scheduler/post_task.h" #include "base/threading/thread_task_runner_handle.h" #include "base/values.h" #include "chrome/browser/extensions/extension_apitest.h" @@ -300,10 +301,10 @@ // Let's check that the file has the expected content. const std::string expected_contents = "hello from test extension."; - content::BrowserThread::PostTask( - content::BrowserThread::FILE, FROM_HERE, - base::BindOnce(&ExpectFileContentEquals, selected_path, - expected_contents)); + base::PostTaskWithTraits(FROM_HERE, + {base::MayBlock(), base::TaskPriority::USER_VISIBLE}, + base::BindOnce(&ExpectFileContentEquals, + selected_path, expected_contents)); // Make sure test doesn't finish until we check on file thread that the // selected file's content is as expected.
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc b/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc index 9db262e..c4413d18 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc
@@ -15,7 +15,6 @@ #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h" #include "chrome/test/base/testing_profile.h" -#include "chrome/test/base/ui_test_utils.h" #include "chromeos/dbus/cros_disks_client.h" #include "chromeos/disks/mock_disk_mount_manager.h" #include "components/drive/file_change.h" @@ -379,11 +378,11 @@ base::FilePath(FILE_PATH_LITERAL("/no-existing-fs-hash/root/aaa")), "extension_3", base::Bind(&AddFileWatchCallback)); - // event_router->addFileWatch create some tasks which are performed on message - // loop of BrowserThread::FILE. Wait until they are done. - content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); - // We also wait the UI thread here, since some tasks which are performed above - // message loop back results to the UI thread. + // event_router->addFileWatch create some tasks which are performed on + // TaskScheduler. Wait until they are done. + base::TaskScheduler::GetInstance()->FlushForTesting(); + // We also wait the UI thread here, since some tasks which are performed + // above message loop back results to the UI thread. base::RunLoop().RunUntilIdle(); // When /a is deleted (1 and 2 is notified). @@ -421,9 +420,9 @@ base::FilePath(FILE_PATH_LITERAL("/no-existing-fs/root/aaa")), "extension_3"); - // event_router->removeFileWatch create some tasks which are performed on - // message loop of BrowserThread::FILE. Wait until they are done. - content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); + // event_router->addFileWatch create some tasks which are performed on + // TaskScheduler. Wait until they are done. + base::TaskScheduler::GetInstance()->FlushForTesting(); } IN_PROC_BROWSER_TEST_F(FileManagerPrivateApiTest, ContentChecksum) {
diff --git a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_apitest.cc b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_apitest.cc index 4b785c2..0789031 100644 --- a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_apitest.cc +++ b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_apitest.cc
@@ -56,8 +56,8 @@ void OnRequestTimeouted(int request_id) override { // Call asynchronously so the notification is setup is completed. base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(&NotificationButtonClicker::ClickButton, - base::Unretained(this))); + FROM_HERE, base::BindOnce(&NotificationButtonClicker::ClickButton, + base::Unretained(this))); } private:
diff --git a/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api.cc b/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api.cc index 8dbc51a..dbb9cb2 100644 --- a/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api.cc +++ b/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api.cc
@@ -361,8 +361,9 @@ content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, - base::Bind(&chromeos::ExtendedAuthenticator::AuthenticateToCheck, - extended_authenticator_.get(), user_context, base::Closure())); + base::BindOnce(&chromeos::ExtendedAuthenticator::AuthenticateToCheck, + extended_authenticator_.get(), user_context, + base::Closure())); return RespondLater(); }
diff --git a/chrome/browser/chromeos/extensions/wallpaper_api.cc b/chrome/browser/chromeos/extensions/wallpaper_api.cc index d8af3ef..13e05cf 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_api.cc
@@ -197,8 +197,8 @@ // request thumbnail in the javascript callback. task_runner->PostTask( FROM_HERE, - base::Bind(&WallpaperSetWallpaperFunction::GenerateThumbnail, this, - thumbnail_path, base::Passed(std::move(deep_copy)))); + base::BindOnce(&WallpaperSetWallpaperFunction::GenerateThumbnail, this, + thumbnail_path, std::move(deep_copy))); } void WallpaperSetWallpaperFunction::GenerateThumbnail( @@ -219,9 +219,9 @@ &thumbnail_data, NULL); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&WallpaperSetWallpaperFunction::ThumbnailGenerated, this, - base::RetainedRef(original_data), - base::RetainedRef(thumbnail_data))); + base::BindOnce(&WallpaperSetWallpaperFunction::ThumbnailGenerated, this, + base::RetainedRef(original_data), + base::RetainedRef(thumbnail_data))); } void WallpaperSetWallpaperFunction::ThumbnailGenerated(
diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc index edb6033..cf4e365 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
@@ -247,11 +247,10 @@ wallpaper::kWallpaperSequenceTokenName), base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); - task_runner->PostTask(FROM_HERE, - base::Bind( - &WallpaperPrivateSetWallpaperIfExistsFunction:: - ReadFileAndInitiateStartDecode, - this, wallpaper_path, fallback_path)); + task_runner->PostTask( + FROM_HERE, base::BindOnce(&WallpaperPrivateSetWallpaperIfExistsFunction:: + ReadFileAndInitiateStartDecode, + this, wallpaper_path, fallback_path)); return true; } @@ -269,8 +268,9 @@ base::ReadFileToString(path, &data)) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&WallpaperPrivateSetWallpaperIfExistsFunction::StartDecode, - this, std::vector<char>(data.begin(), data.end()))); + base::BindOnce( + &WallpaperPrivateSetWallpaperIfExistsFunction::StartDecode, this, + std::vector<char>(data.begin(), data.end()))); return; } std::string error = base::StringPrintf( @@ -278,8 +278,9 @@ path.BaseName().value().c_str()); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&WallpaperPrivateSetWallpaperIfExistsFunction::OnFileNotExists, - this, error)); + base::BindOnce( + &WallpaperPrivateSetWallpaperIfExistsFunction::OnFileNotExists, this, + error)); } void WallpaperPrivateSetWallpaperIfExistsFunction::OnWallpaperDecoded( @@ -352,8 +353,9 @@ wallpaper::kWallpaperSequenceTokenName), base::SequencedWorkerPool::BLOCK_SHUTDOWN); - task_runner->PostTask(FROM_HERE, - base::Bind(&WallpaperPrivateSetWallpaperFunction::SaveToFile, this)); + task_runner->PostTask( + FROM_HERE, + base::BindOnce(&WallpaperPrivateSetWallpaperFunction::SaveToFile, this)); } void WallpaperPrivateSetWallpaperFunction::SaveToFile() { @@ -366,8 +368,9 @@ // post to another thread. BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&WallpaperPrivateSetWallpaperFunction::SetDecodedWallpaper, - this, base::Passed(std::move(deep_copy)))); + base::BindOnce( + &WallpaperPrivateSetWallpaperFunction::SetDecodedWallpaper, this, + std::move(deep_copy))); base::FilePath wallpaper_dir; CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &wallpaper_dir)); @@ -387,8 +390,8 @@ "Failed to create/write wallpaper to %s.", file_name.c_str()); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&WallpaperPrivateSetWallpaperFunction::OnFailure, - this, error)); + base::BindOnce(&WallpaperPrivateSetWallpaperFunction::OnFailure, this, + error)); } } @@ -502,10 +505,11 @@ std::unique_ptr<gfx::ImageSkia> deep_copy(image.DeepCopy()); // Generates thumbnail before call api function callback. We can then // request thumbnail in the javascript callback. - task_runner->PostTask(FROM_HERE, - base::Bind( + task_runner->PostTask( + FROM_HERE, + base::BindOnce( &WallpaperPrivateSetCustomWallpaperFunction::GenerateThumbnail, - this, thumbnail_path, base::Passed(&deep_copy))); + this, thumbnail_path, std::move(deep_copy))); } else { SendResponse(true); } @@ -525,7 +529,7 @@ &data, NULL); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind( + base::BindOnce( &WallpaperPrivateSetCustomWallpaperFunction::ThumbnailGenerated, this, base::RetainedRef(data))); } @@ -638,9 +642,9 @@ wallpaper::kWallpaperSequenceTokenName), base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); - task_runner->PostTask(FROM_HERE, - base::Bind(&WallpaperPrivateGetThumbnailFunction::Get, this, - thumbnail_path)); + task_runner->PostTask( + FROM_HERE, base::BindOnce(&WallpaperPrivateGetThumbnailFunction::Get, + this, thumbnail_path)); return true; } @@ -667,19 +671,20 @@ if (GetData(path, &data)) { if (data.empty()) { BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(&WallpaperPrivateGetThumbnailFunction::FileNotLoaded, this)); + BrowserThread::UI, FROM_HERE, + base::BindOnce(&WallpaperPrivateGetThumbnailFunction::FileNotLoaded, + this)); } else { BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(&WallpaperPrivateGetThumbnailFunction::FileLoaded, this, - data)); + BrowserThread::UI, FROM_HERE, + base::BindOnce(&WallpaperPrivateGetThumbnailFunction::FileLoaded, + this, data)); } } else { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&WallpaperPrivateGetThumbnailFunction::Failure, this, - path.BaseName().value())); + base::BindOnce(&WallpaperPrivateGetThumbnailFunction::Failure, this, + path.BaseName().value())); } } @@ -701,9 +706,10 @@ wallpaper::kWallpaperSequenceTokenName), base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); - task_runner->PostTask(FROM_HERE, - base::Bind(&WallpaperPrivateSaveThumbnailFunction::Save, - this, params->data, GURL(params->url).ExtractFileName())); + task_runner->PostTask( + FROM_HERE, + base::BindOnce(&WallpaperPrivateSaveThumbnailFunction::Save, this, + params->data, GURL(params->url).ExtractFileName())); return true; } @@ -723,13 +729,13 @@ wallpaper::AssertCalledOnWallpaperSequence(); if (SaveData(chrome::DIR_CHROMEOS_WALLPAPER_THUMBNAILS, file_name, data)) { BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(&WallpaperPrivateSaveThumbnailFunction::Success, this)); + BrowserThread::UI, FROM_HERE, + base::BindOnce(&WallpaperPrivateSaveThumbnailFunction::Success, this)); } else { BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(&WallpaperPrivateSaveThumbnailFunction::Failure, - this, file_name)); + BrowserThread::UI, FROM_HERE, + base::BindOnce(&WallpaperPrivateSaveThumbnailFunction::Failure, this, + file_name)); } } @@ -749,9 +755,10 @@ wallpaper::kWallpaperSequenceTokenName), base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); - task_runner->PostTask(FROM_HERE, - base::Bind(&WallpaperPrivateGetOfflineWallpaperListFunction::GetList, - this)); + task_runner->PostTask( + FROM_HERE, + base::BindOnce(&WallpaperPrivateGetOfflineWallpaperListFunction::GetList, + this)); return true; } @@ -774,8 +781,9 @@ } BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&WallpaperPrivateGetOfflineWallpaperListFunction::OnComplete, - this, file_list)); + base::BindOnce( + &WallpaperPrivateGetOfflineWallpaperListFunction::OnComplete, this, + file_list)); } void WallpaperPrivateGetOfflineWallpaperListFunction::OnComplete(
diff --git a/chrome/browser/chromeos/file_manager/file_browser_handlers.cc b/chrome/browser/chromeos/file_manager/file_browser_handlers.cc index 381dc8f2..5f3df33 100644 --- a/chrome/browser/chromeos/file_manager/file_browser_handlers.cc +++ b/chrome/browser/chromeos/file_manager/file_browser_handlers.cc
@@ -16,6 +16,7 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/task_scheduler/post_task.h" #include "chrome/browser/chromeos/drive/file_system_util.h" #include "chrome/browser/chromeos/file_manager/app_id.h" #include "chrome/browser/chromeos/file_manager/fileapi_util.h" @@ -218,7 +219,6 @@ scoped_refptr<storage::FileSystemContext> file_system_context_handler, const scoped_refptr<const Extension>& handler_extension, const std::vector<FileSystemURL>& file_urls) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); DCHECK(handler_extension.get()); storage::ExternalFileSystemBackend* backend = @@ -290,12 +290,9 @@ scoped_refptr<storage::FileSystemContext> file_system_context( util::GetFileSystemContextForExtensionId(profile_, extension_->id())); - BrowserThread::PostTaskAndReplyWithResult( - BrowserThread::FILE, - FROM_HERE, - base::Bind(&SetupFileAccessPermissions, - file_system_context, - extension_, + base::PostTaskWithTraitsAndReplyWithResult( + FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING}, + base::Bind(&SetupFileAccessPermissions, file_system_context, extension_, file_urls), base::Bind(&FileBrowserHandlerExecutor::ExecuteAfterSetupFileAccess, weak_ptr_factory_.GetWeakPtr()));
diff --git a/chrome/browser/chromeos/file_manager/file_watcher.cc b/chrome/browser/chromeos/file_manager/file_watcher.cc index e169e96..60f9a6e2 100644 --- a/chrome/browser/chromeos/file_manager/file_watcher.cc +++ b/chrome/browser/chromeos/file_manager/file_watcher.cc
@@ -5,6 +5,8 @@ #include "chrome/browser/chromeos/file_manager/file_watcher.h" #include "base/bind.h" +#include "base/task_runner_util.h" +#include "base/task_scheduler/post_task.h" #include "content/public/browser/browser_thread.h" #include "google_apis/drive/task_util.h" @@ -18,7 +20,6 @@ base::FilePathWatcher* CreateAndStartFilePathWatcher( const base::FilePath& watch_path, const base::FilePathWatcher::Callback& callback) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); DCHECK(!callback.is_null()); std::unique_ptr<base::FilePathWatcher> watcher(new base::FilePathWatcher); @@ -31,7 +32,9 @@ } // namespace FileWatcher::FileWatcher(const base::FilePath& virtual_path) - : local_file_watcher_(NULL), + : sequenced_task_runner_(base::CreateSequencedTaskRunnerWithTraits( + {base::MayBlock(), base::TaskPriority::USER_VISIBLE})), + local_file_watcher_(NULL), virtual_path_(virtual_path), weak_ptr_factory_(this) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -40,9 +43,7 @@ FileWatcher::~FileWatcher() { DCHECK_CURRENTLY_ON(BrowserThread::UI); - BrowserThread::DeleteSoon(BrowserThread::FILE, - FROM_HERE, - local_file_watcher_); + sequenced_task_runner_->DeleteSoon(FROM_HERE, local_file_watcher_); } void FileWatcher::AddExtension(const std::string& extension_id) { @@ -86,14 +87,11 @@ DCHECK(!callback.is_null()); DCHECK(!local_file_watcher_); - BrowserThread::PostTaskAndReplyWithResult( - BrowserThread::FILE, - FROM_HERE, - base::Bind(&CreateAndStartFilePathWatcher, - local_path, + base::PostTaskAndReplyWithResult( + sequenced_task_runner_.get(), FROM_HERE, + base::Bind(&CreateAndStartFilePathWatcher, local_path, google_apis::CreateRelayCallback(file_watcher_callback)), - base::Bind(&FileWatcher::OnWatcherStarted, - weak_ptr_factory_.GetWeakPtr(), + base::Bind(&FileWatcher::OnWatcherStarted, weak_ptr_factory_.GetWeakPtr(), callback)); }
diff --git a/chrome/browser/chromeos/file_manager/file_watcher.h b/chrome/browser/chromeos/file_manager/file_watcher.h index c06ea578..a1aeed6 100644 --- a/chrome/browser/chromeos/file_manager/file_watcher.h +++ b/chrome/browser/chromeos/file_manager/file_watcher.h
@@ -12,6 +12,7 @@ #include "base/files/file_path.h" #include "base/files/file_path_watcher.h" #include "base/memory/weak_ptr.h" +#include "base/sequenced_task_runner.h" namespace file_manager { @@ -70,6 +71,7 @@ void OnWatcherStarted(const BoolCallback& callback, base::FilePathWatcher* file_path_watcher); + scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner_; base::FilePathWatcher* local_file_watcher_; base::FilePath virtual_path_; // Map of extension-id to counter. See the comment at AddExtension() for
diff --git a/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc b/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc index 6ba94877..b692f43 100644 --- a/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc +++ b/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc
@@ -8,6 +8,7 @@ #include "base/files/scoped_temp_dir.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" +#include "base/task_scheduler/task_scheduler.h" #include "content/public/test/test_browser_thread_bundle.h" #include "google_apis/drive/test_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -115,22 +116,26 @@ base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - // See the comment at the end of this function for why scoped_ptr is used. - std::unique_ptr<FileWatcher> file_watcher(new FileWatcher(kVirtualPath)); - file_watcher->AddExtension(kExtensionId); + // Create a callback that will run when a change is detected. + bool on_change_error = false; + base::FilePath changed_path; + base::RunLoop change_run_loop; + base::FilePathWatcher::Callback change_callback = CreateQuitCallback( + &change_run_loop, + CreateCopyResultCallback(&changed_path, &on_change_error)); + + // Create a callback that will run when the watcher is started. + bool watcher_created = false; + base::RunLoop start_run_loop; + FileWatcher::BoolCallback start_callback = CreateQuitCallback( + &start_run_loop, CreateCopyResultCallback(&watcher_created)); // Start watching changes in the temporary directory. - base::FilePath changed_path; - bool watcher_created = false; - bool on_change_error = false; - base::RunLoop run_loop; - file_watcher->WatchLocalFile( - temp_dir.GetPath(), - CreateQuitCallback( - &run_loop, CreateCopyResultCallback(&changed_path, &on_change_error)), - CreateCopyResultCallback(&watcher_created)); - // Spin the message loop so the base::FilePathWatcher is created. - base::RunLoop().RunUntilIdle(); + FileWatcher file_watcher(kVirtualPath); + file_watcher.AddExtension(kExtensionId); + file_watcher.WatchLocalFile(temp_dir.GetPath(), change_callback, + start_callback); + start_run_loop.Run(); ASSERT_TRUE(watcher_created); // Create a temporary file in the temporary directory. The file watcher @@ -138,17 +143,13 @@ base::FilePath temp_file_path; ASSERT_TRUE( base::CreateTemporaryFileInDir(temp_dir.GetPath(), &temp_file_path)); - // Wait until the directory change is notified. - run_loop.Run(); + // Wait until the directory change is notified, and also flush the tasks in + // the message loop since |change_callback| can be called multiple times. + change_run_loop.Run(); + base::RunLoop().RunUntilIdle(); + ASSERT_FALSE(on_change_error); ASSERT_EQ(temp_dir.GetPath().value(), changed_path.value()); - - // This is ugly, but FileWatcher should be deleted explicitly here, and - // spin the message loop so the base::FilePathWatcher is deleted. - // Otherwise, base::FilePathWatcher may detect a change when the temporary - // directory is deleted, which may result in crash. - file_watcher.reset(); - base::RunLoop().RunUntilIdle(); } } // namespace
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index 15e6f80..e6343383 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -340,6 +340,11 @@ const base::Closure& internal_complete_callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); #if defined(FULL_SAFE_BROWSING) + if (!download_prefs_->safebrowsing_for_trusted_sources_enabled() && + download_prefs_->IsFromTrustedSource(*item)) { + return true; + } + SafeBrowsingState* state = static_cast<SafeBrowsingState*>( item->GetUserData(&kSafeBrowsingUserDataKey)); if (!state) {
diff --git a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc index e07149d..9661b63 100644 --- a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc +++ b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc
@@ -7,6 +7,7 @@ #include <string> +#include "base/command_line.h" #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" @@ -20,6 +21,7 @@ #include "chrome/browser/download/download_item_model.h" #include "chrome/browser/download/download_prefs.h" #include "chrome/browser/download/download_target_info.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/features.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" @@ -883,6 +885,46 @@ run_loop.Run(); } +TEST_F(ChromeDownloadManagerDelegateTestWithSafeBrowsing, + TrustedSourcesPolicyNotTrusted) { + GURL download_url("http://untrusted.com/best-download-ever.exe"); + pref_service()->SetBoolean(prefs::kSafeBrowsingForTrustedSourcesEnabled, + false); + std::unique_ptr<content::MockDownloadItem> download_item = + CreateActiveDownloadItem(0); + EXPECT_CALL(*download_item, GetURL()).WillRepeatedly(ReturnRef(download_url)); + + EXPECT_CALL(*delegate(), GetDownloadProtectionService()); + EXPECT_CALL(*download_protection_service(), MockCheckClientDownload()) + .WillOnce(Return(safe_browsing::DownloadProtectionService::SAFE)); + EXPECT_CALL(*download_item, GetDangerType()) + .WillRepeatedly(Return(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS)); + + base::RunLoop run_loop; + ASSERT_FALSE(delegate()->ShouldCompleteDownload(download_item.get(), + run_loop.QuitClosure())); + run_loop.Run(); +} + +#if !defined(OS_WIN) +// TODO(crbug.com/739204) Add a Windows version of this test. +TEST_F(ChromeDownloadManagerDelegateTestWithSafeBrowsing, + TrustedSourcesPolicyTrusted) { + base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); + DCHECK(command_line); + command_line->AppendSwitchASCII(switches::kTrustedDownloadSources, + "trusted.com"); + GURL download_url("http://trusted.com/best-download-ever.exe"); + pref_service()->SetBoolean(prefs::kSafeBrowsingForTrustedSourcesEnabled, + false); + std::unique_ptr<content::MockDownloadItem> download_item = + CreateActiveDownloadItem(0); + EXPECT_CALL(*download_item, GetURL()).WillRepeatedly(ReturnRef(download_url)); + EXPECT_CALL(*delegate(), GetDownloadProtectionService()).Times(0); + EXPECT_TRUE( + delegate()->ShouldCompleteDownload(download_item.get(), base::Closure())); +} +#endif // OS_WIN #endif // FULL_SAFE_BROWSING #if defined(OS_ANDROID)
diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc index 1f2bca5..eb39af5 100644 --- a/chrome/browser/download/download_prefs.cc +++ b/chrome/browser/download/download_prefs.cc
@@ -23,6 +23,7 @@ #include "build/build_config.h" #include "chrome/browser/download/chrome_download_manager_delegate.h" #include "chrome/browser/download/download_target_determiner.h" +#include "chrome/browser/download/trusted_sources_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/chrome_paths.h" @@ -31,6 +32,7 @@ #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_service.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/download_item.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/save_page_type.h" @@ -156,6 +158,8 @@ download_path_.Init(prefs::kDownloadDefaultDirectory, prefs); save_file_path_.Init(prefs::kSaveFileDefaultDirectory, prefs); save_file_type_.Init(prefs::kSaveFileType, prefs); + safebrowsing_for_trusted_sources_enabled_.Init( + prefs::kSafeBrowsingForTrustedSourcesEnabled, prefs); download_restriction_.Init(prefs::kDownloadRestrictions, prefs); // We store any file extension that should be opened automatically at @@ -188,8 +192,9 @@ // expected that some entries in the users' auto open list will get dropped // permanently as a result. if (FileTypePolicies::GetInstance()->IsAllowedToOpenAutomatically( - filename_with_extension)) + filename_with_extension)) { auto_open_.insert(extension); + } } } @@ -206,6 +211,9 @@ registry->RegisterBooleanPref(prefs::kDownloadDirUpgraded, false); registry->RegisterIntegerPref(prefs::kSaveFileType, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML); + registry->RegisterIntegerPref(prefs::kDownloadRestrictions, 0); + registry->RegisterBooleanPref(prefs::kSafeBrowsingForTrustedSourcesEnabled, + true); const base::FilePath& default_download_path = GetDefaultDownloadDirectory(); registry->RegisterFilePathPref(prefs::kDownloadDefaultDirectory, @@ -245,6 +253,12 @@ return FromDownloadManager(BrowserContext::GetDownloadManager(context)); } +bool DownloadPrefs::IsFromTrustedSource(const content::DownloadItem& item) { + if (!trusted_sources_manager_) + trusted_sources_manager_.reset(TrustedSourcesManager::Create()); + return trusted_sources_manager_->IsFromTrustedSource(item.GetURL()); +} + base::FilePath DownloadPrefs::DownloadPath() const { #if defined(OS_CHROMEOS) // If the download path is under /drive, and DriveIntegrationService isn't @@ -315,8 +329,9 @@ const base::FilePath& file_name) { base::FilePath::StringType extension = file_name.Extension(); if (!FileTypePolicies::GetInstance()->IsAllowedToOpenAutomatically( - file_name)) + file_name)) { return false; + } DCHECK(extension[0] == base::FilePath::kExtensionSeparator); extension.erase(0, 1);
diff --git a/chrome/browser/download/download_prefs.h b/chrome/browser/download/download_prefs.h index 09e1484..0499d71 100644 --- a/chrome/browser/download/download_prefs.h +++ b/chrome/browser/download/download_prefs.h
@@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PREFS_H_ +#include <memory> #include <set> #include "base/files/file_path.h" @@ -13,9 +14,11 @@ #include "components/prefs/pref_member.h" class Profile; +class TrustedSourcesManager; namespace content { class BrowserContext; +class DownloadItem; class DownloadManager; } @@ -50,6 +53,9 @@ static DownloadPrefs* FromBrowserContext( content::BrowserContext* browser_context); + // Identify whether the downloaded item was downloaded from a trusted source. + bool IsFromTrustedSource(const content::DownloadItem& item); + base::FilePath DownloadPath() const; void SetDownloadPath(const base::FilePath& path); base::FilePath SaveFilePath() const; @@ -59,6 +65,9 @@ DownloadRestriction download_restriction() const { return static_cast<DownloadRestriction>(*download_restriction_); } + bool safebrowsing_for_trusted_sources_enabled() const { + return *safebrowsing_for_trusted_sources_enabled_; + } // Returns true if the prompt_for_download preference has been set and the // download location is not managed (which means the user shouldn't be able @@ -109,6 +118,10 @@ FilePathPrefMember save_file_path_; IntegerPrefMember save_file_type_; IntegerPrefMember download_restriction_; + BooleanPrefMember safebrowsing_for_trusted_sources_enabled_; + + // To identify if a download URL is from a trusted source. + std::unique_ptr<TrustedSourcesManager> trusted_sources_manager_; // Set of file extensions to open at download completion. struct AutoOpenCompareFunctor {
diff --git a/chrome/browser/download/trusted_sources_manager.cc b/chrome/browser/download/trusted_sources_manager.cc new file mode 100644 index 0000000..67237bc --- /dev/null +++ b/chrome/browser/download/trusted_sources_manager.cc
@@ -0,0 +1,21 @@ +// Copyright (c) 2017 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/download/trusted_sources_manager.h" + +#include "base/command_line.h" +#include "chrome/common/chrome_switches.h" + +TrustedSourcesManager::TrustedSourcesManager() { + base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); + DCHECK(command_line); + rules_.ParseFromString( + command_line->GetSwitchValueASCII(switches::kTrustedDownloadSources)); +} + +TrustedSourcesManager::~TrustedSourcesManager() = default; + +bool TrustedSourcesManager::IsFromTrustedSource(const GURL& url) const { + return rules_.Matches(url); +}
diff --git a/chrome/browser/download/trusted_sources_manager.h b/chrome/browser/download/trusted_sources_manager.h new file mode 100644 index 0000000..62f584b --- /dev/null +++ b/chrome/browser/download/trusted_sources_manager.h
@@ -0,0 +1,49 @@ +// Copyright (c) 2017 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_DOWNLOAD_TRUSTED_SOURCES_MANAGER_H_ +#define CHROME_BROWSER_DOWNLOAD_TRUSTED_SOURCES_MANAGER_H_ + +#include "base/macros.h" +#include "net/proxy/proxy_bypass_rules.h" + +class GURL; + +// Identifies if a URL is from a trusted source. +class TrustedSourcesManager { + public: + virtual ~TrustedSourcesManager(); + + // Creates a platform-dependent instance of TrustedSourcesManager. + // + // A trusted sources manager has a list of sources that can be trusted with + // downloads, extracted from the kTrustedDownloadSources command line switch. + // An example usage is to specify that files downloaded from trusted sites + // don't need to be scanned by SafeBrowsing when the + // SafeBrowsingForTrustedSourcesEnabled policy is set to false. + // + // On creation the list of trusted sources is NULL. + // + // If the platform is Windows, the kTrustedDownloadSources value is ignored, + // the security zone mapping is used instead to determine whether the source + // is trusted or not. + // + static TrustedSourcesManager* Create(); + + // Returns true if the source of this URL is part of the trusted sources. + virtual bool IsFromTrustedSource(const GURL& url) const; + + protected: + // Must use Create. + TrustedSourcesManager(); + + private: + // We are using ProxyBypassRules because they have the functionality that we + // want, but we are not using it for proxy bypass. + net::ProxyBypassRules rules_; + + DISALLOW_COPY_AND_ASSIGN(TrustedSourcesManager); +}; + +#endif // CHROME_BROWSER_DOWNLOAD_TRUSTED_SOURCES_MANAGER_H_
diff --git a/chrome/browser/download/trusted_sources_manager_posix.cc b/chrome/browser/download/trusted_sources_manager_posix.cc new file mode 100644 index 0000000..0c0adab --- /dev/null +++ b/chrome/browser/download/trusted_sources_manager_posix.cc
@@ -0,0 +1,10 @@ +// Copyright (c) 2017 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/download/trusted_sources_manager.h" + +// static +TrustedSourcesManager* TrustedSourcesManager::Create() { + return new TrustedSourcesManager; +}
diff --git a/chrome/browser/download/trusted_sources_manager_win.cc b/chrome/browser/download/trusted_sources_manager_win.cc new file mode 100644 index 0000000..88bcf71 --- /dev/null +++ b/chrome/browser/download/trusted_sources_manager_win.cc
@@ -0,0 +1,54 @@ +// Copyright (c) 2017 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/download/trusted_sources_manager.h" + +#include <urlmon.h> + +#include "base/logging.h" +#include "base/strings/string_util.h" +#include "base/strings/utf_string_conversions.h" +#include "base/win/scoped_comptr.h" +#include "url/gurl.h" + +namespace { + +class TrustedSourcesManagerWin : public TrustedSourcesManager { + public: + TrustedSourcesManagerWin(); + ~TrustedSourcesManagerWin() override; + + // TrustedSourcesManager methods: + bool IsFromTrustedSource(const GURL& url) const override; +}; + +TrustedSourcesManagerWin::TrustedSourcesManagerWin() = default; +TrustedSourcesManagerWin::~TrustedSourcesManagerWin() = default; + +bool TrustedSourcesManagerWin::IsFromTrustedSource(const GURL& url) const { + base::win::ScopedComPtr<IInternetSecurityManager> security_manager; + HRESULT hr = ::CoInternetCreateSecurityManager( + NULL, security_manager.GetAddressOf(), NULL); + // URLZONE_LOCAL_MACHINE 0 + // URLZONE_INTRANET 1 + // URLZONE_TRUSTED 2 + // URLZONE_INTERNET 3 + // URLZONE_UNTRUSTED 4 + DWORD zone = 0; + base::string16 url16 = base::ASCIIToUTF16(url.spec()); + hr = security_manager->MapUrlToZone(url16.c_str(), &zone, 0); + if (FAILED(hr)) { + LOG(ERROR) << "security_manager->MapUrlToZone failed with hr: " << std::hex + << hr; + return false; + } + return zone <= static_cast<DWORD>(URLZONE_TRUSTED); +} + +} // namespace + +// static +TrustedSourcesManager* TrustedSourcesManager::Create() { + return new TrustedSourcesManagerWin; +}
diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_browsertest.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_browsertest.cc index f91ab6d..c472eaa 100644 --- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_browsertest.cc +++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_browsertest.cc
@@ -123,7 +123,7 @@ void SignIn() { fake_signin_manager_->SetAuthenticatedAccountInfo("12345", "tester"); - sync_engine()->GoogleSigninSucceeded("12345", "tester", "password"); + sync_engine()->GoogleSigninSucceeded("12345", "tester"); } void SetSyncEnabled(bool enabled) { @@ -187,7 +187,7 @@ EXPECT_EQ(REMOTE_SERVICE_AUTHENTICATION_REQUIRED, sync_engine()->GetCurrentState()); - sync_engine()->GoogleSigninSucceeded("test_account", "tester", "testing"); + sync_engine()->GoogleSigninSucceeded("test_account", "tester"); WaitUntilIdle(); bar_created.Reply("resume");
diff --git a/chrome/browser/media/media_engagement_score.cc b/chrome/browser/media/media_engagement_score.cc new file mode 100644 index 0000000..318a1e6 --- /dev/null +++ b/chrome/browser/media/media_engagement_score.cc
@@ -0,0 +1,110 @@ +// Copyright 2017 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/media/media_engagement_score.h" + +#include "chrome/browser/engagement/site_engagement_metrics.h" +#include "components/content_settings/core/browser/host_content_settings_map.h" +#include "components/content_settings/core/common/content_settings.h" +#include "components/content_settings/core/common/content_settings_types.h" + +const char* MediaEngagementScore::kVisitsKey = "visits"; +const char* MediaEngagementScore::kMediaPlaybacksKey = "mediaPlaybacks"; +const char* MediaEngagementScore::kLastMediaPlaybackTimeKey = + "lastMediaPlaybackTime"; + +const int MediaEngagementScore::kScoreMinVisits = 5; + +namespace { + +std::unique_ptr<base::DictionaryValue> GetScoreDictForSettings( + const HostContentSettingsMap* settings, + const GURL& origin_url) { + if (!settings) + return base::MakeUnique<base::DictionaryValue>(); + + std::unique_ptr<base::DictionaryValue> value = + base::DictionaryValue::From(settings->GetWebsiteSetting( + origin_url, origin_url, CONTENT_SETTINGS_TYPE_MEDIA_ENGAGEMENT, + content_settings::ResourceIdentifier(), nullptr)); + + if (value.get()) + return value; + return base::MakeUnique<base::DictionaryValue>(); +} + +} // namespace + +MediaEngagementScore::MediaEngagementScore(base::Clock* clock, + const GURL& origin, + HostContentSettingsMap* settings) + : MediaEngagementScore(clock, + origin, + GetScoreDictForSettings(settings, origin)) { + settings_map_ = settings; +} + +MediaEngagementScore::MediaEngagementScore( + base::Clock* clock, + const GURL& origin, + std::unique_ptr<base::DictionaryValue> score_dict) + : origin_(origin), clock_(clock), score_dict_(score_dict.release()) { + if (!score_dict_) + return; + + score_dict_->GetInteger(kVisitsKey, &visits_); + score_dict_->GetInteger(kMediaPlaybacksKey, &media_playbacks_); + + double internal_time; + if (score_dict_->GetDouble(kLastMediaPlaybackTimeKey, &internal_time)) + last_media_playback_time_ = base::Time::FromInternalValue(internal_time); +} + +MediaEngagementScore::~MediaEngagementScore() = default; + +double MediaEngagementScore::GetTotalScore() const { + if (visits_ < kScoreMinVisits) + return 0; + return static_cast<double>(media_playbacks_) / static_cast<double>(visits_); +} + +void MediaEngagementScore::Commit() { + DCHECK(settings_map_); + if (!UpdateScoreDict()) + return; + + settings_map_->SetWebsiteSettingDefaultScope( + origin_, GURL(), CONTENT_SETTINGS_TYPE_MEDIA_ENGAGEMENT, + content_settings::ResourceIdentifier(), std::move(score_dict_)); +} + +void MediaEngagementScore::IncrementMediaPlaybacks() { + media_playbacks_++; + last_media_playback_time_ = clock_->Now(); +} + +bool MediaEngagementScore::UpdateScoreDict() { + int stored_visits = 0; + int stored_media_playbacks = 0; + double stored_last_media_playback_internal = 0; + + score_dict_->GetInteger(kVisitsKey, &stored_visits); + score_dict_->GetInteger(kMediaPlaybacksKey, &stored_media_playbacks); + score_dict_->GetDouble(kLastMediaPlaybackTimeKey, + &stored_last_media_playback_internal); + + bool changed = stored_visits != visits() || + stored_media_playbacks != media_playbacks() || + stored_last_media_playback_internal != + last_media_playback_time_.ToInternalValue(); + if (!changed) + return false; + + score_dict_->SetInteger(kVisitsKey, visits_); + score_dict_->SetInteger(kMediaPlaybacksKey, media_playbacks_); + score_dict_->SetDouble(kLastMediaPlaybackTimeKey, + last_media_playback_time_.ToInternalValue()); + + return true; +}
diff --git a/chrome/browser/media/media_engagement_score.h b/chrome/browser/media/media_engagement_score.h new file mode 100644 index 0000000..5190559 --- /dev/null +++ b/chrome/browser/media/media_engagement_score.h
@@ -0,0 +1,96 @@ +// Copyright 2017 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_MEDIA_MEDIA_ENGAGEMENT_SCORE_H_ +#define CHROME_BROWSER_MEDIA_MEDIA_ENGAGEMENT_SCORE_H_ + +#include "base/macros.h" +#include "base/memory/ptr_util.h" +#include "base/time/clock.h" +#include "base/values.h" +#include "url/gurl.h" + +class HostContentSettingsMap; + +// Calculates and stores the Media Engagement Index score for a certain origin. +class MediaEngagementScore final { + public: + // The dictionary keys to store individual metrics. kVisitsKey will + // store the number of visits to an origin and kMediaPlaybacksKey + // will store the number of media playbacks on an origin. + // kLastMediaPlaybackTimeKey will store the timestamp of the last + // media playback on an origin. + static const char* kVisitsKey; + static const char* kMediaPlaybacksKey; + static const char* kLastMediaPlaybackTimeKey; + + // Origins with a number of visits less than this number will recieve + // a score of zero. + static const int kScoreMinVisits; + + MediaEngagementScore(base::Clock* clock, + const GURL& origin, + HostContentSettingsMap* settings); + ~MediaEngagementScore(); + + // Returns the total score, as per the formula. + double GetTotalScore() const; + + // Writes the values in this score into |settings_map_|. If there are multiple + // instances of a score object for an origin, this could result in stale data + // being stored. + void Commit(); + + // Get/increment the number of visits this origin has had. + int visits() const { return visits_; } + void IncrementVisits() { visits_++; } + + // Get/increment the number of media playbacks this origin has had. + int media_playbacks() const { return media_playbacks_; } + void IncrementMediaPlaybacks(); + + // Get the last time media was played on this origin. + base::Time last_media_playback_time() const { + return last_media_playback_time_; + } + + private: + friend class MediaEngagementScoreTest; + + // Used for tests. + MediaEngagementScore(base::Clock* clock, + const GURL& origin, + std::unique_ptr<base::DictionaryValue> score_dict); + + // Update the dictionary continaing the latest score values and return whether + // they have changed or not (since what was last retrieved from content + // settings). + bool UpdateScoreDict(); + + // The number of media playbacks this origin has had. + int media_playbacks_ = 0; + + // The number of visits this origin has had. + int visits_ = 0; + + // The last time media was played back on this origin. + base::Time last_media_playback_time_; + + // The origin this score represents. + GURL origin_; + + // A clock that can be used for testing, owned by the service. + base::Clock* clock_; + + // The dictionary that represents this engagement score. + std::unique_ptr<base::DictionaryValue> score_dict_; + + // The content settings map that will persist the score, + // has a lifetime of the Profile like the service which owns |this|. + HostContentSettingsMap* settings_map_; + + DISALLOW_COPY_AND_ASSIGN(MediaEngagementScore); +}; + +#endif // CHROME_BROWSER_MEDIA_MEDIA_ENGAGEMENT_SCORE_H_
diff --git a/chrome/browser/media/media_engagement_score_unittest.cc b/chrome/browser/media/media_engagement_score_unittest.cc new file mode 100644 index 0000000..36af081 --- /dev/null +++ b/chrome/browser/media/media_engagement_score_unittest.cc
@@ -0,0 +1,229 @@ +// Copyright 2017 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/media/media_engagement_score.h" + +#include <utility> + +#include "base/macros.h" +#include "base/test/simple_test_clock.h" +#include "base/values.h" +#include "chrome/browser/content_settings/host_content_settings_map_factory.h" +#include "chrome/browser/engagement/site_engagement_service.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/test/base/chrome_render_view_host_test_harness.h" +#include "chrome/test/base/testing_profile.h" +#include "components/content_settings/core/browser/host_content_settings_map.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" + +namespace { + +base::Time GetReferenceTime() { + base::Time::Exploded exploded_reference_time; + exploded_reference_time.year = 2015; + exploded_reference_time.month = 1; + exploded_reference_time.day_of_month = 30; + exploded_reference_time.day_of_week = 5; + exploded_reference_time.hour = 11; + exploded_reference_time.minute = 0; + exploded_reference_time.second = 0; + exploded_reference_time.millisecond = 0; + + base::Time out_time; + EXPECT_TRUE( + base::Time::FromLocalExploded(exploded_reference_time, &out_time)); + return out_time; +} + +} // namespace + +class MediaEngagementScoreTest : public ChromeRenderViewHostTestHarness { + public: + void SetUp() override { + ChromeRenderViewHostTestHarness::SetUp(); + test_clock.SetNow(GetReferenceTime()); + score_ = new MediaEngagementScore(&test_clock, GURL(), nullptr); + } + + void TearDown() override { + delete score_; + ChromeRenderViewHostTestHarness::TearDown(); + } + + base::SimpleTestClock test_clock; + + protected: + MediaEngagementScore* score_; + + void VerifyScore(MediaEngagementScore* score, + int expected_visits, + int expected_media_playbacks, + base::Time expected_last_media_playback_time) { + EXPECT_EQ(expected_visits, score->visits()); + EXPECT_EQ(expected_media_playbacks, score->media_playbacks()); + EXPECT_EQ(expected_last_media_playback_time, + score->last_media_playback_time()); + } + + void UpdateScore(MediaEngagementScore* score) { + test_clock.SetNow(test_clock.Now() + base::TimeDelta::FromHours(1)); + + score->IncrementVisits(); + score->IncrementMediaPlaybacks(); + } + + void TestScoreInitializesAndUpdates( + std::unique_ptr<base::DictionaryValue> score_dict, + int expected_visits, + int expected_media_playbacks, + base::Time expected_last_media_playback_time) { + MediaEngagementScore* initial_score = + new MediaEngagementScore(&test_clock, GURL(), std::move(score_dict)); + VerifyScore(initial_score, expected_visits, expected_media_playbacks, + expected_last_media_playback_time); + + // Updating the score dict should return false, as the score shouldn't + // have changed at this point. + EXPECT_FALSE(initial_score->UpdateScoreDict()); + + // Increment the scores and check that the values were stored correctly. + UpdateScore(initial_score); + EXPECT_TRUE(initial_score->UpdateScoreDict()); + delete initial_score; + } + + void SetVisits(int visits) { score_->visits_ = visits; } +}; + +// Test that scores are read / written correctly from / to empty score +// dictionaries. +TEST_F(MediaEngagementScoreTest, EmptyDictionary) { + std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); + TestScoreInitializesAndUpdates(std::move(dict), 0, 0, base::Time()); +} + +// Test that scores are read / written correctly from / to partially empty +// score dictionaries. +TEST_F(MediaEngagementScoreTest, PartiallyEmptyDictionary) { + std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); + dict->SetInteger(MediaEngagementScore::kVisitsKey, 2); + + TestScoreInitializesAndUpdates(std::move(dict), 2, 0, base::Time()); +} + +// Test that scores are read / written correctly from / to populated score +// dictionaries. +TEST_F(MediaEngagementScoreTest, PopulatedDictionary) { + std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); + dict->SetInteger(MediaEngagementScore::kVisitsKey, 1); + dict->SetInteger(MediaEngagementScore::kMediaPlaybacksKey, 2); + dict->SetDouble(MediaEngagementScore::kLastMediaPlaybackTimeKey, + test_clock.Now().ToInternalValue()); + + TestScoreInitializesAndUpdates(std::move(dict), 1, 2, test_clock.Now()); +} + +// Test getting and commiting the score works correctly with different +// origins. +TEST_F(MediaEngagementScoreTest, ContentSettingsMultiOrigin) { + GURL url("https://www.google.com"); + + // Replace |score_| with one with an actual URL, and with a settings map. + HostContentSettingsMap* settings_map = + HostContentSettingsMapFactory::GetForProfile(profile()); + MediaEngagementScore* score = + new MediaEngagementScore(&test_clock, url, settings_map); + + // Verify the score is originally zero, try incrementing and storing + // the score. + VerifyScore(score, 0, 0, base::Time()); + score->IncrementVisits(); + UpdateScore(score); + score->Commit(); + + // Now confirm the correct score is present on the same origin, + // but zero for a different origin. + GURL same_origin("https://www.google.com"); + GURL different_origin("https://www.google.co.uk"); + MediaEngagementScore* new_score = + new MediaEngagementScore(&test_clock, url, settings_map); + MediaEngagementScore* same_origin_score = + new MediaEngagementScore(&test_clock, same_origin, settings_map); + MediaEngagementScore* different_origin_score = + new MediaEngagementScore(&test_clock, different_origin, settings_map); + VerifyScore(new_score, 2, 1, test_clock.Now()); + VerifyScore(same_origin_score, 2, 1, test_clock.Now()); + VerifyScore(different_origin_score, 0, 0, base::Time()); + + delete score; + delete new_score; + delete same_origin_score; + delete different_origin_score; +} + +// Tests content settings read/write. +TEST_F(MediaEngagementScoreTest, ContentSettings) { + HostContentSettingsMap* settings_map = + HostContentSettingsMapFactory::GetForProfile(profile()); + int example_num_visits = 5; + int example_media_playbacks = 2; + + // Store some example data in content settings. + GURL origin("https://www.google.com"); + std::unique_ptr<base::DictionaryValue> score_dict = + base::MakeUnique<base::DictionaryValue>(); + score_dict->SetInteger(MediaEngagementScore::kVisitsKey, example_num_visits); + score_dict->SetInteger(MediaEngagementScore::kMediaPlaybacksKey, + example_media_playbacks); + score_dict->SetDouble(MediaEngagementScore::kLastMediaPlaybackTimeKey, + test_clock.Now().ToInternalValue()); + settings_map->SetWebsiteSettingDefaultScope( + origin, GURL(), CONTENT_SETTINGS_TYPE_MEDIA_ENGAGEMENT, + content_settings::ResourceIdentifier(), std::move(score_dict)); + + // Make sure we read that data back correctly. + MediaEngagementScore* score = + new MediaEngagementScore(&test_clock, origin, settings_map); + EXPECT_EQ(score->visits(), example_num_visits); + EXPECT_EQ(score->media_playbacks(), example_media_playbacks); + EXPECT_EQ(score->last_media_playback_time(), test_clock.Now()); + + UpdateScore(score); + score->Commit(); + + // Now read back content settings and make sure we have the right values. + int stored_visits; + int stored_media_playbacks; + double stored_last_media_playback_time; + std::unique_ptr<base::DictionaryValue> values = + base::DictionaryValue::From(settings_map->GetWebsiteSetting( + origin, GURL(), CONTENT_SETTINGS_TYPE_MEDIA_ENGAGEMENT, + content_settings::ResourceIdentifier(), nullptr)); + values->GetInteger(MediaEngagementScore::kVisitsKey, &stored_visits); + values->GetInteger(MediaEngagementScore::kMediaPlaybacksKey, + &stored_media_playbacks); + values->GetDouble(MediaEngagementScore::kLastMediaPlaybackTimeKey, + &stored_last_media_playback_time); + EXPECT_EQ(stored_visits, example_num_visits + 1); + EXPECT_EQ(stored_media_playbacks, example_media_playbacks + 1); + EXPECT_EQ(stored_last_media_playback_time, + test_clock.Now().ToInternalValue()); + + delete score; +} + +// Test that the total score is calculated correctly. +TEST_F(MediaEngagementScoreTest, TotalScoreCalculation) { + EXPECT_EQ(0, score_->GetTotalScore()); + UpdateScore(score_); + + // Check that the score is zero even with 1 visit. + EXPECT_EQ(0.0, score_->GetTotalScore()); + + EXPECT_EQ(0, score_->GetTotalScore()); + UpdateScore(score_); + SetVisits(MediaEngagementScore::kScoreMinVisits); + EXPECT_EQ(0.4, score_->GetTotalScore()); +}
diff --git a/chrome/browser/password_manager/password_store_signin_notifier_impl.cc b/chrome/browser/password_manager/password_store_signin_notifier_impl.cc index e0918ea..076a0ec 100644 --- a/chrome/browser/password_manager/password_store_signin_notifier_impl.cc +++ b/chrome/browser/password_manager/password_store_signin_notifier_impl.cc
@@ -28,7 +28,7 @@ SigninManagerFactory::GetForProfile(profile_)->RemoveObserver(this); } -void PasswordStoreSigninNotifierImpl::GoogleSigninSucceeded( +void PasswordStoreSigninNotifierImpl::GoogleSigninSucceededWithPassword( const std::string& account_id, const std::string& username, const std::string& password) {
diff --git a/chrome/browser/password_manager/password_store_signin_notifier_impl.h b/chrome/browser/password_manager/password_store_signin_notifier_impl.h index f5cbc71..c76b612 100644 --- a/chrome/browser/password_manager/password_store_signin_notifier_impl.h +++ b/chrome/browser/password_manager/password_store_signin_notifier_impl.h
@@ -27,9 +27,9 @@ void UnsubscribeFromSigninEvents() override; // SigninManagerBase::Observer implementations. - void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + void GoogleSigninSucceededWithPassword(const std::string& account_id, + const std::string& username, + const std::string& password) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override;
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index 0efb07d..4fa7e8e 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -139,6 +139,9 @@ { key::kSafeBrowsingEnabled, prefs::kSafeBrowsingEnabled, base::Value::Type::BOOLEAN }, + { key::kSafeBrowsingForTrustedSourcesEnabled, + prefs::kSafeBrowsingForTrustedSourcesEnabled, + base::Value::Type::BOOLEAN }, { key::kDownloadRestrictions, prefs::kDownloadRestrictions, base::Value::Type::INTEGER },
diff --git a/chrome/browser/printing/print_preview_message_handler.cc b/chrome/browser/printing/print_preview_message_handler.cc index 89cc497..ae2ff22 100644 --- a/chrome/browser/printing/print_preview_message_handler.cc +++ b/chrome/browser/printing/print_preview_message_handler.cc
@@ -190,6 +190,12 @@ void PrintPreviewMessageHandler::OnPrintPreviewCancelled(int document_cookie) { // Always need to stop the worker. StopWorker(document_cookie); + + // Notify UI + PrintPreviewUI* print_preview_ui = GetPrintPreviewUI(); + if (!print_preview_ui) + return; + print_preview_ui->OnPrintPreviewCancelled(); } void PrintPreviewMessageHandler::OnInvalidPrinterSettings(int document_cookie) {
diff --git a/chrome/browser/profiles/gaia_info_update_service.cc b/chrome/browser/profiles/gaia_info_update_service.cc index 069ae113..b0ba280 100644 --- a/chrome/browser/profiles/gaia_info_update_service.cc +++ b/chrome/browser/profiles/gaia_info_update_service.cc
@@ -206,10 +206,8 @@ timer_.Start(FROM_HERE, delta, this, &GAIAInfoUpdateService::Update); } -void GAIAInfoUpdateService::GoogleSigninSucceeded( - const std::string& account_id, - const std::string& username, - const std::string& password) { +void GAIAInfoUpdateService::GoogleSigninSucceeded(const std::string& account_id, + const std::string& username) { OnUsernameChanged(username); }
diff --git a/chrome/browser/profiles/gaia_info_update_service.h b/chrome/browser/profiles/gaia_info_update_service.h index 0c91867..5c84e89d 100644 --- a/chrome/browser/profiles/gaia_info_update_service.h +++ b/chrome/browser/profiles/gaia_info_update_service.h
@@ -56,8 +56,7 @@ // Overridden from SigninManagerBase::Observer: void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + const std::string& username) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override;
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index a3d038d..ef4466a 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc
@@ -7,6 +7,7 @@ #include <stddef.h> #include <memory> +#include <set> #include <utility> #include <vector> @@ -400,7 +401,6 @@ home_page_flags); registry->RegisterStringPref(prefs::kNewTabPageLocationOverride, std::string()); - registry->RegisterIntegerPref(prefs::kDownloadRestrictions, 0); #if BUILDFLAG(ENABLE_PRINTING) registry->RegisterBooleanPref(prefs::kPrintingEnabled, true);
diff --git a/chrome/browser/resources/md_bookmarks/app.html b/chrome/browser/resources/md_bookmarks/app.html index 7d01735c..577ede51 100644 --- a/chrome/browser/resources/md_bookmarks/app.html +++ b/chrome/browser/resources/md_bookmarks/app.html
@@ -34,7 +34,11 @@ #splitter { box-sizing: border-box; + cursor: col-resize; +<if expr="is_win"> + /* Unlike other platforms, e-resize is a two-way arrow on Windows. */ cursor: e-resize; +</if> flex: 0 0 var(--splitter-width); opacity: 0; } @@ -46,10 +50,6 @@ transition: opacity 100ms ease-out; } - :host-context([dir='rtl']) #splitter { - cursor: w-resize; - } - #sidebar { -webkit-padding-start: 3px; display: block;
diff --git a/chrome/browser/resources/print_preview/native_layer.js b/chrome/browser/resources/print_preview/native_layer.js index 7e45ed32..d0b37df 100644 --- a/chrome/browser/resources/print_preview/native_layer.js +++ b/chrome/browser/resources/print_preview/native_layer.js
@@ -87,13 +87,10 @@ function NativeLayer() { // Bind global handlers global.reloadPrintersList = this.onReloadPrintersList_.bind(this); - global.printPreviewFailed = this.onPrintPreviewFailed_.bind(this); - global.invalidPrinterSettings = this.onInvalidPrinterSettings_.bind(this); global.onDidGetDefaultPageLayout = this.onDidGetDefaultPageLayout_.bind(this); global.onDidGetPreviewPageCount = this.onDidGetPreviewPageCount_.bind(this); global.onDidPreviewPage = this.onDidPreviewPage_.bind(this); - global.updatePrintPreview = this.onUpdatePrintPreview_.bind(this); global.onEnableManipulateSettingsForTest = this.onEnableManipulateSettingsForTest_.bind(this); global.printPresetOptionsFromDocument = @@ -330,8 +327,10 @@ * @param {!print_preview.DocumentInfo} documentInfo Document data model. * @param {boolean} generateDraft Tell the renderer to re-render. * @param {number} requestId ID of the preview request. + * @return {!Promise<number>} Promise that resolves with the unique ID of + * the preview UI when the preview has been generated. */ - startGetPreview: function( + getPreview: function( destination, printTicketStore, documentInfo, generateDraft, requestId) { assert( printTicketStore.isTicketValidForPreview(), @@ -394,9 +393,9 @@ }; } - chrome.send('getPreview', [ - JSON.stringify(ticket), requestId > 0 ? documentInfo.pageCount : -1 - ]); + return cr.sendWithPromise( + 'getPreview', JSON.stringify(ticket), + requestId > 0 ? documentInfo.pageCount : -1); }, /** @@ -559,26 +558,6 @@ }, /** - * Display an error message when print preview fails. - * Called from PrintPreviewMessageHandler::OnPrintPreviewFailed(). - * @private - */ - onPrintPreviewFailed_: function() { - cr.dispatchSimpleEvent( - this.eventTarget_, NativeLayer.EventType.PREVIEW_GENERATION_FAIL); - }, - - /** - * Display an error message when encountered invalid printer settings. - * Called from PrintPreviewMessageHandler::OnInvalidPrinterSettings(). - * @private - */ - onInvalidPrinterSettings_: function() { - cr.dispatchSimpleEvent( - this.eventTarget_, NativeLayer.EventType.SETTINGS_INVALID); - }, - - /** * @param {{contentWidth: number, contentHeight: number, marginLeft: number, * marginRight: number, marginTop: number, marginBottom: number, * printableAreaX: number, printableAreaY: number, @@ -636,23 +615,6 @@ }, /** - * Update the print preview when new preview data is available. - * Create the PDF plugin as needed. - * Called from PrintPreviewUI::PreviewDataIsAvailable(). - * @param {number} previewUid Preview unique identifier. - * @param {number} previewResponseId The preview request id that resulted in - * this response. - * @private - */ - onUpdatePrintPreview_: function(previewUid, previewResponseId) { - var previewGenDoneEvent = - new Event(NativeLayer.EventType.PREVIEW_GENERATION_DONE); - previewGenDoneEvent.previewUid = previewUid; - previewGenDoneEvent.previewResponseId = previewResponseId; - this.eventTarget_.dispatchEvent(previewGenDoneEvent); - }, - - /** * Updates print preset options from source PDF document. * Called from PrintPreviewUI::OnSetOptionsFromDocument(). * @param {{disableScaling: boolean, copies: number,
diff --git a/chrome/browser/resources/print_preview/preview_generator.js b/chrome/browser/resources/print_preview/preview_generator.js index 37c81e4c..9880330 100644 --- a/chrome/browser/resources/print_preview/preview_generator.js +++ b/chrome/browser/resources/print_preview/preview_generator.js
@@ -173,20 +173,23 @@ /** * Request that new preview be generated. A preview request will not be * generated if the print ticket has not changed sufficiently. - * @return {boolean} Whether a new preview was actually requested. + * @return {{id: number, + * request: Promise}} The preview request id, or -1 if no preview + * was requested, and a promise that will resolve when the preview is + * complete (null if no preview was actually requested). */ requestPreview: function() { if (!this.printTicketStore_.isTicketValidForPreview() || !this.printTicketStore_.isInitialized || !this.destinationStore_.selectedDestination) { - return false; + return {id: -1, request: null}; } var previewChanged = this.hasPreviewChanged_(); if (!previewChanged && !this.hasPreviewPageRangeChanged_()) { // Changes to these ticket items might not trigger a new preview, but // they still need to be recorded. this.marginsType_ = this.printTicketStore_.marginsType.getValue(); - return false; + return {id: -1, request: null}; } this.mediaSize_ = this.printTicketStore_.mediaSize.getValue(); this.isLandscapeEnabled_ = this.printTicketStore_.landscape.getValue(); @@ -205,10 +208,12 @@ this.inFlightRequestId_++; this.generateDraft_ = this.documentInfo_.isModifiable && previewChanged; - this.nativeLayer_.startGetPreview( - this.destinationStore_.selectedDestination, this.printTicketStore_, - this.documentInfo_, this.generateDraft_, this.inFlightRequestId_); - return true; + return { + id: this.inFlightRequestId_, + request: this.nativeLayer_.getPreview( + this.destinationStore_.selectedDestination, this.printTicketStore_, + this.documentInfo_, this.generateDraft_, this.inFlightRequestId_), + }; }, /** Removes all event listeners that the preview generator has attached. */ @@ -234,14 +239,6 @@ nativeLayerEventTarget, print_preview.NativeLayer.EventType.PAGE_PREVIEW_READY, this.onPagePreviewReady_.bind(this)); - this.tracker_.add( - nativeLayerEventTarget, - print_preview.NativeLayer.EventType.PREVIEW_GENERATION_DONE, - this.onPreviewGenerationDone_.bind(this)); - this.tracker_.add( - nativeLayerEventTarget, - print_preview.NativeLayer.EventType.PREVIEW_GENERATION_FAIL, - this.onPreviewGenerationFail_.bind(this)); }, /** @@ -395,18 +392,18 @@ /** * Called when the preview generation is complete. Dispatches a * DOCUMENT_READY event. - * @param {Event} event Contains the preview UID and response ID. - * @private + * @param {number} previewResponseId + * @param {number} previewUid */ - onPreviewGenerationDone_: function(event) { - if (this.inFlightRequestId_ != event.previewResponseId) { + onPreviewGenerationDone: function(previewResponseId, previewUid) { + if (this.inFlightRequestId_ != previewResponseId) { return; // Ignore old response. } if (!this.generateDraft_) { // Dispatch a PREVIEW_START event since not generating a draft PDF, // which includes print preview for non-modifiable documents, does not // trigger PAGE_READY events. - this.dispatchPreviewStartEvent_(event.previewUid, 0); + this.dispatchPreviewStartEvent_(previewUid, 0); } cr.dispatchSimpleEvent(this, PreviewGenerator.EventType.DOCUMENT_READY); },
diff --git a/chrome/browser/resources/print_preview/previewarea/preview_area.js b/chrome/browser/resources/print_preview/previewarea/preview_area.js index 994668d..24b14be 100644 --- a/chrome/browser/resources/print_preview/previewarea/preview_area.js +++ b/chrome/browser/resources/print_preview/previewarea/preview_area.js
@@ -171,6 +171,12 @@ * @private */ this.openSystemDialogButton_ = null; + + /** + * If this is in a browser test (fake plugin). + * @private {boolean} + */ + this.isBrowserTest_ = false; } /** @@ -192,7 +198,10 @@ // Dispatched when a new document preview is being generated. PREVIEW_GENERATION_IN_PROGRESS: - 'print_preview.PreviewArea.PREVIEW_GENERATION_IN_PROGRESS' + 'print_preview.PreviewArea.PREVIEW_GENERATION_IN_PROGRESS', + + // Dispatched when invalid printer settings are detected. + SETTINGS_INVALID: 'print_preview.PreviewArea.SETTINGS_INVALID' }; /** @@ -351,10 +360,6 @@ this.onPagePreviewReady_.bind(this)); this.tracker.add( this.previewGenerator_, - print_preview.PreviewGenerator.EventType.FAIL, - this.onPreviewGenerationFail_.bind(this)); - this.tracker.add( - this.previewGenerator_, print_preview.PreviewGenerator.EventType.DOCUMENT_READY, this.onDocumentReady_.bind(this)); } else { @@ -523,7 +528,10 @@ * @private */ onTicketChange_: function() { - if (this.previewGenerator_ && this.previewGenerator_.requestPreview()) { + if (!this.previewGenerator_) + return; + var previewRequest = this.previewGenerator_.requestPreview(); + if (previewRequest.id > -1) { cr.dispatchSimpleEvent( this, PreviewArea.EventType.PREVIEW_GENERATION_IN_PROGRESS); if (this.loadingTimeout_ == null) { @@ -532,6 +540,29 @@ this, print_preview.PreviewAreaMessageId_.LOADING), PreviewArea.LOADING_TIMEOUT_); } + previewRequest.request.then( + /** @param {number} previewUid The unique id of the preview. */ + function(previewUid) { + this.previewGenerator_.onPreviewGenerationDone( + previewRequest.id, previewUid); + }.bind(this), + /** + * @param {*} type The type of print preview failure that + * occurred. + */ + function(type) { + if (/** @type{string} */ (type) == 'CANCELLED') + return; // overriden by a new request, do nothing. + else if (/** @type{string} */ (type) == 'SETTINGS_INVALID') { + this.cancelTimeout(); + this.showCustomMessage( + loadTimeData.getString('invalidPrinterSettings')); + cr.dispatchSimpleEvent( + this, PreviewArea.EventType.SETTINGS_INVALID); + } else { + this.onPreviewGenerationFail_(); + } + }.bind(this)); } else { this.marginControlContainer_.showMarginControlsIfNeeded(); } @@ -574,6 +605,8 @@ */ onDocumentReady_: function(event) { this.isDocumentReady_ = true; + if (this.isBrowserTest_) + this.isPluginReloaded_ = true; this.dispatchPreviewGenerationDoneIfReady_(); }, @@ -641,6 +674,11 @@ // we don't want this to happen as it can cause the margin to stop // being draggable. this.plugin_.style.pointerEvents = isDragging ? 'none' : 'auto'; + }, + + /** @param {boolean} isTest Whether this instance is in a browser test. */ + setIsBrowserTest: function(isTest) { + this.isBrowserTest_ = isTest; } };
diff --git a/chrome/browser/resources/print_preview/print_preview.js b/chrome/browser/resources/print_preview/print_preview.js index 8e915cc5..c60a439 100644 --- a/chrome/browser/resources/print_preview/print_preview.js +++ b/chrome/browser/resources/print_preview/print_preview.js
@@ -350,10 +350,6 @@ var nativeLayerEventTarget = this.nativeLayer_.getEventTarget(); this.tracker.add( nativeLayerEventTarget, - print_preview.NativeLayer.EventType.SETTINGS_INVALID, - this.onSettingsInvalid_.bind(this)); - this.tracker.add( - nativeLayerEventTarget, print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS, this.onPrintPresetOptionsFromDocument_.bind(this)); this.tracker.add( @@ -392,6 +388,10 @@ this.previewArea_, print_preview.PreviewArea.EventType.OPEN_SYSTEM_DIALOG_CLICK, this.openSystemPrintDialog_.bind(this)); + this.tracker.add( + this.previewArea_, + print_preview.PreviewArea.EventType.SETTINGS_INVALID, + this.onSettingsInvalid_.bind(this)); this.tracker.add( this.destinationStore_, @@ -955,9 +955,6 @@ this.uiState_ = PrintPreviewUiState_.ERROR; this.isPreviewGenerationInProgress_ = false; this.printHeader_.isPrintButtonEnabled = false; - this.previewArea_.cancelTimeout(); - this.previewArea_.showCustomMessage( - loadTimeData.getString('invalidPrinterSettings')); }, /**
diff --git a/chrome/browser/resources/usb_internals/usb_internals.html b/chrome/browser/resources/usb_internals/usb_internals.html index 46bfe49..51a95766 100644 --- a/chrome/browser/resources/usb_internals/usb_internals.html +++ b/chrome/browser/resources/usb_internals/usb_internals.html
@@ -6,7 +6,10 @@ <link rel="stylesheet" href="chrome://resources/css/text_defaults.css"> <link rel="stylesheet" href="usb_internals.css"> <script src="chrome://resources/js/cr.js"></script> + <script src="chrome://resources/js/mojo_bindings.js"></script> <script src="chrome://resources/js/util.js"></script> + <script src="chrome/browser/ui/webui/usb_internals/usb_internals.mojom.js"> + </script> <script src="usb_internals.js"></script> </head> <body>
diff --git a/chrome/browser/resources/usb_internals/usb_internals.js b/chrome/browser/resources/usb_internals/usb_internals.js index 1b324a4d..a09a7ea 100644 --- a/chrome/browser/resources/usb_internals/usb_internals.js +++ b/chrome/browser/resources/usb_internals/usb_internals.js
@@ -23,8 +23,8 @@ let remove = document.createElement('td'); let removeButton = document.createElement('button'); name.textContent = device.name; - serialNumber.textContent = device.serial_number; - landingPage.textContent = device.landing_page.url; + serialNumber.textContent = device.serialNumber; + landingPage.textContent = device.landingPage.url; removeButton.addEventListener('click', function() { pageHandler.removeDeviceForTesting(device.guid).then(refreshDeviceList); }); @@ -54,24 +54,12 @@ event.preventDefault(); } -function initializeProxies() { - return importModules([ - 'chrome/browser/ui/webui/usb_internals/usb_internals.mojom', - 'content/public/renderer/frame_interfaces', - ]) - .then(function(modules) { - let mojom = modules[0]; - let frameInterfaces = modules[1]; - - pageHandler = new mojom.UsbInternalsPageHandlerPtr( - frameInterfaces.getInterface(mojom.UsbInternalsPageHandler.name)); - }); -} - document.addEventListener('DOMContentLoaded', function() { - initializeProxies().then(function() { - $('add-test-device-form').addEventListener('submit', addTestDevice); - refreshDeviceList(); - }); + pageHandler = new mojom.UsbInternalsPageHandlerPtr; + Mojo.bindInterface( + mojom.UsbInternalsPageHandler.name, mojo.makeRequest(pageHandler).handle); + + $('add-test-device-form').addEventListener('submit', addTestDevice); + refreshDeviceList(); }); })();
diff --git a/chrome/browser/search/one_google_bar/one_google_bar_service.cc b/chrome/browser/search/one_google_bar/one_google_bar_service.cc index d4eece4..23ddb31 100644 --- a/chrome/browser/search/one_google_bar/one_google_bar_service.cc +++ b/chrome/browser/search/one_google_bar/one_google_bar_service.cc
@@ -27,8 +27,7 @@ private: // SigninManagerBase::Observer implementation. void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override { + const std::string& username) override { callback_.Run(); }
diff --git a/chrome/browser/signin/signin_manager_unittest.cc b/chrome/browser/signin/signin_manager_unittest.cc index 25ffe5cb..77990bc 100644 --- a/chrome/browser/signin/signin_manager_unittest.cc +++ b/chrome/browser/signin/signin_manager_unittest.cc
@@ -68,15 +68,17 @@ class TestSigninManagerObserver : public SigninManagerBase::Observer { public: - TestSigninManagerObserver() : num_failed_signins_(0), - num_successful_signins_(0), - num_signouts_(0) { - } + TestSigninManagerObserver() + : num_failed_signins_(0), + num_successful_signins_(0), + num_successful_signins_with_password_(0), + num_signouts_(0) {} ~TestSigninManagerObserver() override {} int num_failed_signins_; int num_successful_signins_; + int num_successful_signins_with_password_; int num_signouts_; private: @@ -86,11 +88,16 @@ } void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override { + const std::string& username) override { num_successful_signins_++; } + void GoogleSigninSucceededWithPassword(const std::string& account_id, + const std::string& username, + const std::string& password) override { + num_successful_signins_with_password_++; + } + void GoogleSignedOut(const std::string& account_id, const std::string& username) override { num_signouts_++; @@ -209,6 +216,7 @@ // Should go into token service and stop. EXPECT_EQ(1, test_observer_.num_successful_signins_); + EXPECT_EQ(1, test_observer_.num_successful_signins_with_password_); EXPECT_EQ(0, test_observer_.num_failed_signins_); } @@ -404,10 +412,12 @@ EXPECT_EQ("", manager_->GetAuthenticatedAccountInfo().email); EXPECT_EQ("", manager_->GetAuthenticatedAccountId()); EXPECT_EQ(0, test_observer_.num_successful_signins_); + EXPECT_EQ(0, test_observer_.num_successful_signins_with_password_); std::string account_id = AddToAccountTracker("gaia_id", "user@gmail.com"); manager_->OnExternalSigninCompleted("user@gmail.com"); EXPECT_EQ(1, test_observer_.num_successful_signins_); + EXPECT_EQ(1, test_observer_.num_successful_signins_with_password_); EXPECT_EQ(0, test_observer_.num_failed_signins_); EXPECT_EQ("user@gmail.com", manager_->GetAuthenticatedAccountInfo().email); EXPECT_EQ(account_id, manager_->GetAuthenticatedAccountId());
diff --git a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc index 411beeb..40607a3 100644 --- a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc +++ b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc
@@ -181,7 +181,8 @@ std::string gaia_id = GetGaiaIdForUsername(username_); service()->signin()->SetAuthenticatedAccountInfo(gaia_id, username_); std::string account_id = service()->signin()->GetAuthenticatedAccountId(); - service()->GoogleSigninSucceeded(account_id, username_, password_); + service()->GoogleSigninSucceededWithPassword(account_id, username_, + password_); ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> UpdateCredentials(account_id, GenerateFakeOAuth2RefreshTokenString()); } else {
diff --git a/chrome/browser/sync_file_system/drive_backend/sync_engine.cc b/chrome/browser/sync_file_system/drive_backend/sync_engine.cc index 9db9617..c92419c1 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_engine.cc +++ b/chrome/browser/sync_file_system/drive_backend/sync_engine.cc
@@ -706,8 +706,7 @@ } void SyncEngine::GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) { + const std::string& username) { Initialize(); }
diff --git a/chrome/browser/sync_file_system/drive_backend/sync_engine.h b/chrome/browser/sync_file_system/drive_backend/sync_engine.h index b454f65..bc1759c 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_engine.h +++ b/chrome/browser/sync_file_system/drive_backend/sync_engine.h
@@ -144,8 +144,7 @@ // SigninManagerBase::Observer overrides. void GoogleSigninFailed(const GoogleServiceAuthError& error) override; void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + const std::string& username) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override;
diff --git a/chrome/browser/thumbnails/thumbnail_tab_helper.cc b/chrome/browser/thumbnails/thumbnail_tab_helper.cc index 6d470f8..5c445db 100644 --- a/chrome/browser/thumbnails/thumbnail_tab_helper.cc +++ b/chrome/browser/thumbnails/thumbnail_tab_helper.cc
@@ -6,6 +6,8 @@ #include "base/feature_list.h" #include "base/metrics/histogram_macros.h" +#include "base/task_scheduler/post_task.h" +#include "base/task_scheduler/task_traits.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/thumbnails/thumbnail_service.h" #include "chrome/browser/thumbnails/thumbnail_service_factory.h" @@ -23,6 +25,27 @@ #include "ui/gfx/color_utils.h" #include "ui/gfx/scrollbar_size.h" +using thumbnails::ThumbnailingContext; +using thumbnails::ThumbnailingAlgorithm; + +namespace { + +void ComputeThumbnailScore(const SkBitmap& thumbnail, + scoped_refptr<ThumbnailingContext> context) { + base::TimeTicks process_bitmap_start_time = base::TimeTicks::Now(); + + context->score.boring_score = color_utils::CalculateBoringScore(thumbnail); + + context->score.good_clipping = + thumbnails::IsGoodClipping(context->clip_result); + + base::TimeDelta process_bitmap_time = + base::TimeTicks::Now() - process_bitmap_start_time; + UMA_HISTOGRAM_TIMES("Thumbnails.ProcessBitmapTime", process_bitmap_time); +} + +} // namespace + DEFINE_WEB_CONTENTS_USER_DATA_KEY(ThumbnailTabHelper); // Overview @@ -41,9 +64,6 @@ // may also be captured when a page load finishes (subject to the same // heuristics). -using thumbnails::ThumbnailingContext; -using thumbnails::ThumbnailingAlgorithm; - ThumbnailTabHelper::ThumbnailTabHelper(content::WebContents* contents) : content::WebContentsObserver(contents), capture_on_load_finished_(base::FeatureList::IsEnabled( @@ -222,20 +242,13 @@ if (response == content::READBACK_SUCCESS) { // On success, we must be on the UI thread. DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - base::TimeTicks process_bitmap_start_time = base::TimeTicks::Now(); - if (!bitmap.isNull() && !bitmap.empty()) { - // TODO(treib): Move this off the UI thread. crbug.com/737396 - thumbnailing_context_->score.boring_score = - color_utils::CalculateBoringScore(bitmap); - - thumbnailing_context_->score.good_clipping = - thumbnails::IsGoodClipping(thumbnailing_context_->clip_result); - } - base::TimeDelta process_bitmap_time = - base::TimeTicks::Now() - process_bitmap_start_time; - UMA_HISTOGRAM_TIMES("Thumbnails.ProcessBitmapTime", process_bitmap_time); - - UpdateThumbnail(bitmap); + base::PostTaskWithTraitsAndReply( + FROM_HERE, + {base::TaskPriority::BACKGROUND, + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, + base::Bind(&ComputeThumbnailScore, bitmap, thumbnailing_context_), + base::Bind(&ThumbnailTabHelper::UpdateThumbnail, + weak_factory_.GetWeakPtr(), bitmap)); } else { // On failure because of shutdown we are not on the UI thread, so ensure // that cleanup happens on that thread.
diff --git a/chrome/browser/translate/translate_manager_browsertest.cc b/chrome/browser/translate/translate_manager_browsertest.cc index a76421f..73d3e20 100644 --- a/chrome/browser/translate/translate_manager_browsertest.cc +++ b/chrome/browser/translate/translate_manager_browsertest.cc
@@ -14,15 +14,179 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" +#include "components/translate/core/browser/translate_error_details.h" #include "components/translate/core/common/language_detection_details.h" #include "content/public/browser/notification_service.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_fetcher_delegate.h" #include "url/gurl.h" +namespace { + +static const char kTestValidScript[] = + "var google = {};" + "google.translate = (function() {" + " return {" + " TranslateService: function() {" + " return {" + " isAvailable : function() {" + " return true;" + " }," + " restore : function() {" + " return;" + " }," + " getDetectedLanguage : function() {" + " return \"fr\";" + " }," + " translatePage : function(originalLang, targetLang," + " onTranslateProgress) {" + " var error = (originalLang == 'auto') ? true : false;" + " onTranslateProgress(100, true, error);" + " }" + " };" + " }" + " };" + "})();" + "cr.googleTranslate.onTranslateElementLoad();"; + +static const char kTestScriptInitializationError[] = + "var google = {};" + "google.translate = (function() {" + " return {" + " TranslateService: function() {" + " return error;" + " }" + " };" + "})();" + "cr.googleTranslate.onTranslateElementLoad();"; + +static const char kTestScriptIdenticalLanguages[] = + "var google = {};" + "google.translate = (function() {" + " return {" + " TranslateService: function() {" + " return {" + " isAvailable : function() {" + " return true;" + " }," + " restore : function() {" + " return;" + " }," + " getDetectedLanguage : function() {" + " return \"en\";" + " }," + " translatePage : function(originalLang, targetLang," + " onTranslateProgress) {" + " onTranslateProgress(100, true, 0);" + " }" + " };" + " }" + " };" + "})();" + "cr.googleTranslate.onTranslateElementLoad();"; + +static const char kTestScriptTimeout[] = + "var google = {};" + "google.translate = (function() {" + " return {" + " TranslateService: function() {" + " return {" + " isAvailable : function() {" + " return false;" + " }," + " };" + " }" + " };" + "})();" + "cr.googleTranslate.onTranslateElementLoad();"; + +static const char kTestScriptUnexpectedScriptError[] = + "var google = {};" + "google.translate = (function() {" + " return {" + " TranslateService: function() {" + " return {" + " isAvailable : function() {" + " return true;" + " }," + " restore : function() {" + " return;" + " }," + " getDetectedLanguage : function() {" + " return \"fr\";" + " }," + " translatePage : function(originalLang, targetLang," + " onTranslateProgress) {" + " return error;" + " }" + " };" + " }" + " };" + "})();" + "cr.googleTranslate.onTranslateElementLoad();"; + +static const char kTestScriptBadOrigin[] = + "var google = {};" + "google.translate = (function() {" + " return {" + " TranslateService: function() {" + " return {" + " isAvailable : function() {" + " return true;" + " }," + " restore : function() {" + " return;" + " }," + " getDetectedLanguage : function() {" + " return \"fr\";" + " }," + " translatePage : function(originalLang, targetLang," + " onTranslateProgress) {" + " var url = \"\";" + " cr.googleTranslate.onLoadJavascript(url);" + " }" + " };" + " }" + " };" + "})();" + "cr.googleTranslate.onTranslateElementLoad();"; + +static const char kTestScriptLoadError[] = + "var google = {};" + "google.translate = (function() {" + " return {" + " TranslateService: function() {" + " return {" + " isAvailable : function() {" + " return true;" + " }," + " restore : function() {" + " return;" + " }," + " getDetectedLanguage : function() {" + " return \"fr\";" + " }," + " translatePage : function(originalLang, targetLang," + " onTranslateProgress) {" + " var url = \"https://translate.googleapis.com/INVALID\";" + " cr.googleTranslate.onLoadJavascript(url);" + " }" + " };" + " }" + " };" + "})();" + "cr.googleTranslate.onTranslateElementLoad();"; + +} // namespace + class TranslateManagerBrowserTest : public InProcessBrowserTest { public: - TranslateManagerBrowserTest() {} + TranslateManagerBrowserTest() { + error_subscription_ = + translate::TranslateManager::RegisterTranslateErrorCallback( + base::Bind(&TranslateManagerBrowserTest::OnTranslateError, + base::Unretained(this))); + } ~TranslateManagerBrowserTest() override {} void WaitUntilLanguageDetected() { language_detected_signal_->Wait(); } @@ -37,37 +201,11 @@ content::NotificationService::AllSources())); } - void SimulateURLFetch(bool success) { + void SimulateURLFetch(const std::string& script, bool success) { net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0); ASSERT_TRUE(fetcher); net::Error error = success ? net::OK : net::ERR_FAILED; - std::string script = - " var google = {};" - "google.translate = (function() {" - " return {" - " TranslateService: function() {" - " return {" - " isAvailable : function() {" - " return true;" - " }," - " restore : function() {" - " return;" - " }," - " getDetectedLanguage : function() {" - " return \"fr\";" - " }," - " translatePage : function(originalLang, targetLang," - " onTranslateProgress) {" - " var error = (originalLang == 'auto') ? true : false;" - " onTranslateProgress(100, true, error);" - " }" - " };" - " }" - " };" - "})();" - "cr.googleTranslate.onTranslateElementLoad();"; - fetcher->set_url(fetcher->GetOriginalURL()); fetcher->set_status(net::URLRequestStatus::FromError(error)); fetcher->set_response_code(success ? 200 : 500); @@ -75,6 +213,19 @@ fetcher->delegate()->OnURLFetchComplete(fetcher); } + void OnTranslateError(const translate::TranslateErrorDetails& details) { + error_type_ = details.error; + } + + translate::TranslateErrors::Type GetPageTranslatedResult() { + return error_type_; + } + + ChromeTranslateClient* GetChromeTranslateClient() { + return ChromeTranslateClient::FromWebContents( + browser()->tab_strip_model()->GetActiveWebContents()); + } + protected: // InProcessBrowserTest members. void SetUp() override { @@ -82,11 +233,18 @@ } void SetUpOnMainThread() override { ResetObserver(); + error_type_ = translate::TranslateErrors::NONE; } private: net::TestURLFetcherFactory url_fetcher_factory_; + translate::TranslateErrors::Type error_type_; + + std::unique_ptr< + translate::TranslateManager::TranslateErrorCallbackList::Subscription> + error_subscription_; + using LangageDetectionObserver = ui_test_utils::WindowedNotificationObserverWithDetails< translate::LanguageDetectionDetails>; @@ -100,10 +258,8 @@ IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest, PageLanguageDetection) { ASSERT_TRUE(embedded_test_server()->Start()); - content::WebContents* current_web_contents = - browser()->tab_strip_model()->GetActiveWebContents(); - ChromeTranslateClient* chrome_translate_client = - ChromeTranslateClient::FromWebContents(current_web_contents); + ChromeTranslateClient* chrome_translate_client = GetChromeTranslateClient(); + // The InProcessBrowserTest opens a new tab, let's wait for that first. // There is a possible race condition, when the language is not yet detected, // so we check for that and wait if necessary. @@ -117,9 +273,7 @@ ResetObserver(); AddTabAtIndex(0, GURL(embedded_test_server()->GetURL("/english_page.html")), ui::PAGE_TRANSITION_TYPED); - current_web_contents = browser()->tab_strip_model()->GetActiveWebContents(); - chrome_translate_client = - ChromeTranslateClient::FromWebContents(current_web_contents); + chrome_translate_client = GetChromeTranslateClient(); WaitUntilLanguageDetected(); EXPECT_EQ("en", @@ -139,10 +293,7 @@ IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest, PageTranslationSuccess) { ASSERT_TRUE(embedded_test_server()->Start()); - content::WebContents* current_web_contents = - browser()->tab_strip_model()->GetActiveWebContents(); - ChromeTranslateClient* chrome_translate_client = - ChromeTranslateClient::FromWebContents(current_web_contents); + ChromeTranslateClient* chrome_translate_client = GetChromeTranslateClient(); // There is a possible race condition, when the language is not yet detected, // so we check for that and wait if necessary. @@ -156,9 +307,7 @@ ResetObserver(); AddTabAtIndex(0, GURL(embedded_test_server()->GetURL("/french_page.html")), ui::PAGE_TRANSITION_TYPED); - current_web_contents = browser()->tab_strip_model()->GetActiveWebContents(); - chrome_translate_client = - ChromeTranslateClient::FromWebContents(current_web_contents); + chrome_translate_client = GetChromeTranslateClient(); WaitUntilLanguageDetected(); EXPECT_EQ("fr", @@ -171,22 +320,20 @@ chrome_translate_client->GetLanguageState().original_language(), "en", true); - SimulateURLFetch(true); + SimulateURLFetch(kTestValidScript, true); // Wait for NOTIFICATION_PAGE_TRANSLATED notification. WaitUntilPageTranslated(); EXPECT_FALSE(chrome_translate_client->GetLanguageState().translation_error()); + EXPECT_EQ(translate::TranslateErrors::NONE, GetPageTranslatedResult()); } // Test if there was an error during translation. IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest, PageTranslationError) { ASSERT_TRUE(embedded_test_server()->Start()); - content::WebContents* current_web_contents = - browser()->tab_strip_model()->GetActiveWebContents(); - ChromeTranslateClient* chrome_translate_client = - ChromeTranslateClient::FromWebContents(current_web_contents); + ChromeTranslateClient* chrome_translate_client = GetChromeTranslateClient(); // There is a possible race condition, when the language is not yet detected, // so we check for that and wait if necessary. @@ -199,9 +346,7 @@ // Open a new tab with about:blank page. ResetObserver(); AddTabAtIndex(0, GURL("about:blank"), ui::PAGE_TRANSITION_TYPED); - current_web_contents = browser()->tab_strip_model()->GetActiveWebContents(); - chrome_translate_client = - ChromeTranslateClient::FromWebContents(current_web_contents); + chrome_translate_client = GetChromeTranslateClient(); WaitUntilLanguageDetected(); EXPECT_EQ("und", @@ -214,12 +359,263 @@ chrome_translate_client->GetLanguageState().original_language(), "en", true); - SimulateURLFetch(true); + SimulateURLFetch(kTestValidScript, true); // Wait for NOTIFICATION_PAGE_TRANSLATED notification. WaitUntilPageTranslated(); EXPECT_TRUE(chrome_translate_client->GetLanguageState().translation_error()); + EXPECT_EQ(translate::TranslateErrors::TRANSLATION_ERROR, + GetPageTranslatedResult()); +} + +// Test if there was an error during translate library initialization. +IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest, + PageTranslationInitializationError) { + ASSERT_TRUE(embedded_test_server()->Start()); + + ChromeTranslateClient* chrome_translate_client = GetChromeTranslateClient(); + + // There is a possible race condition, when the language is not yet detected, + // so we check for that and wait if necessary. + if (chrome_translate_client->GetLanguageState().original_language().empty()) + WaitUntilLanguageDetected(); + + EXPECT_EQ("und", + chrome_translate_client->GetLanguageState().original_language()); + + // Open a new tab with a page in French. + ResetObserver(); + AddTabAtIndex(0, GURL(embedded_test_server()->GetURL("/french_page.html")), + ui::PAGE_TRANSITION_TYPED); + chrome_translate_client = GetChromeTranslateClient(); + WaitUntilLanguageDetected(); + + EXPECT_EQ("fr", + chrome_translate_client->GetLanguageState().original_language()); + + // Translate the page through TranslateManager. + translate::TranslateManager* manager = + chrome_translate_client->GetTranslateManager(); + manager->TranslatePage( + chrome_translate_client->GetLanguageState().original_language(), "en", + true); + + SimulateURLFetch(kTestScriptInitializationError, true); + + // Wait for NOTIFICATION_PAGE_TRANSLATED notification. + WaitUntilPageTranslated(); + + EXPECT_TRUE(chrome_translate_client->GetLanguageState().translation_error()); + EXPECT_EQ(translate::TranslateErrors::INITIALIZATION_ERROR, + GetPageTranslatedResult()); +} + +// Test the checks translate lib never gets ready and throws timeout. +IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest, + PageTranslationTimeoutError) { + ASSERT_TRUE(embedded_test_server()->Start()); + + ChromeTranslateClient* chrome_translate_client = GetChromeTranslateClient(); + + // There is a possible race condition, when the language is not yet detected, + // so we check for that and wait if necessary. + if (chrome_translate_client->GetLanguageState().original_language().empty()) + WaitUntilLanguageDetected(); + + EXPECT_EQ("und", + chrome_translate_client->GetLanguageState().original_language()); + + // Open a new tab with a page in French. + ResetObserver(); + AddTabAtIndex(0, GURL(embedded_test_server()->GetURL("/french_page.html")), + ui::PAGE_TRANSITION_TYPED); + chrome_translate_client = GetChromeTranslateClient(); + WaitUntilLanguageDetected(); + + EXPECT_EQ("fr", + chrome_translate_client->GetLanguageState().original_language()); + + // Translate the page through TranslateManager. + translate::TranslateManager* manager = + chrome_translate_client->GetTranslateManager(); + manager->TranslatePage( + chrome_translate_client->GetLanguageState().original_language(), "en", + true); + + SimulateURLFetch(kTestScriptTimeout, true); + + // Wait for NOTIFICATION_PAGE_TRANSLATED notification. + WaitUntilPageTranslated(); + + EXPECT_TRUE(chrome_translate_client->GetLanguageState().translation_error()); + EXPECT_EQ(translate::TranslateErrors::TRANSLATION_TIMEOUT, + GetPageTranslatedResult()); +} + +// Test the checks if both source and target languages mentioned are identical. +IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest, + PageTranslationIdenticalLanguagesError) { + ASSERT_TRUE(embedded_test_server()->Start()); + + ChromeTranslateClient* chrome_translate_client = GetChromeTranslateClient(); + + // There is a possible race condition, when the language is not yet detected, + // so we check for that and wait if necessary. + if (chrome_translate_client->GetLanguageState().original_language().empty()) + WaitUntilLanguageDetected(); + + EXPECT_EQ("und", + chrome_translate_client->GetLanguageState().original_language()); + + // Open a new tab with a page in French. + ResetObserver(); + AddTabAtIndex(0, GURL(embedded_test_server()->GetURL("/french_page.html")), + ui::PAGE_TRANSITION_TYPED); + chrome_translate_client = GetChromeTranslateClient(); + WaitUntilLanguageDetected(); + + EXPECT_EQ("fr", + chrome_translate_client->GetLanguageState().original_language()); + + // Translate the page through TranslateManager. + translate::TranslateManager* manager = + chrome_translate_client->GetTranslateManager(); + manager->TranslatePage("aa", "en", true); + + SimulateURLFetch(kTestScriptIdenticalLanguages, true); + + // Wait for NOTIFICATION_PAGE_TRANSLATED notification. + WaitUntilPageTranslated(); + + EXPECT_TRUE(chrome_translate_client->GetLanguageState().translation_error()); + EXPECT_EQ(translate::TranslateErrors::IDENTICAL_LANGUAGES, + GetPageTranslatedResult()); +} + +// Test if there was an error during translatePage script execution. +IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest, + PageTranslationUnexpectedScriptError) { + ASSERT_TRUE(embedded_test_server()->Start()); + + ChromeTranslateClient* chrome_translate_client = GetChromeTranslateClient(); + + // There is a possible race condition, when the language is not yet detected, + // so we check for that and wait if necessary. + if (chrome_translate_client->GetLanguageState().original_language().empty()) + WaitUntilLanguageDetected(); + + EXPECT_EQ("und", + chrome_translate_client->GetLanguageState().original_language()); + + // Open a new tab with a page in French. + ResetObserver(); + AddTabAtIndex(0, GURL(embedded_test_server()->GetURL("/french_page.html")), + ui::PAGE_TRANSITION_TYPED); + chrome_translate_client = GetChromeTranslateClient(); + WaitUntilLanguageDetected(); + + EXPECT_EQ("fr", + chrome_translate_client->GetLanguageState().original_language()); + + // Translate the page through TranslateManager. + translate::TranslateManager* manager = + chrome_translate_client->GetTranslateManager(); + manager->TranslatePage( + chrome_translate_client->GetLanguageState().original_language(), "en", + true); + + SimulateURLFetch(kTestScriptUnexpectedScriptError, true); + + // Wait for NOTIFICATION_PAGE_TRANSLATED notification. + WaitUntilPageTranslated(); + + EXPECT_TRUE(chrome_translate_client->GetLanguageState().translation_error()); + EXPECT_EQ(translate::TranslateErrors::UNEXPECTED_SCRIPT_ERROR, + GetPageTranslatedResult()); +} + +// Test if securityOrigin mentioned in url is valid. +IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest, + PageTranslationBadOriginError) { + ASSERT_TRUE(embedded_test_server()->Start()); + + ChromeTranslateClient* chrome_translate_client = GetChromeTranslateClient(); + + // There is a possible race condition, when the language is not yet detected, + // so we check for that and wait if necessary. + if (chrome_translate_client->GetLanguageState().original_language().empty()) + WaitUntilLanguageDetected(); + + EXPECT_EQ("und", + chrome_translate_client->GetLanguageState().original_language()); + + // Open a new tab with a page in French. + ResetObserver(); + AddTabAtIndex(0, GURL(embedded_test_server()->GetURL("/french_page.html")), + ui::PAGE_TRANSITION_TYPED); + chrome_translate_client = GetChromeTranslateClient(); + WaitUntilLanguageDetected(); + + EXPECT_EQ("fr", + chrome_translate_client->GetLanguageState().original_language()); + + // Translate the page through TranslateManager. + translate::TranslateManager* manager = + chrome_translate_client->GetTranslateManager(); + manager->TranslatePage( + chrome_translate_client->GetLanguageState().original_language(), "en", + true); + + SimulateURLFetch(kTestScriptBadOrigin, true); + + // Wait for NOTIFICATION_PAGE_TRANSLATED notification. + WaitUntilPageTranslated(); + + EXPECT_TRUE(chrome_translate_client->GetLanguageState().translation_error()); + EXPECT_EQ(translate::TranslateErrors::BAD_ORIGIN, GetPageTranslatedResult()); +} + +// Test if there was an error during script load. +IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest, + PageTranslationScriptLoadError) { + ASSERT_TRUE(embedded_test_server()->Start()); + + ChromeTranslateClient* chrome_translate_client = GetChromeTranslateClient(); + + // There is a possible race condition, when the language is not yet detected, + // so we check for that and wait if necessary. + if (chrome_translate_client->GetLanguageState().original_language().empty()) + WaitUntilLanguageDetected(); + + EXPECT_EQ("und", + chrome_translate_client->GetLanguageState().original_language()); + + // Open a new tab with a page in French. + ResetObserver(); + AddTabAtIndex(0, GURL(embedded_test_server()->GetURL("/french_page.html")), + ui::PAGE_TRANSITION_TYPED); + chrome_translate_client = GetChromeTranslateClient(); + WaitUntilLanguageDetected(); + + EXPECT_EQ("fr", + chrome_translate_client->GetLanguageState().original_language()); + + // Translate the page through TranslateManager. + translate::TranslateManager* manager = + chrome_translate_client->GetTranslateManager(); + manager->TranslatePage( + chrome_translate_client->GetLanguageState().original_language(), "en", + true); + + SimulateURLFetch(kTestScriptLoadError, true); + + // Wait for NOTIFICATION_PAGE_TRANSLATED notification. + WaitUntilPageTranslated(); + + EXPECT_TRUE(chrome_translate_client->GetLanguageState().translation_error()); + EXPECT_EQ(translate::TranslateErrors::SCRIPT_LOAD_ERROR, + GetPageTranslatedResult()); } // Test that session restore restores the translate infobar and other translate @@ -229,10 +625,7 @@ SessionStartupPref pref(SessionStartupPref::LAST); SessionStartupPref::SetStartupPref(browser()->profile(), pref); - content::WebContents* current_web_contents = - browser()->tab_strip_model()->GetActiveWebContents(); - ChromeTranslateClient* chrome_translate_client = - ChromeTranslateClient::FromWebContents(current_web_contents); + ChromeTranslateClient* chrome_translate_client = GetChromeTranslateClient(); // There is a possible race condition, when the language is not yet detected, // so we check for that and wait if necessary. @@ -255,10 +648,7 @@ IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest, TranslateSessionRestore) { - content::WebContents* active_web_contents = - browser()->tab_strip_model()->GetActiveWebContents(); - ChromeTranslateClient* active_translate_client = - ChromeTranslateClient::FromWebContents(active_web_contents); + ChromeTranslateClient* active_translate_client = GetChromeTranslateClient(); if (active_translate_client->GetLanguageState().current_language().empty()) WaitUntilLanguageDetected(); EXPECT_EQ("und",
diff --git a/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc b/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc index e81d68d2..629a4cbaf 100644 --- a/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc +++ b/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc
@@ -53,7 +53,7 @@ } void AutofillPopupViewAndroid::Hide() { - controller_ = NULL; + controller_ = nullptr; JNIEnv* env = base::android::AttachCurrentThread(); if (!java_object_.is_null()) { Java_AutofillPopupBridge_dismiss(env, java_object_); @@ -171,6 +171,8 @@ if (controller_) controller_->ViewDestroyed(); + // The controller has now deleted itself. Remove dangling weak reference. + controller_ = nullptr; delete this; }
diff --git a/chrome/browser/ui/ash/chrome_screenshot_grabber.cc b/chrome/browser/ui/ash/chrome_screenshot_grabber.cc index 8bb9e53..688679e 100644 --- a/chrome/browser/ui/ash/chrome_screenshot_grabber.cc +++ b/chrome/browser/ui/ash/chrome_screenshot_grabber.cc
@@ -19,7 +19,7 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/task_scheduler/post_task.h" -#include "base/threading/sequenced_worker_pool.h" +#include "base/threading/thread_restrictions.h" #include "build/build_config.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/drive/file_system_util.h" @@ -53,6 +53,11 @@ const char kImageClipboardFormatPrefix[] = "<img src='data:image/png;base64,"; const char kImageClipboardFormatSuffix[] = "'>"; +// User is waiting for the screenshot-taken notification, hence USER_VISIBLE. +constexpr base::TaskTraits kBlockingTaskTraits = { + base::MayBlock(), base::TaskPriority::USER_VISIBLE, + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}; + void CopyScreenshotToClipboard(scoped_refptr<base::RefCountedString> png_data) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -73,6 +78,7 @@ } void ReadFileAndCopyToClipboardLocal(const base::FilePath& screenshot_path) { + base::ThreadRestrictions::AssertIOAllowed(); scoped_refptr<base::RefCountedString> png_data(new base::RefCountedString()); if (!base::ReadFileToString(screenshot_path, &(png_data->data()))) { LOG(ERROR) << "Failed to read the screenshot file: " @@ -94,8 +100,9 @@ << drive::FileErrorToString(error); return; } - content::BrowserThread::GetBlockingPool()->PostTask( - FROM_HERE, base::BindOnce(&ReadFileAndCopyToClipboardLocal, file_path)); + base::PostTaskWithTraits( + FROM_HERE, kBlockingTaskTraits, + base::BindOnce(&ReadFileAndCopyToClipboardLocal, file_path)); } // Delegate for a notification. This class has two roles: to implement callback @@ -130,8 +137,8 @@ base::Bind(&ReadFileAndCopyToClipboardDrive)); return; } - content::BrowserThread::GetBlockingPool()->PostTask( - FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, kBlockingTaskTraits, base::BindOnce(&ReadFileAndCopyToClipboardLocal, screenshot_path_)); break; } @@ -212,8 +219,8 @@ } else { LOG(ERROR) << "Failed to ensure the existence of the specified directory " << "in Google Drive: " << error; - content::BrowserThread::GetBlockingPool()->PostTask( - FROM_HERE, + base::PostTaskWithTraits( + FROM_HERE, kBlockingTaskTraits, base::BindOnce(callback, ui::ScreenshotGrabberDelegate::FILE_CHECK_DIR_FAILED, base::FilePath()));
diff --git a/chrome/browser/ui/passwords/password_manager_presenter.cc b/chrome/browser/ui/passwords/password_manager_presenter.cc index 7dc4922..0ce2824 100644 --- a/chrome/browser/ui/passwords/password_manager_presenter.cc +++ b/chrome/browser/ui/passwords/password_manager_presenter.cc
@@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/memory/ptr_util.h" +#include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" #include "base/strings/string_piece.h" @@ -32,6 +33,7 @@ #include "components/browser_sync/profile_sync_service.h" #include "components/password_manager/core/browser/android_affiliation/affiliation_utils.h" #include "components/password_manager/core/browser/import/password_importer.h" +#include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/password_manager/core/browser/password_ui_utils.h" #include "components/password_manager/core/common/password_manager_pref_names.h" #include "components/password_manager/sync/browser/password_sync_util.h" @@ -252,6 +254,10 @@ origin_url, base::UTF16ToUTF8(password_list_[index]->username_value), password_list_[index]->password_value); + UMA_HISTOGRAM_ENUMERATION( + "PasswordManager.AccessPasswordInSettings", + password_manager::metrics_util::ACCESS_PASSWORD_VIEWED, + password_manager::metrics_util::ACCESS_PASSWORD_COUNT); #endif } @@ -345,8 +351,16 @@ #endif if (authenticated) last_authentication_time_ = base::TimeTicks::Now(); + UMA_HISTOGRAM_ENUMERATION( + "PasswordManager.ReauthToAccessPasswordInSettings", + authenticated ? password_manager::metrics_util::REAUTH_SUCCESS + : password_manager::metrics_util::REAUTH_FAILURE, + password_manager::metrics_util::REAUTH_COUNT); return authenticated; } + UMA_HISTOGRAM_ENUMERATION("PasswordManager.ReauthToAccessPasswordInSettings", + password_manager::metrics_util::REAUTH_SKIPPED, + password_manager::metrics_util::REAUTH_COUNT); return true; }
diff --git a/chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc b/chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc index 3b326e4..d3ac129f 100644 --- a/chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc +++ b/chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc
@@ -468,6 +468,9 @@ InvokePaymentRequestUI(); + // Focus expectations are different in Keyboard Accessible mode. + dialog_view()->GetFocusManager()->SetKeyboardAccessible(false); + // One instrument is available, and it's selected because being expired can // still select the instrument. PaymentRequest* request = GetPaymentRequests(GetActiveWebContents()).front();
diff --git a/chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h b/chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h index 07df8d9..cea42989 100644 --- a/chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h +++ b/chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h
@@ -48,6 +48,9 @@ ORDER_SUMMARY_LINE_ITEM_3, DATA_SOURCE_LABEL, + // This is the title used at the top of each sheet. + SHEET_TITLE, + // The following are Label objects. SHIPPING_OPTION_DESCRIPTION, SHIPPING_OPTION_AMOUNT,
diff --git a/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc b/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc index 5e03b47..17c4ceb 100644 --- a/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc +++ b/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc
@@ -72,6 +72,20 @@ views::FocusTraversable* GetPaneFocusTraversable() override { return this; } void RequestFocus() override { + // In accessibility contexts, we want to focus the title of the sheet. + views::View* title = + GetViewByID(static_cast<int>(DialogViewID::SHEET_TITLE)); + views::FocusManager* focus = GetFocusManager(); + DCHECK(focus); + + title->RequestFocus(); + + // RequestFocus only works if we are in an accessible context, and is a + // no-op otherwise. Thus, if the focused view didn't change, we need to + // proceed with setting the focus for standard usage. + if (focus->GetFocusedView() == title) + return; + views::View* first_focusable = first_focusable_; if (!first_focusable) {
diff --git a/chrome/browser/ui/views/payments/payment_request_views_util.cc b/chrome/browser/ui/views/payments/payment_request_views_util.cc index dc8e501..c014b168 100644 --- a/chrome/browser/ui/views/payments/payment_request_views_util.cc +++ b/chrome/browser/ui/views/payments/payment_request_views_util.cc
@@ -227,6 +227,8 @@ views::Label* title_label = new views::Label(title, views::style::CONTEXT_DIALOG_TITLE); title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); + title_label->set_id(static_cast<int>(DialogViewID::SHEET_TITLE)); + title_label->SetFocusBehavior(views::View::FocusBehavior::ACCESSIBLE_ONLY); layout->AddView(title_label); return container;
diff --git a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc index 42b3ccd..dbd2a84 100644 --- a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc +++ b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc
@@ -567,6 +567,9 @@ InvokePaymentRequestUI(); SetRegionDataLoader(&test_region_data_loader_); + // Focus expectations are different in Keyboard Accessible mode. + dialog_view()->GetFocusManager()->SetKeyboardAccessible(false); + test_region_data_loader_.set_synchronous_callback(true); OpenShippingAddressEditorScreen();
diff --git a/chrome/browser/ui/views/payments/view_stack.cc b/chrome/browser/ui/views/payments/view_stack.cc index 16be8cc..b3e6c81 100644 --- a/chrome/browser/ui/views/payments/view_stack.cc +++ b/chrome/browser/ui/views/payments/view_stack.cc
@@ -57,9 +57,8 @@ // This is handled by the post-animation callback in the animated case, so // trigger it synchronously here. HideCoveredViews(); + RequestFocus(); } - - RequestFocus(); } void ViewStack::Pop() { @@ -144,10 +143,10 @@ if (animator == slide_out_animator_.get()) { stack_.pop_back(); DCHECK(!stack_.empty()) << "State stack should never be empty"; - RequestFocus(); } else if (animator == slide_in_animator_.get()) { HideCoveredViews(); } else { NOTREACHED(); } + RequestFocus(); }
diff --git a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc index 420efe93..1b25fe1c 100644 --- a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc +++ b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc
@@ -398,8 +398,7 @@ void LocalDiscoveryUIHandler::GoogleSigninSucceeded( const std::string& account_id, - const std::string& username, - const std::string& password) { + const std::string& username) { CheckUserLoggedIn(); }
diff --git a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h index c1afc02..80302ce 100644 --- a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h +++ b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h
@@ -80,8 +80,7 @@ // SigninManagerBase::Observer implementation. void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + const std::string& username) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override;
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc index 61ce8bf..318d10a 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.cc +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -992,8 +992,7 @@ } void BrowserOptionsHandler::GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) { + const std::string& username) { UpdateSyncState(); }
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.h b/chrome/browser/ui/webui/options/browser_options_handler.h index 2d117952b..0fccab77 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.h +++ b/chrome/browser/ui/webui/options/browser_options_handler.h
@@ -88,8 +88,7 @@ // SigninManagerBase::Observer implementation. void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + const std::string& username) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override;
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc index 7b05dfc..222b4d90 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -782,18 +782,23 @@ } void PrintPreviewHandler::HandleGetPreview(const base::ListValue* args) { - DCHECK_EQ(2U, args->GetSize()); + DCHECK_EQ(3U, args->GetSize()); + std::string callback_id; std::string json_str; - if (!args->GetString(0, &json_str)) - return; + + // All of the conditions below should be guaranteed by the print preview + // javascript. + args->GetString(0, &callback_id); + CHECK(!callback_id.empty()); + args->GetString(1, &json_str); std::unique_ptr<base::DictionaryValue> settings = GetSettingsDictionary(json_str); - if (!settings) - return; + CHECK(settings); int request_id = -1; - if (!settings->GetInteger(printing::kPreviewRequestID, &request_id)) - return; + settings->GetInteger(printing::kPreviewRequestID, &request_id); + CHECK_GT(request_id, -1); + preview_callbacks_.push(callback_id); print_preview_ui()->OnPrintPreviewRequest(request_id); // Add an additional key in order to identify |print_preview_ui| later on // when calling PrintPreviewUI::GetCurrentPrintPreviewStatus() on the IO @@ -844,7 +849,7 @@ if (!generate_draft_data) { int page_count = -1; - success = args->GetInteger(1, &page_count); + success = args->GetInteger(2, &page_count); DCHECK(success); if (page_count != -1) { @@ -1525,11 +1530,38 @@ FileSelected(path, 0, nullptr); } -void PrintPreviewHandler::OnPrintPreviewFailed() { - if (reported_failed_preview_) +void PrintPreviewHandler::OnPrintPreviewReady(int preview_uid, int request_id) { + if (request_id < 0) // invalid ID. return; - reported_failed_preview_ = true; - ReportUserActionHistogram(PREVIEW_FAILED); + CHECK(!preview_callbacks_.empty()); + ResolveJavascriptCallback(base::Value(preview_callbacks_.front()), + base::Value(preview_uid)); + preview_callbacks_.pop(); +} + +void PrintPreviewHandler::OnPrintPreviewFailed() { + CHECK(!preview_callbacks_.empty()); + if (!reported_failed_preview_) { + reported_failed_preview_ = true; + ReportUserActionHistogram(PREVIEW_FAILED); + } + RejectJavascriptCallback(base::Value(preview_callbacks_.front()), + base::Value("PREVIEW_FAILED")); + preview_callbacks_.pop(); +} + +void PrintPreviewHandler::OnInvalidPrinterSettings() { + CHECK(!preview_callbacks_.empty()); + RejectJavascriptCallback(base::Value(preview_callbacks_.front()), + base::Value("SETTINGS_INVALID")); + preview_callbacks_.pop(); +} + +void PrintPreviewHandler::OnPrintPreviewCancelled() { + CHECK(!preview_callbacks_.empty()); + RejectJavascriptCallback(base::Value(preview_callbacks_.front()), + base::Value("CANCELLED")); + preview_callbacks_.pop(); } #if BUILDFLAG(ENABLE_BASIC_PRINT_DIALOG)
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.h b/chrome/browser/ui/webui/print_preview/print_preview_handler.h index 3fc478f6..34725e3 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.h +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.h
@@ -6,6 +6,7 @@ #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ #include <memory> +#include <queue> #include <string> #include "base/files/file_path.h" @@ -76,6 +77,15 @@ // Called when print preview failed. void OnPrintPreviewFailed(); + // Called when print preview is cancelled due to a new request. + void OnPrintPreviewCancelled(); + + // Called when printer settings were invalid. + void OnInvalidPrinterSettings(); + + // Called when print preview is ready. + void OnPrintPreviewReady(int preview_uid, int request_id); + #if BUILDFLAG(ENABLE_BASIC_PRINTING) // Called when the user press ctrl+shift+p to display the native system // dialog. @@ -421,6 +431,8 @@ // notify the test if it was a successful save, only that it was attempted. base::Closure pdf_file_saved_closure_; + std::queue<std::string> preview_callbacks_; + #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) // Callback ID to be used to notify UI that privet search is finished. std::string privet_search_callback_id_;
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc index 83086734..74220ae 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
@@ -542,6 +542,10 @@ OnClosePrintPreviewDialog(); } +void PrintPreviewUI::OnPrintPreviewCancelled() { + handler_->OnPrintPreviewCancelled(); +} + void PrintPreviewUI::OnPrintPreviewRequest(int request_id) { if (!initial_preview_start_time_.is_null()) { UMA_HISTOGRAM_TIMES("PrintPreview.InitializationTime", @@ -619,10 +623,7 @@ handler_->regenerate_preview_request_count()); initial_preview_start_time_ = base::TimeTicks(); } - base::Value ui_identifier(id_); - base::Value ui_preview_request_id(preview_request_id); - web_ui()->CallJavascriptFunctionUnsafe("updatePrintPreview", ui_identifier, - ui_preview_request_id); + handler_->OnPrintPreviewReady(id_, preview_request_id); } void PrintPreviewUI::OnCancelPendingPreviewRequest() { @@ -631,11 +632,10 @@ void PrintPreviewUI::OnPrintPreviewFailed() { handler_->OnPrintPreviewFailed(); - web_ui()->CallJavascriptFunctionUnsafe("printPreviewFailed"); } void PrintPreviewUI::OnInvalidPrinterSettings() { - web_ui()->CallJavascriptFunctionUnsafe("invalidPrinterSettings"); + handler_->OnInvalidPrinterSettings(); } void PrintPreviewUI::OnHidePreviewDialog() {
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.h b/chrome/browser/ui/webui/print_preview/print_preview_ui.h index 2abe24e..722c316 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_ui.h +++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.h
@@ -115,6 +115,9 @@ // closed, which may occur for several reasons, e.g. tab closure or crash. void OnPrintPreviewDialogClosed(); + // Notifies the Web UI that the preview request was cancelled. + void OnPrintPreviewCancelled(); + // Notifies the Web UI that initiator is closed, so we can disable all the // controls that need the initiator for generating the preview data. void OnInitiatorClosed();
diff --git a/chrome/browser/ui/webui/settings/people_handler.cc b/chrome/browser/ui/webui/settings/people_handler.cc index 25d5670..b0a1c04 100644 --- a/chrome/browser/ui/webui/settings/people_handler.cc +++ b/chrome/browser/ui/webui/settings/people_handler.cc
@@ -697,8 +697,7 @@ } void PeopleHandler::GoogleSigninSucceeded(const std::string& /* account_id */, - const std::string& /* username */, - const std::string& /* password */) { + const std::string& /* username */) { UpdateSyncStatus(); }
diff --git a/chrome/browser/ui/webui/settings/people_handler.h b/chrome/browser/ui/webui/settings/people_handler.h index 2559679..7b587f7 100644 --- a/chrome/browser/ui/webui/settings/people_handler.h +++ b/chrome/browser/ui/webui/settings/people_handler.h
@@ -113,8 +113,7 @@ // SigninManagerBase::Observer implementation. void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + const std::string& username) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override;
diff --git a/chrome/browser/ui/webui/usb_internals/BUILD.gn b/chrome/browser/ui/webui/usb_internals/BUILD.gn index 99f9375..1774bc0 100644 --- a/chrome/browser/ui/webui/usb_internals/BUILD.gn +++ b/chrome/browser/ui/webui/usb_internals/BUILD.gn
@@ -16,7 +16,4 @@ # TODO(crbug.com/714018): Convert the implementation to use OnceCallback. use_once_callback = false - - # TODO(crbug.com/699569): Convert to use the new JS bindings. - use_new_js_bindings = false }
diff --git a/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc b/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc index aa60c9c..decb96e 100644 --- a/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc +++ b/chrome/browser/ui/webui/usb_internals/usb_internals_ui.cc
@@ -18,10 +18,10 @@ source->AddResourcePath("usb_internals.css", IDR_USB_INTERNALS_CSS); source->AddResourcePath("usb_internals.js", IDR_USB_INTERNALS_JS); source->AddResourcePath( - "chrome/browser/ui/webui/usb_internals/usb_internals.mojom", + "chrome/browser/ui/webui/usb_internals/usb_internals.mojom.js", IDR_USB_INTERNALS_MOJO_JS); - source->AddResourcePath("url/mojo/origin.mojom", IDR_ORIGIN_MOJO_JS); - source->AddResourcePath("url/mojo/url.mojom", IDR_URL_MOJO_JS); + source->AddResourcePath("url/mojo/origin.mojom.js", IDR_ORIGIN_MOJO_JS); + source->AddResourcePath("url/mojo/url.mojom.js", IDR_URL_MOJO_JS); source->SetDefaultResource(IDR_USB_INTERNALS_HTML); source->UseGzip(std::unordered_set<std::string>());
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 2f4e2f1..15ca32a 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc
@@ -769,6 +769,10 @@ // Passes the name of the current running automated test to Chrome. const char kTestName[] = "test-name"; +// Identifies a list of download sources as trusted, but only if proper group +// policy is set. +const char kTrustedDownloadSources[] = "trusted-download-sources"; + // Experimental. Shows a dialog asking the user to try chrome. This flag is to // be used only by the upgrade process. const char kTryChromeAgain[] = "try-chrome-again";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 9551a1b..15e5f75 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h
@@ -215,6 +215,7 @@ extern const char kSupervisedUserSyncToken[]; extern const char kSystemLogUploadFrequency[]; extern const char kTestName[]; +extern const char kTrustedDownloadSources[]; extern const char kTryChromeAgain[]; extern const char kUnlimitedStorage[]; extern const char kUnsafelyTreatInsecureOriginAsSecure[];
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 40319de..cc393e19 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc
@@ -76,6 +76,10 @@ // Defaults apps are installed only when creating a new profile. const char kDefaultApps[] = "default_apps"; +// Disable SafeBrowsing checks for files coming from trusted URLs when false. +const char kSafeBrowsingForTrustedSourcesEnabled[] = + "safebrowsing_for_trusted_sources_enabled"; + // Disables screenshot accelerators and extension APIs. // This setting resides both in profile prefs and local state. Accelerator // handling code reads local state, while extension APIs use profile pref. @@ -1513,6 +1517,9 @@ // the chrome/browser/download/save_package.h for the possible values. const char kSaveFileType[] = "savefile.type"; +// A list of download sources that can be trusted, e.g., enterprise intranet. +const char kTrustedDownloadSources[] = "trusted_download_sources"; + // String which specifies the last directory that was chosen for uploading // or opening a file. const char kSelectFileLastDirectory[] = "selectfile.last_directory";
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index da5aece1..90a87ec 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h
@@ -39,6 +39,7 @@ #endif extern const char kChildAccountStatusKnown[]; extern const char kDefaultApps[]; +extern const char kSafeBrowsingForTrustedSourcesEnabled[]; extern const char kDisableScreenshots[]; extern const char kDownloadRestrictions[]; extern const char kForceEphemeralProfiles[]; @@ -545,6 +546,7 @@ extern const char kSaveFileDefaultDirectory[]; extern const char kSaveFileType[]; +extern const char kTrustedDownloadSources[]; extern const char kAllowFileSelectionDialogs[]; extern const char kDefaultTasksByMimeType[];
diff --git a/chrome/renderer/translate/translate_helper_browsertest.cc b/chrome/renderer/translate/translate_helper_browsertest.cc index 679b628..b0238cdb 100644 --- a/chrome/renderer/translate/translate_helper_browsertest.cc +++ b/chrome/renderer/translate/translate_helper_browsertest.cc
@@ -112,12 +112,14 @@ MOCK_METHOD0(HasTranslationFinished, bool()); MOCK_METHOD0(HasTranslationFailed, bool()); MOCK_METHOD0(GetOriginalPageLanguage, std::string()); + MOCK_METHOD0(GetErrorCode, int64_t()); MOCK_METHOD0(StartTranslation, bool()); MOCK_METHOD1(ExecuteScript, void(const std::string&)); MOCK_METHOD2(ExecuteScriptAndGetBoolResult, bool(const std::string&, bool)); MOCK_METHOD1(ExecuteScriptAndGetStringResult, std::string(const std::string&)); MOCK_METHOD1(ExecuteScriptAndGetDoubleResult, double(const std::string&)); + MOCK_METHOD1(ExecuteScriptAndGetIntegerResult, int64_t(const std::string&)); private: void OnPageTranslated(bool cancelled, @@ -184,12 +186,16 @@ // translate_helper.cc .WillRepeatedly(Return(false)); + EXPECT_CALL(*translate_helper_, GetErrorCode()) + .Times(AtLeast(5)) + .WillRepeatedly(Return(translate::TranslateErrors::NONE)); + translate_helper_->TranslatePage("en", "fr", std::string()); base::RunLoop().RunUntilIdle(); translate::TranslateErrors::Type error; ASSERT_TRUE(translate_helper_->GetPageTranslatedResult(NULL, NULL, &error)); - EXPECT_EQ(translate::TranslateErrors::INITIALIZATION_ERROR, error); + EXPECT_EQ(translate::TranslateErrors::TRANSLATION_TIMEOUT, error); } // Tests that the browser gets notified of the translation success when the @@ -205,6 +211,9 @@ .WillOnce(Return(false)) .WillOnce(Return(true)); + EXPECT_CALL(*translate_helper_, GetErrorCode()) + .WillOnce(Return(translate::TranslateErrors::NONE)); + EXPECT_CALL(*translate_helper_, StartTranslation()).WillOnce(Return(true)); // Succeed after few checks. @@ -259,6 +268,9 @@ .Times(AtLeast(1)) .WillRepeatedly(Return(false)); + EXPECT_CALL(*translate_helper_, GetErrorCode()) + .WillOnce(Return(translate::TranslateErrors::TRANSLATION_ERROR)); + // V8 call for performance monitoring should be ignored. EXPECT_CALL(*translate_helper_, ExecuteScriptAndGetDoubleResult(_)).Times(2);
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index a0583d4..42c2eb2 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -786,6 +786,10 @@ libs = [ "oleacc.lib" ] } + if (toolkit_views && is_win) { + sources += [ "//ui/views/accessibility/ax_system_caret_win_interactive_uitest.cc" ] + } + if (is_mac) { data_deps += [ "//chrome", @@ -3124,6 +3128,7 @@ "../browser/media/android/router/media_router_android_unittest.cc", "../browser/media/cast_remoting_connector_unittest.cc", "../browser/media/media_engagement_contents_observer_unittest.cc", + "../browser/media/media_engagement_score_unittest.cc", "../browser/media/midi_permission_context_unittest.cc", "../browser/media/midi_sysex_permission_context_unittest.cc", "../browser/media/router/browser_presentation_connection_proxy_unittest.cc",
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeSigninUtils.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeSigninUtils.java index 26e97c3..bfd92e5 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeSigninUtils.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ChromeSigninUtils.java
@@ -76,7 +76,6 @@ } Account account = new Account(username, GOOGLE_ACCOUNT_TYPE); - mFakeAccountManagerDelegate = new FakeAccountManagerDelegate(mContext, account); AccountHolder accountHolder = AccountHolder.builder(account).password(password).build(); mFakeAccountManagerDelegate.addAccountHolderExplicitly(accountHolder); }
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/signin/SigninTestUtil.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/signin/SigninTestUtil.java index 583376c..c1d9ed7 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/signin/SigninTestUtil.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/signin/SigninTestUtil.java
@@ -20,7 +20,9 @@ import org.chromium.components.signin.test.util.AccountHolder; import org.chromium.components.signin.test.util.FakeAccountManagerDelegate; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; /** * Utility class for test signin functionality. @@ -34,6 +36,8 @@ private static Context sContext; @SuppressLint("StaticFieldLeak") private static FakeAccountManagerDelegate sAccountManager; + @SuppressLint("StaticFieldLeak") + private static List<AccountHolder> sAddedAccounts = new ArrayList<>(); /** * Sets up the test authentication environment. @@ -59,6 +63,10 @@ * Tears down the test authentication environment. */ public static void tearDownAuthForTest() { + for (AccountHolder accountHolder : sAddedAccounts) { + sAccountManager.removeAccountHolderExplicitly(accountHolder); + } + sAddedAccounts.clear(); sContext = null; } @@ -109,8 +117,9 @@ private static Account createTestAccount(String accountName) { assert sContext != null; Account account = AccountManagerHelper.createAccountFromName(accountName); - AccountHolder.Builder accountHolder = AccountHolder.builder(account).alwaysAccept(true); - sAccountManager.addAccountHolderExplicitly(accountHolder.build()); + AccountHolder accountHolder = AccountHolder.builder(account).alwaysAccept(true).build(); + sAccountManager.addAccountHolderExplicitly(accountHolder); + sAddedAccounts.add(accountHolder); return account; }
diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json index 358607a7..a1ec46f7 100644 --- a/chrome/test/data/policy/policy_test_cases.json +++ b/chrome/test/data/policy/policy_test_cases.json
@@ -549,6 +549,15 @@ ] }, + "SafeBrowsingForTrustedSourcesEnabled": { + "os": ["win"], + "can_be_recommended": true, + "test_policy": { "SafeBrowsingForTrustedSourcesEnabled": false }, + "pref_mappings": [ + { "pref": "safebrowsing_for_trusted_sources_enabled" } + ] + }, + "DownloadDirectory.0": { "os": ["win", "mac", "linux", "chromeos"], "can_be_recommended": true,
diff --git a/chrome/test/data/webui/print_preview/native_layer_stub.js b/chrome/test/data/webui/print_preview/native_layer_stub.js index 495d224..e95b708 100644 --- a/chrome/test/data/webui/print_preview/native_layer_stub.js +++ b/chrome/test/data/webui/print_preview/native_layer_stub.js
@@ -13,6 +13,7 @@ 'getInitialSettings', 'getPrinters', 'getExtensionPrinters', + 'getPreview', 'getPrivetPrinters', 'getPrinterCapabilities', 'print', @@ -26,12 +27,6 @@ this.eventTarget_ = new cr.EventTarget(); /** - * @private {boolean} Whether the native layer has set the generate draft - * parameter when requesting an updated preview. - */ - this.generateDraft_ = false; - - /** * @private {!print_preview.NativeInitialSettings} The initial settings * to be used for the response to a |getInitialSettings| call. */ @@ -62,6 +57,11 @@ * @private {boolean} Whether the printer setup request should be rejected. */ this.shouldRejectPrinterSetup_ = false; + + /** + * @private {string} The ID of a printer with a bad driver. + */ + this.badPrinterId_ = ''; } NativeLayerStub.prototype = { @@ -86,6 +86,24 @@ }, /** @override */ + getPreview: function( + destination, printTicketStore, documentInfo, generateDraft, requestId) { + this.methodCalled('getPreview', { + destination: destination, + printTicketStore: printTicketStore, + documentInfo: documentInfo, + generateDraft: generateDraft, + requestId: requestId, + }); + var rejectString = print_preview.PreviewArea.EventType.SETTINGS_INVALID; + rejectString = rejectString.substring( + rejectString.lastIndexOf(".") + 1, rejectString.length); + return destination.id == this.badPrinterId_ ? + Promise.reject(rejectString) : + Promise.resolve(requestId); + }, + + /** @override */ getPrivetPrinters: function() { this.methodCalled('getPrivetPrinters'); return Promise.resolve(true); @@ -119,11 +137,6 @@ /** Stubs for |print_preview.NativeLayer| methods that call C++ handlers. */ previewReadyForTest: function() {}, - - startGetPreview: function(destination, printTicketStore, documentInfo, - generateDraft, requestId) { - this.generateDraft_ = generateDraft; - }, startHideDialog: function () {}, /** @return {!cr.EventTarget} The native layer event target. */ @@ -134,9 +147,6 @@ this.eventTarget_ = eventTarget; }, - /** @return {boolean} Whether a new draft was requested for preview. */ - generateDraft: function() { return this.generateDraft_; }, - /** * @param {!print_preview.NativeInitialSettings} settings The settings * to return as a response to |getInitialSettings|. @@ -174,6 +184,15 @@ this.shouldRejectPrinterSetup_ = reject; this.setupPrinterResponse_ = response; }, + + /** + * @param {string} bad_id The printer ID that should cause an + * SETTINGS_INVALID error in response to a preview request. Models a + * bad printer driver. + */ + setInvalidPrinterId: function(id) { + this.badPrinterId_ = id; + }, }; return {
diff --git a/chrome/test/data/webui/print_preview/print_preview_tests.js b/chrome/test/data/webui/print_preview/print_preview_tests.js index e06412d9..e874df6 100644 --- a/chrome/test/data/webui/print_preview/print_preview_tests.js +++ b/chrome/test/data/webui/print_preview/print_preview_tests.js
@@ -274,7 +274,7 @@ print_preview.PreviewArea.prototype.checkPluginCompatibility_ = function() { - return false; + return true; }; }); @@ -302,6 +302,7 @@ print_preview.NativeLayer.setInstance(nativeLayer); printPreview = new print_preview.PrintPreview(); previewArea = printPreview.getPreviewArea(); + previewArea.setIsBrowserTest(true); }); // Test some basic assumptions about the print preview WebUI. @@ -1079,13 +1080,14 @@ // Test that changing the selected printer updates the preview. test('PrinterChangeUpdatesPreview', function() { - return setupSettingsAndDestinationsWithCapabilities().then(function() { - var previewGenerator = mock(print_preview.PreviewGenerator); - previewArea.previewGenerator_ = previewGenerator.proxy(); - - // The number of settings that can change due to a change in the - // destination that will therefore dispatch ticket item change events. - previewGenerator.expects(exactly(9)).requestPreview(); + return Promise.all([ + setupSettingsAndDestinationsWithCapabilities(), + nativeLayer.whenCalled('getPreview'), + ]).then(function(args) { + expectEquals(0, args[1].requestId); + expectEquals('FooDevice', args[1].destination.id); + nativeLayer.resetResolver('getPrinterCapabilities'); + nativeLayer.resetResolver('getPreview'); // Setup capabilities for BarDevice. var device = getCddTemplate('BarDevice'); @@ -1095,7 +1097,6 @@ ] }; nativeLayer.setLocalDestinationCapabilities(device); - // Select BarDevice var barDestination = printPreview.destinationStore_.destinations().find( @@ -1103,14 +1104,21 @@ return d.id == 'BarDevice'; }); printPreview.destinationStore_.selectDestination(barDestination); - return nativeLayer.whenCalled('getPrinterCapabilities', 'BarDevice'); - }).then(function(){ - return whenAnimationDone('more-settings'); + return Promise.all([ + nativeLayer.whenCalled('getPrinterCapabilities'), + nativeLayer.whenCalled('getPreview'), + ]); + }).then(function(args) { + expectEquals(1, args[1].requestId); + expectEquals('BarDevice', args[1].destination.id); }); }); // Test that error message is displayed when plugin doesn't exist. test('NoPDFPluginErrorMessage', function() { + previewArea.checkPluginCompatibility_ = function() { + return false; + } nativeLayer.setLocalDestinationCapabilities(getCddTemplate('FooDevice')); setInitialSettings(); return nativeLayer.whenCalled('getInitialSettings').then(function() { @@ -1247,22 +1255,21 @@ nativeLayer.setLocalDestinationCapabilities(getCddTemplate('ID2')) nativeLayer.setLocalDestinationCapabilities(getCddTemplate('ID3')); - // Use a real preview generator. - previewArea.previewGenerator_ = - new print_preview.PreviewGenerator(printPreview.destinationStore_, - printPreview.printTicketStore_, nativeLayer, - printPreview.documentInfo_); - - // Preview generator starts out with inFlightRequestId_ == -1. The id - // increments by 1 for each startGetPreview call it makes. It should only - // make one such call during initialization or there will be a race; see - // crbug.com/666595 - expectEquals(-1, previewArea.previewGenerator_.inFlightRequestId_); + // For crbug.com/666595. If multiple destinations are fetched there may + // be multiple preview requests. This verifies the first fetch is for + // ID1, which ensures no other destinations are fetched earlier. The last + // destination retrieved before timeout will end up in the preview + // request. Ensure this is also ID1. setInitialSettings(); - return nativeLayer.whenCalled('getInitialSettings').then(function() { - return nativeLayer.whenCalled('getPrinterCapabilities', 'ID1'); - }).then(function() { - expectEquals(0, previewArea.previewGenerator_.inFlightRequestId_); + var initialSettingsSet = nativeLayer.whenCalled('getInitialSettings'); + return initialSettingsSet.then(function() { + return nativeLayer.whenCalled('getPrinterCapabilities'); + }).then(function(id) { + expectEquals('ID1', id); + return nativeLayer.whenCalled('getPreview'); + }).then(function(previewArgs) { + expectEquals(0, previewArgs.requestId); + expectEquals('ID1', previewArgs.destination.id); }); }); @@ -1270,14 +1277,18 @@ // an error and that the preview dialog can be recovered by selecting a // new destination. test('InvalidSettingsError', function() { - return setupSettingsAndDestinationsWithCapabilities().then(function() { - // Manually enable the print header. This is needed since there is no - // plugin during test, so it will be set as disabled normally. - printPreview.printHeader_.isEnabled = true; + var barDevice = getCddTemplate('BarDevice'); + nativeLayer.setLocalDestinationCapabilities(barDevice); - // There will be an error message in the preview area since the plugin - // is not running. However, it should not be the invalid settings - // error. + // FooDevice is the default printer, so will be selected for the initial + // preview request. + nativeLayer.setInvalidPrinterId('FooDevice'); + return Promise.all([ + setupSettingsAndDestinationsWithCapabilities(), + nativeLayer.whenCalled('getPreview'), + ]).then(function() { + // Print preview should have failed with invalid settings, since + // FooDevice was set as an invalid printer. var previewAreaEl = $('preview-area'); var customMessageEl = previewAreaEl. @@ -1285,100 +1296,92 @@ expectFalse(customMessageEl.hidden); var expectedMessageStart = 'The selected printer is not available or ' + 'not installed correctly.' - expectFalse(customMessageEl.textContent.includes( - expectedMessageStart)); - - // Verify that the print button is enabled. - var printHeader = $('print-header'); - var printButton = printHeader.querySelector('button.print'); - checkElementDisplayed(printButton, true); - expectFalse(printButton.disabled); - - // Report invalid settings error. - var invalidSettingsEvent = - new Event(print_preview.NativeLayer.EventType.SETTINGS_INVALID); - nativeLayer.getEventTarget().dispatchEvent(invalidSettingsEvent); - - // Should be in an error state, print button disabled, invalid custom - // error message shown. - expectFalse(customMessageEl.hidden); expectTrue(customMessageEl.textContent.includes( expectedMessageStart)); + + // Verify that the print button is disabled + var printButton = $('print-header').querySelector('button.print'); + checkElementDisplayed(printButton, true); expectTrue(printButton.disabled); + // Reset + nativeLayer.resetResolver('getPrinterCapabilities'); + nativeLayer.resetResolver('getPreview'); + // Select a new destination var barDestination = printPreview.destinationStore_.destinations().find( function(d) { return d.id == 'BarDevice'; }); - - var barDevice = getCddTemplate('BarDevice'); - nativeLayer.setLocalDestinationCapabilities(barDevice); printPreview.destinationStore_.selectDestination(barDestination); - - return nativeLayer.whenCalled('getPrinterCapabilities', 'BarDevice') - .then(function() { - // Dispatch event indicating new preview has loaded. - var previewDoneEvent = new Event( - print_preview.PreviewArea.EventType.PREVIEW_GENERATION_DONE); - previewArea.dispatchEvent(previewDoneEvent); - - // Has active print button and successfully 'prints', indicating - // recovery from error state. - expectFalse(printButton.disabled); - printButton.click(); - // This should result in a call to print. - return nativeLayer.whenCalled('print').then( - /** - * @param {{destination: !print_preview.Destination, - * printTicketStore: !print_preview.PrintTicketStore, - * cloudPrintInterface: print_preview - * .CloudPrintInterface, - * documentInfo: print_preview.DocumentInfo}} args - * The arguments that print() was called with. - */ - function(args) { - // Sanity check some printing argument values. - var printTicketStore = args.printTicketStore; - expectEquals(barDevice.printerId, args.destination.id); - expectEquals( - getDefaultOrientation(barDevice) == 'LANDSCAPE', - printTicketStore.landscape.getValue()); - expectEquals(1, printTicketStore.copies.getValueAsNumber()); - var mediaDefault = getDefaultMediaSize(barDevice); - expectEquals( - mediaDefault.width_microns, - printTicketStore.mediaSize.getValue().width_microns); - expectEquals( - mediaDefault.height_microns, - printTicketStore.mediaSize.getValue().height_microns); - }); - }); - }); + return Promise.all([ + nativeLayer.whenCalled('getPrinterCapabilities'), + nativeLayer.whenCalled('getPreview'), + ]); + }).then(function() { + // Has active print button and successfully 'prints', indicating + // recovery from error state. + var printButton = $('print-header').querySelector('button.print'); + expectFalse(printButton.disabled); + printButton.click(); + // This should result in a call to print. + return nativeLayer.whenCalled('print'); + }).then( + /** + * @param {{destination: !print_preview.Destination, + * printTicketStore: !print_preview.PrintTicketStore, + * cloudPrintInterface: print_preview + * .CloudPrintInterface, + * documentInfo: print_preview.DocumentInfo}} args + * The arguments that print() was called with. + */ + function(args) { + // Sanity check some printing argument values. + var printTicketStore = args.printTicketStore; + expectEquals(barDevice.printerId, args.destination.id); + expectEquals( + getDefaultOrientation(barDevice) == 'LANDSCAPE', + printTicketStore.landscape.getValue()); + expectEquals(1, printTicketStore.copies.getValueAsNumber()); + var mediaDefault = getDefaultMediaSize(barDevice); + expectEquals( + mediaDefault.width_microns, + printTicketStore.mediaSize.getValue().width_microns); + expectEquals( + mediaDefault.height_microns, + printTicketStore.mediaSize.getValue().height_microns); + }); }); // Test the preview generator to make sure the generate draft parameter is // set correctly. It should be false if the only change is the page range. test('GenerateDraft', function() { - // Use a real preview generator. - previewArea.previewGenerator_ = - new print_preview.PreviewGenerator(printPreview.destinationStore_, - printPreview.printTicketStore_, nativeLayer, - printPreview.documentInfo_); - return setupSettingsAndDestinationsWithCapabilities().then(function() { + return Promise.all([ + setupSettingsAndDestinationsWithCapabilities(), + nativeLayer.whenCalled('getPreview'), + ]).then(function(args) { // The first request should generate draft because there was no // previous print preview draft. - expectTrue(nativeLayer.generateDraft()); + expectTrue(args[1].generateDraft); + expectEquals(0, args[1].requestId); + nativeLayer.resetResolver('getPreview'); // Change the page range - no new draft needed. printPreview.printTicketStore_.pageRange.updateValue('2'); - expectFalse(nativeLayer.generateDraft()); + return nativeLayer.whenCalled('getPreview'); + }).then(function(args) { + expectFalse(args.generateDraft); + expectEquals(1, args.requestId); + nativeLayer.resetResolver('getPreview'); // Change the margin type - need to regenerate again. printPreview.printTicketStore_.marginsType.updateValue( print_preview.ticket_items.MarginsTypeValue.NO_MARGINS); - expectTrue(nativeLayer.generateDraft()); + return nativeLayer.whenCalled('getPreview'); + }).then(function(args) { + expectTrue(args.generateDraft); + expectEquals(2, args.requestId); }); });
diff --git a/components/arc/arc_session_runner.cc b/components/arc/arc_session_runner.cc index e08cfa6..c9af993 100644 --- a/components/arc/arc_session_runner.cc +++ b/components/arc/arc_session_runner.cc
@@ -228,10 +228,12 @@ // safe place to start the container for login screen. DCHECK(!arc_session_); DCHECK_EQ(state_, State::STOPPED); - arc_session_ = factory_.Run(); - arc_session_->AddObserver(this); - state_ = State::STARTING_FOR_LOGIN_SCREEN; - arc_session_->StartForLoginScreen(); + + // TODO(yusukes): Once Chrome OS side is ready, uncomment the following: + // arc_session_ = factory_.Run(); + // arc_session_->AddObserver(this); + // state_ = State::STARTING_FOR_LOGIN_SCREEN; + // arc_session_->StartForLoginScreen(); } } // namespace arc
diff --git a/components/arc/arc_session_runner_unittest.cc b/components/arc/arc_session_runner_unittest.cc index f8f9cc4..144d0b0b 100644 --- a/components/arc/arc_session_runner_unittest.cc +++ b/components/arc/arc_session_runner_unittest.cc
@@ -189,7 +189,7 @@ // Does the same with the mini instance for login screen. // TODO(yusukes): Enable the test once EmitLoginPromptVisibleCalled() is fully // enabled. -TEST_F(ArcSessionRunnerTest, BootFailureForLoginScreen) { +TEST_F(ArcSessionRunnerTest, DISABLED_BootFailureForLoginScreen) { ResetArcSessionFactory( base::Bind(&ArcSessionRunnerTest::CreateBootFailureArcSession, ArcStopReason::CRASH)); @@ -214,7 +214,7 @@ // is called. // TODO(yusukes): Enable the test once EmitLoginPromptVisibleCalled() is fully // enabled. -TEST_F(ArcSessionRunnerTest, StartWithLoginScreenInstance) { +TEST_F(ArcSessionRunnerTest, DISABLED_StartWithLoginScreenInstance) { EXPECT_TRUE(arc_session_runner()->IsStopped()); chromeos::DBusThreadManager::Get()
diff --git a/components/browser_sync/profile_sync_service.cc b/components/browser_sync/profile_sync_service.cc index 0bf8b69..72c18a83 100644 --- a/components/browser_sync/profile_sync_service.cc +++ b/components/browser_sync/profile_sync_service.cc
@@ -1943,9 +1943,10 @@ } } -void ProfileSyncService::GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) { +void ProfileSyncService::GoogleSigninSucceededWithPassword( + const std::string& account_id, + const std::string& username, + const std::string& password) { DCHECK(thread_checker_.CalledOnValidThread()); if (IsSyncRequested() && !password.empty()) { crypto_->CachePassphrase(password);
diff --git a/components/browser_sync/profile_sync_service.h b/components/browser_sync/profile_sync_service.h index ed8908c..963748d 100644 --- a/components/browser_sync/profile_sync_service.h +++ b/components/browser_sync/profile_sync_service.h
@@ -381,9 +381,9 @@ syncer::ModelTypeSet GetEncryptedDataTypes() const override; // SigninManagerBase::Observer implementation. - void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + void GoogleSigninSucceededWithPassword(const std::string& account_id, + const std::string& username, + const std::string& password) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override;
diff --git a/components/browser_sync/profile_sync_service_startup_unittest.cc b/components/browser_sync/profile_sync_service_startup_unittest.cc index 34213e2..83c2123 100644 --- a/components/browser_sync/profile_sync_service_startup_unittest.cc +++ b/components/browser_sync/profile_sync_service_startup_unittest.cc
@@ -125,7 +125,8 @@ profile_sync_service_bundle_.signin_manager()->SetAuthenticatedAccountInfo( kGaiaId, kEmail); if (sync_service) - sync_service->GoogleSigninSucceeded(account_id, kEmail, kDummyPassword); + sync_service->GoogleSigninSucceededWithPassword(account_id, kEmail, + kDummyPassword); #endif return account_id; }
diff --git a/components/content_settings/core/browser/website_settings_registry.cc b/components/content_settings/core/browser/website_settings_registry.cc index 86a80a4..794d411 100644 --- a/components/content_settings/core/browser/website_settings_registry.cc +++ b/components/content_settings/core/browser/website_settings_registry.cc
@@ -173,6 +173,11 @@ WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, DESKTOP | PLATFORM_ANDROID, WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); + Register(CONTENT_SETTINGS_TYPE_MEDIA_ENGAGEMENT, "media-engagement", nullptr, + WebsiteSettingsInfo::SYNCABLE, WebsiteSettingsInfo::LOSSY, + WebsiteSettingsInfo::REQUESTING_ORIGIN_ONLY_SCOPE, + DESKTOP | PLATFORM_ANDROID, + WebsiteSettingsInfo::INHERIT_IN_INCOGNITO); } } // namespace content_settings
diff --git a/components/content_settings/core/common/content_settings_types.h b/components/content_settings/core/common/content_settings_types.h index 24bd04b6..83acdae 100644 --- a/components/content_settings/core/common/content_settings_types.h +++ b/components/content_settings/core/common/content_settings_types.h
@@ -1,4 +1,4 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. +// Copyright 2017 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. @@ -67,6 +67,10 @@ // verdicts of each origin. CONTENT_SETTINGS_TYPE_PASSWORD_PROTECTION, + // Website setting which stores engagement data for media related to a + // specific origin. + CONTENT_SETTINGS_TYPE_MEDIA_ENGAGEMENT, + // WARNING: This enum is going to be removed soon. Do not depend on NUM_TYPES. CONTENT_SETTINGS_NUM_TYPES_DO_NOT_USE, };
diff --git a/components/cronet/android/cronet_url_request_context_adapter.cc b/components/cronet/android/cronet_url_request_context_adapter.cc index 53399035..d62729b6 100644 --- a/components/cronet/android/cronet_url_request_context_adapter.cc +++ b/components/cronet/android/cronet_url_request_context_adapter.cc
@@ -607,6 +607,17 @@ base::Unretained(this), should)); } +void CronetURLRequestContextAdapter::InitializeNQEPrefsOnNetworkThread() const { + DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); + + // Initializing |network_qualities_prefs_manager_| may post a callback to + // |this|. So, |network_qualities_prefs_manager_| should be initialized after + // |jcronet_url_request_context_| has been constructed. + DCHECK(jcronet_url_request_context_.obj() != nullptr); + network_qualities_prefs_manager_->InitializeOnNetworkThread( + network_quality_estimator_.get()); +} + void CronetURLRequestContextAdapter::InitializeOnNetworkThread( std::unique_ptr<URLRequestContextConfig> config, const base::android::ScopedJavaGlobalRef<jobject>& @@ -692,18 +703,18 @@ if (config->enable_network_quality_estimator) { DCHECK(!network_quality_estimator_); - std::map<std::string, std::string> variation_params; - // Configure network quality estimator: Specify the algorithm that should - // be used for computing the effective connection type. The algorithm - // is specified using the key-value pairs defined in - // //net/nqe/network_quality_estimator.cc. - // TODO(tbansal): Investigate a more robust way of configuring the network - // quality estimator. - variation_params["effective_connection_type_algorithm"] = - "TransportRTTOrDownstreamThroughput"; + std::unique_ptr<net::NetworkQualityEstimatorParams> nqe_params = + base::MakeUnique<net::NetworkQualityEstimatorParams>( + std::map<std::string, std::string>()); + nqe_params->set_persistent_cache_reading_enabled( + config->nqe_persistent_caching_enabled); + if (config->nqe_forced_effective_connection_type) { + nqe_params->SetForcedEffectiveConnectionType( + config->nqe_forced_effective_connection_type.value()); + } + network_quality_estimator_ = base::MakeUnique<net::NetworkQualityEstimator>( - std::unique_ptr<net::ExternalEstimateProvider>(), - base::MakeUnique<net::NetworkQualityEstimatorParams>(variation_params), + std::unique_ptr<net::ExternalEstimateProvider>(), std::move(nqe_params), g_net_log.Get().net_log()); network_quality_estimator_->AddEffectiveConnectionTypeObserver(this); network_quality_estimator_->AddRTTAndThroughputEstimatesObserver(this); @@ -715,8 +726,10 @@ base::MakeUnique<net::NetworkQualitiesPrefsManager>( base::MakeUnique<NetworkQualitiesPrefDelegateImpl>( pref_service_.get())); - network_qualities_prefs_manager_->InitializeOnNetworkThread( - network_quality_estimator_.get()); + PostTaskToNetworkThread(FROM_HERE, + base::Bind(&CronetURLRequestContextAdapter:: + InitializeNQEPrefsOnNetworkThread, + base::Unretained(this))); } context_builder.set_network_quality_estimator( network_quality_estimator_.get());
diff --git a/components/cronet/android/cronet_url_request_context_adapter.h b/components/cronet/android/cronet_url_request_context_adapter.h index c02bad0..775c8427 100644 --- a/components/cronet/android/cronet_url_request_context_adapter.h +++ b/components/cronet/android/cronet_url_request_context_adapter.h
@@ -212,6 +212,10 @@ std::unique_ptr<base::DictionaryValue> GetNetLogInfo() const; + // Initializes Network Quality Estimator (NQE) prefs manager on network + // thread. + void InitializeNQEPrefsOnNetworkThread() const; + // Network thread is owned by |this|, but is destroyed from java thread. base::Thread* network_thread_;
diff --git a/components/cronet/android/test/cronet_url_request_context_config_test.cc b/components/cronet/android/test/cronet_url_request_context_config_test.cc index ad522b7..6b0d1be 100644 --- a/components/cronet/android/test/cronet_url_request_context_config_test.cc +++ b/components/cronet/android/test/cronet_url_request_context_config_test.cc
@@ -43,7 +43,7 @@ CHECK_EQ(config->http_cache, URLRequestContextConfig::HttpCacheType::MEMORY); CHECK_EQ(config->http_cache_max_size, 54321); CHECK_EQ(config->user_agent, "efgh"); - CHECK_EQ(config->experimental_options, "ijkl"); + CHECK(!config->effective_experimental_options); CHECK_EQ(config->storage_path, base::android::ConvertJavaStringToUTF8(env, jstorage_path)); }
diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/NQETest.java b/components/cronet/android/test/javatests/src/org/chromium/net/NQETest.java index 0d391b0..ab9296e 100644 --- a/components/cronet/android/test/javatests/src/org/chromium/net/NQETest.java +++ b/components/cronet/android/test/javatests/src/org/chromium/net/NQETest.java
@@ -7,10 +7,11 @@ import android.os.StrictMode; import android.support.test.filters.SmallTest; +import org.json.JSONObject; + import org.chromium.base.Log; import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.SuppressFBWarnings; -import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.MetricsUtils.HistogramDelta; import org.chromium.net.MetricsTestUtil.TestExecutor; @@ -126,8 +127,8 @@ // Returns whether a file contains a particular string. @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE") - private boolean fileContainsString(String filename, String content) throws IOException { - File file = new File(getTestStorage(getContext()) + "/prefs/" + filename); + private boolean prefsFileContainsString(String content) throws IOException { + File file = new File(getTestStorage(getContext()) + "/prefs/local_prefs.json"); FileInputStream fileInputStream = new FileInputStream(file); byte[] data = new byte[(int) file.length()]; fileInputStream.read(data); @@ -137,7 +138,6 @@ @SmallTest @Feature({"Cronet"}) - @DisabledTest(message = "Disabled due to flaky assert. See crbug.com/710626") public void testQuicDisabled() throws Exception { ExperimentalCronetEngine.Builder cronetEngineBuilder = new ExperimentalCronetEngine.Builder(getContext()); @@ -214,7 +214,7 @@ Log.i(TAG, "Still waiting for pref file update....."); Thread.sleep(12000); try { - if (fileContainsString("local_prefs.json", "network_qualities")) { + if (prefsFileContainsString("network_qualities")) { break; } } catch (FileNotFoundException e) { @@ -222,9 +222,156 @@ // flushed to the disk. } } - assertTrue(fileContainsString("local_prefs.json", "network_qualities")); + assertTrue(prefsFileContainsString("network_qualities")); cronetEngine.shutdown(); assertTrue(writeCountHistogram.getDelta() > 0); } + + @SmallTest + @OnlyRunNativeCronet + @Feature({"Cronet"}) + public void testPrefsWriteRead() throws Exception { + // When the loop is run for the first time, network quality is written to the disk. The + // test verifies that in the next loop, the network quality is read back. + for (int i = 0; i <= 1; ++i) { + ExperimentalCronetEngine.Builder cronetEngineBuilder = + new ExperimentalCronetEngine.Builder(getContext()); + assert RttThroughputValues.INVALID_RTT_THROUGHPUT < 0; + Executor listenersExecutor = + Executors.newSingleThreadExecutor(new ExecutorThreadFactory()); + TestNetworkQualityRttListener rttListener = + new TestNetworkQualityRttListener(listenersExecutor); + cronetEngineBuilder.enableNetworkQualityEstimator(true).enableHttp2(true).enableQuic( + false); + cronetEngineBuilder.setStoragePath(getTestStorage(getContext())); + + JSONObject nqeOptions = new JSONObject().put("persistent_cache_reading_enabled", true); + JSONObject experimentalOptions = + new JSONObject().put("NetworkQualityEstimator", nqeOptions); + + cronetEngineBuilder.setExperimentalOptions(experimentalOptions.toString()); + final ExperimentalCronetEngine cronetEngine = cronetEngineBuilder.build(); + cronetEngine.configureNetworkQualityEstimatorForTesting(true, true, true); + cronetEngine.addRttListener(rttListener); + + HistogramDelta writeCountHistogram = new HistogramDelta("NQE.Prefs.WriteCount", 1); + assertEquals(0, writeCountHistogram.getDelta()); // Sanity check. + + HistogramDelta readCountHistogram = new HistogramDelta("NQE.Prefs.ReadCount", 1); + assertEquals(0, readCountHistogram.getDelta()); // Sanity check. + + HistogramDelta readPrefsSizeHistogram = new HistogramDelta("NQE.Prefs.ReadSize", 1); + assertEquals(0, readPrefsSizeHistogram.getDelta()); // Sanity check. + + // NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_CACHED_ESTIMATE: 3 + HistogramDelta cachedRttHistogram = new HistogramDelta("NQE.RTT.ObservationSource", 3); + assertEquals(0, cachedRttHistogram.getDelta()); // Sanity check. + + TestUrlRequestCallback callback = new TestUrlRequestCallback(); + UrlRequest.Builder builder = + cronetEngine.newUrlRequestBuilder(mUrl, callback, callback.getExecutor()); + UrlRequest urlRequest = builder.build(); + urlRequest.start(); + callback.blockForDone(); + + // Wait for RTT observation (at the URL request layer) to be posted. + rttListener.waitUntilFirstUrlRequestRTTReceived(); + + // Prefs must be read at startup. + assertTrue(readCountHistogram.getDelta() > 0); + + // Check RTT observation count after throughput observation has been received. This + // ensures + // that executor has finished posting the RTT observation to the RTT listeners. + assertTrue(rttListener.rttObservationCount() > 0); + + // Verify that effective connection type callback is received and + // effective connection type is correctly set. + assertTrue(cronetEngine.getEffectiveConnectionType() + != EffectiveConnectionType.TYPE_UNKNOWN); + + cronetEngine.shutdown(); + + if (i == 0) { + // Verify that the cached estimates were written to the prefs. + assertTrue(prefsFileContainsString("network_qualities")); + } + + // Stored network quality in the pref should be read in the second iteration. + assertEquals(readPrefsSizeHistogram.getDelta() > 0, i > 0); + assertEquals(cachedRttHistogram.getDelta() > 0, i > 0); + } + } + + @SmallTest + @Feature({"Cronet"}) + public void testQuicDisabledWithParams() throws Exception { + ExperimentalCronetEngine.Builder cronetEngineBuilder = + new ExperimentalCronetEngine.Builder(getContext()); + Executor listenersExecutor = Executors.newSingleThreadExecutor(new ExecutorThreadFactory()); + TestNetworkQualityRttListener rttListener = + new TestNetworkQualityRttListener(listenersExecutor); + TestNetworkQualityThroughputListener throughputListener = + new TestNetworkQualityThroughputListener(listenersExecutor); + + // Force the effective connection type to "2G". + JSONObject nqeOptions = new JSONObject().put("force_effective_connection_type", "Slow-2G"); + // Add one more extra param two times to ensure robustness. + nqeOptions.put("some_other_param_1", "value1"); + nqeOptions.put("some_other_param_2", "value2"); + JSONObject experimentalOptions = + new JSONObject().put("NetworkQualityEstimator", nqeOptions); + experimentalOptions.put("SomeOtherFieldTrialName", new JSONObject()); + + cronetEngineBuilder.enableNetworkQualityEstimator(true).enableHttp2(true).enableQuic(false); + cronetEngineBuilder.setExperimentalOptions(experimentalOptions.toString()); + final ExperimentalCronetEngine cronetEngine = cronetEngineBuilder.build(); + cronetEngine.configureNetworkQualityEstimatorForTesting(true, true, false); + + cronetEngine.addRttListener(rttListener); + cronetEngine.addThroughputListener(throughputListener); + + TestUrlRequestCallback callback = new TestUrlRequestCallback(); + UrlRequest.Builder builder = + cronetEngine.newUrlRequestBuilder(mUrl, callback, callback.getExecutor()); + UrlRequest urlRequest = builder.build(); + urlRequest.start(); + callback.blockForDone(); + + // Throughput observation is posted to the network quality estimator on the network thread + // after the UrlRequest is completed. The observations are then eventually posted to + // throughput listeners on the executor provided to network quality. + throughputListener.waitUntilFirstThroughputObservationReceived(); + + // Wait for RTT observation (at the URL request layer) to be posted. + rttListener.waitUntilFirstUrlRequestRTTReceived(); + + assertTrue(throughputListener.throughputObservationCount() > 0); + + // Check RTT observation count after throughput observation has been received. This ensures + // that executor has finished posting the RTT observation to the RTT listeners. + assertTrue(rttListener.rttObservationCount() > 0); + + // NETWORK_QUALITY_OBSERVATION_SOURCE_URL_REQUEST + assertTrue(rttListener.rttObservationCount(0) > 0); + + // NETWORK_QUALITY_OBSERVATION_SOURCE_TCP + assertTrue(rttListener.rttObservationCount(1) > 0); + + // NETWORK_QUALITY_OBSERVATION_SOURCE_QUIC + assertEquals(0, rttListener.rttObservationCount(2)); + + // Verify that the listeners were notified on the expected thread. + assertEquals(mNetworkQualityThread, rttListener.getThread()); + assertEquals(mNetworkQualityThread, throughputListener.getThread()); + + // Verify that effective connection type callback is received and effective connection type + // is correctly set to the forced value. This also verifies that the configuration params + // from Cronet embedders were correctly read by NetworkQualityEstimator. + assertEquals( + EffectiveConnectionType.TYPE_SLOW_2G, cronetEngine.getEffectiveConnectionType()); + + cronetEngine.shutdown(); + } }
diff --git a/components/cronet/url_request_context_config.cc b/components/cronet/url_request_context_config.cc index 432fb1eb..93820d83 100644 --- a/components/cronet/url_request_context_config.cc +++ b/components/cronet/url_request_context_config.cc
@@ -23,6 +23,7 @@ #include "net/dns/host_resolver.h" #include "net/dns/mapped_host_resolver.h" #include "net/http/http_server_properties.h" +#include "net/nqe/network_quality_estimator_params.h" #include "net/quic/chromium/quic_utils_chromium.h" #include "net/quic/core/quic_packets.h" #include "net/socket/ssl_client_socket.h" @@ -85,6 +86,12 @@ const char kHostResolverRulesFieldTrialName[] = "HostResolverRules"; const char kHostResolverRules[] = "host_resolver_rules"; +// NetworkQualityEstimator (NQE) experiment dictionary name. +const char kNetworkQualityEstimatorFieldTrialName[] = "NetworkQualityEstimator"; +// Name of the boolean to enable reading of the persistent prefs in NQE. +const char kNQEPersistentCacheReadingEnabled[] = + "persistent_cache_reading_enabled"; + // Disable IPv6 when on WiFi. This is a workaround for a known issue on certain // Android phones, and should not be necessary when not on one of those devices. // See https://crbug.com/696569 for details. @@ -136,12 +143,13 @@ load_disable_cache(load_disable_cache), storage_path(storage_path), user_agent(user_agent), - experimental_options(experimental_options), mock_cert_verifier(std::move(mock_cert_verifier)), enable_network_quality_estimator(enable_network_quality_estimator), bypass_public_key_pinning_for_local_trust_anchors( bypass_public_key_pinning_for_local_trust_anchors), - cert_verifier_data(cert_verifier_data) {} + cert_verifier_data(cert_verifier_data), + nqe_persistent_caching_enabled(false), + experimental_options(experimental_options) {} URLRequestContextConfig::~URLRequestContextConfig() {} @@ -337,6 +345,38 @@ file_task_runner); } } + } else if (it.key() == kNetworkQualityEstimatorFieldTrialName) { + const base::DictionaryValue* nqe_args = nullptr; + if (!it.value().GetAsDictionary(&nqe_args)) { + LOG(ERROR) << "\"" << it.key() << "\" config params \"" << it.value() + << "\" is not a dictionary value"; + effective_experimental_options->Remove(it.key(), nullptr); + continue; + } + + bool persistent_caching_enabled; + if (nqe_args->GetBoolean(kNQEPersistentCacheReadingEnabled, + &persistent_caching_enabled)) { + nqe_persistent_caching_enabled = persistent_caching_enabled; + } + + std::string nqe_option; + if (nqe_args->GetString(net::kForceEffectiveConnectionType, + &nqe_option)) { + net::EffectiveConnectionType forced_effective_connection_type = + net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN; + bool effective_connection_type_available = + net::GetEffectiveConnectionTypeForName( + nqe_option, &forced_effective_connection_type); + if (!effective_connection_type_available) { + LOG(ERROR) << "\"" << nqe_option + << "\" is not a valid effective connection type value"; + } else { + nqe_forced_effective_connection_type = + forced_effective_connection_type; + } + } + } else { LOG(WARNING) << "Unrecognized Cronet experimental option \"" << it.key() << "\" with params \"" << it.value();
diff --git a/components/cronet/url_request_context_config.h b/components/cronet/url_request_context_config.h index 51eb80b6..a7fc179 100644 --- a/components/cronet/url_request_context_config.h +++ b/components/cronet/url_request_context_config.h
@@ -11,10 +11,12 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" +#include "base/optional.h" #include "base/time/time.h" #include "base/values.h" #include "net/base/hash_value.h" #include "net/cert/cert_verifier.h" +#include "net/nqe/effective_connection_type.h" namespace base { class SequencedTaskRunner; @@ -141,18 +143,11 @@ const std::string storage_path; // User-Agent request header field. const std::string user_agent; - // Experimental options encoded as a string in a JSON format containing - // experiments and their corresponding configuration options. The format - // is a JSON object with the name of the experiment as the key, and the - // configuration options as the value. An example: - // {"experiment1": {"option1": "option_value1", "option2": "option_value2", - // ...}, "experiment2: {"option3", "option_value3", ...}, ...} - const std::string experimental_options; // Certificate verifier for testing. std::unique_ptr<net::CertVerifier> mock_cert_verifier; - // Enable network quality estimator. + // Enable Network Quality Estimator (NQE). const bool enable_network_quality_estimator; // Enable public key pinning bypass for local trust anchors. @@ -178,6 +173,14 @@ std::unique_ptr<base::DictionaryValue> effective_experimental_options = nullptr; + // Enable reading of the network quality from the prefs. + bool nqe_persistent_caching_enabled; + + // If set, forces NQE to return the set value as the effective connection + // type. + base::Optional<net::EffectiveConnectionType> + nqe_forced_effective_connection_type; + private: // Parses experimental options and makes appropriate changes to settings in // the URLRequestContextConfig and URLRequestContextBuilder. @@ -186,6 +189,14 @@ net::NetLog* net_log, const scoped_refptr<base::SequencedTaskRunner>& file_task_runner); + // Experimental options encoded as a string in a JSON format containing + // experiments and their corresponding configuration options. The format + // is a JSON object with the name of the experiment as the key, and the + // configuration options as the value. An example: + // {"experiment1": {"option1": "option_value1", "option2": "option_value2", + // ...}, "experiment2: {"option3", "option_value3", ...}, ...} + const std::string experimental_options; + DISALLOW_COPY_AND_ASSIGN(URLRequestContextConfig); };
diff --git a/components/drive/file_write_watcher_unittest.cc b/components/drive/file_write_watcher_unittest.cc index d567c8f..7078463 100644 --- a/components/drive/file_write_watcher_unittest.cc +++ b/components/drive/file_write_watcher_unittest.cc
@@ -11,6 +11,7 @@ #include "base/files/scoped_temp_dir.h" #include "base/macros.h" #include "base/run_loop.h" +#include "base/task_scheduler/post_task.h" #include "content/public/browser/browser_thread.h" #include "content/public/test/test_browser_thread_bundle.h" #include "testing/gtest/include/gtest/gtest.h" @@ -89,10 +90,9 @@ TestObserver observer(expected, loop.QuitClosure()); // Set up the watcher. - scoped_refptr<base::SingleThreadTaskRunner> file_task_runner = - content::BrowserThread::GetTaskRunnerForThread( - content::BrowserThread::FILE); - FileWriteWatcher watcher(file_task_runner.get()); + scoped_refptr<base::SequencedTaskRunner> task_runner = + base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()}); + FileWriteWatcher watcher(task_runner.get()); watcher.DisableDelayForTesting(); // Start watching and running.
diff --git a/components/ntp_snippets/BUILD.gn b/components/ntp_snippets/BUILD.gn index 651fe36e..7d1a3ab 100644 --- a/components/ntp_snippets/BUILD.gn +++ b/components/ntp_snippets/BUILD.gn
@@ -58,6 +58,8 @@ "pref_util.h", "reading_list/reading_list_suggestions_provider.cc", "reading_list/reading_list_suggestions_provider.h", + "remote/cached_image_fetcher.cc", + "remote/cached_image_fetcher.h", "remote/json_request.cc", "remote/json_request.h", "remote/json_to_categories.cc",
diff --git a/components/ntp_snippets/breaking_news/breaking_news_gcm_app_handler.cc b/components/ntp_snippets/breaking_news/breaking_news_gcm_app_handler.cc index 31c4e1c2..9c7ca33 100644 --- a/components/ntp_snippets/breaking_news/breaking_news_gcm_app_handler.cc +++ b/components/ntp_snippets/breaking_news/breaking_news_gcm_app_handler.cc
@@ -19,8 +19,7 @@ // The sender ID is used in the registration process. // See: https://developers.google.com/cloud-messaging/gcm#senderid -// TODO(mamir): use proper sender Id. -const char kBreakingNewsGCMSenderId[] = "128223710667"; +const char kBreakingNewsGCMSenderId[] = "667617379155"; // OAuth2 Scope passed to getToken to obtain GCM registration tokens. // Must match Java GoogleCloudMessaging.INSTANCE_ID_SCOPE.
diff --git a/components/ntp_snippets/content_suggestions_service.cc b/components/ntp_snippets/content_suggestions_service.cc index d54fb772..e5a70bbe 100644 --- a/components/ntp_snippets/content_suggestions_service.cc +++ b/components/ntp_snippets/content_suggestions_service.cc
@@ -517,8 +517,7 @@ // SigninManagerBase::Observer implementation void ContentSuggestionsService::GoogleSigninSucceeded( const std::string& account_id, - const std::string& username, - const std::string& password) { + const std::string& username) { OnSignInStateChanged(); }
diff --git a/components/ntp_snippets/content_suggestions_service.h b/components/ntp_snippets/content_suggestions_service.h index ddeae6e3e..bf7b4ab 100644 --- a/components/ntp_snippets/content_suggestions_service.h +++ b/components/ntp_snippets/content_suggestions_service.h
@@ -289,8 +289,7 @@ // SigninManagerBase::Observer implementation void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + const std::string& username) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override;
diff --git a/components/ntp_snippets/remote/cached_image_fetcher.cc b/components/ntp_snippets/remote/cached_image_fetcher.cc new file mode 100644 index 0000000..5faf283 --- /dev/null +++ b/components/ntp_snippets/remote/cached_image_fetcher.cc
@@ -0,0 +1,142 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/ntp_snippets/remote/cached_image_fetcher.h" + +#include "base/bind.h" +#include "base/location.h" +#include "components/image_fetcher/core/image_decoder.h" +#include "components/image_fetcher/core/image_fetcher.h" +#include "components/ntp_snippets/remote/remote_suggestions_database.h" +#include "net/traffic_annotation/network_traffic_annotation.h" +#include "ui/gfx/geometry/size.h" +#include "ui/gfx/image/image.h" + +namespace ntp_snippets { + +CachedImageFetcher::CachedImageFetcher( + std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher, + PrefService* pref_service, + RemoteSuggestionsDatabase* database) + : image_fetcher_(std::move(image_fetcher)), + database_(database), + thumbnail_requests_throttler_( + pref_service, + RequestThrottler::RequestType::CONTENT_SUGGESTION_THUMBNAIL) { + // |image_fetcher_| can be null in tests. + if (image_fetcher_) { + image_fetcher_->SetImageFetcherDelegate(this); + image_fetcher_->SetDataUseServiceName( + data_use_measurement::DataUseUserData::NTP_SNIPPETS_THUMBNAILS); + } +} + +CachedImageFetcher::~CachedImageFetcher() {} + +void CachedImageFetcher::FetchSuggestionImage( + const ContentSuggestion::ID& suggestion_id, + const GURL& url, + const ImageFetchedCallback& callback) { + database_->LoadImage( + suggestion_id.id_within_category(), + base::Bind(&CachedImageFetcher::OnImageFetchedFromDatabase, + base::Unretained(this), callback, suggestion_id, url)); +} + +// This function gets only called for caching the image data received from the +// network. The actual decoding is done in OnImageDecodedFromDatabase(). +void CachedImageFetcher::OnImageDataFetched( + const std::string& id_within_category, + const std::string& image_data) { + if (image_data.empty()) { + return; + } + database_->SaveImage(id_within_category, image_data); +} + +void CachedImageFetcher::OnImageDecodingDone( + const ImageFetchedCallback& callback, + const std::string& id_within_category, + const gfx::Image& image, + const image_fetcher::RequestMetadata& metadata) { + callback.Run(image); +} + +void CachedImageFetcher::OnImageFetchedFromDatabase( + const ImageFetchedCallback& callback, + const ContentSuggestion::ID& suggestion_id, + const GURL& url, + std::string data) { // SnippetImageCallback requires by-value. + // The image decoder is null in tests. + if (image_fetcher_->GetImageDecoder() && !data.empty()) { + image_fetcher_->GetImageDecoder()->DecodeImage( + data, + // We're not dealing with multi-frame images. + /*desired_image_frame_size=*/gfx::Size(), + base::Bind(&CachedImageFetcher::OnImageDecodedFromDatabase, + base::Unretained(this), callback, suggestion_id, url)); + return; + } + // Fetching from the DB failed; start a network fetch. + FetchImageFromNetwork(suggestion_id, url, callback); +} + +void CachedImageFetcher::OnImageDecodedFromDatabase( + const ImageFetchedCallback& callback, + const ContentSuggestion::ID& suggestion_id, + const GURL& url, + const gfx::Image& image) { + if (!image.IsEmpty()) { + callback.Run(image); + return; + } + // If decoding the image failed, delete the DB entry. + database_->DeleteImage(suggestion_id.id_within_category()); + FetchImageFromNetwork(suggestion_id, url, callback); +} + +void CachedImageFetcher::FetchImageFromNetwork( + const ContentSuggestion::ID& suggestion_id, + const GURL& url, + const ImageFetchedCallback& callback) { + if (url.is_empty() || !thumbnail_requests_throttler_.DemandQuotaForRequest( + /*interactive_request=*/true)) { + // Return an empty image. Directly, this is never synchronous with the + // original FetchSuggestionImage() call - an asynchronous database query has + // happened in the meantime. + callback.Run(gfx::Image()); + return; + } + + net::NetworkTrafficAnnotationTag traffic_annotation = + net::DefineNetworkTrafficAnnotation("remote_suggestions_provider", R"( + semantics { + sender: "Content Suggestion Thumbnail Fetch" + description: + "Retrieves thumbnails for content suggestions, for display on the " + "New Tab page or Chrome Home." + trigger: + "Triggered when the user looks at a content suggestion (and its " + "thumbnail isn't cached yet)." + data: "None." + destination: GOOGLE_OWNED_SERVICE + } + policy { + cookies_allowed: false + setting: "Currently not available, but in progress: crbug.com/703684" + chrome_policy { + NTPContentSuggestionsEnabled { + policy_options {mode: MANDATORY} + NTPContentSuggestionsEnabled: false + } + } + })"); + image_fetcher_->StartOrQueueNetworkRequest( + suggestion_id.id_within_category(), url, + base::Bind(&CachedImageFetcher::OnImageDecodingDone, + base::Unretained(this), callback), + traffic_annotation); +} + +} // namespace ntp_snippets
diff --git a/components/ntp_snippets/remote/cached_image_fetcher.h b/components/ntp_snippets/remote/cached_image_fetcher.h new file mode 100644 index 0000000..b02e3af --- /dev/null +++ b/components/ntp_snippets/remote/cached_image_fetcher.h
@@ -0,0 +1,87 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_CACHED_IMAGE_FETCHER_H_ +#define COMPONENTS_NTP_SNIPPETS_REMOTE_CACHED_IMAGE_FETCHER_H_ + +#include <cstddef> +#include <memory> +#include <string> +#include <vector> + +#include "base/callback_forward.h" +#include "base/gtest_prod_util.h" +#include "base/macros.h" +#include "components/image_fetcher/core/image_fetcher_delegate.h" +#include "components/ntp_snippets/callbacks.h" +#include "components/ntp_snippets/content_suggestion.h" +#include "components/ntp_snippets/remote/request_throttler.h" + +class PrefService; + +namespace gfx { +class Image; +} // namespace gfx + +namespace image_fetcher { +class ImageFetcher; +struct RequestMetadata; +} // namespace image_fetcher + +namespace ntp_snippets { + +class RemoteSuggestionsDatabase; + +// CachedImageFetcher takes care of fetching images from the network and caching +// them in the database. +// TODO(gaschler): add unit test +class CachedImageFetcher : public image_fetcher::ImageFetcherDelegate { + public: + // |pref_service| and |database| need to outlive the created image fetcher + // instance. + CachedImageFetcher(std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher, + PrefService* pref_service, + RemoteSuggestionsDatabase* database); + ~CachedImageFetcher() override; + + // Fetches the image for a suggestion. The fetcher will first issue a lookup + // to the underlying cache with a fallback to the network. + void FetchSuggestionImage(const ContentSuggestion::ID& suggestion_id, + const GURL& image_url, + const ImageFetchedCallback& callback); + + private: + // image_fetcher::ImageFetcherDelegate implementation. + void OnImageDataFetched(const std::string& id_within_category, + const std::string& image_data) override; + + void OnImageDecodingDone(const ImageFetchedCallback& callback, + const std::string& id_within_category, + const gfx::Image& image, + const image_fetcher::RequestMetadata& metadata); + void OnImageFetchedFromDatabase( + const ImageFetchedCallback& callback, + const ContentSuggestion::ID& suggestion_id, + const GURL& image_url, + // SnippetImageCallback requires by-value (not const ref). + std::string data); + void OnImageDecodedFromDatabase(const ImageFetchedCallback& callback, + const ContentSuggestion::ID& suggestion_id, + const GURL& url, + const gfx::Image& image); + void FetchImageFromNetwork(const ContentSuggestion::ID& suggestion_id, + const GURL& url, + const ImageFetchedCallback& callback); + + std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_; + RemoteSuggestionsDatabase* database_; + // Request throttler for limiting requests to thumbnail images. + RequestThrottler thumbnail_requests_throttler_; + + DISALLOW_COPY_AND_ASSIGN(CachedImageFetcher); +}; + +} // namespace ntp_snippets + +#endif // COMPONENTS_NTP_SNIPPETS_REMOTE_CACHED_IMAGE_FETCHER_H_
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc b/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc index ebeb516..5469ed3 100644 --- a/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc +++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc
@@ -21,7 +21,6 @@ #include "base/time/time.h" #include "base/values.h" #include "components/data_use_measurement/core/data_use_user_data.h" -#include "components/image_fetcher/core/image_decoder.h" #include "components/image_fetcher/core/image_fetcher.h" #include "components/ntp_snippets/category_rankers/category_ranker.h" #include "components/ntp_snippets/features.h" @@ -33,8 +32,6 @@ #include "components/prefs/pref_service.h" #include "components/strings/grit/components_strings.h" #include "components/variations/variations_associated_data.h" -#include "net/traffic_annotation/network_traffic_annotation.h" -#include "ui/gfx/geometry/size.h" #include "ui/gfx/image/image.h" namespace ntp_snippets { @@ -221,130 +218,6 @@ } // namespace -CachedImageFetcher::CachedImageFetcher( - std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher, - PrefService* pref_service, - RemoteSuggestionsDatabase* database) - : image_fetcher_(std::move(image_fetcher)), - database_(database), - thumbnail_requests_throttler_( - pref_service, - RequestThrottler::RequestType::CONTENT_SUGGESTION_THUMBNAIL) { - // |image_fetcher_| can be null in tests. - if (image_fetcher_) { - image_fetcher_->SetImageFetcherDelegate(this); - image_fetcher_->SetDataUseServiceName( - data_use_measurement::DataUseUserData::NTP_SNIPPETS_THUMBNAILS); - } -} - -CachedImageFetcher::~CachedImageFetcher() {} - -void CachedImageFetcher::FetchSuggestionImage( - const ContentSuggestion::ID& suggestion_id, - const GURL& url, - const ImageFetchedCallback& callback) { - database_->LoadImage( - suggestion_id.id_within_category(), - base::Bind(&CachedImageFetcher::OnImageFetchedFromDatabase, - base::Unretained(this), callback, suggestion_id, url)); -} - -// This function gets only called for caching the image data received from the -// network. The actual decoding is done in OnImageDecodedFromDatabase(). -void CachedImageFetcher::OnImageDataFetched( - const std::string& id_within_category, - const std::string& image_data) { - if (image_data.empty()) { - return; - } - database_->SaveImage(id_within_category, image_data); -} - -void CachedImageFetcher::OnImageDecodingDone( - const ImageFetchedCallback& callback, - const std::string& id_within_category, - const gfx::Image& image, - const image_fetcher::RequestMetadata& metadata) { - callback.Run(image); -} - -void CachedImageFetcher::OnImageFetchedFromDatabase( - const ImageFetchedCallback& callback, - const ContentSuggestion::ID& suggestion_id, - const GURL& url, - std::string data) { // SnippetImageCallback requires by-value. - // The image decoder is null in tests. - if (image_fetcher_->GetImageDecoder() && !data.empty()) { - image_fetcher_->GetImageDecoder()->DecodeImage( - data, - // We're not dealing with multi-frame images. - /*desired_image_frame_size=*/gfx::Size(), - base::Bind(&CachedImageFetcher::OnImageDecodedFromDatabase, - base::Unretained(this), callback, suggestion_id, url)); - return; - } - // Fetching from the DB failed; start a network fetch. - FetchImageFromNetwork(suggestion_id, url, callback); -} - -void CachedImageFetcher::OnImageDecodedFromDatabase( - const ImageFetchedCallback& callback, - const ContentSuggestion::ID& suggestion_id, - const GURL& url, - const gfx::Image& image) { - if (!image.IsEmpty()) { - callback.Run(image); - return; - } - // If decoding the image failed, delete the DB entry. - database_->DeleteImage(suggestion_id.id_within_category()); - FetchImageFromNetwork(suggestion_id, url, callback); -} - -void CachedImageFetcher::FetchImageFromNetwork( - const ContentSuggestion::ID& suggestion_id, - const GURL& url, - const ImageFetchedCallback& callback) { - if (url.is_empty() || !thumbnail_requests_throttler_.DemandQuotaForRequest( - /*interactive_request=*/true)) { - // Return an empty image. Directly, this is never synchronous with the - // original FetchSuggestionImage() call - an asynchronous database query has - // happened in the meantime. - callback.Run(gfx::Image()); - return; - } - - net::NetworkTrafficAnnotationTag traffic_annotation = - net::DefineNetworkTrafficAnnotation("remote_suggestions_provider", R"( - semantics { - sender: "Content Suggestion Thumbnail Fetch" - description: - "Retrieves thumbnails for content suggestions, for display on the " - "New Tab page or Chrome Home." - trigger: - "Triggered when the user looks at a content suggestion (and its " - "thumbnail isn't cached yet)." - data: "None." - destination: GOOGLE_OWNED_SERVICE - } - policy { - cookies_allowed: false - setting: "Currently not available, but in progress: crbug.com/703684" - chrome_policy { - NTPContentSuggestionsEnabled { - policy_options {mode: MANDATORY} - NTPContentSuggestionsEnabled: false - } - } - })"); - image_fetcher_->StartOrQueueNetworkRequest( - suggestion_id.id_within_category(), url, - base::Bind(&CachedImageFetcher::OnImageDecodingDone, - base::Unretained(this), callback), - traffic_annotation); -} - RemoteSuggestionsProviderImpl::RemoteSuggestionsProviderImpl( Observer* observer, PrefService* pref_service,
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl.h b/components/ntp_snippets/remote/remote_suggestions_provider_impl.h index dac737b..1941a49c 100644 --- a/components/ntp_snippets/remote/remote_suggestions_provider_impl.h +++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl.h
@@ -20,11 +20,11 @@ #include "base/optional.h" #include "base/time/clock.h" #include "base/time/time.h" -#include "components/image_fetcher/core/image_fetcher_delegate.h" #include "components/ntp_snippets/category.h" #include "components/ntp_snippets/category_status.h" #include "components/ntp_snippets/content_suggestion.h" #include "components/ntp_snippets/content_suggestions_provider.h" +#include "components/ntp_snippets/remote/cached_image_fetcher.h" #include "components/ntp_snippets/remote/json_to_categories.h" #include "components/ntp_snippets/remote/prefetched_pages_tracker.h" #include "components/ntp_snippets/remote/remote_suggestion.h" @@ -37,13 +37,8 @@ class PrefRegistrySimple; class PrefService; -namespace gfx { -class Image; -} // namespace gfx - namespace image_fetcher { class ImageFetcher; -struct RequestMetadata; } // namespace image_fetcher namespace ntp_snippets { @@ -52,58 +47,6 @@ class RemoteSuggestionsDatabase; class RemoteSuggestionsScheduler; -// CachedImageFetcher takes care of fetching images from the network and caching -// them in the database. -// TODO(tschumann): Move into a separate library and inject the -// CachedImageFetcher into the RemoteSuggestionsProvider. This allows us to get -// rid of exposing this member for testing and lets us test the caching logic -// separately. -class CachedImageFetcher : public image_fetcher::ImageFetcherDelegate { - public: - // |pref_service| and |database| need to outlive the created image fetcher - // instance. - CachedImageFetcher(std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher, - PrefService* pref_service, - RemoteSuggestionsDatabase* database); - ~CachedImageFetcher() override; - - // Fetches the image for a suggestion. The fetcher will first issue a lookup - // to the underlying cache with a fallback to the network. - void FetchSuggestionImage(const ContentSuggestion::ID& suggestion_id, - const GURL& image_url, - const ImageFetchedCallback& callback); - - private: - // image_fetcher::ImageFetcherDelegate implementation. - void OnImageDataFetched(const std::string& id_within_category, - const std::string& image_data) override; - - void OnImageDecodingDone(const ImageFetchedCallback& callback, - const std::string& id_within_category, - const gfx::Image& image, - const image_fetcher::RequestMetadata& metadata); - void OnImageFetchedFromDatabase( - const ImageFetchedCallback& callback, - const ContentSuggestion::ID& suggestion_id, - const GURL& image_url, - // SnippetImageCallback requires by-value (not const ref). - std::string data); - void OnImageDecodedFromDatabase(const ImageFetchedCallback& callback, - const ContentSuggestion::ID& suggestion_id, - const GURL& url, - const gfx::Image& image); - void FetchImageFromNetwork(const ContentSuggestion::ID& suggestion_id, - const GURL& url, - const ImageFetchedCallback& callback); - - std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_; - RemoteSuggestionsDatabase* database_; - // Request throttler for limiting requests to thumbnail images. - RequestThrottler thumbnail_requests_throttler_; - - DISALLOW_COPY_AND_ASSIGN(CachedImageFetcher); -}; - // Retrieves fresh content data (articles) from the server, stores them and // provides them as content suggestions. // This class is final because it does things in its constructor which make it
diff --git a/components/ntp_tiles/most_visited_sites.cc b/components/ntp_tiles/most_visited_sites.cc index aa52d584..ad0dba3b 100644 --- a/components/ntp_tiles/most_visited_sites.cc +++ b/components/ntp_tiles/most_visited_sites.cc
@@ -139,6 +139,10 @@ suggestions_service_->FetchSuggestionsData(); } +void MostVisitedSites::OnHomePageStateChanged() { + BuildCurrentTiles(); +} + void MostVisitedSites::AddOrRemoveBlacklistedUrl(const GURL& url, bool add_url) { if (add_url) {
diff --git a/components/ntp_tiles/most_visited_sites.h b/components/ntp_tiles/most_visited_sites.h index dbd1dfb1..12ed83a09 100644 --- a/components/ntp_tiles/most_visited_sites.h +++ b/components/ntp_tiles/most_visited_sites.h
@@ -142,6 +142,9 @@ // if the request resulted in the set of tiles changing. void Refresh(); + // Forces a rebuild of the current tiles to update the pinned home page. + void OnHomePageStateChanged(); + void AddOrRemoveBlacklistedUrl(const GURL& url, bool add_url); void ClearBlacklistedUrls();
diff --git a/components/ntp_tiles/most_visited_sites_unittest.cc b/components/ntp_tiles/most_visited_sites_unittest.cc index 6f2f895..5a0d9e18f 100644 --- a/components/ntp_tiles/most_visited_sites_unittest.cc +++ b/components/ntp_tiles/most_visited_sites_unittest.cc
@@ -463,6 +463,37 @@ base::RunLoop().RunUntilIdle(); } +TEST_P(MostVisitedSitesTest, ShouldUpdateHomePageTileOnHomePageStateChanged) { + FakeHomePageClient* home_page_client = RegisterNewHomePageClient(); + home_page_client->SetHomePageEnabled(true); + DisableRemoteSuggestions(); + + // Ensure that home tile is available as usual. + EXPECT_CALL(*mock_top_sites_, GetMostVisitedURLs(_, false)) + .WillRepeatedly(InvokeCallbackArgument<0>(MostVisitedURLList{})); + EXPECT_CALL(*mock_top_sites_, SyncWithHistory()); + EXPECT_CALL(*mock_top_sites_, IsBlacklisted(Eq(GURL(kHomePageUrl)))) + .Times(AnyNumber()) + .WillRepeatedly(Return(false)); + EXPECT_CALL(mock_observer_, OnMostVisitedURLsAvailable(FirstTileIs( + "", kHomePageUrl, TileSource::HOMEPAGE))); + most_visited_sites_->SetMostVisitedURLsObserver(&mock_observer_, + /*num_sites=*/3); + base::RunLoop().RunUntilIdle(); + VerifyAndClearExpectations(); + + // Disable home page and rebuild _without_ Resync. The tile should be gone. + home_page_client->SetHomePageEnabled(false); + DisableRemoteSuggestions(); + EXPECT_CALL(*mock_top_sites_, GetMostVisitedURLs(_, false)) + .WillRepeatedly(InvokeCallbackArgument<0>(MostVisitedURLList{})); + EXPECT_CALL(*mock_top_sites_, SyncWithHistory()).Times(0); + EXPECT_CALL(mock_observer_, OnMostVisitedURLsAvailable(Not(FirstTileIs( + "", kHomePageUrl, TileSource::HOMEPAGE)))); + most_visited_sites_->OnHomePageStateChanged(); + base::RunLoop().RunUntilIdle(); +} + TEST_P(MostVisitedSitesTest, ShouldNotIncludeHomePageIfNoTileRequested) { FakeHomePageClient* home_page_client = RegisterNewHomePageClient(); home_page_client->SetHomePageEnabled(true);
diff --git a/components/password_manager/core/browser/password_manager_metrics_util.h b/components/password_manager/core/browser/password_manager_metrics_util.h index 203be60..dc8bdae 100644 --- a/components/password_manager/core/browser/password_manager_metrics_util.h +++ b/components/password_manager/core/browser/password_manager_metrics_util.h
@@ -193,6 +193,21 @@ SUBMITTED_FORM_FRAME_COUNT }; +// Metrics: "PasswordManager.AccessPasswordInSettings" +enum AccessPasswordInSettingsEvent { + ACCESS_PASSWORD_VIEWED = 0, + ACCESS_PASSWORD_COPIED = 1, + ACCESS_PASSWORD_COUNT +}; + +// Metrics: PasswordManager.ReauthToAccessPasswordInSettings +enum ReauthToAccessPasswordInSettingsEvent { + REAUTH_SUCCESS = 0, + REAUTH_FAILURE = 1, + REAUTH_SKIPPED = 2, + REAUTH_COUNT +}; + // A version of the UMA_HISTOGRAM_BOOLEAN macro that allows the |name| // to vary over the program's runtime. void LogUMAHistogramBoolean(const std::string& name, bool sample);
diff --git a/components/policy/core/common/policy_loader_win.cc b/components/policy/core/common/policy_loader_win.cc index 0881e239..ccc5037 100644 --- a/components/policy/core/common/policy_loader_win.cc +++ b/components/policy/core/common/policy_loader_win.cc
@@ -66,7 +66,7 @@ key::kMetricsReportingEnabled, key::kDefaultSearchProviderEnabled, key::kHomepageIsNewTabPage, key::kHomepageLocation, key::kNewTabPageLocation, key::kRestoreOnStartup, - key::kRestoreOnStartupURLs}; + key::kRestoreOnStartupURLs, key::kSafeBrowsingForTrustedSourcesEnabled}; #pragma warning(push) #pragma warning(disable : 4068) // unknown pragmas
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 452bfb5..03305bf 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -143,7 +143,7 @@ # persistent IDs for all fields (but not for groups!) are needed. These are # specified by the 'id' keys of each policy. NEVER CHANGE EXISTING IDs, # because doing so would break the deployed wire format! -# For your editing convenience: highest ID currently used: 374 +# For your editing convenience: highest ID currently used: 375 # And don't forget to also update the EnterprisePolicies enum of # histograms.xml (run 'python tools/metrics/histograms/update_policies.py'). # @@ -258,7 +258,7 @@ Leaving this policy not set will allow the user to choose their home page on their own if HomepageIsNewTabPage is not set too. This policy is not available on Windows instances that are not joined - to a Microsoft® Active Directory® domain.''', + to a <ph name="MS_AD_NAME">Microsoft® Active Directory®</ph> domain.''', 'label': '''Home page URL''', }, { @@ -286,7 +286,7 @@ Leaving this policy not set will allow the user to choose whether the new tab page is their home page on their own. This policy is not available on Windows instances that are not joined - to a Microsoft® Active Directory® domain.''', + to a <ph name="MS_AD_NAME">Microsoft® Active Directory®</ph> domain.''', }, ], }, @@ -318,7 +318,7 @@ If the policy is not set or left empty the default new tab page is used. - This policy is not available on Windows instances that are not joined to a Microsoft® Active Directory® domain.''', + This policy is not available on Windows instances that are not joined to a <ph name="MS_AD_NAME">Microsoft® Active Directory®</ph> domain.''', 'label': '''New Tab page URL''', }, ], @@ -1305,7 +1305,7 @@ upon installation / first run. This policy is not available on Windows instances that are not joined to - a Microsoft® Active Directory® domain. (For Chrome OS, see + a <ph name="MS_AD_NAME">Microsoft® Active Directory®</ph> domain. (For Chrome OS, see DeviceMetricsReportingEnabled.)''', }, { @@ -1764,9 +1764,7 @@ When this policy is not set, (or the 'No special restrictions' option is chosen), the dowloads will go through the usual security restrictions based on SafeBrowsing analysis results. - Note that these restrictions apply to downloads triggered from web page content, as well as the 'download link...' context menu option. - - These restrictions do not apply to the save / download of the currently displayed page, nor does it apply to saving as PDF from the printing options. + Note that these restrictions apply to downloads triggered from web page content, as well as the 'download link...' context menu option. These restrictions do not apply to the save / download of the currently displayed page, nor does it apply to saving as PDF from the printing options. See https://developers.google.com/safe-browsing for more info on SafeBrowsing.''', 'label': '''Download restrictions''', @@ -1796,6 +1794,32 @@ 'arc_support': 'This policy has no effect on Android apps. Android apps always use the default downloads directory and cannot access any files downloaded by <ph name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> into a non-default downloads directory.', }, { + 'name': 'SafeBrowsingForTrustedSourcesEnabled', + 'type': 'main', + 'schema': { 'type': 'boolean' }, + 'supported_on': ['chrome.win:61-'], + 'features': { + 'can_be_recommended': True, + 'dynamic_refresh': True, + 'per_profile': True, + }, + 'example_value': False, + 'id': 375, + 'caption': '''SafeBrowsing enable state for trusted sources''', + 'tags': ['local-data-access'], + 'desc': '''Identify if <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> can allow download without Safe Browsing checks when it's from a trusted source. + + When False, downloaded files will not be sent to be analyzed by Safe Browsing when it's from a trusted source. + + When not set (or set to True), downloaded files are sent to be analyzed by Safe Browsing, even when it's from a trusted source. + + Note that these restrictions apply to downloads triggered from web page content, as well as the 'download link...' context menu option. These restrictions do not apply to the save / download of the currently displayed page, nor does it apply to saving as PDF from the printing options. + + This policy is not available on Windows instances that are not joined + to a <ph name="MS_AD_NAME">Microsoft® Active Directory®</ph> domain.''', + 'label': '''SafeBrowsing enable state for trusted sources''', + }, + { 'name': 'ClearSiteDataOnExit', 'type': 'main', 'schema': { 'type': 'boolean' }, @@ -2690,7 +2714,7 @@ Disabling this setting is equivalent to leaving it not configured. The user will still be able to change it in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>. This policy is not available on Windows instances that are not joined - to a Microsoft® Active Directory® domain.''', + to a <ph name="MS_AD_NAME">Microsoft® Active Directory®</ph> domain.''', }, { 'name': 'RestoreOnStartupURLs', @@ -2714,7 +2738,7 @@ This policy only works if the 'RestoreOnStartup' policy is set to 'RestoreOnStartupIsURLs'. This policy is not available on Windows instances that are not joined - to a Microsoft® Active Directory® domain.''', + to a <ph name="MS_AD_NAME">Microsoft® Active Directory®</ph> domain.''', }, ], }, @@ -2777,7 +2801,7 @@ If this policy is left not set, the default search provider is enabled, and the user will be able to set the search provider list. This policy is not available on Windows instances that are not joined - to a Microsoft® Active Directory® domain.''', + to a <ph name="MS_AD_NAME">Microsoft® Active Directory®</ph> domain.''', }, { 'name': 'DefaultSearchProviderName', @@ -9816,7 +9840,7 @@ The recommended way to configure policy on Windows is via GPO, although provisioning policy via registry is still supported for Windows instances - that are joined to a Microsoft® Active Directory® domain.''' + that are joined to a <ph name="MS_AD_NAME">Microsoft® Active Directory®</ph> domain.''' }, 'doc_back_to_top': { 'desc': '''Text of a link in the generated policy documentation, that takes the user to the top of the page''',
diff --git a/components/printing/renderer/print_web_view_helper.cc b/components/printing/renderer/print_web_view_helper.cc index b92da73a..ca63359 100644 --- a/components/printing/renderer/print_web_view_helper.cc +++ b/components/printing/renderer/print_web_view_helper.cc
@@ -1187,13 +1187,10 @@ if (!UpdatePrintSettings(print_preview_context_.source_frame(), print_preview_context_.source_node(), settings)) { if (print_preview_context_.last_error() != PREVIEW_ERROR_BAD_SETTING) { - Send(new PrintHostMsg_PrintPreviewInvalidPrinterSettings( - routing_id(), print_pages_params_ - ? print_pages_params_->params.document_cookie - : 0)); - notify_browser_of_print_failure_ = false; // Already sent. + DidFinishPrinting(INVALID_SETTINGS); + } else { + DidFinishPrinting(FAIL_PREVIEW); } - DidFinishPrinting(FAIL_PREVIEW); return; } @@ -1557,6 +1554,8 @@ #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { + int cookie = + print_pages_params_ ? print_pages_params_->params.document_cookie : 0; switch (result) { case OK: break; @@ -1567,15 +1566,12 @@ case FAIL_PRINT: if (notify_browser_of_print_failure_ && print_pages_params_) { - int cookie = print_pages_params_->params.document_cookie; Send(new PrintHostMsg_PrintingFailed(routing_id(), cookie)); } break; #if BUILDFLAG(ENABLE_PRINT_PREVIEW) case FAIL_PREVIEW: - int cookie = - print_pages_params_ ? print_pages_params_->params.document_cookie : 0; if (notify_browser_of_print_failure_) { LOG(ERROR) << "CreatePreviewDocument failed"; Send(new PrintHostMsg_PrintPreviewFailed(routing_id(), cookie)); @@ -1584,6 +1580,11 @@ } print_preview_context_.Failed(notify_browser_of_print_failure_); break; + case INVALID_SETTINGS: + Send(new PrintHostMsg_PrintPreviewInvalidPrinterSettings(routing_id(), + cookie)); + print_preview_context_.Failed(false); + break; #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) } prep_frame_view_.reset();
diff --git a/components/printing/renderer/print_web_view_helper.h b/components/printing/renderer/print_web_view_helper.h index a6ad94b..fc5e964 100644 --- a/components/printing/renderer/print_web_view_helper.h +++ b/components/printing/renderer/print_web_view_helper.h
@@ -154,6 +154,7 @@ FAIL_PRINT, #if BUILDFLAG(ENABLE_PRINT_PREVIEW) FAIL_PREVIEW, + INVALID_SETTINGS, #endif };
diff --git a/components/printing/test/print_web_view_helper_browsertest.cc b/components/printing/test/print_web_view_helper_browsertest.cc index 8f4e244..eeed7b9 100644 --- a/components/printing/test/print_web_view_helper_browsertest.cc +++ b/components/printing/test/print_web_view_helper_browsertest.cc
@@ -129,7 +129,8 @@ bool OnMessageReceived(const IPC::Message& message) override { if (message.type() == PrintHostMsg_MetafileReadyForPrinting::ID || message.type() == PrintHostMsg_PrintPreviewFailed::ID || - message.type() == PrintHostMsg_PrintPreviewCancelled::ID) + message.type() == PrintHostMsg_PrintPreviewCancelled::ID || + message.type() == PrintHostMsg_PrintPreviewInvalidPrinterSettings::ID) run_loop_->Quit(); return false; }
diff --git a/components/signin/core/browser/about_signin_internals.cc b/components/signin/core/browser/about_signin_internals.cc index ade203bf..fca6fbe 100644 --- a/components/signin/core/browser/about_signin_internals.cc +++ b/components/signin/core/browser/about_signin_internals.cc
@@ -393,8 +393,7 @@ } void AboutSigninInternals::GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) { + const std::string& username) { NotifyObservers(); }
diff --git a/components/signin/core/browser/about_signin_internals.h b/components/signin/core/browser/about_signin_internals.h index 8e42feab..46d11da5 100644 --- a/components/signin/core/browser/about_signin_internals.h +++ b/components/signin/core/browser/about_signin_internals.h
@@ -191,8 +191,7 @@ // SigninManagerBase::Observer implementations. void GoogleSigninFailed(const GoogleServiceAuthError& error) override; void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + const std::string& username) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override;
diff --git a/components/signin/core/browser/access_token_fetcher.cc b/components/signin/core/browser/access_token_fetcher.cc index d301d37..de83407 100644 --- a/components/signin/core/browser/access_token_fetcher.cc +++ b/components/signin/core/browser/access_token_fetcher.cc
@@ -76,8 +76,7 @@ } void AccessTokenFetcher::GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) { + const std::string& username) { DCHECK(waiting_for_sign_in_); DCHECK(!waiting_for_refresh_token_); DCHECK(signin_manager_->IsAuthenticated());
diff --git a/components/signin/core/browser/access_token_fetcher.h b/components/signin/core/browser/access_token_fetcher.h index 2963ab8b..cfa84724 100644 --- a/components/signin/core/browser/access_token_fetcher.h +++ b/components/signin/core/browser/access_token_fetcher.h
@@ -51,8 +51,7 @@ // SigninManagerBase::Observer implementation. void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + const std::string& username) override; void GoogleSigninFailed(const GoogleServiceAuthError& error) override; // OAuth2TokenService::Observer implementation.
diff --git a/components/signin/core/browser/account_reconcilor.cc b/components/signin/core/browser/account_reconcilor.cc index 34731af..3393ef7 100644 --- a/components/signin/core/browser/account_reconcilor.cc +++ b/components/signin/core/browser/account_reconcilor.cc
@@ -222,8 +222,7 @@ } void AccountReconcilor::GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) { + const std::string& username) { VLOG(1) << "AccountReconcilor::GoogleSigninSucceeded: signed in"; RegisterWithCookieManagerService(); RegisterWithContentSettings();
diff --git a/components/signin/core/browser/account_reconcilor.h b/components/signin/core/browser/account_reconcilor.h index 6217588..285e6f5 100644 --- a/components/signin/core/browser/account_reconcilor.h +++ b/components/signin/core/browser/account_reconcilor.h
@@ -151,8 +151,7 @@ // Overriden from SigninManagerBase::Observer. void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + const std::string& username) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override;
diff --git a/components/signin/core/browser/android/BUILD.gn b/components/signin/core/browser/android/BUILD.gn index f9f482b..760282f 100644 --- a/components/signin/core/browser/android/BUILD.gn +++ b/components/signin/core/browser/android/BUILD.gn
@@ -50,6 +50,7 @@ "//base:base_java_test_support", "//third_party/android_tools:android_support_annotations_java", "//third_party/jsr-305:jsr_305_javalib", + "//third_party/junit", ] java_files = [
diff --git a/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/util/FakeAccountManagerDelegate.java b/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/util/FakeAccountManagerDelegate.java index 331328a..64eaf04 100644 --- a/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/util/FakeAccountManagerDelegate.java +++ b/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/util/FakeAccountManagerDelegate.java
@@ -9,6 +9,8 @@ import android.app.Activity; import android.content.Context; +import org.junit.Assert; + import org.chromium.base.Callback; import org.chromium.base.Log; import org.chromium.base.ThreadUtils; @@ -70,20 +72,20 @@ * Add an AccountHolder directly. * * @param accountHolder the account holder to add - * @return whether the account holder was added successfully */ - public boolean addAccountHolderExplicitly(AccountHolder accountHolder) { - return mAccounts.add(accountHolder); + public void addAccountHolderExplicitly(AccountHolder accountHolder) { + boolean added = mAccounts.add(accountHolder); + Assert.assertTrue("Account was already added", added); } /** * Remove an AccountHolder directly. * * @param accountHolder the account holder to remove - * @return whether the account holder was removed successfully */ - public boolean removeAccountHolderExplicitly(AccountHolder accountHolder) { - return mAccounts.remove(accountHolder); + public void removeAccountHolderExplicitly(AccountHolder accountHolder) { + boolean removed = mAccounts.remove(accountHolder); + Assert.assertTrue("Account was already added", removed); } @Override
diff --git a/components/signin/core/browser/fake_signin_manager.cc b/components/signin/core/browser/fake_signin_manager.cc index 339e062..104d8ea 100644 --- a/components/signin/core/browser/fake_signin_manager.cc +++ b/components/signin/core/browser/fake_signin_manager.cc
@@ -58,8 +58,9 @@ SetAuthenticatedAccountId(GetAccountIdForAuthInProgress()); set_auth_in_progress(std::string()); for (auto& observer : observer_list_) { - observer.GoogleSigninSucceeded(authenticated_account_id_, username_, - password_); + observer.GoogleSigninSucceeded(authenticated_account_id_, username_); + observer.GoogleSigninSucceededWithPassword(authenticated_account_id_, + username_, password_); } }
diff --git a/components/signin/core/browser/profile_identity_provider.cc b/components/signin/core/browser/profile_identity_provider.cc index 3be796e..a537d4b 100644 --- a/components/signin/core/browser/profile_identity_provider.cc +++ b/components/signin/core/browser/profile_identity_provider.cc
@@ -42,8 +42,7 @@ void ProfileIdentityProvider::GoogleSigninSucceeded( const std::string& account_id, - const std::string& username, - const std::string& password) { + const std::string& username) { FireOnActiveAccountLogin(); }
diff --git a/components/signin/core/browser/profile_identity_provider.h b/components/signin/core/browser/profile_identity_provider.h index ca3e1a59..eef7e34 100644 --- a/components/signin/core/browser/profile_identity_provider.h +++ b/components/signin/core/browser/profile_identity_provider.h
@@ -32,8 +32,7 @@ // SigninManagerBase::Observer: void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + const std::string& username) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override;
diff --git a/components/signin/core/browser/signin_manager.cc b/components/signin/core/browser/signin_manager.cc index 9e588dc9..7856c7855 100644 --- a/components/signin/core/browser/signin_manager.cc +++ b/components/signin/core/browser/signin_manager.cc
@@ -66,9 +66,9 @@ const std::string& password) { std::string account_id = account_tracker_service()->PickAccountIdForAccount(gaia_id, username); + DCHECK(!account_id.empty()); DCHECK(possibly_invalid_account_id_.empty() || possibly_invalid_account_id_ == account_id); - DCHECK(!account_id.empty()); if (!IsAllowedUsername(username)) { // Account is not allowed by admin policy. @@ -385,8 +385,11 @@ for (auto& observer : observer_list_) { observer.GoogleSigninSucceeded(GetAuthenticatedAccountId(), - GetAuthenticatedAccountInfo().email, - password_); + GetAuthenticatedAccountInfo().email); + + observer.GoogleSigninSucceededWithPassword( + GetAuthenticatedAccountId(), GetAuthenticatedAccountInfo().email, + password_); } client_->OnSignedIn(GetAuthenticatedAccountId(), gaia_id,
diff --git a/components/signin/core/browser/signin_manager_base.h b/components/signin/core/browser/signin_manager_base.h index 7eb2952..06c08c3 100644 --- a/components/signin/core/browser/signin_manager_base.h +++ b/components/signin/core/browser/signin_manager_base.h
@@ -43,6 +43,14 @@ class PrefService; class SigninClient; +namespace browser_sync { +class ProfileSyncService; +} + +namespace password_manager { +class PasswordStoreSigninNotifierImpl; +} + namespace user_prefs { class PrefRegistrySyncable; } @@ -56,8 +64,7 @@ // Called when a user signs into Google services such as sync. virtual void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) {} + const std::string& username) {} // Called when the currently signed-in user for a user has been signed out. virtual void GoogleSignedOut(const std::string& account_id, @@ -65,6 +72,31 @@ protected: virtual ~Observer() {} + + private: + // Observers that can observer the password of the Google account after a + // successful sign-in. + friend class PasswordStoreSigninNotifierImpl; + friend class browser_sync::ProfileSyncService; + + // SigninManagers that fire |GoogleSigninSucceededWithPassword| + // notifications. + friend class SigninManager; + friend class FakeSigninManager; + + // Called when a user signs into Google services such as sync. Also passes + // the password of the Google account that was used to sign in. + // + // Observers should override |GoogleSigninSucceeded| if they are not + // interested in the password thas was used during the sign-in. + // + // Note: The password is always empty on mobile as the user signs in to + // Chrome with accounts that were added to the device, so Chrome does not + // have access to the password. + virtual void GoogleSigninSucceededWithPassword( + const std::string& account_id, + const std::string& username, + const std::string& password) {} }; SigninManagerBase(SigninClient* client,
diff --git a/components/signin/core/browser/signin_status_metrics_provider.cc b/components/signin/core/browser/signin_status_metrics_provider.cc index 699e61d..8ead61c 100644 --- a/components/signin/core/browser/signin_status_metrics_provider.cc +++ b/components/signin/core/browser/signin_status_metrics_provider.cc
@@ -77,8 +77,7 @@ void SigninStatusMetricsProvider::GoogleSigninSucceeded( const std::string& account_id, - const std::string& username, - const std::string& password) { + const std::string& username) { SigninStatus recorded_signin_status = signin_status(); if (recorded_signin_status == ALL_PROFILES_NOT_SIGNED_IN) { UpdateSigninStatus(MIXED_SIGNIN_STATUS);
diff --git a/components/signin/core/browser/signin_status_metrics_provider.h b/components/signin/core/browser/signin_status_metrics_provider.h index 9d6e663..ee6f0ad 100644 --- a/components/signin/core/browser/signin_status_metrics_provider.h +++ b/components/signin/core/browser/signin_status_metrics_provider.h
@@ -70,8 +70,7 @@ // SigninManagerBase::Observer: void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + const std::string& username) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override;
diff --git a/components/signin/core/browser/signin_status_metrics_provider_unittest.cc b/components/signin/core/browser/signin_status_metrics_provider_unittest.cc index 13f54ab..ed1a8712 100644 --- a/components/signin/core/browser/signin_status_metrics_provider_unittest.cc +++ b/components/signin/core/browser/signin_status_metrics_provider_unittest.cc
@@ -27,15 +27,13 @@ // Initial status is all signed out and then one of the profiles is signed in. metrics_provider.UpdateInitialSigninStatus(2, 0); - metrics_provider.GoogleSigninSucceeded(std::string(), std::string(), - std::string()); + metrics_provider.GoogleSigninSucceeded(std::string(), std::string()); EXPECT_EQ(SigninStatusMetricsProviderBase::MIXED_SIGNIN_STATUS, metrics_provider.GetSigninStatusForTesting()); // Initial status is mixed and then one of the profiles is signed in. metrics_provider.UpdateInitialSigninStatus(2, 1); - metrics_provider.GoogleSigninSucceeded(std::string(), std::string(), - std::string()); + metrics_provider.GoogleSigninSucceeded(std::string(), std::string()); EXPECT_EQ(SigninStatusMetricsProviderBase::MIXED_SIGNIN_STATUS, metrics_provider.GetSigninStatusForTesting()); }
diff --git a/components/signin/ios/browser/account_consistency_service.h b/components/signin/ios/browser/account_consistency_service.h index 3723c42..8df4874 100644 --- a/components/signin/ios/browser/account_consistency_service.h +++ b/components/signin/ios/browser/account_consistency_service.h
@@ -143,8 +143,7 @@ // SigninManagerBase::Observer implementation. void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + const std::string& username) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override;
diff --git a/components/signin/ios/browser/account_consistency_service.mm b/components/signin/ios/browser/account_consistency_service.mm index 80088aa..a56cc1b 100644 --- a/components/signin/ios/browser/account_consistency_service.mm +++ b/components/signin/ios/browser/account_consistency_service.mm
@@ -462,8 +462,7 @@ void AccountConsistencyService::GoogleSigninSucceeded( const std::string& account_id, - const std::string& username, - const std::string& password) { + const std::string& username) { AddChromeConnectedCookies(); }
diff --git a/components/translate/content/renderer/translate_helper.cc b/components/translate/content/renderer/translate_helper.cc index 14251b6b..bd03e04 100644 --- a/components/translate/content/renderer/translate_helper.cc +++ b/components/translate/content/renderer/translate_helper.cc
@@ -167,6 +167,13 @@ return ExecuteScriptAndGetBoolResult("cr.googleTranslate.error", true); } +int64_t TranslateHelper::GetErrorCode() { + int64_t error_code = + ExecuteScriptAndGetIntegerResult("cr.googleTranslate.errorCode"); + DCHECK_LT(error_code, static_cast<int>(TranslateErrors::TRANSLATE_ERROR_MAX)); + return error_code; +} + bool TranslateHelper::StartTranslation() { return ExecuteScriptAndGetBoolResult( BuildTranslationScript(source_lang_, target_lang_), false); @@ -249,6 +256,24 @@ return results[0]->NumberValue(); } +int64_t TranslateHelper::ExecuteScriptAndGetIntegerResult( + const std::string& script) { + WebLocalFrame* main_frame = render_frame()->GetWebFrame(); + if (!main_frame) + return 0; + + v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); + WebVector<v8::Local<v8::Value>> results; + WebScriptSource source = WebScriptSource(WebString::FromASCII(script)); + main_frame->ExecuteScriptInIsolatedWorld(world_id_, &source, 1, &results); + if (results.size() != 1 || results[0].IsEmpty() || !results[0]->IsNumber()) { + NOTREACHED(); + return 0; + } + + return results[0]->IntegerValue(); +} + // mojom::Page implementations. void TranslateHelper::Translate(const std::string& translate_script, const std::string& source_lang, @@ -322,8 +347,8 @@ void TranslateHelper::CheckTranslateStatus() { // First check if there was an error. if (HasTranslationFailed()) { - // TODO(toyoshim): Check |errorCode| of translate.js and notify it here. - NotifyBrowserTranslationFailed(TranslateErrors::TRANSLATION_ERROR); + NotifyBrowserTranslationFailed( + static_cast<translate::TranslateErrors::Type>(GetErrorCode())); return; // There was an error. } @@ -369,10 +394,18 @@ void TranslateHelper::TranslatePageImpl(int count) { DCHECK_LT(count, kMaxTranslateInitCheckAttempts); if (!IsTranslateLibReady()) { + // There was an error during initialization of library. + TranslateErrors::Type error = + static_cast<translate::TranslateErrors::Type>(GetErrorCode()); + if (error != TranslateErrors::NONE) { + NotifyBrowserTranslationFailed(error); + return; + } + // The library is not ready, try again later, unless we have tried several // times unsuccessfully already. if (++count >= kMaxTranslateInitCheckAttempts) { - NotifyBrowserTranslationFailed(TranslateErrors::INITIALIZATION_ERROR); + NotifyBrowserTranslationFailed(TranslateErrors::TRANSLATION_TIMEOUT); return; } base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( @@ -390,7 +423,7 @@ ExecuteScriptAndGetDoubleResult("cr.googleTranslate.loadTime")); if (!StartTranslation()) { - NotifyBrowserTranslationFailed(TranslateErrors::TRANSLATION_ERROR); + CheckTranslateStatus(); return; } // Check the status of the translation.
diff --git a/components/translate/content/renderer/translate_helper.h b/components/translate/content/renderer/translate_helper.h index 58f2c88..e5c5499f 100644 --- a/components/translate/content/renderer/translate_helper.h +++ b/components/translate/content/renderer/translate_helper.h
@@ -65,6 +65,9 @@ // translation. virtual bool HasTranslationFailed(); + // Returns the error code generated in translate library. + virtual int64_t GetErrorCode(); + // Starts the translation by calling the translate library. This method // should only be called when the translate script has been injected in the // page. Returns false if the call failed immediately. @@ -99,6 +102,11 @@ // run successfully. Otherwise, returns 0.0. virtual double ExecuteScriptAndGetDoubleResult(const std::string& script); + // Executes the JavaScript code in |script| in the main frame of RenderView. + // and returns the integer value returned by the script evaluation if the + // script was run successfully. Otherwise, returns 0. + virtual int64_t ExecuteScriptAndGetIntegerResult(const std::string& script); + private: FRIEND_TEST_ALL_PREFIXES(TranslateHelperTest, TestBuildTranslationScript);
diff --git a/components/translate/core/browser/translate_infobar_delegate.cc b/components/translate/core/browser/translate_infobar_delegate.cc index cb32c684..5a29f34f 100644 --- a/components/translate/core/browser/translate_infobar_delegate.cc +++ b/components/translate/core/browser/translate_infobar_delegate.cc
@@ -228,6 +228,10 @@ IDS_TRANSLATE_INFOBAR_ERROR_CANT_CONNECT); case TranslateErrors::INITIALIZATION_ERROR: case TranslateErrors::TRANSLATION_ERROR: + case TranslateErrors::TRANSLATION_TIMEOUT: + case TranslateErrors::UNEXPECTED_SCRIPT_ERROR: + case TranslateErrors::BAD_ORIGIN: + case TranslateErrors::SCRIPT_LOAD_ERROR: return l10n_util::GetStringUTF16( IDS_TRANSLATE_INFOBAR_ERROR_CANT_TRANSLATE); case TranslateErrors::UNKNOWN_LANGUAGE:
diff --git a/components/translate/core/common/translate_errors.h b/components/translate/core/common/translate_errors.h index 268fe45..3701f31bb 100644 --- a/components/translate/core/common/translate_errors.h +++ b/components/translate/core/common/translate_errors.h
@@ -27,7 +27,7 @@ IDENTICAL_LANGUAGES, // The original and target languages are the same. TRANSLATION_ERROR, // An error was reported by the translation script // during translation. - TRANSLATION_TIMEOUT, // The library doesn't finish the translation. + TRANSLATION_TIMEOUT, // The library doesn't finish initialization. UNEXPECTED_SCRIPT_ERROR, // The library raises an unexpected exception. BAD_ORIGIN, // The library is blocked because of bad origin. SCRIPT_LOAD_ERROR, // Loader fails to load a dependent JavaScript.
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index d7804b4..0cc7f6ac 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -1079,6 +1079,8 @@ "payments/payment_app_context_impl.h", "payments/payment_app_database.cc", "payments/payment_app_database.h", + "payments/payment_app_info_fetcher.cc", + "payments/payment_app_info_fetcher.h", "payments/payment_app_provider_impl.cc", "payments/payment_app_provider_impl.h", "payments/payment_instrument_icon_fetcher.cc",
diff --git a/content/browser/payments/payment_app.proto b/content/browser/payments/payment_app.proto index 78a0a23..4eaba56 100644 --- a/content/browser/payments/payment_app.proto +++ b/content/browser/payments/payment_app.proto
@@ -18,12 +18,18 @@ } message StoredPaymentInstrumentProto { + optional string instrument_key = 1; + optional string origin = 2; + optional string name = 3; + repeated string enabled_methods = 4; + optional string stringified_capabilities = 5; + repeated StoredPaymentInstrumentImageObject icons = 6; + optional string decoded_instrument_icon = 7; +} + +message StoredPaymentAppProto { optional int64 registration_id = 1; - optional string instrument_key = 2; - optional string origin = 3; - optional string name = 4; - repeated string enabled_methods = 5; - optional string stringified_capabilities = 6; - repeated StoredPaymentInstrumentImageObject icons = 7; - optional string decoded_instrument_icon = 8; + optional string origin = 2; + optional string name = 3; + optional string icon = 4; }
diff --git a/content/browser/payments/payment_app_browsertest.cc b/content/browser/payments/payment_app_browsertest.cc index 6e6ca7e..bab82aec 100644 --- a/content/browser/payments/payment_app_browsertest.cc +++ b/content/browser/payments/payment_app_browsertest.cc
@@ -95,9 +95,9 @@ std::map<std::string, int64_t> registrationIds; for (const auto& app_info : apps) { - for (const auto& instrument : app_info.second) { + for (const auto& instrument : app_info.second->instruments) { registrationIds.insert(std::pair<std::string, int64_t>( - instrument->instrument_key, instrument->registration_id)); + instrument->instrument_key, app_info.second->registration_id)); } }
diff --git a/content/browser/payments/payment_app_content_unittest_base.cc b/content/browser/payments/payment_app_content_unittest_base.cc index 37294f6..2725e37b 100644 --- a/content/browser/payments/payment_app_content_unittest_base.cc +++ b/content/browser/payments/payment_app_content_unittest_base.cc
@@ -141,7 +141,7 @@ for (const auto& candidate_manager : payment_app_context()->payment_managers_) { if (!base::ContainsKey(existing_managers, candidate_manager.first)) { - candidate_manager.first->Init(scope_url.spec()); + candidate_manager.first->Init(sw_script_url.spec(), scope_url.spec()); base::RunLoop().RunUntilIdle(); return candidate_manager.first; }
diff --git a/content/browser/payments/payment_app_database.cc b/content/browser/payments/payment_app_database.cc index c1c1bf8..cc7b7b3 100644 --- a/content/browser/payments/payment_app_database.cc +++ b/content/browser/payments/payment_app_database.cc
@@ -17,8 +17,11 @@ #include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/browser/service_worker/service_worker_registration.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/stored_payment_instrument.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/image/image.h" +#include "url/gurl.h" +#include "url/origin.h" namespace content { namespace { @@ -27,9 +30,14 @@ using ::payments::mojom::PaymentInstrument; using ::payments::mojom::PaymentInstrumentPtr; +const char kPaymentAppPrefix[] = "PaymentApp:"; const char kPaymentInstrumentPrefix[] = "PaymentInstrument:"; const char kPaymentInstrumentKeyInfoPrefix[] = "PaymentInstrumentKeyInfo:"; +std::string CreatePaymentAppKey(const std::string& origin) { + return kPaymentAppPrefix + origin; +} + std::string CreatePaymentInstrumentKey(const std::string& instrument_key) { return kPaymentInstrumentPrefix + instrument_key; } @@ -73,6 +81,30 @@ return instrument; } +std::unique_ptr<StoredPaymentApp> ToStoredPaymentApp(const std::string& input) { + StoredPaymentAppProto app_proto; + if (!app_proto.ParseFromString(input)) + return std::unique_ptr<StoredPaymentApp>(); + + std::unique_ptr<StoredPaymentApp> app = base::MakeUnique<StoredPaymentApp>(); + app->registration_id = app_proto.registration_id(); + app->origin = url::Origin(GURL(app_proto.origin())); + app->name = app_proto.name(); + + if (!app_proto.icon().empty()) { + std::string icon_raw_data; + base::Base64Decode(app_proto.icon(), &icon_raw_data); + // Note that the icon has been decoded to PNG raw data regardless of the + // original icon format that was downloaded. + gfx::Image icon_image = gfx::Image::CreateFrom1xPNGBytes( + reinterpret_cast<const unsigned char*>(icon_raw_data.data()), + icon_raw_data.size()); + app->icon = base::MakeUnique<SkBitmap>(icon_image.AsBitmap()); + } + + return app; +} + std::unique_ptr<StoredPaymentInstrument> ToStoredPaymentInstrument( const std::string& input) { StoredPaymentInstrumentProto instrument_proto; @@ -81,7 +113,6 @@ std::unique_ptr<StoredPaymentInstrument> instrument = base::MakeUnique<StoredPaymentInstrument>(); - instrument->registration_id = instrument_proto.registration_id(); instrument->instrument_key = instrument_proto.instrument_key(); instrument->origin = GURL(instrument_proto.origin()); instrument->name = instrument_proto.name(); @@ -120,10 +151,9 @@ DCHECK_CURRENTLY_ON(BrowserThread::IO); service_worker_context_->GetUserDataForAllRegistrationsByKeyPrefix( - kPaymentInstrumentPrefix, - base::Bind(&PaymentAppDatabase::DidReadAllPaymentApps, - weak_ptr_factory_.GetWeakPtr(), - base::Passed(std::move(callback)))); + kPaymentAppPrefix, base::Bind(&PaymentAppDatabase::DidReadAllPaymentApps, + weak_ptr_factory_.GetWeakPtr(), + base::Passed(std::move(callback)))); } void PaymentAppDatabase::DeletePaymentInstrument( @@ -228,6 +258,84 @@ base::Passed(std::move(callback)))); } +void PaymentAppDatabase::FetchAndWritePaymentAppInfo( + const GURL& context, + const GURL& scope, + FetchAndWritePaymentAppInfoCallback callback) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + payment_app_info_fetcher_ = new PaymentAppInfoFetcher(); + payment_app_info_fetcher_->Start( + context, service_worker_context_, + base::BindOnce(&PaymentAppDatabase::FetchPaymentAppInfoCallback, + weak_ptr_factory_.GetWeakPtr(), scope, + std::move(callback))); +} + +void PaymentAppDatabase::FetchPaymentAppInfoCallback( + const GURL& scope, + FetchAndWritePaymentAppInfoCallback callback, + const std::string& name, + const std::string& icon) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + payment_app_info_fetcher_ = nullptr; + + service_worker_context_->FindReadyRegistrationForPattern( + scope, + base::Bind(&PaymentAppDatabase::DidFindRegistrationToWritePaymentAppInfo, + weak_ptr_factory_.GetWeakPtr(), + base::Passed(std::move(callback)), name, icon)); +} + +void PaymentAppDatabase::DidFindRegistrationToWritePaymentAppInfo( + FetchAndWritePaymentAppInfoCallback callback, + const std::string& name, + const std::string& icon, + ServiceWorkerStatusCode status, + scoped_refptr<ServiceWorkerRegistration> registration) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + if (status != SERVICE_WORKER_OK) { + std::move(callback).Run(PaymentHandlerStatus::NO_ACTIVE_WORKER); + return; + } + + StoredPaymentAppProto payment_app_proto; + payment_app_proto.set_registration_id(registration->id()); + payment_app_proto.set_origin(registration->pattern().GetOrigin().spec()); + payment_app_proto.set_name(name.empty() ? payment_app_proto.origin() : name); + payment_app_proto.set_icon(icon); + + std::string serialized_payment_app; + bool success = payment_app_proto.SerializeToString(&serialized_payment_app); + DCHECK(success); + + service_worker_context_->StoreRegistrationUserData( + registration->id(), registration->pattern().GetOrigin(), + {{CreatePaymentAppKey(registration->pattern().GetOrigin().spec()), + serialized_payment_app}}, + base::Bind(&PaymentAppDatabase::DidWritePaymentApp, + weak_ptr_factory_.GetWeakPtr(), + base::Passed(std::move(callback)), + name.empty() | icon.empty())); +} + +void PaymentAppDatabase::DidWritePaymentApp( + FetchAndWritePaymentAppInfoCallback callback, + bool fetch_app_info_failed, + ServiceWorkerStatusCode status) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + PaymentHandlerStatus handler_status = + fetch_app_info_failed + ? PaymentHandlerStatus::FETCH_PAYMENT_APP_INFO_FAILED + : PaymentHandlerStatus::SUCCESS; + handler_status = status == SERVICE_WORKER_OK + ? handler_status + : PaymentHandlerStatus::STORAGE_OPERATION_FAILED; + return std::move(callback).Run(handler_status); +} + void PaymentAppDatabase::ClearPaymentInstruments( const GURL& scope, ClearPaymentInstrumentsCallback callback) { @@ -253,13 +361,41 @@ PaymentApps apps; for (const auto& item_of_raw_data : raw_data) { + std::unique_ptr<StoredPaymentApp> app = + ToStoredPaymentApp(item_of_raw_data.second); + if (app) + apps[app->origin.GetURL()] = std::move(app); + } + + if (apps.size() == 0U) { + std::move(callback).Run(PaymentApps()); + return; + } + + service_worker_context_->GetUserDataForAllRegistrationsByKeyPrefix( + kPaymentInstrumentPrefix, + base::Bind(&PaymentAppDatabase::DidReadAllPaymentInstruments, + weak_ptr_factory_.GetWeakPtr(), base::Passed(std::move(apps)), + base::Passed(std::move(callback)))); +} + +void PaymentAppDatabase::DidReadAllPaymentInstruments( + PaymentApps apps, + ReadAllPaymentAppsCallback callback, + const std::vector<std::pair<int64_t, std::string>>& raw_data, + ServiceWorkerStatusCode status) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + if (status != SERVICE_WORKER_OK) { + std::move(callback).Run(std::move(apps)); + return; + } + + for (const auto& item_of_raw_data : raw_data) { std::unique_ptr<StoredPaymentInstrument> instrument = ToStoredPaymentInstrument(item_of_raw_data.second); - if (!instrument) + if (!instrument || !base::ContainsKey(apps, instrument->origin)) continue; - if (!base::ContainsKey(apps, instrument->origin)) - apps.insert(std::make_pair(instrument->origin, Instruments())); - apps[instrument->origin].push_back(std::move(instrument)); + apps[instrument->origin]->instruments.push_back(std::move(instrument)); } std::move(callback).Run(std::move(apps)); @@ -436,7 +572,6 @@ StoredPaymentInstrumentProto instrument_proto; instrument_proto.set_decoded_instrument_icon(decoded_instrument_icon); - instrument_proto.set_registration_id(registration->id()); instrument_proto.set_instrument_key(instrument_key); instrument_proto.set_origin(registration->pattern().GetOrigin().spec()); instrument_proto.set_name(instrument->name); @@ -498,12 +633,12 @@ KeysOfPaymentInstruments( scope, base::BindOnce(&PaymentAppDatabase::DidGetKeysToClearPaymentInstruments, - weak_ptr_factory_.GetWeakPtr(), registration->id(), + weak_ptr_factory_.GetWeakPtr(), std::move(registration), std::move(callback))); } void PaymentAppDatabase::DidGetKeysToClearPaymentInstruments( - int64_t registration_id, + scoped_refptr<ServiceWorkerRegistration> registration, ClearPaymentInstrumentsCallback callback, const std::vector<std::string>& keys, PaymentHandlerStatus status) { @@ -520,8 +655,12 @@ keys_with_prefix.push_back(CreatePaymentInstrumentKeyInfoKey(key)); } + // Clear payment app info after clearing all payment instruments. + keys_with_prefix.push_back( + CreatePaymentAppKey(registration->pattern().GetOrigin().spec())); + service_worker_context_->ClearRegistrationUserData( - registration_id, keys_with_prefix, + registration->id(), keys_with_prefix, base::Bind(&PaymentAppDatabase::DidClearPaymentInstruments, weak_ptr_factory_.GetWeakPtr(), base::Passed(std::move(callback))));
diff --git a/content/browser/payments/payment_app_database.h b/content/browser/payments/payment_app_database.h index 6931226..1b88e80 100644 --- a/content/browser/payments/payment_app_database.h +++ b/content/browser/payments/payment_app_database.h
@@ -11,12 +11,13 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" +#include "content/browser/payments/payment_app_info_fetcher.h" #include "content/browser/payments/payment_instrument_icon_fetcher.h" #include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/browser/service_worker/service_worker_registration.h" #include "content/common/content_export.h" #include "content/common/service_worker/service_worker_status_code.h" -#include "content/public/browser/stored_payment_instrument.h" +#include "content/public/browser/stored_payment_app.h" #include "mojo/public/cpp/bindings/binding.h" #include "third_party/WebKit/public/platform/modules/payments/payment_app.mojom.h" @@ -26,8 +27,7 @@ class CONTENT_EXPORT PaymentAppDatabase { public: - using Instruments = std::vector<std::unique_ptr<StoredPaymentInstrument>>; - using PaymentApps = std::map<GURL, Instruments>; + using PaymentApps = std::map<GURL, std::unique_ptr<StoredPaymentApp>>; using ReadAllPaymentAppsCallback = base::OnceCallback<void(PaymentApps)>; using DeletePaymentInstrumentCallback = @@ -42,6 +42,8 @@ base::OnceCallback<void(payments::mojom::PaymentHandlerStatus)>; using WritePaymentInstrumentCallback = base::OnceCallback<void(payments::mojom::PaymentHandlerStatus)>; + using FetchAndWritePaymentAppInfoCallback = + base::OnceCallback<void(payments::mojom::PaymentHandlerStatus)>; using ClearPaymentInstrumentsCallback = base::OnceCallback<void(payments::mojom::PaymentHandlerStatus)>; @@ -66,6 +68,10 @@ const std::string& instrument_key, payments::mojom::PaymentInstrumentPtr instrument, WritePaymentInstrumentCallback callback); + void FetchAndWritePaymentAppInfo( + const GURL& context, + const GURL& scope, + FetchAndWritePaymentAppInfoCallback callback); void ClearPaymentInstruments(const GURL& scope, ClearPaymentInstrumentsCallback callback); @@ -75,6 +81,11 @@ ReadAllPaymentAppsCallback callback, const std::vector<std::pair<int64_t, std::string>>& raw_data, ServiceWorkerStatusCode status); + void DidReadAllPaymentInstruments( + PaymentApps apps, + ReadAllPaymentAppsCallback callback, + const std::vector<std::pair<int64_t, std::string>>& raw_data, + ServiceWorkerStatusCode status); // DeletePaymentInstrument callbacks void DidFindRegistrationToDeletePaymentInstrument( @@ -130,6 +141,21 @@ void DidWritePaymentInstrument(WritePaymentInstrumentCallback callback, ServiceWorkerStatusCode status); + // FetchAndWritePaymentAppInfo callbacks. + void FetchPaymentAppInfoCallback(const GURL& scope, + FetchAndWritePaymentAppInfoCallback callback, + const std::string& name, + const std::string& icon); + void DidFindRegistrationToWritePaymentAppInfo( + FetchAndWritePaymentAppInfoCallback callback, + const std::string& name, + const std::string& icon, + ServiceWorkerStatusCode status, + scoped_refptr<ServiceWorkerRegistration> registration); + void DidWritePaymentApp(FetchAndWritePaymentAppInfoCallback callback, + bool fetch_app_info_failed, + ServiceWorkerStatusCode status); + // PaymentInstrumentIconFetcherCallback. void DidFetchedPaymentInstrumentIcon( const GURL& scope, @@ -145,13 +171,14 @@ ServiceWorkerStatusCode status, scoped_refptr<ServiceWorkerRegistration> registration); void DidGetKeysToClearPaymentInstruments( - int64_t registration_id, + scoped_refptr<ServiceWorkerRegistration> registration, ClearPaymentInstrumentsCallback callback, const std::vector<std::string>& keys, payments::mojom::PaymentHandlerStatus status); void DidClearPaymentInstruments(ClearPaymentInstrumentsCallback callback, ServiceWorkerStatusCode status); + scoped_refptr<PaymentAppInfoFetcher> payment_app_info_fetcher_; scoped_refptr<PaymentInstrumentIconFetcher> instrument_icon_fetcher_; scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; base::WeakPtrFactory<PaymentAppDatabase> weak_ptr_factory_;
diff --git a/content/browser/payments/payment_app_info_fetcher.cc b/content/browser/payments/payment_app_info_fetcher.cc new file mode 100644 index 0000000..f4d68e87 --- /dev/null +++ b/content/browser/payments/payment_app_info_fetcher.cc
@@ -0,0 +1,157 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/payments/payment_app_info_fetcher.h" + +#include "base/base64.h" +#include "base/bind_helpers.h" +#include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/browser/service_worker/service_worker_context_wrapper.h" +#include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/manifest_icon_downloader.h" +#include "content/public/browser/manifest_icon_selector.h" +#include "ui/gfx/image/image.h" + +namespace content { + +namespace { + +// TODO(gogerald): Choose appropriate icon size dynamically on different +// platforms. +const int kPaymentAppIdealIconSize = 64; +const int kPaymentAppMinimumIconSize = 0; + +} // namespace + +PaymentAppInfoFetcher::PaymentAppInfoFetcher() + : context_process_id_(-1), context_frame_id_(-1) {} +PaymentAppInfoFetcher::~PaymentAppInfoFetcher() {} + +void PaymentAppInfoFetcher::Start( + const GURL& context_url, + scoped_refptr<ServiceWorkerContextWrapper> service_worker_context, + PaymentAppInfoFetchCallback callback) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + context_url_ = context_url; + callback_ = std::move(callback); + + std::unique_ptr<std::vector<std::pair<int, int>>> provider_hosts = + service_worker_context->GetProviderHostIds(context_url.GetOrigin()); + + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::BindOnce(&PaymentAppInfoFetcher::StartFromUIThread, this, + std::move(provider_hosts))); +} + +void PaymentAppInfoFetcher::StartFromUIThread( + const std::unique_ptr<std::vector<std::pair<int, int>>>& provider_hosts) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + + if (provider_hosts->size() == 0U) { + PostPaymentAppInfoFetchResultToIOThread(); + return; + } + + for (const auto& frame : *provider_hosts) { + RenderFrameHostImpl* render_frame_host = + RenderFrameHostImpl::FromID(frame.first, frame.second); + if (!render_frame_host) + continue; + + WebContentsImpl* web_content = static_cast<WebContentsImpl*>( + WebContents::FromRenderFrameHost(render_frame_host)); + if (!web_content || web_content->IsHidden() || + context_url_.spec().compare( + web_content->GetLastCommittedURL().spec()) != 0) { + continue; + } + + context_process_id_ = frame.first; + context_frame_id_ = frame.second; + + web_content->GetManifest(base::Bind( + &PaymentAppInfoFetcher::FetchPaymentAppManifestCallback, this)); + return; + } + + PostPaymentAppInfoFetchResultToIOThread(); +} + +void PaymentAppInfoFetcher::FetchPaymentAppManifestCallback( + const GURL& url, + const Manifest& manifest) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + + if (url.is_empty() || manifest.IsEmpty()) { + PostPaymentAppInfoFetchResultToIOThread(); + return; + } + + if (manifest.name.is_null() || + !base::UTF16ToUTF8(manifest.name.string().c_str(), + manifest.name.string().length(), + &fetched_payment_app_name_)) { + PostPaymentAppInfoFetchResultToIOThread(); + return; + } + + GURL icon_url = ManifestIconSelector::FindBestMatchingIcon( + manifest.icons, kPaymentAppIdealIconSize, kPaymentAppMinimumIconSize, + Manifest::Icon::ANY); + if (!icon_url.is_valid()) { + PostPaymentAppInfoFetchResultToIOThread(); + return; + } + + RenderFrameHostImpl* render_frame_host = + RenderFrameHostImpl::FromID(context_process_id_, context_frame_id_); + if (!render_frame_host) { + PostPaymentAppInfoFetchResultToIOThread(); + return; + } + + WebContents* web_content = + WebContents::FromRenderFrameHost(render_frame_host); + if (!web_content) { + PostPaymentAppInfoFetchResultToIOThread(); + return; + } + + if (!content::ManifestIconDownloader::Download( + web_content, icon_url, kPaymentAppIdealIconSize, + kPaymentAppMinimumIconSize, + base::Bind(&PaymentAppInfoFetcher::OnIconFetched, this))) { + PostPaymentAppInfoFetchResultToIOThread(); + } +} + +void PaymentAppInfoFetcher::OnIconFetched(const SkBitmap& icon) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + + if (icon.drawsNothing()) { + PostPaymentAppInfoFetchResultToIOThread(); + return; + } + + gfx::Image decoded_image = gfx::Image::CreateFrom1xBitmap(icon); + scoped_refptr<base::RefCountedMemory> raw_data = decoded_image.As1xPNGBytes(); + base::Base64Encode( + base::StringPiece(raw_data->front_as<char>(), raw_data->size()), + &fetched_payment_app_icon_); + PostPaymentAppInfoFetchResultToIOThread(); +} + +void PaymentAppInfoFetcher::PostPaymentAppInfoFetchResultToIOThread() { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::BindOnce(std::move(callback_), fetched_payment_app_name_, + fetched_payment_app_icon_)); +} + +} // namespace content \ No newline at end of file
diff --git a/content/browser/payments/payment_app_info_fetcher.h b/content/browser/payments/payment_app_info_fetcher.h new file mode 100644 index 0000000..002a2dd --- /dev/null +++ b/content/browser/payments/payment_app_info_fetcher.h
@@ -0,0 +1,57 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_INFO_FETCHER_H_ +#define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_INFO_FETCHER_H_ + +#include <string> + +#include "base/macros.h" +#include "base/memory/ref_counted.h" +#include "content/browser/service_worker/service_worker_context_wrapper.h" +#include "content/public/common/manifest.h" +#include "third_party/skia/include/core/SkBitmap.h" + +namespace content { + +class PaymentAppInfoFetcher + : public base::RefCountedThreadSafe<PaymentAppInfoFetcher> { + public: + PaymentAppInfoFetcher(); + + using PaymentAppInfoFetchCallback = + base::OnceCallback<void(const std::string&, const std::string&)>; + void Start(const GURL& context_url, + scoped_refptr<ServiceWorkerContextWrapper> service_worker_context, + PaymentAppInfoFetchCallback callback); + + private: + friend class base::RefCountedThreadSafe<PaymentAppInfoFetcher>; + ~PaymentAppInfoFetcher(); + + void StartFromUIThread( + const std::unique_ptr<std::vector<std::pair<int, int>>>& provider_hosts); + + // The WebContents::GetManifestCallback. + void FetchPaymentAppManifestCallback(const GURL& url, + const Manifest& manifest); + + // The ManifestIconDownloader::IconFetchCallback. + void OnIconFetched(const SkBitmap& icon); + void PostPaymentAppInfoFetchResultToIOThread(); + + GURL context_url_; + PaymentAppInfoFetchCallback callback_; + + int context_process_id_; + int context_frame_id_; + std::string fetched_payment_app_name_; + std::string fetched_payment_app_icon_; + + DISALLOW_COPY_AND_ASSIGN(PaymentAppInfoFetcher); +}; + +} // namespace content + +#endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_INFO_FETCHER_H_
diff --git a/content/browser/payments/payment_app_provider_impl_unittest.cc b/content/browser/payments/payment_app_provider_impl_unittest.cc index af91b215..beeaa902 100644 --- a/content/browser/payments/payment_app_provider_impl_unittest.cc +++ b/content/browser/payments/payment_app_provider_impl_unittest.cc
@@ -104,12 +104,12 @@ event_data->total->amount = payments::mojom::PaymentCurrencyAmount::New(); bool called = false; - InvokePaymentApp(apps[GURL("https://hellopay.com/")][0]->registration_id, + InvokePaymentApp(apps[GURL("https://hellopay.com/")]->registration_id, std::move(event_data), base::Bind(&InvokePaymentAppCallback, &called)); ASSERT_TRUE(called); - EXPECT_EQ(apps[GURL("https://hellopay.com/")][0]->registration_id, + EXPECT_EQ(apps[GURL("https://hellopay.com/")]->registration_id, last_sw_registration_id()); } @@ -131,8 +131,8 @@ GetAllPaymentApps(base::Bind(&GetAllPaymentAppsCallback, &apps)); ASSERT_EQ(2U, apps.size()); - ASSERT_EQ(1U, apps[GURL("https://hellopay.com/")].size()); - ASSERT_EQ(2U, apps[GURL("https://bobpay.com/")].size()); + ASSERT_EQ(1U, apps[GURL("https://hellopay.com/")]->instruments.size()); + ASSERT_EQ(2U, apps[GURL("https://bobpay.com/")]->instruments.size()); } } // namespace content
diff --git a/content/browser/payments/payment_manager.cc b/content/browser/payments/payment_manager.cc index ce9445e..753fe245 100644 --- a/content/browser/payments/payment_manager.cc +++ b/content/browser/payments/payment_manager.cc
@@ -34,8 +34,11 @@ base::Bind(&PaymentManager::OnConnectionError, base::Unretained(this))); } -void PaymentManager::Init(const std::string& scope) { +void PaymentManager::Init(const std::string& context, + const std::string& scope) { DCHECK_CURRENTLY_ON(BrowserThread::IO); + should_set_payment_app_info_ = true; + context_ = GURL(context); scope_ = GURL(scope); } @@ -80,8 +83,32 @@ PaymentManager::SetPaymentInstrumentCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - payment_app_context_->payment_app_database()->WritePaymentInstrument( - scope_, instrument_key, std::move(details), std::move(callback)); + if (should_set_payment_app_info_) { + payment_app_context_->payment_app_database()->WritePaymentInstrument( + scope_, instrument_key, std::move(details), + base::BindOnce( + &PaymentManager::SetPaymentInstrumentIntermediateCallback, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); + } else { + payment_app_context_->payment_app_database()->WritePaymentInstrument( + scope_, instrument_key, std::move(details), std::move(callback)); + } +} + +void PaymentManager::SetPaymentInstrumentIntermediateCallback( + PaymentManager::SetPaymentInstrumentCallback callback, + payments::mojom::PaymentHandlerStatus status) { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + if (status != payments::mojom::PaymentHandlerStatus::SUCCESS || + !should_set_payment_app_info_) { + std::move(callback).Run(status); + return; + } + + payment_app_context_->payment_app_database()->FetchAndWritePaymentAppInfo( + context_, scope_, std::move(callback)); + should_set_payment_app_info_ = false; } void PaymentManager::ClearPaymentInstruments(
diff --git a/content/browser/payments/payment_manager.h b/content/browser/payments/payment_manager.h index a6e9682..da77b81 100644 --- a/content/browser/payments/payment_manager.h +++ b/content/browser/payments/payment_manager.h
@@ -33,7 +33,7 @@ friend class PaymentManagerTest; // payments::mojom::PaymentManager methods: - void Init(const std::string& scope) override; + void Init(const std::string& context, const std::string& scope) override; void DeletePaymentInstrument( const std::string& instrument_key, DeletePaymentInstrumentCallback callback) override; @@ -52,9 +52,15 @@ // Called when an error is detected on binding_. void OnConnectionError(); + void SetPaymentInstrumentIntermediateCallback( + PaymentManager::SetPaymentInstrumentCallback callback, + payments::mojom::PaymentHandlerStatus status); + // PaymentAppContextImpl owns PaymentManager PaymentAppContextImpl* payment_app_context_; + bool should_set_payment_app_info_; + GURL context_; GURL scope_; mojo::Binding<payments::mojom::PaymentManager> binding_; base::WeakPtrFactory<PaymentManager> weak_ptr_factory_;
diff --git a/content/browser/payments/payment_manager_unittest.cc b/content/browser/payments/payment_manager_unittest.cc index c027448..faaf3d4d 100644 --- a/content/browser/payments/payment_manager_unittest.cc +++ b/content/browser/payments/payment_manager_unittest.cc
@@ -129,7 +129,11 @@ write_details->enabled_methods.push_back("visa"); write_details->stringified_capabilities = "{}"; SetPaymentInstrument("test_key", std::move(write_details), &write_status); - ASSERT_EQ(PaymentHandlerStatus::SUCCESS, write_status); + // Write the first instrument of a web payment app will return + // FETCH_PAYMENT_APP_INFO_FAILED since the web app's manifest is not + // available, but the write of the instrument is succeed, othewise will return + // the other errors. + ASSERT_EQ(PaymentHandlerStatus::FETCH_PAYMENT_APP_INFO_FAILED, write_status); PaymentHandlerStatus read_status = PaymentHandlerStatus::NOT_FOUND; PaymentInstrumentPtr read_details; @@ -155,7 +159,11 @@ write_details->enabled_methods.push_back("visa"); write_details->stringified_capabilities = "{}"; SetPaymentInstrument("test_key", std::move(write_details), &write_status); - ASSERT_EQ(PaymentHandlerStatus::SUCCESS, write_status); + // Write the first instrument of a web payment app will return + // FETCH_PAYMENT_APP_INFO_FAILED since the web app's manifest is not + // available, but the write of the instrument is succeed, othewise will return + // the other errors. + ASSERT_EQ(PaymentHandlerStatus::FETCH_PAYMENT_APP_INFO_FAILED, write_status); PaymentHandlerStatus read_status = PaymentHandlerStatus::NOT_FOUND; PaymentInstrumentPtr read_details; @@ -178,7 +186,11 @@ write_details->enabled_methods.push_back("visa"); write_details->stringified_capabilities = "{}"; SetPaymentInstrument("test_key", std::move(write_details), &write_status); - ASSERT_EQ(PaymentHandlerStatus::SUCCESS, write_status); + // Write the first instrument of a web payment app will return + // FETCH_PAYMENT_APP_INFO_FAILED since the web app's manifest is not + // available, but the write of the instrument is succeed, othewise will return + // the other errors. + ASSERT_EQ(PaymentHandlerStatus::FETCH_PAYMENT_APP_INFO_FAILED, write_status); PaymentHandlerStatus has_status = PaymentHandlerStatus::NOT_FOUND; HasPaymentInstrument("test_key", &has_status); @@ -198,7 +210,12 @@ { PaymentHandlerStatus write_status = PaymentHandlerStatus::NOT_FOUND; SetPaymentInstrument("test_key1", PaymentInstrument::New(), &write_status); - ASSERT_EQ(PaymentHandlerStatus::SUCCESS, write_status); + // Write the first instrument of a web payment app will return + // FETCH_PAYMENT_APP_INFO_FAILED since the web app's manifest is not + // available, but the write of the instrument is succeed, othewise will + // return the other errors. + ASSERT_EQ(PaymentHandlerStatus::FETCH_PAYMENT_APP_INFO_FAILED, + write_status); } { PaymentHandlerStatus write_status = PaymentHandlerStatus::NOT_FOUND; @@ -230,7 +247,12 @@ { PaymentHandlerStatus write_status = PaymentHandlerStatus::NOT_FOUND; SetPaymentInstrument("test_key1", PaymentInstrument::New(), &write_status); - ASSERT_EQ(PaymentHandlerStatus::SUCCESS, write_status); + // Write the first instrument of a web payment app will return + // FETCH_PAYMENT_APP_INFO_FAILED since the web app's manifest is not + // available, but the write of the instrument is succeed, othewise will + // return the other errors. + ASSERT_EQ(PaymentHandlerStatus::FETCH_PAYMENT_APP_INFO_FAILED, + write_status); } { PaymentHandlerStatus write_status = PaymentHandlerStatus::NOT_FOUND;
diff --git a/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc b/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc index c7306154..1402f94 100644 --- a/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc +++ b/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc
@@ -399,7 +399,7 @@ ukm::SourceId RenderWidgetHostLatencyTracker::GetUkmSourceId() { ukm::UkmRecorder* ukm_recorder = ukm::UkmRecorder::Get(); - if (ukm_recorder && ukm_source_id_ == -1) { + if (ukm_recorder && ukm_source_id_ == -1 && render_widget_host_delegate_) { ukm_source_id_ = ukm_recorder->GetNewSourceID(); render_widget_host_delegate_->UpdateUrlForUkmSource(ukm_recorder, ukm_source_id_);
diff --git a/content/browser/renderer_host/legacy_render_widget_host_win.cc b/content/browser/renderer_host/legacy_render_widget_host_win.cc index 770362c8..91c4d4f 100644 --- a/content/browser/renderer_host/legacy_render_widget_host_win.cc +++ b/content/browser/renderer_host/legacy_render_widget_host_win.cc
@@ -17,7 +17,7 @@ #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_aura.h" #include "content/public/common/content_switches.h" -#include "ui/accessibility/platform/ax_fake_caret_win.h" +#include "ui/accessibility/platform/ax_system_caret_win.h" #include "ui/base/view_prop.h" #include "ui/base/win/internal_constants.h" #include "ui/base/win/window_event_target.h" @@ -89,8 +89,8 @@ } void LegacyRenderWidgetHostHWND::MoveCaretTo(const gfx::Rect& bounds) { - DCHECK(ax_fake_caret_); - ax_fake_caret_->MoveCaretTo(bounds); + DCHECK(ax_system_caret_); + ax_system_caret_->MoveCaretTo(bounds); } void LegacyRenderWidgetHostHWND::OnFinalMessage(HWND hwnd) { @@ -111,10 +111,10 @@ Base::Create(parent, rect, L"Chrome Legacy Window", WS_CHILDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_TRANSPARENT); - // We create the fake caret regardless of accessibility mode since not all - // assistive software that makes use of a fake caret is classified as a screen + // We create a system caret regardless of accessibility mode since not all + // assistive software that makes use of a caret is classified as a screen // reader, e.g. the built-in Windows Magnifier. - ax_fake_caret_ = std::make_unique<ui::AXFakeCaretWin>(hwnd()); + ax_system_caret_ = std::make_unique<ui::AXSystemCaretWin>(hwnd()); } LegacyRenderWidgetHostHWND::~LegacyRenderWidgetHostHWND() { @@ -201,11 +201,11 @@ } if (static_cast<DWORD>(OBJID_CARET) == obj_id && host_->HasFocus()) { - DCHECK(ax_fake_caret_); - base::win::ScopedComPtr<IAccessible> fake_caret_accessible = - ax_fake_caret_->GetCaret(); + DCHECK(ax_system_caret_); + base::win::ScopedComPtr<IAccessible> ax_system_caret_accessible = + ax_system_caret_->GetCaret(); return LresultFromObject(IID_IAccessible, w_param, - fake_caret_accessible.Detach()); + ax_system_caret_accessible.Detach()); } return static_cast<LRESULT>(0L);
diff --git a/content/browser/renderer_host/legacy_render_widget_host_win.h b/content/browser/renderer_host/legacy_render_widget_host_win.h index 91a0205..b89060e 100644 --- a/content/browser/renderer_host/legacy_render_widget_host_win.h +++ b/content/browser/renderer_host/legacy_render_widget_host_win.h
@@ -24,7 +24,7 @@ } // namespace gfx namespace ui { -class AXFakeCaretWin; +class AXSystemCaretWin; class WindowEventTarget; } @@ -121,7 +121,7 @@ host_ = host; } - // Changes the position of the fake caret. + // Changes the position of the system caret used for accessibility. void MoveCaretTo(const gfx::Rect& bounds); protected: @@ -164,7 +164,7 @@ RenderWidgetHostViewAura* host_; // Some assistive software need to track the location of the caret. - std::unique_ptr<ui::AXFakeCaretWin> ax_fake_caret_; + std::unique_ptr<ui::AXSystemCaretWin> ax_system_caret_; // This class provides functionality to register the legacy window as a // Direct Manipulation consumer. This allows us to support smooth scroll
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 2d542fb5..18561991 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -2619,6 +2619,12 @@ // Send a GesturePinchBegin event if none has been sent yet. if (!gestureBeginPinchSent_) { + if (renderWidgetHostView_->wheel_scroll_latching_enabled()) { + // Before starting a pinch sequence, send the pending wheel end event to + // finish scrolling. + renderWidgetHostView_->mouse_wheel_phase_handler_ + .DispatchPendingWheelEndEvent(); + } WebGestureEvent beginEvent(*gestureBeginEvent_); beginEvent.SetType(WebInputEvent::kGesturePinchBegin); renderWidgetHostView_->render_widget_host_->ForwardGestureEvent(beginEvent);
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc index eddab03..1c6f549 100644 --- a/content/browser/service_worker/service_worker_context_wrapper.cc +++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -604,6 +604,24 @@ context_core_->HasMainFrameProviderHost(origin, callback); } +std::unique_ptr<std::vector<std::pair<int, int>>> +ServiceWorkerContextWrapper::GetProviderHostIds(const GURL& origin) const { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + + std::unique_ptr<std::vector<std::pair<int, int>>> provider_host_ids( + new std::vector<std::pair<int, int>>()); + + for (std::unique_ptr<ServiceWorkerContextCore::ProviderHostIterator> it = + context_core_->GetClientProviderHostIterator(origin); + !it->IsAtEnd(); it->Advance()) { + ServiceWorkerProviderHost* provider_host = it->GetProviderHost(); + provider_host_ids->push_back( + std::make_pair(provider_host->process_id(), provider_host->frame_id())); + } + + return provider_host_ids; +} + void ServiceWorkerContextWrapper::FindReadyRegistrationForDocument( const GURL& document_url, const FindRegistrationCallback& callback) {
diff --git a/content/browser/service_worker/service_worker_context_wrapper.h b/content/browser/service_worker/service_worker_context_wrapper.h index aea3fae..71f341d 100644 --- a/content/browser/service_worker/service_worker_context_wrapper.h +++ b/content/browser/service_worker/service_worker_context_wrapper.h
@@ -135,6 +135,11 @@ void HasMainFrameProviderHost(const GURL& origin, const BoolCallback& callback) const; + // Returns all render process ids and frame ids for the given |origin|. + std::unique_ptr< + std::vector<std::pair<int /* render process id */, int /* frame id */>>> + GetProviderHostIds(const GURL& origin) const; + // Returns the registration whose scope longest matches |document_url|. It is // guaranteed that the returned registration has the activated worker. //
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc index 398bbd0..0cb948b 100644 --- a/content/browser/service_worker/service_worker_dispatcher_host.cc +++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -91,10 +91,11 @@ this), render_process_id_(render_process_id), resource_context_(resource_context), - channel_ready_(false), - weak_factory_(this) {} + channel_ready_(false) {} ServiceWorkerDispatcherHost::~ServiceWorkerDispatcherHost() { + // Temporary CHECK for debugging https://crbug.com/736203. + CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); if (GetContext()) GetContext()->RemoveDispatcherHost(render_process_id_); } @@ -117,6 +118,8 @@ void ServiceWorkerDispatcherHost::OnFilterAdded(IPC::Channel* channel) { TRACE_EVENT0("ServiceWorker", "ServiceWorkerDispatcherHost::OnFilterAdded"); + // Temporary CHECK for debugging https://crbug.com/736203. + CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); channel_ready_ = true; std::vector<std::unique_ptr<IPC::Message>> messages; messages.swap(pending_messages_); @@ -126,6 +129,8 @@ } void ServiceWorkerDispatcherHost::OnFilterRemoved() { + // Temporary CHECK for debugging https://crbug.com/736203. + CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); // Don't wait until the destructor to teardown since a new dispatcher host // for this process might be created before then. if (GetContext()) @@ -135,6 +140,8 @@ } void ServiceWorkerDispatcherHost::OnDestruct() const { + // Destruct on the IO thread since |context_wrapper_| should only be accessed + // on the IO thread. BrowserThread::DeleteOnIOThread::Destruct(this); } @@ -1478,6 +1485,8 @@ } ServiceWorkerContextCore* ServiceWorkerDispatcherHost::GetContext() { + // Temporary CHECK for debugging https://crbug.com/736203. + CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); if (!context_wrapper_.get()) return nullptr; return context_wrapper_->context();
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.h b/content/browser/service_worker/service_worker_dispatcher_host.h index 6670faa..3af8eed 100644 --- a/content/browser/service_worker/service_worker_dispatcher_host.h +++ b/content/browser/service_worker/service_worker_dispatcher_host.h
@@ -42,6 +42,24 @@ struct ServiceWorkerRegistrationObjectInfo; struct ServiceWorkerVersionAttributes; +// ServiceWorkerDispatcherHost is the browser-side endpoint for several IPC +// messages for service workers. There is a 1:1 correspondence between +// renderer processes and ServiceWorkerDispatcherHosts. Currently +// ServiceWorkerDispatcherHost handles both legacy IPC messages (to and from +// its corresponding ServiceWorkerDispatcher on the renderer) and Mojo IPC +// messages (from any ServiceWorkerNetworkProvider on the renderer). +// +// Most messages are "from" a "service worker provider" on the renderer (a +// ServiceWorkerNetworkProvider or a blink::WebServiceWorkerProvider), hence +// they include a provider_id which must match to a ServiceWorkerProviderHost. +// +// ServiceWorkerDispatcherHost is created on the UI thread in +// RenderProcessHostImpl::Init() via CreateMessageFilters(). But initialization +// and destruction occur on the IO thread, as does most (or all?) message +// handling. It lives as long as the renderer process lives. Therefore much +// tracking of renderer processes in browser-side service worker code is built +// on ServiceWorkerDispatcherHost lifetime. +// // This class is bound with mojom::ServiceWorkerDispatcherHost. All // InterfacePtrs on the same render process are bound to the same // content::ServiceWorkerDispatcherHost. @@ -254,6 +272,7 @@ const int render_process_id_; ResourceContext* resource_context_; + // Only accessed on the IO thread. scoped_refptr<ServiceWorkerContextWrapper> context_wrapper_; IDMap<std::unique_ptr<ServiceWorkerHandle>> handles_; @@ -265,8 +284,6 @@ bool channel_ready_; // True after BrowserMessageFilter::sender_ != NULL. std::vector<std::unique_ptr<IPC::Message>> pending_messages_; - base::WeakPtrFactory<ServiceWorkerDispatcherHost> weak_factory_; - DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); };
diff --git a/content/browser/webrtc/webrtc_getusermedia_browsertest.cc b/content/browser/webrtc/webrtc_getusermedia_browsertest.cc index 57b608b..3550c0c2 100644 --- a/content/browser/webrtc/webrtc_getusermedia_browsertest.cc +++ b/content/browser/webrtc/webrtc_getusermedia_browsertest.cc
@@ -109,9 +109,8 @@ class WebRtcGetUserMediaBrowserTest : public WebRtcContentBrowserTestBase { public: WebRtcGetUserMediaBrowserTest() : trace_log_(NULL) { - scoped_feature_list_.InitWithFeatures( - {}, {features::kMediaStreamOldVideoConstraints, - features::kMediaStreamOldAudioConstraints}); + scoped_feature_list_.InitAndDisableFeature( + features::kMediaStreamOldAudioConstraints); // Automatically grant device permission. AppendUseFakeUIForMediaStreamFlag(); } @@ -806,10 +805,8 @@ : public WebRtcContentBrowserTestBase { public: WebRtcGetUserMediaOldConstraintsBrowserTest() : trace_log_(NULL) { - scoped_feature_list_.InitWithFeatures( - {features::kMediaStreamOldVideoConstraints, - features::kMediaStreamOldAudioConstraints}, - {}); + scoped_feature_list_.InitAndEnableFeature( + features::kMediaStreamOldAudioConstraints); // Automatically grant device permission. AppendUseFakeUIForMediaStreamFlag(); } @@ -1193,37 +1190,6 @@ expected_result); } -// TODO(guidou): Remove this test. http://crbug.com/706408 -IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaOldConstraintsBrowserTest, - TwoGetUserMediaWithSecondVideoCropped) { - std::string constraints1 = "{video: true}"; - std::string constraints2 = "{video: {mandatory: {maxHeight: 360}}}"; - std::string expected_result = "w=640:h=480-w=640:h=360"; - RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, - expected_result); -} - -// Test fails under MSan, http://crbug.com/445745 -// TODO(guidou): Remove this test. http://crbug.com/706408 -#if defined(MEMORY_SANITIZER) -#define MAYBE_TwoGetUserMediaWithFirstHdSecondVga \ - DISABLED_TwoGetUserMediaWithFirstHdSecondVga -#else -#define MAYBE_TwoGetUserMediaWithFirstHdSecondVga \ - TwoGetUserMediaWithFirstHdSecondVga -#endif -IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaOldConstraintsBrowserTest, - MAYBE_TwoGetUserMediaWithFirstHdSecondVga) { - std::string constraints1 = - "{video: {mandatory: {maxWidth:1280 , minWidth:1280 , maxHeight: 720, " - "minHeight: 720}}}"; - std::string constraints2 = - "{video: {mandatory: {maxWidth:640 , maxHeight: 480}}}"; - std::string expected_result = "w=1280:h=720-w=640:h=480"; - RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, - expected_result); -} - // Timing out on Windows 7 bot: http://crbug.com/443294 // Flaky: http://crbug.com/660656; possible the test is too perf sensitive. IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaOldConstraintsBrowserTest,
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index fbbb633..69794836 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc
@@ -334,6 +334,9 @@ WebRuntimeFeatures::EnableServiceWorkerNavigationPreload( base::FeatureList::IsEnabled(features::kServiceWorkerNavigationPreload)); + WebRuntimeFeatures::EnableServiceWorkerScriptStreaming( + base::FeatureList::IsEnabled(features::kServiceWorkerScriptStreaming)); + WebRuntimeFeatures::EnableOffMainThreadFetch( base::FeatureList::IsEnabled(features::kOffMainThreadFetch));
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc index 4df5a085..e773166 100644 --- a/content/child/web_url_loader_impl.cc +++ b/content/child/web_url_loader_impl.cc
@@ -14,6 +14,7 @@ #include "base/bind.h" #include "base/callback.h" +#include "base/command_line.h" #include "base/files/file_path.h" #include "base/logging.h" #include "base/memory/ptr_util.h" @@ -40,6 +41,7 @@ #include "content/public/child/fixed_received_data.h" #include "content/public/child/request_peer.h" #include "content/public/common/browser_side_navigation_policy.h" +#include "content/public/common/content_features.h" #include "content/public/common/resource_request_body.h" #include "net/base/data_url.h" #include "net/base/filename_util.h" @@ -463,7 +465,13 @@ task_runner_(std::move(task_runner)), defers_loading_(NOT_DEFERRING), request_id_(-1), - url_loader_factory_(url_loader_factory) {} + url_loader_factory_(url_loader_factory) { +#if DCHECK_IS_ON() + const bool mojo_loading_enabled = + base::FeatureList::IsEnabled(features::kLoadingWithMojo); + DCHECK(url_loader_factory_ || !mojo_loading_enabled); +#endif +} void WebURLLoaderImpl::Context::Cancel() { TRACE_EVENT_WITH_FLOW0("loading", "WebURLLoaderImpl::Context::Cancel", this,
diff --git a/content/common/service_worker/service_worker_utils.cc b/content/common/service_worker/service_worker_utils.cc index 805644e..323b301 100644 --- a/content/common/service_worker/service_worker_utils.cc +++ b/content/common/service_worker/service_worker_utils.cc
@@ -7,9 +7,11 @@ #include <string> #include "base/command_line.h" +#include "base/feature_list.h" #include "base/logging.h" #include "base/strings/string_util.h" #include "content/public/common/browser_side_navigation_policy.h" +#include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "content/public/common/origin_util.h" @@ -146,6 +148,11 @@ return true; } +// static +bool ServiceWorkerUtils::IsScriptStreamingEnabled() { + return base::FeatureList::IsEnabled(features::kServiceWorkerScriptStreaming); +} + bool LongestScopeMatcher::MatchLongest(const GURL& scope) { if (!ServiceWorkerUtils::ScopeMatches(scope, url_)) return false;
diff --git a/content/common/service_worker/service_worker_utils.h b/content/common/service_worker/service_worker_utils.h index 05ee687..309d93d 100644 --- a/content/common/service_worker/service_worker_utils.h +++ b/content/common/service_worker/service_worker_utils.h
@@ -43,6 +43,7 @@ std::string* error_message); static bool IsMojoForServiceWorkerEnabled(); + static bool IsScriptStreamingEnabled(); // Returns true if all members of |urls| have the same origin, and // OriginCanAccessServiceWorkers is true for this origin.
diff --git a/content/public/browser/BUILD.gn b/content/public/browser/BUILD.gn index 54bc620..ba02145 100644 --- a/content/public/browser/BUILD.gn +++ b/content/public/browser/BUILD.gn
@@ -248,6 +248,8 @@ "ssl_status.cc", "ssl_status.h", "storage_partition.h", + "stored_payment_app.cc", + "stored_payment_app.h", "stored_payment_instrument.cc", "stored_payment_instrument.h", "stream_handle.h",
diff --git a/content/public/browser/payment_app_provider.h b/content/public/browser/payment_app_provider.h index 6572aea..54a9a97 100644 --- a/content/public/browser/payment_app_provider.h +++ b/content/public/browser/payment_app_provider.h
@@ -12,7 +12,7 @@ #include "base/callback_forward.h" #include "content/common/content_export.h" -#include "content/public/browser/stored_payment_instrument.h" +#include "content/public/browser/stored_payment_app.h" #include "third_party/WebKit/public/platform/modules/payments/payment_app.mojom.h" namespace content { @@ -32,9 +32,7 @@ // Please see: content/browser/payments/payment_app_provider_impl.cc static PaymentAppProvider* GetInstance(); - using Instruments = std::vector<std::unique_ptr<StoredPaymentInstrument>>; - using PaymentApps = std::map<GURL, Instruments>; - + using PaymentApps = std::map<GURL, std::unique_ptr<StoredPaymentApp>>; using GetAllPaymentAppsCallback = base::OnceCallback<void(PaymentApps)>; using InvokePaymentAppCallback = base::Callback<void(payments::mojom::PaymentAppResponsePtr)>;
diff --git a/content/public/browser/render_widget_host_view.h b/content/public/browser/render_widget_host_view.h index 725d7b06..995f917 100644 --- a/content/public/browser/render_widget_host_view.h +++ b/content/public/browser/render_widget_host_view.h
@@ -27,8 +27,8 @@ } namespace ui { -class TextInputClient; class AcceleratedWidgetMac; +class TextInputClient; } namespace content {
diff --git a/content/public/browser/stored_payment_app.cc b/content/public/browser/stored_payment_app.cc new file mode 100644 index 0000000..3ba73d28 --- /dev/null +++ b/content/public/browser/stored_payment_app.cc
@@ -0,0 +1,13 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/public/browser/stored_payment_app.h" + +namespace content { + +StoredPaymentApp::StoredPaymentApp() = default; + +StoredPaymentApp::~StoredPaymentApp() = default; + +} // namespace content \ No newline at end of file
diff --git a/content/public/browser/stored_payment_app.h b/content/public/browser/stored_payment_app.h new file mode 100644 index 0000000..4b298c0 --- /dev/null +++ b/content/public/browser/stored_payment_app.h
@@ -0,0 +1,42 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_BROWSER_STORED_PAYMENT_APP_H_ +#define CONTENT_PUBLIC_BROWSER_STORED_PAYMENT_APP_H_ + +#include <stdint.h> +#include <string> +#include <vector> + +#include "content/common/content_export.h" +#include "content/public/browser/stored_payment_instrument.h" +#include "third_party/skia/include/core/SkBitmap.h" +#include "url/origin.h" + +namespace content { + +// This class represents the stored payment app. +struct CONTENT_EXPORT StoredPaymentApp { + StoredPaymentApp(); + ~StoredPaymentApp(); + + // Id of the service worker registration this app is associated with. + int64_t registration_id = 0; + + // Origin of the payment app provider that provides this payment app. + url::Origin origin; + + // Label for this payment app. + std::string name; + + // Decoded icon for this payment app. + std::unique_ptr<SkBitmap> icon; + + // A list of one or more payment instruments in this payment app. + std::vector<std::unique_ptr<StoredPaymentInstrument>> instruments; +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_BROWSER_STORED_PAYMENT_APP_H_ \ No newline at end of file
diff --git a/content/public/browser/stored_payment_instrument.h b/content/public/browser/stored_payment_instrument.h index 5c0f64d..68600162 100644 --- a/content/public/browser/stored_payment_instrument.h +++ b/content/public/browser/stored_payment_instrument.h
@@ -20,9 +20,6 @@ StoredPaymentInstrument(); ~StoredPaymentInstrument(); - // Id of the service worker registration this instrument is associated with. - int64_t registration_id = 0; - // Id of this payment instrument. This key will be passed to the payment // handler to indicate the instrument selected by the user. std::string instrument_key;
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index f26cb21..102701f 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -146,10 +146,6 @@ const base::Feature kMediaStreamOldAudioConstraints{ "MediaStreamOldAudioConstraints", base::FEATURE_DISABLED_BY_DEFAULT}; -// Enables the old algorithm for processing video constraints in getUserMedia(). -const base::Feature kMediaStreamOldVideoConstraints{ - "MediaStreamOldVideoConstraints", base::FEATURE_DISABLED_BY_DEFAULT}; - // Enables the memory coordinator. // WARNING: // The memory coordinator is not ready for use and enabling this may cause @@ -249,6 +245,10 @@ const base::Feature kServiceWorkerNavigationPreload{ "ServiceWorkerNavigationPreload", base::FEATURE_ENABLED_BY_DEFAULT}; +// Streaming installed scripts on starting service workers. +const base::Feature kServiceWorkerScriptStreaming{ + "ServiceWorkerScriptStreaming", base::FEATURE_DISABLED_BY_DEFAULT}; + // http://tc39.github.io/ecmascript_sharedmem/shmem.html const base::Feature kSharedArrayBuffer{"SharedArrayBuffer", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index a198457..ca80540 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -45,7 +45,6 @@ CONTENT_EXPORT extern const base::Feature kLoadingWithMojo; CONTENT_EXPORT extern const base::Feature kMediaDocumentDownloadButton; CONTENT_EXPORT extern const base::Feature kMediaStreamOldAudioConstraints; -CONTENT_EXPORT extern const base::Feature kMediaStreamOldVideoConstraints; CONTENT_EXPORT extern const base::Feature kMemoryCoordinator; CONTENT_EXPORT extern const base::Feature kNotificationContentImage; CONTENT_EXPORT extern const base::Feature kMainThreadBusyScrollIntervention; @@ -67,6 +66,7 @@ kRequireSecureOriginsForPepperMediaRequests; CONTENT_EXPORT extern const base::Feature kScrollAnchoring; CONTENT_EXPORT extern const base::Feature kServiceWorkerNavigationPreload; +CONTENT_EXPORT extern const base::Feature kServiceWorkerScriptStreaming; CONTENT_EXPORT extern const base::Feature kSharedArrayBuffer; CONTENT_EXPORT extern const base::Feature kSkipCompositingSmallScrollers; CONTENT_EXPORT extern const base::Feature kSlimmingPaintInvalidation;
diff --git a/content/renderer/media/media_stream_center.cc b/content/renderer/media/media_stream_center.cc index e7d146a7..d6bb4c9 100644 --- a/content/renderer/media/media_stream_center.cc +++ b/content/renderer/media/media_stream_center.cc
@@ -68,23 +68,9 @@ MediaStreamVideoSource* native_source = MediaStreamVideoSource::GetVideoSource(source); DCHECK(native_source); - if (IsOldVideoConstraints()) { - // TODO(perkj): The constraints to use here should be passed from blink when - // a new track is created. For cloning, it should be the constraints of the - // cloned track and not the originating source. - // Also - source.constraints() returns an uninitialized constraint if the - // source is coming from a remote video track. See http://crbug/287805. - blink::WebMediaConstraints constraints = source.Constraints(); - if (constraints.IsNull()) - constraints.Initialize(); - track.SetTrackData(new MediaStreamVideoTrack( - native_source, constraints, - MediaStreamVideoSource::ConstraintsCallback(), track.IsEnabled())); - } else { - track.SetTrackData(new MediaStreamVideoTrack( - native_source, MediaStreamVideoSource::ConstraintsCallback(), - track.IsEnabled())); - } + track.SetTrackData(new MediaStreamVideoTrack( + native_source, MediaStreamVideoSource::ConstraintsCallback(), + track.IsEnabled())); } void CloneNativeVideoMediaStreamTrack( @@ -96,28 +82,14 @@ MediaStreamVideoSource* native_source = MediaStreamVideoSource::GetVideoSource(source); DCHECK(native_source); - if (IsOldVideoConstraints()) { - // TODO(perkj): The constraints to use here should be passed from blink when - // a new track is created. For cloning, it should be the constraints of the - // cloned track and not the originating source. - // Also - source.constraints() returns an uninitialized constraint if the - // source is coming from a remote video track. See http://crbug/287805. - blink::WebMediaConstraints constraints = source.Constraints(); - if (constraints.IsNull()) - constraints.Initialize(); - clone.SetTrackData(new MediaStreamVideoTrack( - native_source, constraints, - MediaStreamVideoSource::ConstraintsCallback(), clone.IsEnabled())); - } else { - MediaStreamVideoTrack* original_track = - MediaStreamVideoTrack::GetVideoTrack(original); - DCHECK(original_track); - clone.SetTrackData(new MediaStreamVideoTrack( - native_source, original_track->adapter_settings(), - original_track->noise_reduction(), original_track->is_screencast(), - original_track->min_frame_rate(), - MediaStreamVideoSource::ConstraintsCallback(), clone.IsEnabled())); - } + MediaStreamVideoTrack* original_track = + MediaStreamVideoTrack::GetVideoTrack(original); + DCHECK(original_track); + clone.SetTrackData(new MediaStreamVideoTrack( + native_source, original_track->adapter_settings(), + original_track->noise_reduction(), original_track->is_screencast(), + original_track->min_frame_rate(), + MediaStreamVideoSource::ConstraintsCallback(), clone.IsEnabled())); } } // namespace
diff --git a/content/renderer/media/media_stream_video_capturer_source.cc b/content/renderer/media/media_stream_video_capturer_source.cc index 1eccdda..f4d0568 100644 --- a/content/renderer/media/media_stream_video_capturer_source.cc +++ b/content/renderer/media/media_stream_video_capturer_source.cc
@@ -27,409 +27,6 @@ namespace { -// Resolutions used if the source doesn't support capability enumeration. -struct { - int width; - int height; -} const kVideoResolutions[] = {{1920, 1080}, - {1280, 720}, - {960, 720}, - {640, 480}, - {640, 360}, - {320, 240}, - {320, 180}}; - -// Frame rates for sources with no support for capability enumeration. -const int kVideoFrameRates[] = {30, 60}; - -// Hard upper-bound frame rate for tab/desktop capture. -const double kMaxScreenCastFrameRate = 120.0; - -// Allows the user to Override default power line frequency. -const char kPowerLineFrequency[] = "googPowerLineFrequency"; - -// Returns true if the value for width or height is reasonable. -bool DimensionValueIsValid(int x) { - return x > 0 && x <= media::limits::kMaxDimension; -} - -// Returns true if the value for frame rate is reasonable. -bool FrameRateValueIsValid(double frame_rate) { - return (frame_rate > (1.0 / 60.0)) && // Lower-bound: One frame per minute. - (frame_rate <= media::limits::kMaxFramesPerSecond); -} - -// Returns true if the aspect ratio of |a| and |b| are equivalent to two -// significant digits. -bool AreNearlyEquivalentInAspectRatio(const gfx::Size& a, const gfx::Size& b) { - DCHECK(!a.IsEmpty()); - DCHECK(!b.IsEmpty()); - const int aspect_ratio_a = (100 * a.width()) / a.height(); - const int aspect_ratio_b = (100 * b.width()) / b.height(); - return aspect_ratio_a == aspect_ratio_b; -} - -// Checks if |device_info|s type is a generated content, e.g. Tab or Desktop. -bool IsContentVideoCaptureDevice(const StreamDeviceInfo& device_info) { - return device_info.device.type == MEDIA_TAB_VIDEO_CAPTURE || - device_info.device.type == MEDIA_DESKTOP_VIDEO_CAPTURE; -} - -// Interprets the properties in |constraints| to override values in |params| and -// determine the resolution change policy. -void SetContentCaptureParamsFromConstraints( - const blink::WebMediaConstraints& constraints, - MediaStreamType type, - media::VideoCaptureParams* params) { - // The default resolution change policies for tab versus desktop capture are - // the way they are for legacy reasons. - if (type == MEDIA_TAB_VIDEO_CAPTURE) { - params->resolution_change_policy = - media::RESOLUTION_POLICY_FIXED_RESOLUTION; - } else if (type == MEDIA_DESKTOP_VIDEO_CAPTURE) { - params->resolution_change_policy = - media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT; - } else { - NOTREACHED(); - } - - // If the maximum frame resolution was provided in the constraints, use it if - // either: 1) none has been set yet; or 2) the maximum specificed is smaller - // than the current setting. - int width = 0; - int height = 0; - gfx::Size desired_max_frame_size; - if (GetConstraintMaxAsInteger( - constraints, &blink::WebMediaTrackConstraintSet::width, &width) && - GetConstraintMaxAsInteger( - constraints, &blink::WebMediaTrackConstraintSet::height, &height) && - DimensionValueIsValid(width) && DimensionValueIsValid(height)) { - desired_max_frame_size.SetSize(width, height); - if (params->requested_format.frame_size.IsEmpty() || - desired_max_frame_size.width() < - params->requested_format.frame_size.width() || - desired_max_frame_size.height() < - params->requested_format.frame_size.height()) { - params->requested_format.frame_size = desired_max_frame_size; - } - } - - // Set the default frame resolution if none was provided. - if (params->requested_format.frame_size.IsEmpty()) { - params->requested_format.frame_size.SetSize( - MediaStreamVideoSource::kDefaultWidth, - MediaStreamVideoSource::kDefaultHeight); - } - - // If the maximum frame rate was provided, use it if either: 1) none has been - // set yet; or 2) the maximum specificed is smaller than the current setting. - double frame_rate = 0.0; - if (GetConstraintMaxAsDouble(constraints, - &blink::WebMediaTrackConstraintSet::frame_rate, - &frame_rate) && - FrameRateValueIsValid(frame_rate)) { - if (params->requested_format.frame_rate <= 0.0f || - frame_rate < params->requested_format.frame_rate) { - params->requested_format.frame_rate = frame_rate; - } - } - - // Set the default frame rate if none was provided. - if (params->requested_format.frame_rate <= 0.0f) { - params->requested_format.frame_rate = - MediaStreamVideoSource::kDefaultFrameRate; - } - - // If the minimum frame resolution was provided, compare it to the maximum - // frame resolution to determine the intended resolution change policy. - if (!desired_max_frame_size.IsEmpty() && - GetConstraintMinAsInteger( - constraints, &blink::WebMediaTrackConstraintSet::width, &width) && - GetConstraintMinAsInteger( - constraints, &blink::WebMediaTrackConstraintSet::height, &height) && - width <= desired_max_frame_size.width() && - height <= desired_max_frame_size.height()) { - if (width == desired_max_frame_size.width() && - height == desired_max_frame_size.height()) { - // Constraints explicitly require a single frame resolution. - params->resolution_change_policy = - media::RESOLUTION_POLICY_FIXED_RESOLUTION; - } else if (DimensionValueIsValid(width) && - DimensionValueIsValid(height) && - AreNearlyEquivalentInAspectRatio(gfx::Size(width, height), - desired_max_frame_size)) { - // Constraints only mention a single aspect ratio. - params->resolution_change_policy = - media::RESOLUTION_POLICY_FIXED_ASPECT_RATIO; - } else { - // Constraints specify a minimum resolution that is smaller than the - // maximum resolution and has a different aspect ratio (possibly even - // 0x0). This indicates any frame resolution and aspect ratio is - // acceptable. - params->resolution_change_policy = - media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT; - } - } - - DVLOG(1) << __func__ << " " - << media::VideoCaptureFormat::ToString(params->requested_format) - << " with resolution change policy " - << params->resolution_change_policy; -} - -// Interprets the properties in |constraints| to override values in |params| and -// determine the power line frequency. -void SetPowerLineFrequencyParamFromConstraints( - const blink::WebMediaConstraints& constraints, - media::VideoCaptureParams* params) { - int freq; - params->power_line_frequency = media::PowerLineFrequency::FREQUENCY_DEFAULT; - if (!GetConstraintValueAsInteger( - constraints, - &blink::WebMediaTrackConstraintSet::goog_power_line_frequency, - &freq)) { - return; - } - if (freq == static_cast<int>(media::PowerLineFrequency::FREQUENCY_50HZ)) - params->power_line_frequency = media::PowerLineFrequency::FREQUENCY_50HZ; - else if (freq == static_cast<int>(media::PowerLineFrequency::FREQUENCY_60HZ)) - params->power_line_frequency = media::PowerLineFrequency::FREQUENCY_60HZ; -} - -// LegacyLocalVideoCapturerSource is a delegate used by -// MediaStreamVideoCapturerSource for local video capture. It uses the Render -// singleton VideoCaptureImplManager to start / stop and receive I420 frames -// from Chrome's video capture implementation. This is a main Render thread only -// object. -// TODO(guidou): Remove this class. http://crbug.com/706408 -class LegacyLocalVideoCapturerSource final : public media::VideoCapturerSource { - public: - explicit LegacyLocalVideoCapturerSource(const StreamDeviceInfo& device_info); - ~LegacyLocalVideoCapturerSource() override; - - // VideoCaptureDelegate Implementation. - void GetCurrentSupportedFormats( - int max_requested_width, - int max_requested_height, - double max_requested_frame_rate, - const VideoCaptureDeviceFormatsCB& callback) override; - media::VideoCaptureFormats GetPreferredFormats() override; - void StartCapture(const media::VideoCaptureParams& params, - const VideoCaptureDeliverFrameCB& new_frame_callback, - const RunningCallback& running_callback) override; - void RequestRefreshFrame() override; - void MaybeSuspend() override; - void Resume() override; - void StopCapture() override; - - private: - void OnStateUpdate(VideoCaptureState state); - void OnDeviceFormatsInUseReceived(const media::VideoCaptureFormats& formats); - void OnDeviceSupportedFormatsEnumerated( - const media::VideoCaptureFormats& formats); - - // |session_id_| identifies the capture device used for this capture session. - const media::VideoCaptureSessionId session_id_; - - VideoCaptureImplManager* const manager_; - - const base::Closure release_device_cb_; - - // Indicates if we are capturing generated content, e.g. Tab or Desktop. - const bool is_content_capture_; - - // These two are valid between StartCapture() and StopCapture(). - // |running_call_back_| is run when capture is successfully started, and when - // it is stopped or error happens. - RunningCallback running_callback_; - base::Closure stop_capture_cb_; - - // Placeholder keeping the callback between asynchronous device enumeration - // calls. - VideoCaptureDeviceFormatsCB formats_enumerated_callback_; - - // Bound to the main render thread. - base::ThreadChecker thread_checker_; - - base::WeakPtrFactory<LegacyLocalVideoCapturerSource> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(LegacyLocalVideoCapturerSource); -}; - -LegacyLocalVideoCapturerSource::LegacyLocalVideoCapturerSource( - const StreamDeviceInfo& device_info) - : session_id_(device_info.session_id), - manager_(RenderThreadImpl::current()->video_capture_impl_manager()), - release_device_cb_(manager_->UseDevice(session_id_)), - is_content_capture_(IsContentVideoCaptureDevice(device_info)), - weak_factory_(this) { - DCHECK(RenderThreadImpl::current()); -} - -LegacyLocalVideoCapturerSource::~LegacyLocalVideoCapturerSource() { - DCHECK(thread_checker_.CalledOnValidThread()); - release_device_cb_.Run(); -} - -void LegacyLocalVideoCapturerSource::GetCurrentSupportedFormats( - int max_requested_width, - int max_requested_height, - double max_requested_frame_rate, - const VideoCaptureDeviceFormatsCB& callback) { - DVLOG(3) << "GetCurrentSupportedFormats({ max_requested_height = " - << max_requested_height << "}) { max_requested_width = " - << max_requested_width << "}) { max_requested_frame_rate = " - << max_requested_frame_rate << "})"; - DCHECK(thread_checker_.CalledOnValidThread()); - - if (is_content_capture_) { - const int width = max_requested_width ? - max_requested_width : MediaStreamVideoSource::kDefaultWidth; - const int height = max_requested_height ? - max_requested_height : MediaStreamVideoSource::kDefaultHeight; - callback.Run(media::VideoCaptureFormats( - 1, media::VideoCaptureFormat( - gfx::Size(width, height), - static_cast<float>( - std::min(kMaxScreenCastFrameRate, max_requested_frame_rate)), - media::PIXEL_FORMAT_I420))); - return; - } - - DCHECK(formats_enumerated_callback_.is_null()); - formats_enumerated_callback_ = callback; - manager_->GetDeviceFormatsInUse( - session_id_, - media::BindToCurrentLoop(base::Bind( - &LegacyLocalVideoCapturerSource::OnDeviceFormatsInUseReceived, - weak_factory_.GetWeakPtr()))); -} - -media::VideoCaptureFormats -LegacyLocalVideoCapturerSource::GetPreferredFormats() { - return media::VideoCaptureFormats(); -} - -void LegacyLocalVideoCapturerSource::StartCapture( - const media::VideoCaptureParams& params, - const VideoCaptureDeliverFrameCB& new_frame_callback, - const RunningCallback& running_callback) { - DCHECK(params.requested_format.IsValid()); - DCHECK(thread_checker_.CalledOnValidThread()); - running_callback_ = running_callback; - - stop_capture_cb_ = - manager_->StartCapture(session_id_, params, - media::BindToCurrentLoop(base::Bind( - &LegacyLocalVideoCapturerSource::OnStateUpdate, - weak_factory_.GetWeakPtr())), - new_frame_callback); -} - -void LegacyLocalVideoCapturerSource::RequestRefreshFrame() { - DVLOG(3) << __func__; - DCHECK(thread_checker_.CalledOnValidThread()); - if (stop_capture_cb_.is_null()) - return; // Do not request frames if the source is stopped. - manager_->RequestRefreshFrame(session_id_); -} - -void LegacyLocalVideoCapturerSource::MaybeSuspend() { - DVLOG(3) << __func__; - DCHECK(thread_checker_.CalledOnValidThread()); - manager_->Suspend(session_id_); -} - -void LegacyLocalVideoCapturerSource::Resume() { - DVLOG(3) << __func__; - DCHECK(thread_checker_.CalledOnValidThread()); - manager_->Resume(session_id_); -} - -void LegacyLocalVideoCapturerSource::StopCapture() { - DVLOG(3) << __func__; - DCHECK(thread_checker_.CalledOnValidThread()); - // Immediately make sure we don't provide more frames. - if (!stop_capture_cb_.is_null()) - base::ResetAndReturn(&stop_capture_cb_).Run(); - running_callback_.Reset(); - // Invalidate any potential format enumerations going on. - formats_enumerated_callback_.Reset(); -} - -void LegacyLocalVideoCapturerSource::OnStateUpdate(VideoCaptureState state) { - DVLOG(3) << __func__ << " state = " << state; - DCHECK(thread_checker_.CalledOnValidThread()); - if (running_callback_.is_null()) - return; - switch (state) { - case VIDEO_CAPTURE_STATE_STARTED: - running_callback_.Run(true); - break; - - case VIDEO_CAPTURE_STATE_STOPPING: - case VIDEO_CAPTURE_STATE_STOPPED: - case VIDEO_CAPTURE_STATE_ERROR: - case VIDEO_CAPTURE_STATE_ENDED: - base::ResetAndReturn(&running_callback_).Run(false); - break; - - case VIDEO_CAPTURE_STATE_STARTING: - case VIDEO_CAPTURE_STATE_PAUSED: - case VIDEO_CAPTURE_STATE_RESUMED: - // Not applicable to reporting on device starts or errors. - break; - } -} - -void LegacyLocalVideoCapturerSource::OnDeviceFormatsInUseReceived( - const media::VideoCaptureFormats& formats_in_use) { - DVLOG(3) << __func__ << ", #formats received: " << formats_in_use.size(); - DCHECK(thread_checker_.CalledOnValidThread()); - // StopCapture() might have destroyed |formats_enumerated_callback_| before - // arriving here. - if (formats_enumerated_callback_.is_null()) - return; - if (formats_in_use.size()) { - base::ResetAndReturn(&formats_enumerated_callback_).Run(formats_in_use); - return; - } - - // The device doesn't seem to have formats in use so try and retrieve the - // whole list of supported ones. - manager_->GetDeviceSupportedFormats( - session_id_, - media::BindToCurrentLoop(base::Bind( - &LegacyLocalVideoCapturerSource::OnDeviceSupportedFormatsEnumerated, - weak_factory_.GetWeakPtr()))); -} - -void LegacyLocalVideoCapturerSource::OnDeviceSupportedFormatsEnumerated( - const media::VideoCaptureFormats& formats) { - DVLOG(3) << __func__ << ", #formats received: " << formats.size(); - DCHECK(thread_checker_.CalledOnValidThread()); - // StopCapture() might have destroyed |formats_enumerated_callback_| before - // arriving here. - if (formats_enumerated_callback_.is_null()) - return; - if (formats.size()) { - base::ResetAndReturn(&formats_enumerated_callback_).Run(formats); - return; - } - - // The capture device doesn't seem to support capability enumeration, compose - // a fallback list of capabilities. - media::VideoCaptureFormats default_formats; - for (const auto& resolution : kVideoResolutions) { - for (const auto frame_rate : kVideoFrameRates) { - default_formats.push_back(media::VideoCaptureFormat( - gfx::Size(resolution.width, resolution.height), frame_rate, - media::PIXEL_FORMAT_I420)); - } - } - base::ResetAndReturn(&formats_enumerated_callback_).Run(default_formats); -} - // LocalVideoCapturerSource is a delegate used by MediaStreamVideoCapturerSource // for local video capture. It uses the Render singleton VideoCaptureImplManager // to start / stop and receive I420 frames from Chrome's video capture @@ -563,35 +160,20 @@ const SourceStoppedCallback& stop_callback, std::unique_ptr<media::VideoCapturerSource> source) : RenderFrameObserver(nullptr), source_(std::move(source)) { - if (!IsOldVideoConstraints()) { - media::VideoCaptureFormats preferred_formats = - source_->GetPreferredFormats(); - if (!preferred_formats.empty()) - capture_params_.requested_format = preferred_formats.front(); - } + media::VideoCaptureFormats preferred_formats = source_->GetPreferredFormats(); + if (!preferred_formats.empty()) + capture_params_.requested_format = preferred_formats.front(); SetStopCallback(stop_callback); } MediaStreamVideoCapturerSource::MediaStreamVideoCapturerSource( const SourceStoppedCallback& stop_callback, const StreamDeviceInfo& device_info, - RenderFrame* render_frame) - : RenderFrameObserver(render_frame), - source_(new LegacyLocalVideoCapturerSource(device_info)) { - DCHECK(IsOldVideoConstraints()); - SetStopCallback(stop_callback); - SetDeviceInfo(device_info); -} - -MediaStreamVideoCapturerSource::MediaStreamVideoCapturerSource( - const SourceStoppedCallback& stop_callback, - const StreamDeviceInfo& device_info, const media::VideoCaptureParams& capture_params, RenderFrame* render_frame) : RenderFrameObserver(render_frame), source_(new LocalVideoCapturerSource(device_info)), capture_params_(capture_params) { - DCHECK(!IsOldVideoConstraints()); SetStopCallback(stop_callback); SetDeviceInfo(device_info); } @@ -631,16 +213,6 @@ const media::VideoCaptureFormat& format, const blink::WebMediaConstraints& constraints, const VideoCaptureDeliverFrameCB& frame_callback) { - if (IsOldVideoConstraints()) { - capture_params_.requested_format = format; - if (IsContentVideoCaptureDevice(device_info())) { - SetContentCaptureParamsFromConstraints( - constraints, device_info().device.type, &capture_params_); - } else if (device_info().device.type == MEDIA_DEVICE_VIDEO_CAPTURE) { - SetPowerLineFrequencyParamFromConstraints(constraints, &capture_params_); - } - } - is_capture_starting_ = true; source_->StartCapture( capture_params_, frame_callback, @@ -654,7 +226,6 @@ base::Optional<media::VideoCaptureFormat> MediaStreamVideoCapturerSource::GetCurrentFormatImpl() const { - DCHECK(!IsOldVideoConstraints()); return base::Optional<media::VideoCaptureFormat>( capture_params_.requested_format); } @@ -669,9 +240,4 @@ } } -const char* -MediaStreamVideoCapturerSource::GetPowerLineFrequencyForTesting() const { - return kPowerLineFrequency; -} - } // namespace content
diff --git a/content/renderer/media/media_stream_video_capturer_source.h b/content/renderer/media/media_stream_video_capturer_source.h index df70468..ee8abe2 100644 --- a/content/renderer/media/media_stream_video_capturer_source.h +++ b/content/renderer/media/media_stream_video_capturer_source.h
@@ -32,10 +32,6 @@ MediaStreamVideoCapturerSource( const SourceStoppedCallback& stop_callback, std::unique_ptr<media::VideoCapturerSource> source); - // TODO(guidou): Remove this constructor. http://crbug.com/706408 - MediaStreamVideoCapturerSource(const SourceStoppedCallback& stop_callback, - const StreamDeviceInfo& device_info, - RenderFrame* render_frame); MediaStreamVideoCapturerSource( const SourceStoppedCallback& stop_callback, const StreamDeviceInfo& device_info, @@ -71,8 +67,6 @@ // Method to bind as RunningCallback in VideoCapturerSource::StartCapture(). void OnRunStateChanged(bool is_running); - const char* GetPowerLineFrequencyForTesting() const; - // The source that provides video frames. const std::unique_ptr<media::VideoCapturerSource> source_;
diff --git a/content/renderer/media/media_stream_video_capturer_source_unittest.cc b/content/renderer/media/media_stream_video_capturer_source_unittest.cc index e4cffd65..11efe04 100644 --- a/content/renderer/media/media_stream_video_capturer_source_unittest.cc +++ b/content/renderer/media/media_stream_video_capturer_source_unittest.cc
@@ -12,13 +12,10 @@ #include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/strings/utf_string_conversions.h" -#include "base/test/scoped_feature_list.h" #include "base/test/scoped_task_environment.h" #include "content/child/child_process.h" -#include "content/public/common/content_features.h" #include "content/public/renderer/media_stream_video_sink.h" #include "content/renderer/media/media_stream_video_track.h" -#include "content/renderer/media/mock_constraint_factory.h" #include "content/renderer/media/video_track_adapter.h" #include "media/base/bind_to_current_loop.h" #include "testing/gmock/include/gmock/gmock.h" @@ -110,10 +107,7 @@ child_process_(new ChildProcess()), source_(nullptr), delegate_(nullptr), - source_stopped_(false) { - scoped_feature_list_.InitAndDisableFeature( - features::kMediaStreamOldVideoConstraints); - } + source_stopped_(false) {} void TearDown() override { webkit_source_.Reset(); @@ -138,18 +132,6 @@ webkit_source_id_ = webkit_source_.Id(); } - MockConstraintFactory* constraint_factory() { return &constraint_factory_; } - - blink::WebMediaStreamTrack StartSource() { - bool enabled = true; - // CreateVideoTrack will trigger OnConstraintsApplied. - return MediaStreamVideoTrack::CreateVideoTrack( - source_, constraint_factory_.CreateWebMediaConstraints(), - base::Bind(&MediaStreamVideoCapturerSourceTest::OnConstraintsApplied, - base::Unretained(this)), - enabled); - } - blink::WebMediaStreamTrack StartSource( const VideoTrackAdapterSettings& adapter_settings, const base::Optional<bool>& noise_reduction, @@ -167,10 +149,6 @@ MockVideoCapturerSource& mock_delegate() { return *delegate_; } - const char* GetPowerLineFrequencyForTesting() const { - return source_->GetPowerLineFrequencyForTesting(); - } - void OnSourceStopped(const blink::WebMediaStreamSource& source) { source_stopped_ = true; EXPECT_EQ(source.Id(), webkit_source_id_); @@ -192,8 +170,6 @@ MockVideoCapturerSource* delegate_; // owned by |source|. blink::WebString webkit_source_id_; bool source_stopped_; - MockConstraintFactory constraint_factory_; - base::test::ScopedFeatureList scoped_feature_list_; }; TEST_F(MediaStreamVideoCapturerSourceTest, StartAndStop) { @@ -287,339 +263,4 @@ EXPECT_EQ(30.0, metadata_value); } -class MediaStreamVideoCapturerSourceOldConstraintsTest : public testing::Test { - public: - MediaStreamVideoCapturerSourceOldConstraintsTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), - child_process_(new ChildProcess()), - source_(nullptr), - delegate_(nullptr), - source_stopped_(false) { - scoped_feature_list_.InitAndEnableFeature( - features::kMediaStreamOldVideoConstraints); - } - - void TearDown() override { - webkit_source_.Reset(); - blink::WebHeap::CollectAllGarbageForTesting(); - } - - void InitWithDeviceInfo(const StreamDeviceInfo& device_info) { - std::unique_ptr<MockVideoCapturerSource> delegate( - new MockVideoCapturerSource()); - delegate_ = delegate.get(); - source_ = new MediaStreamVideoCapturerSource( - base::Bind( - &MediaStreamVideoCapturerSourceOldConstraintsTest::OnSourceStopped, - base::Unretained(this)), - std::move(delegate)); - source_->SetDeviceInfo(device_info); - - webkit_source_.Initialize(blink::WebString::FromASCII("dummy_source_id"), - blink::WebMediaStreamSource::kTypeVideo, - blink::WebString::FromASCII("dummy_source_name"), - false /* remote */); - webkit_source_.SetExtraData(source_); - webkit_source_id_ = webkit_source_.Id(); - } - - MockConstraintFactory* constraint_factory() { return &constraint_factory_; } - - blink::WebMediaStreamTrack StartSource() { - bool enabled = true; - // CreateVideoTrack will trigger OnConstraintsApplied. - return MediaStreamVideoTrack::CreateVideoTrack( - source_, constraint_factory_.CreateWebMediaConstraints(), - base::Bind(&MediaStreamVideoCapturerSourceOldConstraintsTest:: - OnConstraintsApplied, - base::Unretained(this)), - enabled); - } - - blink::WebMediaStreamTrack StartSource( - const VideoTrackAdapterSettings& adapter_settings, - const base::Optional<bool>& noise_reduction, - bool is_screencast, - double min_frame_rate) { - bool enabled = true; - // CreateVideoTrack will trigger OnConstraintsApplied. - return MediaStreamVideoTrack::CreateVideoTrack( - source_, adapter_settings, noise_reduction, is_screencast, - min_frame_rate, - base::Bind(&MediaStreamVideoCapturerSourceOldConstraintsTest:: - OnConstraintsApplied, - base::Unretained(this)), - enabled); - } - - MockVideoCapturerSource& mock_delegate() { return *delegate_; } - - const char* GetPowerLineFrequencyForTesting() const { - return source_->GetPowerLineFrequencyForTesting(); - } - - void OnSourceStopped(const blink::WebMediaStreamSource& source) { - source_stopped_ = true; - EXPECT_EQ(source.Id(), webkit_source_id_); - } - void OnStarted(bool result) { source_->OnRunStateChanged(result); } - - protected: - void OnConstraintsApplied(MediaStreamSource* source, - MediaStreamRequestResult result, - const blink::WebString& result_name) {} - - // A ChildProcess and a MessageLoopForUI are both needed to fool the Tracks - // and Sources below into believing they are on the right threads. - base::test::ScopedTaskEnvironment scoped_task_environment_; - std::unique_ptr<ChildProcess> child_process_; - - blink::WebMediaStreamSource webkit_source_; - MediaStreamVideoCapturerSource* source_; // owned by |webkit_source_|. - MockVideoCapturerSource* delegate_; // owned by |source|. - blink::WebString webkit_source_id_; - bool source_stopped_; - MockConstraintFactory constraint_factory_; - base::test::ScopedFeatureList scoped_feature_list_; -}; - -TEST_F(MediaStreamVideoCapturerSourceOldConstraintsTest, - TabCaptureFixedResolutionByDefault) { - StreamDeviceInfo device_info; - device_info.device.type = MEDIA_TAB_VIDEO_CAPTURE; - InitWithDeviceInfo(device_info); - - // No constraints are being provided to the implementation, so expect only - // default values. - media::VideoCaptureParams expected_params; - expected_params.requested_format.frame_size.SetSize( - MediaStreamVideoSource::kDefaultWidth, - MediaStreamVideoSource::kDefaultHeight); - expected_params.requested_format.frame_rate = - MediaStreamVideoSource::kDefaultFrameRate; - expected_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; - expected_params.resolution_change_policy = - media::RESOLUTION_POLICY_FIXED_RESOLUTION; - - InSequence s; - EXPECT_CALL(mock_delegate(), GetCurrentSupportedFormats(_, _, _, _)); - EXPECT_CALL(mock_delegate(), StartCapture(expected_params, _, _)); - blink::WebMediaStreamTrack track = StartSource(); - // When the track goes out of scope, the source will be stopped. - EXPECT_CALL(mock_delegate(), StopCapture()); -} - -TEST_F(MediaStreamVideoCapturerSourceOldConstraintsTest, - DesktopCaptureAllowAnyResolutionChangeByDefault) { - StreamDeviceInfo device_info; - device_info.device.type = MEDIA_DESKTOP_VIDEO_CAPTURE; - InitWithDeviceInfo(device_info); - - // No constraints are being provided to the implementation, so expect only - // default values. - media::VideoCaptureParams expected_params; - expected_params.requested_format.frame_size.SetSize( - MediaStreamVideoSource::kDefaultWidth, - MediaStreamVideoSource::kDefaultHeight); - expected_params.requested_format.frame_rate = - MediaStreamVideoSource::kDefaultFrameRate; - expected_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; - expected_params.resolution_change_policy = - media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT; - - InSequence s; - EXPECT_CALL(mock_delegate(), GetCurrentSupportedFormats(_, _, _, _)); - EXPECT_CALL(mock_delegate(), StartCapture(expected_params, _, _)); - blink::WebMediaStreamTrack track = StartSource(); - // When the track goes out of scope, the source will be stopped. - EXPECT_CALL(mock_delegate(), StopCapture()); -} - -TEST_F(MediaStreamVideoCapturerSourceOldConstraintsTest, - TabCaptureConstraintsImplyFixedAspectRatio) { - StreamDeviceInfo device_info; - device_info.device.type = MEDIA_TAB_VIDEO_CAPTURE; - InitWithDeviceInfo(device_info); - - // Specify max and min size constraints that have the same ~16:9 aspect ratio. - constraint_factory()->basic().width.SetMax(1920); - constraint_factory()->basic().height.SetMax(1080); - constraint_factory()->basic().width.SetMin(854); - constraint_factory()->basic().height.SetMin(480); - constraint_factory()->basic().frame_rate.SetMax(60.0); - - media::VideoCaptureParams expected_params; - expected_params.requested_format.frame_size.SetSize(1920, 1080); - expected_params.requested_format.frame_rate = 60.0; - expected_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; - expected_params.resolution_change_policy = - media::RESOLUTION_POLICY_FIXED_ASPECT_RATIO; - - InSequence s; - EXPECT_CALL(mock_delegate(), GetCurrentSupportedFormats(_, _, _, _)); - EXPECT_CALL( - mock_delegate(), - StartCapture( - testing::Field(&media::VideoCaptureParams::resolution_change_policy, - media::RESOLUTION_POLICY_FIXED_ASPECT_RATIO), - _, _)); - blink::WebMediaStreamTrack track = StartSource(); - // When the track goes out of scope, the source will be stopped. - EXPECT_CALL(mock_delegate(), StopCapture()); -} - -TEST_F(MediaStreamVideoCapturerSourceOldConstraintsTest, - TabCaptureConstraintsImplyAllowingAnyResolutionChange) { - StreamDeviceInfo device_info; - device_info.device.type = MEDIA_TAB_VIDEO_CAPTURE; - InitWithDeviceInfo(device_info); - - // Specify max and min size constraints with different aspect ratios. - constraint_factory()->basic().width.SetMax(1920); - constraint_factory()->basic().height.SetMax(1080); - constraint_factory()->basic().width.SetMin(0); - constraint_factory()->basic().height.SetMin(0); - constraint_factory()->basic().frame_rate.SetMax(60.0); - - media::VideoCaptureParams expected_params; - expected_params.requested_format.frame_size.SetSize(1920, 1080); - expected_params.requested_format.frame_rate = 60.0; - expected_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; - expected_params.resolution_change_policy = - media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT; - - InSequence s; - EXPECT_CALL(mock_delegate(), GetCurrentSupportedFormats(_, _, _, _)); - EXPECT_CALL( - mock_delegate(), - StartCapture( - testing::Field(&media::VideoCaptureParams::resolution_change_policy, - media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT), - _, _)); - blink::WebMediaStreamTrack track = StartSource(); - // When the track goes out of scope, the source will be stopped. - EXPECT_CALL(mock_delegate(), StopCapture()); -} - -TEST_F(MediaStreamVideoCapturerSourceOldConstraintsTest, - DeviceCaptureConstraintsSupportPowerLineFrequency) { - for (int frequency = -100; frequency < 100; ++frequency) { - StreamDeviceInfo device_info; - device_info.device.type = MEDIA_DEVICE_VIDEO_CAPTURE; - InitWithDeviceInfo(device_info); - constraint_factory_.Reset(); - - constraint_factory()->AddAdvanced().goog_power_line_frequency.SetExact( - frequency); - - media::VideoCaptureParams expected_params; - expected_params.requested_format.frame_size.SetSize( - MediaStreamVideoSource::kDefaultWidth, - MediaStreamVideoSource::kDefaultHeight); - expected_params.requested_format.frame_rate = - MediaStreamVideoSource::kDefaultFrameRate; - expected_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; - expected_params.resolution_change_policy = - media::RESOLUTION_POLICY_FIXED_RESOLUTION; - if (frequency == 50) { - expected_params.power_line_frequency = - media::PowerLineFrequency::FREQUENCY_50HZ; - } else if (frequency == 60) { - expected_params.power_line_frequency = - media::PowerLineFrequency::FREQUENCY_60HZ; - } else { - expected_params.power_line_frequency = - media::PowerLineFrequency::FREQUENCY_DEFAULT; - } - - InSequence s; - EXPECT_CALL(mock_delegate(), GetCurrentSupportedFormats(_, _, _, _)); - EXPECT_CALL(mock_delegate(), StartCapture(expected_params, _, _)); - blink::WebMediaStreamTrack track = StartSource(); - // When the track goes out of scope, the source will be stopped. - EXPECT_CALL(mock_delegate(), StopCapture()); - } -} - -TEST_F(MediaStreamVideoCapturerSourceOldConstraintsTest, Ended) { - std::unique_ptr<MockVideoCapturerSource> delegate( - new MockVideoCapturerSource()); - delegate_ = delegate.get(); - source_ = new MediaStreamVideoCapturerSource( - base::Bind( - &MediaStreamVideoCapturerSourceOldConstraintsTest::OnSourceStopped, - base::Unretained(this)), - std::move(delegate)); - webkit_source_.Initialize(blink::WebString::FromASCII("dummy_source_id"), - blink::WebMediaStreamSource::kTypeVideo, - blink::WebString::FromASCII("dummy_source_name"), - false /* remote */); - webkit_source_.SetExtraData(source_); - webkit_source_id_ = webkit_source_.Id(); - - InSequence s; - EXPECT_CALL(mock_delegate(), GetCurrentSupportedFormats(_, _, _, _)); - EXPECT_CALL(mock_delegate(), StartCapture(_, _, _)); - blink::WebMediaStreamTrack track = StartSource(); - base::RunLoop().RunUntilIdle(); - - OnStarted(true); - base::RunLoop().RunUntilIdle(); - EXPECT_EQ(blink::WebMediaStreamSource::kReadyStateLive, - webkit_source_.GetReadyState()); - - EXPECT_FALSE(source_stopped_); - - EXPECT_CALL(mock_delegate(), StopCapture()); - OnStarted(false); - base::RunLoop().RunUntilIdle(); - EXPECT_EQ(blink::WebMediaStreamSource::kReadyStateEnded, - webkit_source_.GetReadyState()); - // Verify that MediaStreamSource::SourceStoppedCallback has been triggered. - EXPECT_TRUE(source_stopped_); -} - -TEST_F(MediaStreamVideoCapturerSourceOldConstraintsTest, - CaptureTimeAndMetadataPlumbing) { - StreamDeviceInfo device_info; - device_info.device.type = MEDIA_DESKTOP_VIDEO_CAPTURE; - InitWithDeviceInfo(device_info); - - VideoCaptureDeliverFrameCB deliver_frame_cb; - media::VideoCapturerSource::RunningCallback running_cb; - - InSequence s; - EXPECT_CALL(mock_delegate(), GetCurrentSupportedFormats(_, _, _, _)); - EXPECT_CALL(mock_delegate(), StartCapture(_, _, _)) - .WillOnce(testing::DoAll(testing::SaveArg<1>(&deliver_frame_cb), - testing::SaveArg<2>(&running_cb))); - EXPECT_CALL(mock_delegate(), RequestRefreshFrame()); - EXPECT_CALL(mock_delegate(), StopCapture()); - blink::WebMediaStreamTrack track = StartSource(); - running_cb.Run(true); - - base::RunLoop run_loop; - base::TimeTicks reference_capture_time = - base::TimeTicks::FromInternalValue(60013); - base::TimeTicks capture_time; - media::VideoFrameMetadata metadata; - FakeMediaStreamVideoSink fake_sink( - &capture_time, &metadata, - media::BindToCurrentLoop(run_loop.QuitClosure())); - fake_sink.ConnectToTrack(track); - const scoped_refptr<media::VideoFrame> frame = - media::VideoFrame::CreateBlackFrame(gfx::Size(2, 2)); - frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE, 30.0); - child_process_->io_task_runner()->PostTask( - FROM_HERE, base::Bind(deliver_frame_cb, frame, reference_capture_time)); - run_loop.Run(); - fake_sink.DisconnectFromTrack(); - EXPECT_EQ(reference_capture_time, capture_time); - double metadata_value; - EXPECT_TRUE(metadata.GetDouble(media::VideoFrameMetadata::FRAME_RATE, - &metadata_value)); - EXPECT_EQ(30.0, metadata_value); -} - } // namespace content
diff --git a/content/renderer/media/media_stream_video_source.cc b/content/renderer/media/media_stream_video_source.cc index a9e158a..54852968b 100644 --- a/content/renderer/media/media_stream_video_source.cc +++ b/content/renderer/media/media_stream_video_source.cc
@@ -23,299 +23,6 @@ namespace content { -namespace { - -const char* const kLegalVideoConstraints[] = {"width", - "height", - "aspectRatio", - "frameRate", - "facingMode", - "deviceId", - "groupId", - "mediaStreamSource", - "googNoiseReduction", - "videoKind"}; - -// Returns true if |constraint| has mandatory constraints. -bool HasMandatoryConstraints(const blink::WebMediaConstraints& constraints) { - return constraints.Basic().HasMandatory(); -} - -// Retrieve the desired max width and height from |constraints|. If not set, -// the |desired_width| and |desired_height| are set to -// std::numeric_limits<int>::max(); -// If either max or exact width or height is set as a mandatory constraint, -// the advanced constraints are not checked. -void GetDesiredMaxWidthAndHeight(const blink::WebMediaConstraints& constraints, - int* desired_width, int* desired_height) { - *desired_width = std::numeric_limits<int>::max(); - *desired_height = std::numeric_limits<int>::max(); - - const auto& basic_constraints = constraints.Basic(); - - if (basic_constraints.width.HasMax() || basic_constraints.height.HasMax() || - basic_constraints.width.HasExact() || - basic_constraints.height.HasExact()) { - if (basic_constraints.width.HasMax()) - *desired_width = basic_constraints.width.Max(); - if (basic_constraints.height.HasMax()) - *desired_height = basic_constraints.height.Max(); - // Exact constraints override max constraints if both are specified. - // Specifying both in the same structure is meaningless. - if (basic_constraints.width.HasExact()) - *desired_width = basic_constraints.width.Exact(); - if (basic_constraints.height.HasExact()) - *desired_height = basic_constraints.height.Exact(); - return; - } - - for (const auto& constraint_set : constraints.Advanced()) { - if (constraint_set.width.HasMax()) - *desired_width = constraint_set.width.Max(); - if (constraint_set.height.HasMax()) - *desired_height = constraint_set.height.Max(); - if (constraint_set.width.HasExact()) - *desired_width = constraint_set.width.Exact(); - if (constraint_set.height.HasExact()) - *desired_height = constraint_set.height.Exact(); - } -} - -// Retrieve the desired max and min aspect ratio from |constraints|. If not set, -// the |min_aspect_ratio| is set to 0 and |max_aspect_ratio| is set to -// std::numeric_limits<double>::max(); -// If either min or max aspect ratio is set as a mandatory constraint, the -// optional constraints are not checked. -void GetDesiredMinAndMaxAspectRatio( - const blink::WebMediaConstraints& constraints, - double* min_aspect_ratio, - double* max_aspect_ratio) { - *min_aspect_ratio = 0; - *max_aspect_ratio = std::numeric_limits<double>::max(); - - if (constraints.Basic().aspect_ratio.HasMin() || - constraints.Basic().aspect_ratio.HasMax()) { - if (constraints.Basic().aspect_ratio.HasMin()) - *min_aspect_ratio = constraints.Basic().aspect_ratio.Min(); - if (constraints.Basic().aspect_ratio.HasMax()) - *max_aspect_ratio = constraints.Basic().aspect_ratio.Max(); - return; - // Note - the code will ignore attempts at successive refinement - // of the aspect ratio with advanced constraint. This may be wrong. - } - // Note - the code below will potentially pick min and max from different - // constraint sets, some of which might have been ignored. - for (const auto& constraint_set : constraints.Advanced()) { - if (constraint_set.aspect_ratio.HasMin()) { - *min_aspect_ratio = constraint_set.aspect_ratio.Min(); - break; - } - } - for (const auto& constraint_set : constraints.Advanced()) { - // Advanced constraint sets with max aspect ratio 0 are unsatisfiable and - // must be ignored. - if (constraint_set.aspect_ratio.HasMax() && - constraint_set.aspect_ratio.Max() > 0) { - *max_aspect_ratio = constraint_set.aspect_ratio.Max(); - break; - } - } -} - -// Returns true if |constraints| are fulfilled. |format| can be changed by a -// constraint, e.g. the frame rate can be changed by setting maxFrameRate. -bool UpdateFormatForConstraints( - const blink::WebMediaTrackConstraintSet& constraints, - media::VideoCaptureFormat* format, - std::string* failing_constraint_name) { - DCHECK(format != NULL); - - if (!format->IsValid()) - return false; - - // The width and height are matched based on cropping occuring later: - // min width/height has to be >= the size of the frame (no upscale). - // max width/height just has to be > 0 (we can crop anything too large). - if ((constraints.width.HasMin() && - constraints.width.Min() > format->frame_size.width()) || - (constraints.width.HasMax() && constraints.width.Max() <= 0) || - (constraints.width.HasExact() && - constraints.width.Exact() > format->frame_size.width())) { - *failing_constraint_name = constraints.width.GetName(); - } else if ((constraints.height.HasMin() && - constraints.height.Min() > format->frame_size.height()) || - (constraints.height.HasMax() && constraints.height.Max() <= 0) || - (constraints.height.HasExact() && - constraints.height.Exact() > format->frame_size.height())) { - *failing_constraint_name = constraints.height.GetName(); - } else if (constraints.video_kind.HasExact() && - !constraints.video_kind.Matches(GetVideoKindForFormat(*format))) { - *failing_constraint_name = constraints.video_kind.GetName(); - } else if (!constraints.frame_rate.Matches(format->frame_rate)) { - if (constraints.frame_rate.HasMax()) { - const double value = constraints.frame_rate.Max(); - // TODO(hta): Check if handling of max = 0.0 is relevant. - // (old handling was to set rate to 1.0 if 0.0 was specified) - if (constraints.frame_rate.Matches(value)) { - format->frame_rate = - (format->frame_rate > value) ? value : format->frame_rate; - return true; - } - } - *failing_constraint_name = constraints.frame_rate.GetName(); - } else { - return true; - } - - DCHECK(!failing_constraint_name->empty()); - return false; -} - -// Removes media::VideoCaptureFormats from |formats| that don't meet -// |constraints|. -void FilterFormatsByConstraints( - const blink::WebMediaTrackConstraintSet& constraints, - media::VideoCaptureFormats* formats, - std::string* failing_constraint_name) { - media::VideoCaptureFormats::iterator format_it = formats->begin(); - while (format_it != formats->end()) { - // Modify |format_it| to fulfill the constraint if possible. - // Delete it otherwise. - if (!UpdateFormatForConstraints(constraints, &(*format_it), - failing_constraint_name)) { - DVLOG(2) << "Format filter: Discarding format " - << format_it->frame_size.width() << "x" - << format_it->frame_size.height() << "@" - << format_it->frame_rate; - format_it = formats->erase(format_it); - } else { - ++format_it; - } - } -} - -// Returns the media::VideoCaptureFormats that matches |constraints|. -// If the return value is empty, and the reason is a specific constraint, -// |unsatisfied_constraint| returns the name of the constraint. -media::VideoCaptureFormats FilterFormats( - const blink::WebMediaConstraints& constraints, - const media::VideoCaptureFormats& supported_formats, - std::string* unsatisfied_constraint) { - if (constraints.IsNull()) - return supported_formats; - - const auto& basic = constraints.Basic(); - - // Do some checks that won't be done when filtering candidates. - - if (basic.width.HasMin() && basic.width.HasMax() && - basic.width.Min() > basic.width.Max()) { - *unsatisfied_constraint = basic.width.GetName(); - return media::VideoCaptureFormats(); - } - - if (basic.height.HasMin() && basic.height.HasMax() && - basic.height.Min() > basic.height.Max()) { - *unsatisfied_constraint = basic.height.GetName(); - return media::VideoCaptureFormats(); - } - - double max_aspect_ratio; - double min_aspect_ratio; - GetDesiredMinAndMaxAspectRatio(constraints, - &min_aspect_ratio, - &max_aspect_ratio); - - if (min_aspect_ratio > max_aspect_ratio || max_aspect_ratio < 0.05f) { - DLOG(WARNING) << "Wrong requested aspect ratio: min " << min_aspect_ratio - << " max " << max_aspect_ratio; - *unsatisfied_constraint = basic.aspect_ratio.GetName(); - return media::VideoCaptureFormats(); - } - - std::vector<std::string> temp( - &kLegalVideoConstraints[0], - &kLegalVideoConstraints[sizeof(kLegalVideoConstraints) / - sizeof(kLegalVideoConstraints[0])]); - std::string failing_name; - if (basic.HasMandatoryOutsideSet(temp, failing_name)) { - *unsatisfied_constraint = failing_name; - return media::VideoCaptureFormats(); - } - - media::VideoCaptureFormats candidates = supported_formats; - FilterFormatsByConstraints(basic, &candidates, unsatisfied_constraint); - - if (candidates.empty()) - return candidates; - - // Ok - all mandatory checked and we still have candidates. - // Let's try filtering using the advanced constraints. The advanced - // constraints must be filtered in the order they occur in |advanced|. - // But if a constraint produce zero candidates, the constraint is ignored and - // the next constraint is tested. - // http://w3c.github.io/mediacapture-main/getusermedia.html#dfn-selectsettings - for (const auto& constraint_set : constraints.Advanced()) { - media::VideoCaptureFormats current_candidates = candidates; - std::string unsatisfied_constraint; - FilterFormatsByConstraints(constraint_set, ¤t_candidates, - &unsatisfied_constraint); - if (!current_candidates.empty()) - candidates = current_candidates; - } - - // We have done as good as we can to filter the supported resolutions. - return candidates; -} - -media::VideoCaptureFormat GetBestFormatBasedOnArea( - const media::VideoCaptureFormats& formats, - int area) { - DCHECK(!formats.empty()); - const media::VideoCaptureFormat* best_format = nullptr; - int best_diff = std::numeric_limits<int>::max(); - for (const auto& format : formats) { - const int diff = abs(area - format.frame_size.GetArea()); - if (diff < best_diff) { - best_diff = diff; - best_format = &format; - } - } - DVLOG(3) << "GetBestFormatBasedOnArea chose format " - << media::VideoCaptureFormat::ToString(*best_format); - return *best_format; -} - -// Find the format that best matches the default video size. -// This algorithm is chosen since a resolution must be picked even if no -// constraints are provided. We don't just select the maximum supported -// resolution since higher resolutions cost more in terms of complexity and -// many cameras have lower frame rate and have more noise in the image at -// their maximum supported resolution. -media::VideoCaptureFormat GetBestCaptureFormat( - const media::VideoCaptureFormats& formats, - const blink::WebMediaConstraints& constraints) { - DCHECK(!formats.empty()); - - int max_width; - int max_height; - GetDesiredMaxWidthAndHeight(constraints, &max_width, &max_height); - const int area = - std::min(max_width, - static_cast<int>(MediaStreamVideoSource::kDefaultWidth)) * - std::min(max_height, - static_cast<int>(MediaStreamVideoSource::kDefaultHeight)); - - return GetBestFormatBasedOnArea(formats, area); -} - -} // anonymous namespace - -bool IsOldVideoConstraints() { - return base::FeatureList::IsEnabled( - features::kMediaStreamOldVideoConstraints); -} - // static MediaStreamVideoSource* MediaStreamVideoSource::GetVideoSource( const blink::WebMediaStreamSource& source) { @@ -336,62 +43,6 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } -void MediaStreamVideoSource::AddTrackLegacy( - MediaStreamVideoTrack* track, - const VideoCaptureDeliverFrameCB& frame_callback, - const blink::WebMediaConstraints& constraints, - const ConstraintsCallback& callback) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(IsOldVideoConstraints()); - DCHECK(!constraints.IsNull()); - DCHECK(std::find(tracks_.begin(), tracks_.end(), track) == tracks_.end()); - tracks_.push_back(track); - secure_tracker_.Add(track, true); - - track_descriptors_.push_back( - TrackDescriptor(track, frame_callback, constraints, callback)); - - switch (state_) { - case NEW: { - // Tab capture and Screen capture needs the maximum requested height - // and width to decide on the resolution. - // NOTE: Optional constraints are deliberately ignored. - int max_requested_width = 0; - if (constraints.Basic().width.HasMax()) - max_requested_width = constraints.Basic().width.Max(); - - int max_requested_height = 0; - if (constraints.Basic().height.HasMax()) - max_requested_height = constraints.Basic().height.Max(); - - double max_requested_frame_rate = kDefaultFrameRate; - if (constraints.Basic().frame_rate.HasMax()) - max_requested_frame_rate = constraints.Basic().frame_rate.Max(); - - state_ = RETRIEVING_CAPABILITIES; - GetCurrentSupportedFormats( - max_requested_width, - max_requested_height, - max_requested_frame_rate, - base::Bind(&MediaStreamVideoSource::OnSupportedFormats, - weak_factory_.GetWeakPtr())); - - break; - } - case STARTING: - case RETRIEVING_CAPABILITIES: { - // The |callback| will be triggered once the source has started or - // the capabilities have been retrieved. - break; - } - case ENDED: - case STARTED: { - // Currently, reconfiguring the source is not supported. - FinalizeAddTrackLegacy(); - } - } -} - void MediaStreamVideoSource::AddTrack( MediaStreamVideoTrack* track, const VideoTrackAdapterSettings& track_adapter_settings, @@ -419,10 +70,6 @@ case STARTING: { break; } - case RETRIEVING_CAPABILITIES: { - NOTREACHED(); - break; - } case ENDED: case STARTED: { // Currently, reconfiguring the source is not supported. @@ -485,13 +132,7 @@ base::Optional<media::VideoCaptureFormat> MediaStreamVideoSource::GetCurrentFormat() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - if (IsOldVideoConstraints()) { - if (state_ == STARTING || state_ == STARTED) - return current_format_; - return base::Optional<media::VideoCaptureFormat>(); - } else { - return GetCurrentFormatImpl(); - } + return GetCurrentFormatImpl(); } base::Optional<media::VideoCaptureFormat> @@ -510,76 +151,6 @@ SetReadyState(blink::WebMediaStreamSource::kReadyStateEnded); } -void MediaStreamVideoSource::OnSupportedFormats( - const media::VideoCaptureFormats& formats) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(IsOldVideoConstraints()); - DCHECK_EQ(RETRIEVING_CAPABILITIES, state_); - - supported_formats_ = formats; - blink::WebMediaConstraints fulfilled_constraints; - if (!FindBestFormatWithConstraints(supported_formats_, - ¤t_format_, - &fulfilled_constraints)) { - SetReadyState(blink::WebMediaStreamSource::kReadyStateEnded); - DVLOG(3) << "OnSupportedFormats failed to find an usable format"; - // This object can be deleted after calling FinalizeAddTrack. See comment - // in the header file. - FinalizeAddTrackLegacy(); - return; - } - - state_ = STARTING; - DVLOG(3) << "Starting the capturer with " - << media::VideoCaptureFormat::ToString(current_format_); - - StartSourceImpl( - current_format_, - fulfilled_constraints, - base::Bind(&VideoTrackAdapter::DeliverFrameOnIO, track_adapter_)); -} - -bool MediaStreamVideoSource::FindBestFormatWithConstraints( - const media::VideoCaptureFormats& formats, - media::VideoCaptureFormat* best_format, - blink::WebMediaConstraints* fulfilled_constraints) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DVLOG(3) << "MediaStreamVideoSource::FindBestFormatWithConstraints " - << "with " << formats.size() << " formats"; - // Find the first track descriptor that can fulfil the constraints. - for (const auto& track : track_descriptors_) { - const blink::WebMediaConstraints& track_constraints = track.constraints; - - // If the source doesn't support capability enumeration it is still ok if - // no mandatory constraints have been specified. That just means that - // we will start with whatever format is native to the source. - if (formats.empty() && !HasMandatoryConstraints(track_constraints)) { - DVLOG(3) << "No mandatory constraints and no formats"; - *fulfilled_constraints = track_constraints; - *best_format = media::VideoCaptureFormat(); - return true; - } - std::string unsatisfied_constraint; - const media::VideoCaptureFormats filtered_formats = - FilterFormats(track_constraints, formats, &unsatisfied_constraint); - if (filtered_formats.empty()) - continue; - - // A request with constraints that can be fulfilled. - *fulfilled_constraints = track_constraints; - media::VideoCaptureFormat best_format_candidate = - GetBestCaptureFormat(filtered_formats, track_constraints); - if (!best_format_candidate.IsValid()) - continue; - - *best_format = best_format_candidate; - DVLOG(3) << "Found a track that matches the constraints"; - return true; - } - DVLOG(3) << "No usable format found"; - return false; -} - void MediaStreamVideoSource::OnStartDone(MediaStreamRequestResult result) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DVLOG(3) << "OnStartDone({result =" << result << "})"; @@ -598,76 +169,11 @@ // This object can be deleted after calling FinalizeAddTrack. See comment in // the header file. - if (IsOldVideoConstraints()) - FinalizeAddTrackLegacy(); - else - FinalizeAddTrack(); -} - -void MediaStreamVideoSource::FinalizeAddTrackLegacy() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(IsOldVideoConstraints()); - const media::VideoCaptureFormats formats(1, current_format_); - - std::vector<TrackDescriptor> track_descriptors; - track_descriptors.swap(track_descriptors_); - for (const auto& track : track_descriptors) { - MediaStreamRequestResult result = MEDIA_DEVICE_OK; - std::string unsatisfied_constraint; - - if (HasMandatoryConstraints(track.constraints) && - FilterFormats(track.constraints, formats, &unsatisfied_constraint) - .empty()) { - result = MEDIA_DEVICE_CONSTRAINT_NOT_SATISFIED; - DVLOG(3) << "FinalizeAddTrackLegacy() ignoring device on constraint " - << unsatisfied_constraint; - } - - if (state_ != STARTED && result == MEDIA_DEVICE_OK) - result = MEDIA_DEVICE_TRACK_START_FAILURE; - - if (result == MEDIA_DEVICE_OK) { - int max_width; - int max_height; - GetDesiredMaxWidthAndHeight(track.constraints, &max_width, &max_height); - double max_aspect_ratio; - double min_aspect_ratio; - GetDesiredMinAndMaxAspectRatio(track.constraints, - &min_aspect_ratio, - &max_aspect_ratio); - double max_frame_rate = 0.0f; - // Note: Optional and ideal constraints are ignored; this is - // purely a hard max limit. - if (track.constraints.Basic().frame_rate.HasMax()) - max_frame_rate = track.constraints.Basic().frame_rate.Max(); - - track_adapter_->AddTrack( - track.track, track.frame_callback, - VideoTrackAdapterSettings(max_width, max_height, min_aspect_ratio, - max_aspect_ratio, max_frame_rate, - base::Optional<gfx::Size>())); - // Calculate resulting frame size if the source delivers frames - // according to the current format. Note: Format may change later. - gfx::Size desired_size; - VideoTrackAdapter::CalculateTargetSize( - false /* is_rotated */, current_format_.frame_size, - gfx::Size(max_width, max_height), min_aspect_ratio, max_aspect_ratio, - &desired_size); - track.track->SetTargetSizeAndFrameRate( - desired_size.width(), desired_size.height(), max_frame_rate); - } - - DVLOG(3) << "FinalizeAddTrackLegacy() result " << result; - - if (!track.callback.is_null()) - track.callback.Run(this, result, - blink::WebString::FromUTF8(unsatisfied_constraint)); - } + FinalizeAddTrack(); } void MediaStreamVideoSource::FinalizeAddTrack() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(!IsOldVideoConstraints()); std::vector<TrackDescriptor> track_descriptors; track_descriptors.swap(track_descriptors_); for (const auto& track : track_descriptors) { @@ -724,26 +230,12 @@ MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( MediaStreamVideoTrack* track, const VideoCaptureDeliverFrameCB& frame_callback, - const blink::WebMediaConstraints& constraints, - const ConstraintsCallback& callback) - : track(track), - frame_callback(frame_callback), - constraints(constraints), - callback(callback) { - DCHECK(IsOldVideoConstraints()); -} - -MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( - MediaStreamVideoTrack* track, - const VideoCaptureDeliverFrameCB& frame_callback, std::unique_ptr<VideoTrackAdapterSettings> adapter_settings, const ConstraintsCallback& callback) : track(track), frame_callback(frame_callback), adapter_settings(std::move(adapter_settings)), - callback(callback) { - DCHECK(!IsOldVideoConstraints()); -} + callback(callback) {} MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( TrackDescriptor&& other) = default;
diff --git a/content/renderer/media/media_stream_video_source.h b/content/renderer/media/media_stream_video_source.h index 6015caf..c5f03c63 100644 --- a/content/renderer/media/media_stream_video_source.h +++ b/content/renderer/media/media_stream_video_source.h
@@ -30,8 +30,6 @@ class VideoTrackAdapter; struct VideoTrackAdapterSettings; -CONTENT_EXPORT bool IsOldVideoConstraints(); - // MediaStreamVideoSource is an interface used for sending video frames to a // MediaStreamVideoTrack. // http://dev.w3.org/2011/webrtc/editor/getusermedia.html @@ -73,11 +71,6 @@ const VideoTrackAdapterSettings& track_adapter_settings, const VideoCaptureDeliverFrameCB& frame_callback, const ConstraintsCallback& callback); - // TODO(guidou): Remove this method. http://crbug.com/706408 - void AddTrackLegacy(MediaStreamVideoTrack* track, - const VideoCaptureDeliverFrameCB& frame_callback, - const blink::WebMediaConstraints& constraints, - const ConstraintsCallback& callback); void RemoveTrack(MediaStreamVideoTrack* track); // Called by |track| to notify the source whether it has any paths to a @@ -156,8 +149,6 @@ enum State { NEW, - // TODO(guidou): Remove this state. http://crbug.com/706408 - RETRIEVING_CAPABILITIES, STARTING, STARTED, ENDED @@ -167,17 +158,6 @@ SEQUENCE_CHECKER(sequence_checker_); private: - void OnSupportedFormats(const media::VideoCaptureFormats& formats); - - // Finds the first WebMediaConstraints in |track_descriptors_| that allows - // the use of one of the |formats|. |best_format| and |fulfilled_constraints| - // are set to the results of this search-and-match operation. Returns false - // if no WebMediaConstraints allow the use any of the |formats|. - bool FindBestFormatWithConstraints( - const media::VideoCaptureFormats& formats, - media::VideoCaptureFormat* best_format, - blink::WebMediaConstraints* fulfilled_constraints); - // Trigger all cached callbacks from AddTrack. AddTrack is successful // if the capture delegate has started and the constraints provided in // AddTrack match the format that was used to start the device. @@ -186,21 +166,12 @@ // simply drop the references to the blink source and track which will lead // to this object being deleted. void FinalizeAddTrack(); - // TODO(guidou): Remove this method. http://crbug.com/706408 - void FinalizeAddTrackLegacy(); State state_; - // TODO(guidou): Remove this field. http://crbug.com/706408 - media::VideoCaptureFormat current_format_; - struct TrackDescriptor { TrackDescriptor(MediaStreamVideoTrack* track, const VideoCaptureDeliverFrameCB& frame_callback, - const blink::WebMediaConstraints& constraints, - const ConstraintsCallback& callback); - TrackDescriptor(MediaStreamVideoTrack* track, - const VideoCaptureDeliverFrameCB& frame_callback, std::unique_ptr<VideoTrackAdapterSettings> adapter_settings, const ConstraintsCallback& callback); TrackDescriptor(TrackDescriptor&& other); @@ -209,8 +180,6 @@ MediaStreamVideoTrack* track; VideoCaptureDeliverFrameCB frame_callback; - // TODO(guidou): remove this field. http://crbug.com/706408 - blink::WebMediaConstraints constraints; // TODO(guidou): Make |adapter_settings| a regular field instead of a // unique_ptr. std::unique_ptr<VideoTrackAdapterSettings> adapter_settings; @@ -218,8 +187,6 @@ }; std::vector<TrackDescriptor> track_descriptors_; - media::VideoCaptureFormats supported_formats_; - // |track_adapter_| delivers video frames to the tracks on the IO-thread. const scoped_refptr<VideoTrackAdapter> track_adapter_;
diff --git a/content/renderer/media/media_stream_video_source_unittest.cc b/content/renderer/media/media_stream_video_source_unittest.cc index 3da2950..b1a9c3c 100644 --- a/content/renderer/media/media_stream_video_source_unittest.cc +++ b/content/renderer/media/media_stream_video_source_unittest.cc
@@ -9,11 +9,9 @@ #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" -#include "base/test/scoped_feature_list.h" #include "base/test/scoped_task_environment.h" #include "build/build_config.h" #include "content/child/child_process.h" -#include "content/public/common/content_features.h" #include "content/renderer/media/media_stream_video_source.h" #include "content/renderer/media/media_stream_video_track.h" #include "content/renderer/media/mock_constraint_factory.h" @@ -50,9 +48,6 @@ 1000.0, media::PIXEL_FORMAT_I420), false)) { - scoped_feature_list_.InitAndDisableFeature( - features::kMediaStreamOldVideoConstraints); - media::VideoCaptureFormats formats; formats.push_back(media::VideoCaptureFormat(gfx::Size(1280, 720), 30, media::PIXEL_FORMAT_I420)); @@ -105,7 +100,6 @@ int height, double frame_rate, bool detect_rotation = false) { - DCHECK(!IsOldVideoConstraints()); blink::WebMediaStreamTrack track = CreateTrack("123", VideoTrackAdapterSettings( @@ -141,7 +135,6 @@ int capture_height, int expected_width, int expected_height) { - DCHECK(!IsOldVideoConstraints()); // Configure the track to crop to the expected resolution. blink::WebMediaStreamTrack track = CreateTrackAndStartSource(expected_width, expected_height, 30.0); @@ -268,7 +261,6 @@ blink::WebMediaStreamSource webkit_source_; // |mock_source_| is owned by |webkit_source_|. MockMediaStreamVideoSource* mock_source_; - base::test::ScopedFeatureList scoped_feature_list_; }; TEST_F(MediaStreamVideoSourceTest, AddTrackAndStartSource) { @@ -418,850 +410,4 @@ sink.DisconnectFromTrack(); } -class MediaStreamVideoSourceOldConstraintsTest : public ::testing::Test { - public: - MediaStreamVideoSourceOldConstraintsTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI), - child_process_(new ChildProcess()), - number_of_successful_constraints_applied_(0), - number_of_failed_constraints_applied_(0), - result_(MEDIA_DEVICE_OK), - result_name_(""), - mock_source_(new MockMediaStreamVideoSource(true)) { - scoped_feature_list_.InitAndEnableFeature( - features::kMediaStreamOldVideoConstraints); - - media::VideoCaptureFormats formats; - formats.push_back(media::VideoCaptureFormat( - gfx::Size(1280, 720), 30, media::PIXEL_FORMAT_I420)); - formats.push_back(media::VideoCaptureFormat( - gfx::Size(640, 480), 30, media::PIXEL_FORMAT_I420)); - formats.push_back(media::VideoCaptureFormat( - gfx::Size(352, 288), 30, media::PIXEL_FORMAT_I420)); - formats.push_back(media::VideoCaptureFormat( - gfx::Size(320, 240), 30, media::PIXEL_FORMAT_I420)); - mock_source_->SetSupportedFormats(formats); - webkit_source_.Initialize(blink::WebString::FromASCII("dummy_source_id"), - blink::WebMediaStreamSource::kTypeVideo, - blink::WebString::FromASCII("dummy_source_name"), - false /* remote */); - webkit_source_.SetExtraData(mock_source_); - } - - void TearDown() override { - webkit_source_.Reset(); - blink::WebHeap::CollectAllGarbageForTesting(); - } - - protected: - // Create a track that's associated with |webkit_source_|. - blink::WebMediaStreamTrack CreateTrack( - const std::string& id, - const blink::WebMediaConstraints& constraints) { - bool enabled = true; - return MediaStreamVideoTrack::CreateVideoTrack( - mock_source_, constraints, - base::Bind( - &MediaStreamVideoSourceOldConstraintsTest::OnConstraintsApplied, - base::Unretained(this)), - enabled); - } - - blink::WebMediaStreamTrack CreateTrackAndStartSource( - const blink::WebMediaConstraints& constraints, - int expected_width, - int expected_height, - int expected_frame_rate) { - DCHECK(IsOldVideoConstraints()); - blink::WebMediaStreamTrack track = CreateTrack("123", constraints); - - mock_source_->CompleteGetSupportedFormats(); - const media::VideoCaptureFormat& format = mock_source()->start_format(); - EXPECT_EQ(expected_width, format.frame_size.width()); - EXPECT_EQ(expected_height, format.frame_size.height()); - EXPECT_EQ(expected_frame_rate, format.frame_rate); - - EXPECT_EQ(0, NumberOfSuccessConstraintsCallbacks()); - mock_source_->StartMockedSource(); - // Once the source has started successfully we expect that the - // ConstraintsCallback in MediaStreamSource::AddTrack completes. - EXPECT_EQ(1, NumberOfSuccessConstraintsCallbacks()); - return track; - } - - int NumberOfSuccessConstraintsCallbacks() const { - return number_of_successful_constraints_applied_; - } - - int NumberOfFailedConstraintsCallbacks() const { - return number_of_failed_constraints_applied_; - } - - content::MediaStreamRequestResult error_type() const { return result_; } - blink::WebString error_name() const { return result_name_; } - - MockMediaStreamVideoSource* mock_source() { return mock_source_; } - - const blink::WebMediaStreamSource& webkit_source() { return webkit_source_; } - - // Test that the source crops/scales to the requested width and - // height even though the camera delivers a larger frame. - void TestSourceCropFrame(int capture_width, - int capture_height, - const blink::WebMediaConstraints& constraints, - int expected_width, - int expected_height) { - DCHECK(IsOldVideoConstraints()); - // Expect the source to start capture with the supported resolution. - blink::WebMediaStreamTrack track = CreateTrackAndStartSource( - constraints, capture_width, capture_height, 30); - - MockMediaStreamVideoSink sink; - sink.ConnectToTrack(track); - DeliverVideoFrameAndWaitForRenderer(capture_width, capture_height, &sink); - EXPECT_EQ(1, sink.number_of_frames()); - - // Expect the delivered frame to be cropped. - EXPECT_EQ(expected_height, sink.frame_size().height()); - EXPECT_EQ(expected_width, sink.frame_size().width()); - sink.DisconnectFromTrack(); - } - - void DeliverVideoFrameAndWaitForRenderer(int width, int height, - MockMediaStreamVideoSink* sink) { - base::RunLoop run_loop; - base::Closure quit_closure = run_loop.QuitClosure(); - EXPECT_CALL(*sink, OnVideoFrame()).WillOnce( - RunClosure(quit_closure)); - scoped_refptr<media::VideoFrame> frame = - media::VideoFrame::CreateBlackFrame(gfx::Size(width, height)); - mock_source()->DeliverVideoFrame(frame); - run_loop.Run(); - } - - void DeliverVideoFrameAndWaitForTwoRenderers( - int width, - int height, - MockMediaStreamVideoSink* sink1, - MockMediaStreamVideoSink* sink2) { - base::RunLoop run_loop; - base::Closure quit_closure = run_loop.QuitClosure(); - EXPECT_CALL(*sink1, OnVideoFrame()); - EXPECT_CALL(*sink2, OnVideoFrame()).WillOnce( - RunClosure(quit_closure)); - scoped_refptr<media::VideoFrame> frame = - media::VideoFrame::CreateBlackFrame(gfx::Size(width, height)); - mock_source()->DeliverVideoFrame(frame); - run_loop.Run(); - } - - void TestTwoTracksWithDifferentConstraints( - const blink::WebMediaConstraints& constraints1, - const blink::WebMediaConstraints& constraints2, - int capture_width, - int capture_height, - int expected_width1, - int expected_height1, - int expected_width2, - int expected_height2) { - blink::WebMediaStreamTrack track1 = - CreateTrackAndStartSource(constraints1, capture_width, capture_height, - MediaStreamVideoSource::kDefaultFrameRate); - - blink::WebMediaStreamTrack track2 = CreateTrack("dummy", constraints2); - - MockMediaStreamVideoSink sink1; - sink1.ConnectToTrack(track1); - EXPECT_EQ(0, sink1.number_of_frames()); - - MockMediaStreamVideoSink sink2; - sink2.ConnectToTrack(track2); - EXPECT_EQ(0, sink2.number_of_frames()); - - DeliverVideoFrameAndWaitForTwoRenderers(capture_width, - capture_height, - &sink1, - &sink2); - - EXPECT_EQ(1, sink1.number_of_frames()); - EXPECT_EQ(expected_width1, sink1.frame_size().width()); - EXPECT_EQ(expected_height1, sink1.frame_size().height()); - - EXPECT_EQ(1, sink2.number_of_frames()); - EXPECT_EQ(expected_width2, sink2.frame_size().width()); - EXPECT_EQ(expected_height2, sink2.frame_size().height()); - - sink1.DisconnectFromTrack(); - sink2.DisconnectFromTrack(); - } - - void SetSourceSupportedFormats(const media::VideoCaptureFormats& formats) { - mock_source_->SetSupportedFormats(formats); - } - - void ReleaseTrackAndSourceOnAddTrackCallback( - const blink::WebMediaStreamTrack& track_to_release) { - track_to_release_ = track_to_release; - } - - private: - void OnConstraintsApplied(MediaStreamSource* source, - MediaStreamRequestResult result, - const blink::WebString& result_name) { - ASSERT_EQ(source, webkit_source().GetExtraData()); - - if (result == MEDIA_DEVICE_OK) { - ++number_of_successful_constraints_applied_; - } else { - result_ = result; - result_name_ = result_name; - ++number_of_failed_constraints_applied_; - } - - if (!track_to_release_.IsNull()) { - mock_source_ = nullptr; - webkit_source_.Reset(); - track_to_release_.Reset(); - } - } - const base::test::ScopedTaskEnvironment scoped_task_environment_; - const std::unique_ptr<ChildProcess> child_process_; - blink::WebMediaStreamTrack track_to_release_; - int number_of_successful_constraints_applied_; - int number_of_failed_constraints_applied_; - content::MediaStreamRequestResult result_; - blink::WebString result_name_; - blink::WebMediaStreamSource webkit_source_; - // |mock_source_| is owned by |webkit_source_|. - MockMediaStreamVideoSource* mock_source_; - base::test::ScopedFeatureList scoped_feature_list_; -}; - -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, AddTrackAndStartSource) { - blink::WebMediaConstraints constraints; - constraints.Initialize(); - blink::WebMediaStreamTrack track = CreateTrack("123", constraints); - mock_source()->CompleteGetSupportedFormats(); - mock_source()->StartMockedSource(); - EXPECT_EQ(1, NumberOfSuccessConstraintsCallbacks()); -} - -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - AddTwoTracksBeforeSourceStarts) { - blink::WebMediaConstraints constraints; - constraints.Initialize(); - blink::WebMediaStreamTrack track1 = CreateTrack("123", constraints); - mock_source()->CompleteGetSupportedFormats(); - blink::WebMediaStreamTrack track2 = CreateTrack("123", constraints); - EXPECT_EQ(0, NumberOfSuccessConstraintsCallbacks()); - mock_source()->StartMockedSource(); - EXPECT_EQ(2, NumberOfSuccessConstraintsCallbacks()); -} - -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, AddTrackAfterSourceStarts) { - blink::WebMediaConstraints constraints; - constraints.Initialize(); - blink::WebMediaStreamTrack track1 = CreateTrack("123", constraints); - mock_source()->CompleteGetSupportedFormats(); - mock_source()->StartMockedSource(); - EXPECT_EQ(1, NumberOfSuccessConstraintsCallbacks()); - blink::WebMediaStreamTrack track2 = CreateTrack("123", constraints); - EXPECT_EQ(2, NumberOfSuccessConstraintsCallbacks()); -} - -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, AddTrackAndFailToStartSource) { - blink::WebMediaConstraints constraints; - constraints.Initialize(); - blink::WebMediaStreamTrack track = CreateTrack("123", constraints); - mock_source()->CompleteGetSupportedFormats(); - mock_source()->FailToStartMockedSource(); - EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks()); -} - -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - AddTwoTracksBeforeGetSupportedFormats) { - blink::WebMediaConstraints constraints; - constraints.Initialize(); - blink::WebMediaStreamTrack track1 = CreateTrack("123", constraints); - blink::WebMediaStreamTrack track2 = CreateTrack("123", constraints); - mock_source()->CompleteGetSupportedFormats(); - mock_source()->StartMockedSource(); - EXPECT_EQ(2, NumberOfSuccessConstraintsCallbacks()); -} - -// Test that the capture output is CIF if we set max constraints to CIF. -// and the capture device support CIF. -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, MandatoryConstraintCif5Fps) { - MockConstraintFactory factory; - factory.basic().width.SetMax(352); - factory.basic().height.SetMax(288); - factory.basic().frame_rate.SetMax(5.0); - - CreateTrackAndStartSource(factory.CreateWebMediaConstraints(), 352, 288, 5); -} - -// Test that the capture output is 720P if the camera support it and the -// optional constraint is set to 720P. -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, MandatoryMinVgaOptional720P) { - MockConstraintFactory factory; - factory.basic().width.SetMin(640); - factory.basic().height.SetMin(480); - factory.AddAdvanced().width.SetMin(1280); - factory.AddAdvanced().aspect_ratio.SetMin(1280.0 / 720); - - CreateTrackAndStartSource(factory.CreateWebMediaConstraints(), 1280, 720, 30); -} - -// Test that the capture output is 720P if the camera supports it and the -// mandatory constraint is exactly width 1280. -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, MandatoryExact720P) { - MockConstraintFactory factory; - factory.basic().width.SetExact(1280); - CreateTrackAndStartSource(factory.CreateWebMediaConstraints(), 1280, 720, 30); -} - -// Test that the capture output have aspect ratio 4:3 if a mandatory constraint -// require it even if an optional constraint request a higher resolution -// that don't have this aspect ratio. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, MandatoryAspectRatio4To3) { - MockConstraintFactory factory; - factory.basic().width.SetMin(640); - factory.basic().height.SetMin(480); - factory.basic().aspect_ratio.SetMax(640.0 / 480); - factory.AddAdvanced().width.SetMin(1280); - - TestSourceCropFrame(1280, 720, factory.CreateWebMediaConstraints(), 960, 720); -} - -// Test that AddTrack succeeds if the mandatory min aspect ratio it set to 2. -TEST_F(MediaStreamVideoSourceOldConstraintsTest, MandatoryAspectRatio2) { - MockConstraintFactory factory; - factory.basic().aspect_ratio.SetMin(2.0); - - TestSourceCropFrame(MediaStreamVideoSource::kDefaultWidth, - MediaStreamVideoSource::kDefaultHeight, - factory.CreateWebMediaConstraints(), 640, 320); -} - -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - MinAspectRatioLargerThanMaxAspectRatio) { - MockConstraintFactory factory; - factory.basic().aspect_ratio.SetMin(2.0); - factory.basic().aspect_ratio.SetMax(1.0); - blink::WebMediaStreamTrack track = - CreateTrack("123", factory.CreateWebMediaConstraints()); - mock_source()->CompleteGetSupportedFormats(); - EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks()); -} - -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, MinWidthLargerThanMaxWidth) { - MockConstraintFactory factory; - factory.basic().width.SetMin(640); - factory.basic().width.SetMax(320); - blink::WebMediaStreamTrack track = - CreateTrack("123", factory.CreateWebMediaConstraints()); - mock_source()->CompleteGetSupportedFormats(); - EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks()); -} - -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, MinHeightLargerThanMaxHeight) { - MockConstraintFactory factory; - factory.basic().height.SetMin(480); - factory.basic().height.SetMax(360); - - blink::WebMediaStreamTrack track = - CreateTrack("123", factory.CreateWebMediaConstraints()); - mock_source()->CompleteGetSupportedFormats(); - EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks()); -} - -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - MinFrameRateLargerThanMaxFrameRate) { - MockConstraintFactory factory; - factory.basic().frame_rate.SetMin(25); - factory.basic().frame_rate.SetMax(15); - blink::WebMediaStreamTrack track = - CreateTrack("123", factory.CreateWebMediaConstraints()); - mock_source()->CompleteGetSupportedFormats(); - EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks()); -} - -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, ExactWidthNotSupported) { - MockConstraintFactory factory; - factory.basic().width.SetExact(12000); - blink::WebMediaStreamTrack track = - CreateTrack("123", factory.CreateWebMediaConstraints()); - mock_source()->CompleteGetSupportedFormats(); - EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks()); -} - -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, MinWidthNotSupported) { - MockConstraintFactory factory; - factory.basic().width.SetMin(12000); - blink::WebMediaStreamTrack track = - CreateTrack("123", factory.CreateWebMediaConstraints()); - mock_source()->CompleteGetSupportedFormats(); - EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks()); -} - -// Test that its safe to release the last reference of a blink track and the -// source during the callback if adding a track succeeds. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - ReleaseTrackAndSourceOnSuccessCallBack) { - MockConstraintFactory factory; - blink::WebMediaStreamTrack track = - CreateTrack("123", factory.CreateWebMediaConstraints()); - ReleaseTrackAndSourceOnAddTrackCallback(track); - mock_source()->CompleteGetSupportedFormats(); - mock_source()->StartMockedSource(); - EXPECT_EQ(1, NumberOfSuccessConstraintsCallbacks()); -} - -// Test that its safe to release the last reference of a blink track and the -// source during the callback if adding a track fails. -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - ReleaseTrackAndSourceOnFailureCallBack) { - MockConstraintFactory factory; - factory.basic().width.SetMin(99999); - { - blink::WebMediaStreamTrack track = - CreateTrack("123", factory.CreateWebMediaConstraints()); - ReleaseTrackAndSourceOnAddTrackCallback(track); - } - mock_source()->CompleteGetSupportedFormats(); - EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks()); -} - -// Test that the source ignores an optional aspect ratio that is higher than -// supported. -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, OptionalAspectRatioTooHigh) { - MockConstraintFactory factory; - factory.AddAdvanced().aspect_ratio.SetMin(2.0); - blink::WebMediaStreamTrack track = - CreateTrack("123", factory.CreateWebMediaConstraints()); - mock_source()->CompleteGetSupportedFormats(); - - const media::VideoCaptureFormat& format = mock_source()->start_format(); - const double aspect_ratio = static_cast<double>(format.frame_size.width()) / - format.frame_size.height(); - EXPECT_LT(aspect_ratio, 2); -} - -// Test that the source starts video with the default resolution if the -// that is the only supported. -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, DefaultCapability) { - media::VideoCaptureFormats formats; - formats.push_back(media::VideoCaptureFormat( - gfx::Size(MediaStreamVideoSource::kDefaultWidth, - MediaStreamVideoSource::kDefaultHeight), - MediaStreamVideoSource::kDefaultFrameRate, media::PIXEL_FORMAT_I420)); - mock_source()->SetSupportedFormats(formats); - - blink::WebMediaConstraints constraints; - constraints.Initialize(); - CreateTrackAndStartSource(constraints, MediaStreamVideoSource::kDefaultWidth, - MediaStreamVideoSource::kDefaultHeight, 30); -} - -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, InvalidMandatoryConstraint) { - MockConstraintFactory factory; - // Use a constraint that is only known for audio. - factory.basic().echo_cancellation.SetExact(true); - blink::WebMediaStreamTrack track = - CreateTrack("123", factory.CreateWebMediaConstraints()); - mock_source()->CompleteGetSupportedFormats(); - EXPECT_EQ(MEDIA_DEVICE_CONSTRAINT_NOT_SATISFIED, error_type()); - EXPECT_EQ("echoCancellation", error_name()); - EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks()); -} - -// Test that the source ignores an unknown optional constraint. -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, InvalidOptionalConstraint) { - MockConstraintFactory factory; - factory.AddAdvanced().echo_cancellation.SetExact(true); - - CreateTrackAndStartSource(factory.CreateWebMediaConstraints(), - MediaStreamVideoSource::kDefaultWidth, - MediaStreamVideoSource::kDefaultHeight, 30); -} - -// Tests that the source starts video with the max width and height set by -// constraints for screencast. -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - ScreencastResolutionWithConstraint) { - media::VideoCaptureFormats formats; - formats.push_back(media::VideoCaptureFormat(gfx::Size(480, 270), 30, - media::PIXEL_FORMAT_I420)); - mock_source()->SetSupportedFormats(formats); - MockConstraintFactory factory; - factory.basic().width.SetMax(480); - factory.basic().height.SetMax(270); - - blink::WebMediaStreamTrack track = CreateTrackAndStartSource( - factory.CreateWebMediaConstraints(), 480, 270, 30); - EXPECT_EQ(480, mock_source()->max_requested_height()); - EXPECT_EQ(270, mock_source()->max_requested_width()); -} - -// Test that optional constraints are applied in order. -// Does not apply with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, OptionalConstraints) { - MockConstraintFactory factory; - // Min width of 2056 pixels can not be fulfilled. - factory.AddAdvanced().width.SetMin(2056); - factory.AddAdvanced().width.SetMin(641); - // Since min width is set to 641 pixels, max width 640 can not be fulfilled. - factory.AddAdvanced().width.SetMax(640); - CreateTrackAndStartSource(factory.CreateWebMediaConstraints(), 1280, 720, 30); -} - -// Test that the source crops to the requested max width and -// height even though the camera delivers a larger frame. -// Redundant with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - DeliverCroppedVideoFrameOptional640360) { - MockConstraintFactory factory; - factory.AddAdvanced().width.SetMax(640); - factory.AddAdvanced().height.SetMax(360); - TestSourceCropFrame(640, 480, factory.CreateWebMediaConstraints(), 640, 360); -} - -// Redundant with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - DeliverCroppedVideoFrameMandatory640360) { - MockConstraintFactory factory; - factory.basic().width.SetMax(640); - factory.basic().height.SetMax(360); - TestSourceCropFrame(640, 480, factory.CreateWebMediaConstraints(), 640, 360); -} - -// Redundant with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - DeliverCroppedVideoFrameMandatory732489) { - MockConstraintFactory factory; - factory.basic().width.SetMax(732); - factory.basic().height.SetMax(489); - factory.basic().width.SetMin(732); - factory.basic().height.SetMin(489); - TestSourceCropFrame(1280, 720, factory.CreateWebMediaConstraints(), 732, 489); -} - -// Test that the source crops to the requested max width and -// height even though the requested frame has odd size. -// Redundant with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - DeliverCroppedVideoFrame637359) { - MockConstraintFactory factory; - factory.AddAdvanced().width.SetMax(637); - factory.AddAdvanced().height.SetMax(359); - TestSourceCropFrame(640, 480, factory.CreateWebMediaConstraints(), 637, 359); -} - -// Redundant with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - DeliverCroppedVideoFrame320320) { - MockConstraintFactory factory; - factory.basic().width.SetMax(320); - factory.basic().height.SetMax(320); - factory.basic().height.SetMin(320); - factory.basic().width.SetMax(320); - TestSourceCropFrame(640, 480, factory.CreateWebMediaConstraints(), 320, 320); -} - -// Redundant with spec-compliant constraints. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - DeliverSmallerSizeWhenTooLargeMax) { - MockConstraintFactory factory; - factory.AddAdvanced().width.SetMax(1920); - factory.AddAdvanced().height.SetMax(1080); - factory.AddAdvanced().width.SetMin(1280); - factory.AddAdvanced().height.SetMin(720); - TestSourceCropFrame(1280, 720, factory.CreateWebMediaConstraints(), 1280, - 720); -} - -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, TwoTracksWithVGAAndWVGA) { - MockConstraintFactory factory1; - factory1.AddAdvanced().width.SetMax(640); - factory1.AddAdvanced().height.SetMax(480); - - MockConstraintFactory factory2; - factory2.AddAdvanced().height.SetMax(360); - - TestTwoTracksWithDifferentConstraints(factory1.CreateWebMediaConstraints(), - factory2.CreateWebMediaConstraints(), - 640, 480, 640, 480, 640, 360); -} - -// Redundant with spec-compliant constraints -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, TwoTracksWith720AndWVGA) { - MockConstraintFactory factory1; - factory1.AddAdvanced().width.SetMin(1280); - factory1.AddAdvanced().height.SetMin(720); - - MockConstraintFactory factory2; - factory2.basic().width.SetMax(640); - factory2.basic().height.SetMax(360); - - TestTwoTracksWithDifferentConstraints(factory1.CreateWebMediaConstraints(), - factory2.CreateWebMediaConstraints(), - 1280, 720, 1280, 720, 640, 360); -} - -// Redundant with spec-compliant constraints -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, TwoTracksWith720AndW700H700) { - MockConstraintFactory factory1; - factory1.AddAdvanced().width.SetMin(1280); - factory1.AddAdvanced().height.SetMin(720); - - MockConstraintFactory factory2; - factory2.basic().width.SetMax(700); - factory2.basic().height.SetMax(700); - - TestTwoTracksWithDifferentConstraints(factory1.CreateWebMediaConstraints(), - factory2.CreateWebMediaConstraints(), - 1280, 720, 1280, 720, 700, 700); -} - -// Redundant with spec-compliant constraints -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - TwoTracksWith720AndMaxAspectRatio4To3) { - MockConstraintFactory factory1; - factory1.AddAdvanced().width.SetMin(1280); - factory1.AddAdvanced().height.SetMin(720); - - MockConstraintFactory factory2; - factory2.basic().aspect_ratio.SetMax(640.0 / 480); - - TestTwoTracksWithDifferentConstraints(factory1.CreateWebMediaConstraints(), - factory2.CreateWebMediaConstraints(), - 1280, 720, 1280, 720, 960, 720); -} - -// Redundant with spec-compliant constraints -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - TwoTracksWithVgaAndMinAspectRatio) { - MockConstraintFactory factory1; - factory1.AddAdvanced().width.SetMax(640); - factory1.AddAdvanced().height.SetMax(480); - - MockConstraintFactory factory2; - factory2.basic().aspect_ratio.SetMin(640.0 / 360); - - TestTwoTracksWithDifferentConstraints(factory1.CreateWebMediaConstraints(), - factory2.CreateWebMediaConstraints(), - 640, 480, 640, 480, 640, 360); -} - -// Does not apply with spec-compliant constraints -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - TwoTracksWithSecondTrackFrameRateHigherThanFirst) { - MockConstraintFactory factory1; - factory1.basic().frame_rate.SetMin(15); - factory1.basic().frame_rate.SetMax(15); - - blink::WebMediaStreamTrack track1 = - CreateTrackAndStartSource(factory1.CreateWebMediaConstraints(), - MediaStreamVideoSource::kDefaultWidth, - MediaStreamVideoSource::kDefaultHeight, 15); - - MockConstraintFactory factory2; - factory2.basic().frame_rate.SetMin(30); - blink::WebMediaStreamTrack track2 = - CreateTrack("123", factory2.CreateWebMediaConstraints()); - EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks()); -} - -// Test that a source can change the frame resolution on the fly and that -// tracks sinks get the new frame size unless constraints force the frame to be -// cropped. -// TODO(guidou): Remove this test. http://crbug.com/706408 -TEST_F(MediaStreamVideoSourceOldConstraintsTest, SourceChangeFrameSize) { - MockConstraintFactory factory; - factory.AddAdvanced().width.SetMax(800); - factory.AddAdvanced().height.SetMax(700); - - // Expect the source to start capture with the supported resolution. - // Disable frame-rate adjustment in spec-compliant mode to ensure no frames - // are dropped. - blink::WebMediaStreamTrack track = CreateTrackAndStartSource( - factory.CreateWebMediaConstraints(), 640, 480, 30); - - MockMediaStreamVideoSink sink; - sink.ConnectToTrack(track); - EXPECT_EQ(0, sink.number_of_frames()); - DeliverVideoFrameAndWaitForRenderer(320, 240, &sink); - EXPECT_EQ(1, sink.number_of_frames()); - // Expect the delivered frame to be passed unchanged since its smaller than - // max requested. - EXPECT_EQ(320, sink.frame_size().width()); - EXPECT_EQ(240, sink.frame_size().height()); - - DeliverVideoFrameAndWaitForRenderer(640, 480, &sink); - EXPECT_EQ(2, sink.number_of_frames()); - // Expect the delivered frame to be passed unchanged since its smaller than - // max requested. - EXPECT_EQ(640, sink.frame_size().width()); - EXPECT_EQ(480, sink.frame_size().height()); - - DeliverVideoFrameAndWaitForRenderer(1280, 720, &sink); - EXPECT_EQ(3, sink.number_of_frames()); - // Expect a frame to be cropped since its larger than max requested. - EXPECT_EQ(800, sink.frame_size().width()); - EXPECT_EQ(700, sink.frame_size().height()); - - sink.DisconnectFromTrack(); -} - -// Test that the constraint negotiation can handle 0.0 fps as frame rate. -TEST_F(MediaStreamVideoSourceOldConstraintsTest, Use0FpsSupportedFormat) { - media::VideoCaptureFormats formats; - formats.push_back(media::VideoCaptureFormat(gfx::Size(640, 480), 0.0f, - media::PIXEL_FORMAT_I420)); - formats.push_back(media::VideoCaptureFormat(gfx::Size(320, 240), 0.0f, - media::PIXEL_FORMAT_I420)); - mock_source()->SetSupportedFormats(formats); - - blink::WebMediaConstraints constraints; - constraints.Initialize(); - blink::WebMediaStreamTrack track = CreateTrack("123", constraints); - mock_source()->CompleteGetSupportedFormats(); - mock_source()->StartMockedSource(); - EXPECT_EQ(1, NumberOfSuccessConstraintsCallbacks()); - - MockMediaStreamVideoSink sink; - sink.ConnectToTrack(track); - EXPECT_EQ(0, sink.number_of_frames()); - DeliverVideoFrameAndWaitForRenderer(320, 240, &sink); - EXPECT_EQ(1, sink.number_of_frames()); - // Expect the delivered frame to be passed unchanged since its smaller than - // max requested. - EXPECT_EQ(320, sink.frame_size().width()); - EXPECT_EQ(240, sink.frame_size().height()); - sink.DisconnectFromTrack(); -} - -// Test that a source producing no frames change the source ReadyState to muted. -// that in a reasonable time frame the muted state turns to false. -TEST_F(MediaStreamVideoSourceOldConstraintsTest, MutedSource) { - // Setup the source for support a frame rate of 999 fps in order to test - // the muted event faster. This is since the frame monitoring uses - // PostDelayedTask that is dependent on the source frame rate. - // Note that media::limits::kMaxFramesPerSecond is 1000. - media::VideoCaptureFormats formats; - formats.push_back(media::VideoCaptureFormat( - gfx::Size(640, 480), media::limits::kMaxFramesPerSecond - 1, - media::PIXEL_FORMAT_I420)); - SetSourceSupportedFormats(formats); - - MockConstraintFactory factory; - blink::WebMediaStreamTrack track = - CreateTrackAndStartSource(factory.CreateWebMediaConstraints(), 640, 480, - media::limits::kMaxFramesPerSecond - 1); - - MockMediaStreamVideoSink sink; - sink.ConnectToTrack(track); - EXPECT_EQ(track.Source().GetReadyState(), - blink::WebMediaStreamSource::kReadyStateLive); - - base::RunLoop run_loop; - base::Closure quit_closure = run_loop.QuitClosure(); - bool muted_state = false; - EXPECT_CALL(*mock_source(), DoSetMutedState(_)) - .WillOnce(DoAll(SaveArg<0>(&muted_state), RunClosure(quit_closure))); - run_loop.Run(); - EXPECT_EQ(muted_state, true); - - EXPECT_EQ(track.Source().GetReadyState(), - blink::WebMediaStreamSource::kReadyStateMuted); - - base::RunLoop run_loop2; - base::Closure quit_closure2 = run_loop2.QuitClosure(); - EXPECT_CALL(*mock_source(), DoSetMutedState(_)) - .WillOnce(DoAll(SaveArg<0>(&muted_state), RunClosure(quit_closure2))); - DeliverVideoFrameAndWaitForRenderer(640, 480, &sink); - run_loop2.Run(); - - EXPECT_EQ(muted_state, false); - EXPECT_EQ(track.Source().GetReadyState(), - blink::WebMediaStreamSource::kReadyStateLive); - - sink.DisconnectFromTrack(); -} - -// Test that an optional constraint with an invalid aspect ratio is ignored. -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - InvalidOptionalAspectRatioIgnored) { - MockConstraintFactory factory; - factory.AddAdvanced().aspect_ratio.SetMax(0.0); - blink::WebMediaStreamTrack track = - CreateTrack("123", factory.CreateWebMediaConstraints()); - mock_source()->CompleteGetSupportedFormats(); - EXPECT_EQ(0, NumberOfFailedConstraintsCallbacks()); -} - -// Test that setting an invalid mandatory aspect ratio fails. -// Does not apply with spec-compliant constraints. -TEST_F(MediaStreamVideoSourceOldConstraintsTest, - InvalidMandatoryAspectRatioFails) { - MockConstraintFactory factory; - factory.basic().aspect_ratio.SetMax(0.0); - blink::WebMediaStreamTrack track = - CreateTrack("123", factory.CreateWebMediaConstraints()); - mock_source()->CompleteGetSupportedFormats(); - EXPECT_EQ(1, NumberOfFailedConstraintsCallbacks()); -} - } // namespace content
diff --git a/content/renderer/media/media_stream_video_track.cc b/content/renderer/media/media_stream_video_track.cc index d23adb2d..6dce6ab 100644 --- a/content/renderer/media/media_stream_video_track.cc +++ b/content/renderer/media/media_stream_video_track.cc
@@ -200,20 +200,6 @@ // static blink::WebMediaStreamTrack MediaStreamVideoTrack::CreateVideoTrack( MediaStreamVideoSource* source, - const blink::WebMediaConstraints& constraints, - const MediaStreamVideoSource::ConstraintsCallback& callback, - bool enabled) { - DCHECK(IsOldVideoConstraints()); - blink::WebMediaStreamTrack track; - track.Initialize(source->Owner()); - track.SetTrackData( - new MediaStreamVideoTrack(source, constraints, callback, enabled)); - return track; -} - -// static -blink::WebMediaStreamTrack MediaStreamVideoTrack::CreateVideoTrack( - MediaStreamVideoSource* source, const MediaStreamVideoSource::ConstraintsCallback& callback, bool enabled) { blink::WebMediaStreamTrack track; @@ -261,41 +247,11 @@ VideoTrackAdapterSettings())), is_screencast_(false), source_(source->GetWeakPtr()) { - if (IsOldVideoConstraints()) { - blink::WebMediaConstraints constraints; - constraints.Initialize(); - source->AddTrackLegacy( - this, - base::Bind(&MediaStreamVideoTrack::FrameDeliverer::DeliverFrameOnIO, - frame_deliverer_), - constraints, callback); - } else { - source->AddTrack( - this, VideoTrackAdapterSettings(), - base::Bind(&MediaStreamVideoTrack::FrameDeliverer::DeliverFrameOnIO, - frame_deliverer_), - callback); - } -} - -MediaStreamVideoTrack::MediaStreamVideoTrack( - MediaStreamVideoSource* source, - const blink::WebMediaConstraints& constraints, - const MediaStreamVideoSource::ConstraintsCallback& callback, - bool enabled) - : MediaStreamTrack(true), - frame_deliverer_( - new MediaStreamVideoTrack::FrameDeliverer(source->io_task_runner(), - enabled)), - constraints_(constraints), - source_(source->GetWeakPtr()) { - DCHECK(IsOldVideoConstraints()); - DCHECK(!constraints.IsNull()); - source->AddTrackLegacy( - this, + source->AddTrack( + this, VideoTrackAdapterSettings(), base::Bind(&MediaStreamVideoTrack::FrameDeliverer::DeliverFrameOnIO, frame_deliverer_), - constraints, callback); + callback); } MediaStreamVideoTrack::MediaStreamVideoTrack( @@ -316,7 +272,6 @@ is_screencast_(is_screen_cast), min_frame_rate_(min_frame_rate), source_(source->GetWeakPtr()) { - DCHECK(!IsOldVideoConstraints()); source->AddTrack( this, adapter_settings, base::Bind(&MediaStreamVideoTrack::FrameDeliverer::DeliverFrameOnIO,
diff --git a/content/renderer/media/media_stream_video_track.h b/content/renderer/media/media_stream_video_track.h index 5bd53b5..581d78d 100644 --- a/content/renderer/media/media_stream_video_track.h +++ b/content/renderer/media/media_stream_video_track.h
@@ -36,19 +36,12 @@ // or if the source fails to provide video frames. // If |enabled| is true, sinks added to the track will // receive video frames when the source delivers frames to the track. - // TODO(guidou): Remove the variant that takes a |constraints| argument. - // http://crbug.com/706408 static blink::WebMediaStreamTrack CreateVideoTrack( MediaStreamVideoSource* source, const MediaStreamVideoSource::ConstraintsCallback& callback, bool enabled); static blink::WebMediaStreamTrack CreateVideoTrack( MediaStreamVideoSource* source, - const blink::WebMediaConstraints& constraints, - const MediaStreamVideoSource::ConstraintsCallback& callback, - bool enabled); - static blink::WebMediaStreamTrack CreateVideoTrack( - MediaStreamVideoSource* source, const VideoTrackAdapterSettings& adapter_settings, const base::Optional<bool>& noise_reduction, bool is_screencast, @@ -60,19 +53,12 @@ const blink::WebMediaStreamTrack& track); // Constructors for video tracks. - // TODO(guidou): Remove the variant that takes a |constraints| argument. - // http://crbug.com/706408 MediaStreamVideoTrack( MediaStreamVideoSource* source, const MediaStreamVideoSource::ConstraintsCallback& callback, bool enabled); MediaStreamVideoTrack( MediaStreamVideoSource* source, - const blink::WebMediaConstraints& constraints, - const MediaStreamVideoSource::ConstraintsCallback& callback, - bool enabled); - MediaStreamVideoTrack( - MediaStreamVideoSource* source, const VideoTrackAdapterSettings& adapter_settings, const base::Optional<bool>& noise_reduction, bool is_screen_cast, @@ -90,28 +76,19 @@ void OnReadyStateChanged(blink::WebMediaStreamSource::ReadyState state); - const blink::WebMediaConstraints& constraints() const { - DCHECK(IsOldVideoConstraints()); - return constraints_; - } const base::Optional<bool>& noise_reduction() const { - DCHECK(!IsOldVideoConstraints()); return noise_reduction_; } bool is_screencast() const { - DCHECK(!IsOldVideoConstraints()); return is_screencast_; } const base::Optional<double>& min_frame_rate() const { - DCHECK(!IsOldVideoConstraints()); return min_frame_rate_; } const base::Optional<double>& max_frame_rate() const { - DCHECK(!IsOldVideoConstraints()); return max_frame_rate_; } const VideoTrackAdapterSettings& adapter_settings() const { - DCHECK(!IsOldVideoConstraints()); return *adapter_settings_; } @@ -149,9 +126,6 @@ class FrameDeliverer; const scoped_refptr<FrameDeliverer> frame_deliverer_; - // TODO(guidou): remove this field. http://crbug.com/706408 - const blink::WebMediaConstraints constraints_; - // TODO(guidou): Make this field a regular field instead of a unique_ptr. std::unique_ptr<VideoTrackAdapterSettings> adapter_settings_; base::Optional<bool> noise_reduction_;
diff --git a/content/renderer/media/media_stream_video_track_unittest.cc b/content/renderer/media/media_stream_video_track_unittest.cc index b82549d..32c0ff0 100644 --- a/content/renderer/media/media_stream_video_track_unittest.cc +++ b/content/renderer/media/media_stream_video_track_unittest.cc
@@ -10,10 +10,8 @@ #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" -#include "base/test/scoped_feature_list.h" #include "base/threading/thread_checker_impl.h" #include "content/child/child_process.h" -#include "content/public/common/content_features.h" #include "content/renderer/media/media_stream_video_track.h" #include "content/renderer/media/mock_media_stream_video_sink.h" #include "content/renderer/media/mock_media_stream_video_source.h" @@ -38,10 +36,7 @@ MediaStreamVideoTrackTest() : child_process_(new ChildProcess()), mock_source_(nullptr), - source_started_(false) { - scoped_feature_list_.InitAndDisableFeature( - features::kMediaStreamOldVideoConstraints); - } + source_started_(false) {} ~MediaStreamVideoTrackTest() override {} @@ -70,13 +65,11 @@ void InitializeSource() { blink_source_.Reset(); - mock_source_ = IsOldVideoConstraints() - ? new MockMediaStreamVideoSource(false) - : new MockMediaStreamVideoSource( - media::VideoCaptureFormat( - gfx::Size(kMockSourceWidth, kMockSourceHeight), - 30.0, media::PIXEL_FORMAT_I420), - false); + mock_source_ = new MockMediaStreamVideoSource( + media::VideoCaptureFormat( + gfx::Size(kMockSourceWidth, kMockSourceHeight), 30.0, + media::PIXEL_FORMAT_I420), + false); blink_source_.Initialize(blink::WebString::FromASCII("dummy_source_id"), blink::WebMediaStreamSource::kTypeVideo, blink::WebString::FromASCII("dummy_source_name"), @@ -113,13 +106,11 @@ void UpdateVideoSourceToRespondToRequestRefreshFrame() { blink_source_.Reset(); - mock_source_ = IsOldVideoConstraints() - ? new MockMediaStreamVideoSource(false, true) - : new MockMediaStreamVideoSource( - media::VideoCaptureFormat( - gfx::Size(kMockSourceWidth, kMockSourceHeight), - 30.0, media::PIXEL_FORMAT_I420), - true); + mock_source_ = new MockMediaStreamVideoSource( + media::VideoCaptureFormat( + gfx::Size(kMockSourceWidth, kMockSourceHeight), 30.0, + media::PIXEL_FORMAT_I420), + true); blink_source_.Initialize(blink::WebString::FromASCII("dummy_source_id"), blink::WebMediaStreamSource::kTypeVideo, blink::WebString::FromASCII("dummy_source_name"), @@ -139,7 +130,6 @@ // |mock_source_| is owned by |webkit_source_|. MockMediaStreamVideoSource* mock_source_; bool source_started_; - base::test::ScopedFeatureList scoped_feature_list_; }; TEST_F(MediaStreamVideoTrackTest, AddAndRemoveSink) { @@ -348,242 +338,4 @@ EXPECT_TRUE(settings.device_id.IsNull()); } -// TODO(guidou): Remove this test. http://crbug.com/706408 -class MediaStreamVideoTrackOldConstraintsTest : public ::testing::Test { - public: - MediaStreamVideoTrackOldConstraintsTest() - : child_process_(new ChildProcess()), - mock_source_(nullptr), - source_started_(false) { - scoped_feature_list_.InitAndEnableFeature( - features::kMediaStreamOldVideoConstraints); - } - - ~MediaStreamVideoTrackOldConstraintsTest() override {} - - void TearDown() override { - blink_source_.Reset(); - blink::WebHeap::CollectAllGarbageForTesting(); - } - - void DeliverVideoFrameAndWaitForRenderer(MockMediaStreamVideoSink* sink) { - base::RunLoop run_loop; - base::Closure quit_closure = run_loop.QuitClosure(); - EXPECT_CALL(*sink, OnVideoFrame()).WillOnce(RunClosure(quit_closure)); - const scoped_refptr<media::VideoFrame> frame = - media::VideoFrame::CreateColorFrame( - gfx::Size(MediaStreamVideoSource::kDefaultWidth, - MediaStreamVideoSource::kDefaultHeight), - kColorValue, kColorValue, kColorValue, base::TimeDelta()); - mock_source()->DeliverVideoFrame(frame); - run_loop.Run(); - } - - protected: - base::MessageLoop* io_message_loop() const { - return child_process_->io_message_loop(); - } - - void InitializeSource() { - blink_source_.Reset(); - mock_source_ = IsOldVideoConstraints() - ? new MockMediaStreamVideoSource(false) - : new MockMediaStreamVideoSource( - media::VideoCaptureFormat( - gfx::Size(kMockSourceWidth, kMockSourceHeight), - 30.0, media::PIXEL_FORMAT_I420), - false); - blink_source_.Initialize(blink::WebString::FromASCII("dummy_source_id"), - blink::WebMediaStreamSource::kTypeVideo, - blink::WebString::FromASCII("dummy_source_name"), - false /* remote */); - blink_source_.SetExtraData(mock_source_); - } - - // Create a track that's associated with |mock_source_|. - blink::WebMediaStreamTrack CreateTrack() { - const bool enabled = true; - blink::WebMediaStreamTrack track = MediaStreamVideoTrack::CreateVideoTrack( - mock_source_, MediaStreamSource::ConstraintsCallback(), enabled); - if (!source_started_) { - mock_source_->StartMockedSource(); - source_started_ = true; - } - return track; - } - - void UpdateVideoSourceToRespondToRequestRefreshFrame() { - blink_source_.Reset(); - mock_source_ = IsOldVideoConstraints() - ? new MockMediaStreamVideoSource(false, true) - : new MockMediaStreamVideoSource( - media::VideoCaptureFormat( - gfx::Size(kMockSourceWidth, kMockSourceHeight), - 30.0, media::PIXEL_FORMAT_I420), - true); - blink_source_.Initialize(blink::WebString::FromASCII("dummy_source_id"), - blink::WebMediaStreamSource::kTypeVideo, - blink::WebString::FromASCII("dummy_source_name"), - false /* remote */); - blink_source_.SetExtraData(mock_source_); - } - - MockMediaStreamVideoSource* mock_source() { return mock_source_; } - const blink::WebMediaStreamSource& blink_source() const { - return blink_source_; - } - - private: - const base::MessageLoopForUI message_loop_; - const std::unique_ptr<ChildProcess> child_process_; - blink::WebMediaStreamSource blink_source_; - // |mock_source_| is owned by |webkit_source_|. - MockMediaStreamVideoSource* mock_source_; - bool source_started_; - base::test::ScopedFeatureList scoped_feature_list_; -}; - -TEST_F(MediaStreamVideoTrackOldConstraintsTest, AddAndRemoveSink) { - InitializeSource(); - MockMediaStreamVideoSink sink; - blink::WebMediaStreamTrack track = CreateTrack(); - sink.ConnectToTrack(track); - - DeliverVideoFrameAndWaitForRenderer(&sink); - EXPECT_EQ(1, sink.number_of_frames()); - - DeliverVideoFrameAndWaitForRenderer(&sink); - - sink.DisconnectFromTrack(); - - scoped_refptr<media::VideoFrame> frame = media::VideoFrame::CreateBlackFrame( - gfx::Size(MediaStreamVideoSource::kDefaultWidth, - MediaStreamVideoSource::kDefaultHeight)); - mock_source()->DeliverVideoFrame(frame); - // Wait for the IO thread to complete delivering frames. - base::RunLoop().RunUntilIdle(); - EXPECT_EQ(2, sink.number_of_frames()); -} - -// Checks that the callback given to the track is reset on the right thread. -TEST_F(MediaStreamVideoTrackOldConstraintsTest, ResetCallbackOnThread) { - InitializeSource(); - MockMediaStreamVideoSink sink; - blink::WebMediaStreamTrack track = CreateTrack(); - - base::RunLoop run_loop; - bool correct = false; - sink.ConnectToTrackWithCallback( - track, base::Bind(&CheckThreadVideoFrameReceiver, - base::Owned(new CheckThreadHelper( - run_loop.QuitClosure(), &correct)))); - sink.DisconnectFromTrack(); - run_loop.Run(); - EXPECT_TRUE(correct) << "Not called on correct thread."; -} - -TEST_F(MediaStreamVideoTrackOldConstraintsTest, SetEnabled) { - InitializeSource(); - MockMediaStreamVideoSink sink; - blink::WebMediaStreamTrack track = CreateTrack(); - sink.ConnectToTrack(track); - - MediaStreamVideoTrack* video_track = - MediaStreamVideoTrack::GetVideoTrack(track); - - DeliverVideoFrameAndWaitForRenderer(&sink); - EXPECT_EQ(1, sink.number_of_frames()); - EXPECT_EQ(kColorValue, *sink.last_frame()->data(media::VideoFrame::kYPlane)); - - video_track->SetEnabled(false); - EXPECT_FALSE(sink.enabled()); - - DeliverVideoFrameAndWaitForRenderer(&sink); - EXPECT_EQ(2, sink.number_of_frames()); - EXPECT_EQ(kBlackValue, *sink.last_frame()->data(media::VideoFrame::kYPlane)); - - video_track->SetEnabled(true); - EXPECT_TRUE(sink.enabled()); - DeliverVideoFrameAndWaitForRenderer(&sink); - EXPECT_EQ(3, sink.number_of_frames()); - EXPECT_EQ(kColorValue, *sink.last_frame()->data(media::VideoFrame::kYPlane)); - sink.DisconnectFromTrack(); -} - -TEST_F(MediaStreamVideoTrackOldConstraintsTest, SourceStopped) { - InitializeSource(); - MockMediaStreamVideoSink sink; - blink::WebMediaStreamTrack track = CreateTrack(); - sink.ConnectToTrack(track); - EXPECT_EQ(blink::WebMediaStreamSource::kReadyStateLive, sink.state()); - - mock_source()->StopSource(); - EXPECT_EQ(blink::WebMediaStreamSource::kReadyStateEnded, sink.state()); - sink.DisconnectFromTrack(); -} - -TEST_F(MediaStreamVideoTrackOldConstraintsTest, StopLastTrack) { - InitializeSource(); - MockMediaStreamVideoSink sink1; - blink::WebMediaStreamTrack track1 = CreateTrack(); - sink1.ConnectToTrack(track1); - EXPECT_EQ(blink::WebMediaStreamSource::kReadyStateLive, sink1.state()); - - EXPECT_EQ(blink::WebMediaStreamSource::kReadyStateLive, - blink_source().GetReadyState()); - - MockMediaStreamVideoSink sink2; - blink::WebMediaStreamTrack track2 = CreateTrack(); - sink2.ConnectToTrack(track2); - EXPECT_EQ(blink::WebMediaStreamSource::kReadyStateLive, sink2.state()); - - MediaStreamVideoTrack* const native_track1 = - MediaStreamVideoTrack::GetVideoTrack(track1); - native_track1->Stop(); - EXPECT_EQ(blink::WebMediaStreamSource::kReadyStateEnded, sink1.state()); - EXPECT_EQ(blink::WebMediaStreamSource::kReadyStateLive, - blink_source().GetReadyState()); - sink1.DisconnectFromTrack(); - - MediaStreamVideoTrack* const native_track2 = - MediaStreamVideoTrack::GetVideoTrack(track2); - native_track2->Stop(); - EXPECT_EQ(blink::WebMediaStreamSource::kReadyStateEnded, sink2.state()); - EXPECT_EQ(blink::WebMediaStreamSource::kReadyStateEnded, - blink_source().GetReadyState()); - sink2.DisconnectFromTrack(); -} - -TEST_F(MediaStreamVideoTrackOldConstraintsTest, - CheckTrackRequestsFrameOldConstraintsOldConstraints) { - UpdateVideoSourceToRespondToRequestRefreshFrame(); - blink::WebMediaStreamTrack track = CreateTrack(); - - // Add sink and expect to get a frame. - MockMediaStreamVideoSink sink; - base::RunLoop run_loop; - base::Closure quit_closure = run_loop.QuitClosure(); - EXPECT_CALL(sink, OnVideoFrame()).WillOnce(RunClosure(quit_closure)); - sink.ConnectToTrack(track); - run_loop.Run(); - EXPECT_EQ(1, sink.number_of_frames()); - - sink.DisconnectFromTrack(); -} - -TEST_F(MediaStreamVideoTrackOldConstraintsTest, GetSettingsOldConstraints) { - InitializeSource(); - blink::WebMediaStreamTrack track = CreateTrack(); - MediaStreamVideoTrack* const native_track = - MediaStreamVideoTrack::GetVideoTrack(track); - blink::WebMediaStreamTrack::Settings settings; - native_track->GetSettings(settings); - // These values come straight from the mock video track implementation. - EXPECT_EQ(640, settings.width); - EXPECT_EQ(480, settings.height); - EXPECT_EQ(30.0, settings.frame_rate); - EXPECT_EQ(blink::WebMediaStreamTrack::FacingMode::kNone, - settings.facing_mode); -} - } // namespace content
diff --git a/content/renderer/media/mock_media_stream_registry.cc b/content/renderer/media/mock_media_stream_registry.cc index c775e7c..7f10526e 100644 --- a/content/renderer/media/mock_media_stream_registry.cc +++ b/content/renderer/media/mock_media_stream_registry.cc
@@ -58,32 +58,10 @@ void MockMediaStreamRegistry::AddVideoTrack( const std::string& track_id, - const blink::WebMediaConstraints& constraints) { - DCHECK(IsOldVideoConstraints()); - blink::WebMediaStreamSource blink_source; - blink_source.Initialize("mock video source id", - blink::WebMediaStreamSource::kTypeVideo, - "mock video source name", false /* remote */); - MockMediaStreamVideoSource* native_source = - new MockMediaStreamVideoSource(false /* manual get supported formats */); - blink_source.SetExtraData(native_source); - blink::WebMediaStreamTrack blink_track; - blink_track.Initialize(blink::WebString::FromUTF8(track_id), blink_source); - - MediaStreamVideoTrack* native_track = new MediaStreamVideoTrack( - native_source, constraints, MediaStreamVideoSource::ConstraintsCallback(), - true /* enabled */); - blink_track.SetTrackData(native_track); - test_stream_.AddTrack(blink_track); -} - -void MockMediaStreamRegistry::AddVideoTrack( - const std::string& track_id, const VideoTrackAdapterSettings& adapter_settings, const base::Optional<bool>& noise_reduction, bool is_screencast, double min_frame_rate) { - DCHECK(!IsOldVideoConstraints()); blink::WebMediaStreamSource blink_source; blink_source.Initialize("mock video source id", blink::WebMediaStreamSource::kTypeVideo, @@ -103,14 +81,8 @@ } void MockMediaStreamRegistry::AddVideoTrack(const std::string& track_id) { - if (IsOldVideoConstraints()) { - blink::WebMediaConstraints constraints; - constraints.Initialize(); - AddVideoTrack(track_id, constraints); - } else { - AddVideoTrack(track_id, VideoTrackAdapterSettings(), base::Optional<bool>(), - false /* is_screncast */, 0.0 /* min_frame_rate */); - } + AddVideoTrack(track_id, VideoTrackAdapterSettings(), base::Optional<bool>(), + false /* is_screncast */, 0.0 /* min_frame_rate */); } void MockMediaStreamRegistry::AddAudioTrack(const std::string& track_id) {
diff --git a/content/renderer/media/mock_media_stream_registry.h b/content/renderer/media/mock_media_stream_registry.h index f57ebe9..e37dbb5 100644 --- a/content/renderer/media/mock_media_stream_registry.h +++ b/content/renderer/media/mock_media_stream_registry.h
@@ -10,10 +10,6 @@ #include "base/optional.h" #include "content/renderer/media/media_stream_registry_interface.h" -namespace blink { -class WebMediaConstraints; -} - namespace content { struct VideoTrackAdapterSettings; @@ -26,9 +22,6 @@ MockMediaStreamRegistry(); void Init(const std::string& stream_url); - // TODO(guidou): Remove this method. http://crbug.com/706408 - void AddVideoTrack(const std::string& track_id, - const blink::WebMediaConstraints& constraints); void AddVideoTrack(const std::string& track_id, const VideoTrackAdapterSettings& adapter_settings, const base::Optional<bool>& noise_reduction,
diff --git a/content/renderer/media/mock_media_stream_video_source.cc b/content/renderer/media/mock_media_stream_video_source.cc index f459bf1..05070df 100644 --- a/content/renderer/media/mock_media_stream_video_source.cc +++ b/content/renderer/media/mock_media_stream_video_source.cc
@@ -92,9 +92,6 @@ const blink::WebMediaConstraints& constraints, const VideoCaptureDeliverFrameCB& frame_callback) { DCHECK(frame_callback_.is_null()); - if (IsOldVideoConstraints()) - format_ = format; - attempted_to_start_ = true; frame_callback_ = frame_callback; }
diff --git a/content/renderer/media/renderer_webaudiodevice_impl.cc b/content/renderer/media/renderer_webaudiodevice_impl.cc index ef941bec..568052e5 100644 --- a/content/renderer/media/renderer_webaudiodevice_impl.cc +++ b/content/renderer/media/renderer_webaudiodevice_impl.cc
@@ -65,12 +65,9 @@ hardware_params.sample_rate(), 0); break; case media::AudioLatency::LATENCY_EXACT_MS: - // TODO(andrew.macpherson@soundtrap.com): http://crbug.com/708917 - return std::min(4096, - media::AudioLatency::GetExactBufferSize( - base::TimeDelta::FromSecondsD(latency_hint.Seconds()), - hardware_params.sample_rate(), - hardware_params.frames_per_buffer())); + return media::AudioLatency::GetExactBufferSize( + base::TimeDelta::FromSecondsD(latency_hint.Seconds()), + hardware_params.sample_rate(), hardware_params.frames_per_buffer()); break; default: NOTREACHED();
diff --git a/content/renderer/media/user_media_client_impl.cc b/content/renderer/media/user_media_client_impl.cc index 96ebd7bd..8cdc27b0 100644 --- a/content/renderer/media/user_media_client_impl.cc +++ b/content/renderer/media/user_media_client_impl.cc
@@ -1010,11 +1010,6 @@ const MediaStreamSource::SourceStoppedCallback& stop_callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(current_request_info_); - if (IsOldVideoConstraints()) { - return new MediaStreamVideoCapturerSource(stop_callback, device, - render_frame()); - } - DCHECK(current_request_info_->video_capture_settings().HasValue()); return new MediaStreamVideoCapturerSource( stop_callback, device, @@ -1484,13 +1479,6 @@ DCHECK(native_source); sources_.push_back(source); sources_waiting_for_callback_.push_back(native_source); - if (IsOldVideoConstraints()) { - return MediaStreamVideoTrack::CreateVideoTrack( - native_source, request_.VideoConstraints(), - base::Bind(&UserMediaClientImpl::UserMediaRequestInfo::OnTrackStarted, - AsWeakPtr()), - true); - } return MediaStreamVideoTrack::CreateVideoTrack( native_source, video_capture_settings_.track_adapter_settings(), video_capture_settings_.noise_reduction(), is_video_content_capture_,
diff --git a/content/renderer/media/webrtc/media_stream_video_webrtc_sink.cc b/content/renderer/media/webrtc/media_stream_video_webrtc_sink.cc index 1f6f9aa5..24bad31 100644 --- a/content/renderer/media/webrtc/media_stream_video_webrtc_sink.cc +++ b/content/renderer/media/webrtc/media_stream_video_webrtc_sink.cc
@@ -266,51 +266,12 @@ MediaStreamVideoTrack* video_track = MediaStreamVideoTrack::GetVideoTrack(track); DCHECK(video_track); - rtc::Optional<bool> needs_denoising; - bool is_screencast = false; - base::Optional<double> min_frame_rate; - base::Optional<double> max_frame_rate; - if (IsOldVideoConstraints()) { - const blink::WebMediaConstraints& constraints = video_track->constraints(); - - // Check for presence of mediaStreamSource constraint. The value is ignored. - std::string value; - is_screencast = GetConstraintValueAsString( - constraints, &blink::WebMediaTrackConstraintSet::media_stream_source, - &value); - - // Extract denoising preference, if no value is set this currently falls - // back to a codec-specific default inside webrtc, hence the tri-state of - // {on, off unset}. - // TODO(pbos): Add tests that make sure that googNoiseReduction has properly - // propagated from getUserMedia down to a VideoTrackSource. - bool denoising_value; - if (GetConstraintValueAsBoolean( - constraints, - &blink::WebMediaTrackConstraintSet::goog_noise_reduction, - &denoising_value)) { - needs_denoising = rtc::Optional<bool>(denoising_value); - } - double frame_rate_value; - if (GetConstraintMinAsDouble(constraints, - &blink::WebMediaTrackConstraintSet::frame_rate, - &frame_rate_value) && - frame_rate_value >= 0.0) { - min_frame_rate = frame_rate_value; - } - if (GetConstraintMaxAsDouble(constraints, - &blink::WebMediaTrackConstraintSet::frame_rate, - &frame_rate_value) && - frame_rate_value >= 0.0) { - max_frame_rate = frame_rate_value; - } - } else { - needs_denoising = ToRtcOptional(video_track->noise_reduction()); - is_screencast = video_track->is_screencast(); - min_frame_rate = video_track->min_frame_rate(); - max_frame_rate = video_track->max_frame_rate(); - } + rtc::Optional<bool> needs_denoising = + ToRtcOptional(video_track->noise_reduction()); + bool is_screencast = is_screencast = video_track->is_screencast(); + base::Optional<double> min_frame_rate = video_track->min_frame_rate(); + base::Optional<double> max_frame_rate = video_track->max_frame_rate(); // Enable automatic frame refreshes for the screen capture sources, which will // stop producing frames whenever screen content is not changing. Check the
diff --git a/content/renderer/media/webrtc/media_stream_video_webrtc_sink_unittest.cc b/content/renderer/media/webrtc/media_stream_video_webrtc_sink_unittest.cc index ed6ea4ef..5fff878 100644 --- a/content/renderer/media/webrtc/media_stream_video_webrtc_sink_unittest.cc +++ b/content/renderer/media/webrtc/media_stream_video_webrtc_sink_unittest.cc
@@ -4,10 +4,8 @@ #include "content/renderer/media/webrtc/media_stream_video_webrtc_sink.h" -#include "base/test/scoped_feature_list.h" #include "base/test/scoped_task_environment.h" #include "content/child/child_process.h" -#include "content/public/common/content_features.h" #include "content/renderer/media/mock_constraint_factory.h" #include "content/renderer/media/mock_media_stream_registry.h" #include "content/renderer/media/video_track_adapter.h" @@ -21,10 +19,7 @@ public: MediaStreamVideoWebRtcSinkTest() : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) { - scoped_feature_list_.InitAndDisableFeature( - features::kMediaStreamOldVideoConstraints); - } + base::test::ScopedTaskEnvironment::MainThreadType::UI) {} void SetVideoTrack() { registry_.Init("stream URL"); @@ -36,16 +31,6 @@ // no valid format, using the track will cause a crash. } - void SetVideoTrack(blink::WebMediaConstraints constraints) { - registry_.Init("stream URL"); - registry_.AddVideoTrack("test video track", constraints); - blink::WebVector<blink::WebMediaStreamTrack> video_tracks; - registry_.test_stream().VideoTracks(video_tracks); - track_ = video_tracks[0]; - // TODO(hta): Verify that track_ is valid. When constraints produce - // no valid format, using the track will cause a crash. - } - void SetVideoTrack(const base::Optional<bool>& noise_reduction) { registry_.Init("stream URL"); registry_.AddVideoTrack("test video track", VideoTrackAdapterSettings(), @@ -67,7 +52,6 @@ // and Sources in |registry_| into believing they are on the right threads. base::test::ScopedTaskEnvironment scoped_task_environment_; const ChildProcess child_process_; - base::test::ScopedFeatureList scoped_feature_list_; }; TEST_F(MediaStreamVideoWebRtcSinkTest, NoiseReductionDefaultsToNotSet) { @@ -85,79 +69,5 @@ EXPECT_TRUE(*(my_sink.SourceNeedsDenoisingForTesting())); } -// TODO(guidou): Remove this test. http://crbug.com/706408 -class MediaStreamVideoWebRtcSinkOldConstraintsTest : public ::testing::Test { - public: - MediaStreamVideoWebRtcSinkOldConstraintsTest() - : scoped_task_environment_( - base::test::ScopedTaskEnvironment::MainThreadType::UI) { - scoped_feature_list_.InitAndEnableFeature( - features::kMediaStreamOldVideoConstraints); - } - - void SetVideoTrack() { - registry_.Init("stream URL"); - registry_.AddVideoTrack("test video track"); - blink::WebVector<blink::WebMediaStreamTrack> video_tracks; - registry_.test_stream().VideoTracks(video_tracks); - track_ = video_tracks[0]; - // TODO(hta): Verify that track_ is valid. When constraints produce - // no valid format, using the track will cause a crash. - } - - void SetVideoTrack(blink::WebMediaConstraints constraints) { - registry_.Init("stream URL"); - registry_.AddVideoTrack("test video track", constraints); - blink::WebVector<blink::WebMediaStreamTrack> video_tracks; - registry_.test_stream().VideoTracks(video_tracks); - track_ = video_tracks[0]; - // TODO(hta): Verify that track_ is valid. When constraints produce - // no valid format, using the track will cause a crash. - } - - void SetVideoTrack(const base::Optional<bool>& noise_reduction) { - registry_.Init("stream URL"); - registry_.AddVideoTrack("test video track", VideoTrackAdapterSettings(), - noise_reduction, false, 0.0); - blink::WebVector<blink::WebMediaStreamTrack> video_tracks; - registry_.test_stream().VideoTracks(video_tracks); - track_ = video_tracks[0]; - // TODO(hta): Verify that track_ is valid. When constraints produce - // no valid format, using the track will cause a crash. - } - - protected: - blink::WebMediaStreamTrack track_; - MockPeerConnectionDependencyFactory dependency_factory_; - - private: - MockMediaStreamRegistry registry_; - // A ChildProcess and a MessageLoopForUI are both needed to fool the Tracks - // and Sources in |registry_| into believing they are on the right threads. - base::test::ScopedTaskEnvironment scoped_task_environment_; - const ChildProcess child_process_; - base::test::ScopedFeatureList scoped_feature_list_; -}; - -TEST_F(MediaStreamVideoWebRtcSinkOldConstraintsTest, - NoiseReductionDefaultsToNotSet) { - blink::WebMediaConstraints constraints; - constraints.Initialize(); - SetVideoTrack(constraints); - MediaStreamVideoWebRtcSink my_sink(track_, &dependency_factory_); - EXPECT_TRUE(my_sink.webrtc_video_track()); - EXPECT_FALSE(my_sink.SourceNeedsDenoisingForTesting()); -} - -TEST_F(MediaStreamVideoWebRtcSinkOldConstraintsTest, - NoiseReductionConstraintPassThrough) { - MockConstraintFactory factory; - factory.basic().goog_noise_reduction.SetExact(true); - SetVideoTrack(factory.CreateWebMediaConstraints()); - MediaStreamVideoWebRtcSink my_sink(track_, &dependency_factory_); - EXPECT_TRUE(my_sink.SourceNeedsDenoisingForTesting()); - EXPECT_TRUE(*(my_sink.SourceNeedsDenoisingForTesting())); -} - } // namespace } // namespace content
diff --git a/content/renderer/pepper/pepper_media_stream_video_track_host.cc b/content/renderer/pepper/pepper_media_stream_video_track_host.cc index 52911b6..4924a98 100644 --- a/content/renderer/pepper/pepper_media_stream_video_track_host.cc +++ b/content/renderer/pepper/pepper_media_stream_video_track_host.cc
@@ -446,7 +446,6 @@ private: base::Optional<media::VideoCaptureFormat> GetCurrentFormatImpl() const override { - DCHECK(!IsOldVideoConstraints()); if (host_) { return base::Optional<media::VideoCaptureFormat>( media::VideoCaptureFormat(
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index de3f7951..4ae46edc 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -6715,13 +6715,18 @@ base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableNetworkService); if (network_service_enabled && child_thread) { + // Use if per-frame or per-scheme URLLoaderFactory is given. mojom::URLLoaderFactory* factory = url_loader_factory_.get(); if (request.Url().ProtocolIs(url::kBlobScheme)) factory = RenderThreadImpl::current()->GetBlobURLLoaderFactory(); - return base::MakeUnique<WebURLLoaderImpl>( - child_thread->resource_dispatcher(), task_runner, factory); + if (factory) { + return base::MakeUnique<WebURLLoaderImpl>( + child_thread->resource_dispatcher(), task_runner, factory); + } + // Otherwise fallback to the platform one, which will use the default + // network service's URLLoaderFactory. } return RenderThreadImpl::current()->blink_platform_impl()->CreateURLLoader(
diff --git a/content/renderer/service_worker/embedded_worker_instance_client_impl.cc b/content/renderer/service_worker/embedded_worker_instance_client_impl.cc index c2b8dcd..d513426 100644 --- a/content/renderer/service_worker/embedded_worker_instance_client_impl.cc +++ b/content/renderer/service_worker/embedded_worker_instance_client_impl.cc
@@ -10,6 +10,7 @@ #include "base/strings/utf_string_conversions.h" #include "content/child/scoped_child_process_reference.h" #include "content/common/service_worker/embedded_worker_messages.h" +#include "content/common/service_worker/service_worker_utils.h" #include "content/public/common/content_client.h" #include "content/renderer/service_worker/embedded_worker_devtools_agent.h" #include "content/renderer/service_worker/service_worker_context_client.h" @@ -110,8 +111,9 @@ EmbeddedWorkerInstanceClientImpl::StartWorkerContext( const EmbeddedWorkerStartParams& params, std::unique_ptr<ServiceWorkerContextClient> context_client) { - std::unique_ptr<blink::WebServiceWorkerInstalledScriptsManager> manager = - WebServiceWorkerInstalledScriptsManagerImpl::Create(); + std::unique_ptr<blink::WebServiceWorkerInstalledScriptsManager> manager; + if (ServiceWorkerUtils::IsScriptStreamingEnabled()) + manager = WebServiceWorkerInstalledScriptsManagerImpl::Create(); auto wrapper = base::MakeUnique<WorkerWrapper>( blink::WebEmbeddedWorker::Create(std::move(context_client),
diff --git a/content/shell/renderer/layout_test/layout_test_content_renderer_client.cc b/content/shell/renderer/layout_test/layout_test_content_renderer_client.cc index bf0ffca..b275d6a 100644 --- a/content/shell/renderer/layout_test/layout_test_content_renderer_client.cc +++ b/content/shell/renderer/layout_test/layout_test_content_renderer_client.cc
@@ -217,11 +217,9 @@ media::AudioLatency::GetHighLatencyBufferSize(hw_sample_rate, 0); break; case blink::WebAudioLatencyHint::kCategoryExact: - // TODO(andrew.macpherson@soundtrap.com): http://crbug.com/708917 - buffer_size = std::min( - 4096, media::AudioLatency::GetExactBufferSize( - base::TimeDelta::FromSecondsD(latency_hint.Seconds()), - hw_sample_rate, hw_buffer_size)); + buffer_size = media::AudioLatency::GetExactBufferSize( + base::TimeDelta::FromSecondsD(latency_hint.Seconds()), hw_sample_rate, + hw_buffer_size); break; default: NOTREACHED();
diff --git a/content/test/data/payments/manifest.json b/content/test/data/payments/manifest.json new file mode 100644 index 0000000..f12383d --- /dev/null +++ b/content/test/data/payments/manifest.json
@@ -0,0 +1,9 @@ +{ + "name": "Bob pay web app", + "short_name": "bobpay", + "icons": [{ + "src": "images/bobpay.png", + "sizes": "32x32", + "type": "image/png" + }] +} \ No newline at end of file
diff --git a/content/test/data/payments/payment_app_invocation.html b/content/test/data/payments/payment_app_invocation.html index 79ba835..413e999a 100644 --- a/content/test/data/payments/payment_app_invocation.html +++ b/content/test/data/payments/payment_app_invocation.html
@@ -1,5 +1,8 @@ <!doctype html> <title>Payment App: Test for invoking payment app</title> +<head> + <link rel="manifest" href="manifest.json"> +</head> <script src="./result_queue.js"></script> <script>
diff --git a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py index 9cee0c6..dbadf1a 100644 --- a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py +++ b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
@@ -206,116 +206,20 @@ self.Flaky('deqp/*', ['win', 'intel', 'd3d11'], bug=628395) # Passthrough command decoder / D3D11 - self.Fail('conformance/textures/image_bitmap_from_video/*', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance/textures/video/*', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance/textures/misc/texture-corner-case-videos.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/image_bitmap_from_video/*', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/video/*', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/glsl3/no-attribute-vertex-shader.html', ['win', 'passthrough', 'd3d11'], bug=602688) self.Fail('conformance2/rendering/clearbuffer-sub-source.html', ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/canvas/tex-2d-rg8-rg-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/canvas/tex-2d-rg16f-rg-half_float.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/canvas/tex-2d-rg16f-rg-float.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/canvas/tex-2d-rg32f-rg-float.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/canvas/' + - 'tex-2d-rg8ui-rg_integer-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/canvas/' + - 'tex-2d-rgb8ui-rgb_integer-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/canvas/' + - 'tex-2d-rgba8ui-rgba_integer-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - - self.Fail('conformance2/textures/canvas_sub_rectangle/' + - 'tex-2d-rg8-rg-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/canvas_sub_rectangle/' + - 'tex-2d-rg16f-rg-half_float.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/canvas_sub_rectangle/' + - 'tex-2d-rg16f-rg-float.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/canvas_sub_rectangle/' + - 'tex-2d-rg32f-rg-float.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/canvas_sub_rectangle/' + - 'tex-2d-rg8ui-rg_integer-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/canvas_sub_rectangle/' + - 'tex-2d-rgb8ui-rgb_integer-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/canvas_sub_rectangle/' + - 'tex-2d-rgba8ui-rgba_integer-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - - self.Fail('conformance2/textures/webgl_canvas/' + - 'tex-2d-rg8-rg-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/webgl_canvas/' + - 'tex-2d-rg16f-rg-half_float.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/webgl_canvas/' + - 'tex-2d-rg16f-rg-float.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/webgl_canvas/' + - 'tex-2d-rg32f-rg-float.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/webgl_canvas/' + - 'tex-2d-rg8ui-rg_integer-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/webgl_canvas/' + - 'tex-2d-rgb8ui-rgb_integer-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/webgl_canvas/' + - 'tex-2d-rgba8ui-rgba_integer-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - - self.Fail('conformance2/textures/image_bitmap_from_canvas/' + - 'tex-2d-rg8-rg-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/image_bitmap_from_canvas/' + - 'tex-2d-rg16f-rg-half_float.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/image_bitmap_from_canvas/' + - 'tex-2d-rg16f-rg-float.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/image_bitmap_from_canvas/' + - 'tex-2d-rg32f-rg-float.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/image_bitmap_from_canvas/' + - 'tex-2d-rg8ui-rg_integer-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) self.Fail('conformance2/textures/image_bitmap_from_canvas/' + 'tex-2d-srgb8-rgb-unsigned_byte.html', ['win', 'passthrough', 'd3d11'], bug=602688) self.Fail('conformance2/textures/image_bitmap_from_canvas/' + - 'tex-2d-rgb8ui-rgb_integer-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/image_bitmap_from_canvas/' + 'tex-2d-srgb8_alpha8-rgba-unsigned_byte.html', ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/image_bitmap_from_canvas/' + - 'tex-2d-rgba8ui-rgba_integer-unsigned_byte.html', - ['win', 'passthrough', 'd3d11'], bug=602688) self.Fail('conformance/glsl/misc/shaders-with-name-conflicts.html', ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('deqp/data/gles3/shaders/preprocessor.html', - ['win', 'passthrough', 'd3d11'], bug=602688) self.Fail('conformance2/reading/read-pixels-from-fbo-test.html', ['win', 'passthrough', 'd3d11'], bug=602688) self.Skip('conformance2/textures/misc/' + @@ -328,9 +232,6 @@ self.Fail('conformance2/reading/format-r11f-g11f-b10f.html', ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('conformance2/textures/misc/' + - 'tex-image-with-bad-args-from-dom-elements.html', - ['win', 'passthrough', 'd3d11'], bug=602688) self.Fail('conformance/misc/uninitialized-test.html', ['win', 'passthrough', 'd3d11'], bug=602688) @@ -351,16 +252,8 @@ ['win', 'passthrough', 'd3d11'], bug=602688) self.Fail('deqp/functional/gles3/instancedrendering.html', ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('deqp/functional/gles3/integerstatequery.html', - ['win', 'passthrough', 'd3d11'], bug=602688) self.Fail('deqp/functional/gles3/readpixel.html', ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('deqp/functional/gles3/shaderderivate_dfdx.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('deqp/functional/gles3/shaderderivate_dfdy.html', - ['win', 'passthrough', 'd3d11'], bug=602688) - self.Fail('deqp/functional/gles3/shaderderivate_fwidth.html', - ['win', 'passthrough', 'd3d11'], bug=602688) self.Fail('deqp/functional/gles3/shaderstruct.html', ['win', 'passthrough', 'd3d11'], bug=602688)
diff --git a/docs/task_scheduler_migration.md b/docs/task_scheduler_migration.md index a7200d46..adca4c6 100644 --- a/docs/task_scheduler_migration.md +++ b/docs/task_scheduler_migration.md
@@ -92,8 +92,10 @@ ## Relevant single-thread -> sequence mappings * base::SingleThreadTaskRunner -> base::SequencedTaskRunner + * SingleThreadTaskRunner::BelongsToCurrentThread() -> SeqeuenceTaskRunner::RunsTasksInCurrentSequence() * base::ThreadTaskRunnerHandle -> base::SequencedTaskRunnerHandle * base::ThreadChecker -> base::SequenceChecker + * ThreadChecker::CalledOnValidThread() -> DCHECK_CALLED_ON_VALID_SEQUENCE(...) * base::ThreadLocalStorage::Slot -> base::SequenceLocalStorageSlot * BrowserThread::DeleteOnThread -> base::DeleteOnTaskRunner / base::RefCountedDeleteOnSequence * CreateSingleThreadTaskRunnerWithTraits() -> CreateSequencedTaskRunnerWithTraits() @@ -102,6 +104,7 @@ dependency is addressed (again [Prefer Sequences to Threads](threading_and_tasks.md#Prefer-Sequences-to-Threads)). + ### Other relevant mappings for tests * base::MessageLoop -> base::test::ScopedTaskEnvironment
diff --git a/ios/chrome/browser/BUILD.gn b/ios/chrome/browser/BUILD.gn index 7c5d2fb..56163da 100644 --- a/ios/chrome/browser/BUILD.gn +++ b/ios/chrome/browser/BUILD.gn
@@ -35,6 +35,8 @@ "arch_util.h", "browser_about_rewriter.cc", "browser_about_rewriter.h", + "chrome_browser_provider_observer_bridge.h", + "chrome_browser_provider_observer_bridge.mm", "chrome_constants.cc", "chrome_constants.h", "chrome_coordinator.h", @@ -211,6 +213,7 @@ testonly = true sources = [ "callback_counter_unittest.mm", + "chrome_browser_provider_observer_bridge_unittest.mm", "chrome_url_util_unittest.mm", "crash_loop_detection_util_unittest.mm", "install_time_util_unittest.mm", @@ -228,6 +231,8 @@ "//components/proxy_config", "//components/ssl_config", "//components/variations", + "//ios/public/provider/chrome/browser", + "//ios/public/provider/chrome/browser/signin", "//ios/web/public/test", "//net", "//net:test_support",
diff --git a/ios/chrome/browser/chrome_browser_provider_observer_bridge.h b/ios/chrome/browser/chrome_browser_provider_observer_bridge.h new file mode 100644 index 0000000..4c65da9 --- /dev/null +++ b/ios/chrome/browser/chrome_browser_provider_observer_bridge.h
@@ -0,0 +1,46 @@ +// Copyright 2017 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 IOS_CHROME_BROWSER_CHROME_BROWSER_PROVIDER_OBSERVER_BRIDGE_H_ +#define IOS_CHROME_BROWSER_CHROME_BROWSER_PROVIDER_OBSERVER_BRIDGE_H_ + +#import <Foundation/Foundation.h> + +#include "base/macros.h" +#include "base/scoped_observer.h" +#include "ios/public/provider/chrome/browser/chrome_browser_provider.h" + +// Objective-C protocol mirroring ChromeBrowserProvider::Observer. +@protocol ChromeBrowserProviderObserver<NSObject> +@optional +// Called when a new ChromeIdentityService has been installed. +- (void)chromeIdentityServiceDidChange: + (ios::ChromeIdentityService*)newIdentityService; +// Called when the ChromeBrowserProvider will be destroyed. +- (void)chromeBrowserProviderWillBeDestroyed; +@end + +// Simple observer bridge that forwards all events to its delegate observer. +class ChromeBrowserProviderObserverBridge + : public ios::ChromeBrowserProvider::Observer { + public: + explicit ChromeBrowserProviderObserverBridge( + id<ChromeBrowserProviderObserver> observer); + ~ChromeBrowserProviderObserverBridge() override; + + private: + // ios::ChromeBrowserProvider::Observer implementation. + void OnChromeIdentityServiceDidChange( + ios::ChromeIdentityService* new_identity_service) override; + void OnChromeBrowserProviderWillBeDestroyed() override; + + __weak id<ChromeBrowserProviderObserver> observer_; + ScopedObserver<ios::ChromeBrowserProvider, + ChromeBrowserProviderObserverBridge> + scoped_observer_; + + DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProviderObserverBridge); +}; + +#endif // IOS_CHROME_BROWSER_CHROME_BROWSER_PROVIDER_OBSERVER_BRIDGE_H_
diff --git a/ios/chrome/browser/chrome_browser_provider_observer_bridge.mm b/ios/chrome/browser/chrome_browser_provider_observer_bridge.mm new file mode 100644 index 0000000..f7bf597 --- /dev/null +++ b/ios/chrome/browser/chrome_browser_provider_observer_bridge.mm
@@ -0,0 +1,32 @@ +// Copyright 2017 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 "ios/chrome/browser/chrome_browser_provider_observer_bridge.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +ChromeBrowserProviderObserverBridge::ChromeBrowserProviderObserverBridge( + id<ChromeBrowserProviderObserver> observer) + : observer_(observer), scoped_observer_(this) { + DCHECK(observer_); + scoped_observer_.Add(ios::GetChromeBrowserProvider()); +} + +ChromeBrowserProviderObserverBridge::~ChromeBrowserProviderObserverBridge() {} + +void ChromeBrowserProviderObserverBridge::OnChromeIdentityServiceDidChange( + ios::ChromeIdentityService* new_identity_service) { + if ([observer_ respondsToSelector:@selector(chromeIdentityServiceDidChange:)]) + [observer_ chromeIdentityServiceDidChange:new_identity_service]; +} + +void ChromeBrowserProviderObserverBridge:: + OnChromeBrowserProviderWillBeDestroyed() { + if ([observer_ + respondsToSelector:@selector(chromeBrowserProviderWillBeDestroyed)]) { + [observer_ chromeBrowserProviderWillBeDestroyed]; + } +}
diff --git a/ios/chrome/browser/chrome_browser_provider_observer_bridge_unittest.mm b/ios/chrome/browser/chrome_browser_provider_observer_bridge_unittest.mm new file mode 100644 index 0000000..906b7af --- /dev/null +++ b/ios/chrome/browser/chrome_browser_provider_observer_bridge_unittest.mm
@@ -0,0 +1,103 @@ +// Copyright 2017 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 "ios/chrome/browser/chrome_browser_provider_observer_bridge.h" + +#include <memory> + +#include "base/memory/ptr_util.h" +#include "ios/public/provider/chrome/browser/chrome_browser_provider.h" +#include "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" +#include "testing/gtest_mac.h" +#include "testing/platform_test.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface TestChromeBrowserProviderObserver + : NSObject<ChromeBrowserProviderObserver> +@property(nonatomic) BOOL chromeIdentityServiceDidChangeCalled; +@property(nonatomic) BOOL chromeBrowserProviderWillBeDestroyedCalled; +@property(nonatomic) ios::ChromeIdentityService* identityService; +@property(nonatomic, readonly) + ios::ChromeBrowserProvider::Observer* observerBridge; +@end + +@implementation TestChromeBrowserProviderObserver { + std::unique_ptr<ios::ChromeBrowserProvider::Observer> _observerBridge; +} + +@synthesize chromeIdentityServiceDidChangeCalled = + _chromeIdentityServiceDidChangeCalled; +@synthesize chromeBrowserProviderWillBeDestroyedCalled = + _chromeBrowserProviderWillBeDestroyedCalled; +@synthesize identityService = _identityService; + +- (instancetype)init { + if (self == [super init]) { + _observerBridge = + base::MakeUnique<ChromeBrowserProviderObserverBridge>(self); + } + return self; +} + +- (ios::ChromeBrowserProvider::Observer*)observerBridge { + return _observerBridge.get(); +} + +#pragma mark - ios::ChromeBrowserProvider::Observer + +- (void)chromeIdentityServiceDidChange: + (ios::ChromeIdentityService*)identityService { + _chromeIdentityServiceDidChangeCalled = YES; + _identityService = identityService; +} + +- (void)chromeBrowserProviderWillBeDestroyed { + _chromeBrowserProviderWillBeDestroyedCalled = YES; +} + +@end + +#pragma mark - ChromeBrowserProviderObserverBridgeTest + +class ChromeBrowserProviderObserverBridgeTest : public PlatformTest { + protected: + ChromeBrowserProviderObserverBridgeTest() + : test_observer_([[TestChromeBrowserProviderObserver alloc] init]) {} + + ios::ChromeBrowserProvider::Observer* GetObserverBridge() { + return [test_observer_ observerBridge]; + } + + TestChromeBrowserProviderObserver* GetTestObserver() { + return test_observer_; + } + + private: + TestChromeBrowserProviderObserver* test_observer_; + + DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProviderObserverBridgeTest); +}; + +// Tests that |OnChromeIdentityServiceDidChange| is forwarded. +TEST_F(ChromeBrowserProviderObserverBridgeTest, + ChromeIdentityServiceDidChange) { + std::unique_ptr<ios::ChromeIdentityService> identity_service; + ASSERT_FALSE(GetTestObserver().chromeIdentityServiceDidChangeCalled); + GetObserverBridge()->OnChromeIdentityServiceDidChange(identity_service.get()); + EXPECT_TRUE(GetTestObserver().chromeIdentityServiceDidChangeCalled); + EXPECT_FALSE(GetTestObserver().chromeBrowserProviderWillBeDestroyedCalled); + EXPECT_EQ(identity_service.get(), GetTestObserver().identityService); +} + +// Tests that |OnChromeBrowserProviderWillBeDestroyed| is forwarded. +TEST_F(ChromeBrowserProviderObserverBridgeTest, + ChromeBrowserProviderWillBeDestroyed) { + ASSERT_FALSE(GetTestObserver().chromeBrowserProviderWillBeDestroyedCalled); + GetObserverBridge()->OnChromeBrowserProviderWillBeDestroyed(); + EXPECT_FALSE(GetTestObserver().chromeIdentityServiceDidChangeCalled); + EXPECT_TRUE(GetTestObserver().chromeBrowserProviderWillBeDestroyedCalled); +}
diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_favicon_mediator.h b/ios/chrome/browser/content_suggestions/content_suggestions_favicon_mediator.h index 928c59a4..91ceb38 100644 --- a/ios/chrome/browser/content_suggestions/content_suggestions_favicon_mediator.h +++ b/ios/chrome/browser/content_suggestions/content_suggestions_favicon_mediator.h
@@ -7,6 +7,8 @@ #import <UIKit/UIKit.h> +#include "components/ntp_tiles/ntp_tile.h" + namespace favicon { class LargeIconService; } @@ -36,6 +38,10 @@ // The data sink which should be notified of the changes in the items. @property(nonatomic, weak, nullable) id<ContentSuggestionsDataSink> dataSink; +// Sets the |mostVisitedData| used to log the impression of the tiles. +- (void)setMostVisitedDataForLogging: + (const ntp_tiles::NTPTilesVector&)mostVisitedData; + // Fetches the favicon for this |item|. - (void)fetchFaviconForMostVisited: (nonnull ContentSuggestionsMostVisitedItem*)item;
diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_favicon_mediator.mm b/ios/chrome/browser/content_suggestions/content_suggestions_favicon_mediator.mm index 83dec59f..11dc060 100644 --- a/ios/chrome/browser/content_suggestions/content_suggestions_favicon_mediator.mm +++ b/ios/chrome/browser/content_suggestions/content_suggestions_favicon_mediator.mm
@@ -8,6 +8,9 @@ #include "components/favicon/core/large_icon_service.h" #include "components/ntp_snippets/category.h" #include "components/ntp_snippets/content_suggestions_service.h" +#include "components/ntp_tiles/metrics.h" +#include "components/rappor/rappor_service_impl.h" +#include "ios/chrome/browser/application_context.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_data_sink.h" @@ -31,7 +34,12 @@ } // namespace -@interface ContentSuggestionsFaviconMediator () +@interface ContentSuggestionsFaviconMediator () { + // Most visited data used for logging the tiles impression. The data is + // copied when receiving the first non-empty data. This copy is used to make + // sure only the data received the first time is logged, and only once. + ntp_tiles::NTPTilesVector _mostVisitedDataForLogging; +} // The ContentSuggestionsService, serving suggestions. @property(nonatomic, assign) @@ -73,6 +81,12 @@ return self; } +- (void)setMostVisitedDataForLogging: + (const ntp_tiles::NTPTilesVector&)mostVisitedData { + DCHECK(_mostVisitedDataForLogging.empty()); + _mostVisitedDataForLogging = mostVisitedData; +} + - (void)fetchFaviconForMostVisited:(ContentSuggestionsMostVisitedItem*)item { __weak ContentSuggestionsFaviconMediator* weakSelf = self; __weak ContentSuggestionsMostVisitedItem* weakItem = item; @@ -84,6 +98,7 @@ return; strongItem.attributes = attributes; + [strongSelf logFaviconFetchedForItem:strongItem]; [strongSelf.dataSink itemHasChanged:strongItem]; }; @@ -149,4 +164,24 @@ base::BindBlockArc(imageCallback)); } +// If it is the first time the favicon corresponding to |URL| has its favicon +// fetched, its impression is logged. +// This is called when the favicon is fetched and might not represent a tile +// impression (for example, if some tiles are not displayed on screen because +// the screen is too narrow, their favicons are still fetched, and this function +// is called). +- (void)logFaviconFetchedForItem:(ContentSuggestionsMostVisitedItem*)item { + for (size_t i = 0; i < _mostVisitedDataForLogging.size(); ++i) { + ntp_tiles::NTPTile& ntpTile = _mostVisitedDataForLogging[i]; + if (ntpTile.url == item.URL) { + ntp_tiles::metrics::RecordTileImpression( + i, ntpTile.source, [item tileType], item.URL, + GetApplicationContext()->GetRapporServiceImpl()); + // Reset the URL to be sure to log the impression only once. + ntpTile.url = GURL(); + break; + } + } +} + @end
diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm b/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm index d4cb659..724be72 100644 --- a/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm +++ b/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
@@ -12,6 +12,7 @@ #include "components/ntp_snippets/category.h" #include "components/ntp_snippets/category_info.h" #include "components/ntp_snippets/content_suggestion.h" +#include "components/ntp_tiles/metrics.h" #include "components/ntp_tiles/most_visited_sites.h" #include "components/ntp_tiles/ntp_tile.h" #include "ios/chrome/browser/application_context.h" @@ -391,7 +392,8 @@ if (mostVisited.size() && !self.recordedPageImpression) { self.recordedPageImpression = YES; - RecordImpression(mostVisited); + [self.faviconMediator setMostVisitedDataForLogging:mostVisited]; + ntp_tiles::metrics::RecordPageImpression(mostVisited.size()); } }
diff --git a/ios/chrome/browser/content_suggestions/mediator_util.h b/ios/chrome/browser/content_suggestions/mediator_util.h index a510206..fe046d2 100644 --- a/ios/chrome/browser/content_suggestions/mediator_util.h +++ b/ios/chrome/browser/content_suggestions/mediator_util.h
@@ -61,9 +61,6 @@ // Creates and returns a SectionInfo for the Most Visited section. ContentSuggestionsSectionInformation* MostVisitedSectionInformation(); -// Records the impression of the NTP and of all |mostVisited| tiles. -void RecordImpression(const std::vector<ntp_tiles::NTPTile>& mostVisited); - // Converts a ntp_tiles::NTPTile |tile| to a ContentSuggestionsMostVisitedItem // with a |sectionInfo|. ContentSuggestionsMostVisitedItem* ConvertNTPTile(
diff --git a/ios/chrome/browser/content_suggestions/mediator_util.mm b/ios/chrome/browser/content_suggestions/mediator_util.mm index e1bbab7..0c6115d 100644 --- a/ios/chrome/browser/content_suggestions/mediator_util.mm +++ b/ios/chrome/browser/content_suggestions/mediator_util.mm
@@ -6,9 +6,6 @@ #include "base/strings/sys_string_conversions.h" #include "components/ntp_snippets/category.h" -#include "components/ntp_tiles/metrics.h" -#include "components/rappor/rappor_service_impl.h" -#include "ios/chrome/browser/application_context.h" #import "ios/chrome/browser/content_suggestions/content_suggestions_category_wrapper.h" #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item.h" @@ -126,16 +123,6 @@ return sectionInfo; } -void RecordImpression(const ntp_tiles::NTPTilesVector& mostVisited) { - int index = 0; - for (const ntp_tiles::NTPTile& ntpTile : mostVisited) { - ntp_tiles::metrics::RecordTileImpression( - index++, ntpTile.source, ntp_tiles::UNKNOWN_TILE_TYPE, ntpTile.url, - GetApplicationContext()->GetRapporServiceImpl()); - } - ntp_tiles::metrics::RecordPageImpression(mostVisited.size()); -} - ContentSuggestionsMostVisitedItem* ConvertNTPTile( const ntp_tiles::NTPTile& tile, ContentSuggestionsSectionInformation* sectionInfo) {
diff --git a/ios/chrome/browser/ui/authentication/signin_promo_view_mediator.mm b/ios/chrome/browser/ui/authentication/signin_promo_view_mediator.mm index 14596ec..4bf9db6 100644 --- a/ios/chrome/browser/ui/authentication/signin_promo_view_mediator.mm +++ b/ios/chrome/browser/ui/authentication/signin_promo_view_mediator.mm
@@ -11,6 +11,7 @@ #include "base/strings/sys_string_conversions.h" #include "components/prefs/pref_service.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" +#include "ios/chrome/browser/chrome_browser_provider_observer_bridge.h" #include "ios/chrome/browser/pref_names.h" #include "ios/chrome/browser/signin/chrome_identity_service_observer_bridge.h" #import "ios/chrome/browser/ui/authentication/signin_promo_view_configurator.h" @@ -112,12 +113,14 @@ }; } // namespace -@interface SigninPromoViewMediator ()<ChromeIdentityServiceObserver> +@interface SigninPromoViewMediator ()<ChromeIdentityServiceObserver, + ChromeBrowserProviderObserver> @end @implementation SigninPromoViewMediator { ios::ChromeBrowserState* _browserState; std::unique_ptr<ChromeIdentityServiceObserverBridge> _identityServiceObserver; + std::unique_ptr<ChromeBrowserProviderObserverBridge> _browserProviderObserver; UIImage* _identityAvatar; SigninPromoViewState _signinPromoViewState; } @@ -142,6 +145,8 @@ } _identityServiceObserver = base::MakeUnique<ChromeIdentityServiceObserverBridge>(self); + _browserProviderObserver = + base::MakeUnique<ChromeBrowserProviderObserverBridge>(self); } return self; } @@ -289,6 +294,22 @@ } } +- (void)onChromeIdentityServiceWillBeDestroyed { + _identityServiceObserver.reset(); +} + +#pragma mark - ChromeBrowserProviderObserver + +- (void)chromeIdentityServiceDidChange:(ios::ChromeIdentityService*)identity { + DCHECK(!_identityServiceObserver.get()); + _identityServiceObserver = + base::MakeUnique<ChromeIdentityServiceObserverBridge>(self); +} + +- (void)chromeBrowserProviderWillBeDestroyed { + _browserProviderObserver.reset(); +} + #pragma mark - SigninPromoViewDelegate - (void)signinPromoViewDidTapSigninWithNewAccount:
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_promo_controller.mm b/ios/chrome/browser/ui/bookmarks/bookmark_promo_controller.mm index 22673e0..d4c54f926 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_promo_controller.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_promo_controller.mm
@@ -60,8 +60,7 @@ // Called when a user signs into Google services such as sync. - (void)googleSigninSucceededWithAccountId:(const std::string&)account_id - username:(const std::string&)username - password:(const std::string&)password; + username:(const std::string&)username; // Called when the currently signed-in user for a user has been signed out. - (void)googleSignedOutWithAcountId:(const std::string&)account_id @@ -76,11 +75,9 @@ : controller_(controller) {} void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override { + const std::string& username) override { [controller_ googleSigninSucceededWithAccountId:account_id - username:username - password:password]; + username:username]; } void GoogleSignedOut(const std::string& account_id, @@ -203,8 +200,7 @@ // Called when a user signs into Google services such as sync. - (void)googleSigninSucceededWithAccountId:(const std::string&)account_id - username:(const std::string&)username - password:(const std::string&)password { + username:(const std::string&)username { self.promoState = NO; }
diff --git a/ios/chrome/browser/ui/payments/address_edit_mediator.mm b/ios/chrome/browser/ui/payments/address_edit_mediator.mm index 1dc7e72..0ee0c5e1 100644 --- a/ios/chrome/browser/ui/payments/address_edit_mediator.mm +++ b/ios/chrome/browser/ui/payments/address_edit_mediator.mm
@@ -153,7 +153,7 @@ if ([regions objectForKey:region]) { self.regionField.value = region; } else if ([[regions allKeysForObject:region] count]) { - DCHECK(1 == [[regions allKeysForObject:region] count]); + DCHECK_EQ(1U, [[regions allKeysForObject:region] count]); self.regionField.value = [regions allKeysForObject:region][0]; } } @@ -189,16 +189,23 @@ } _countries = countries; - // If an address is being edited and it has a valid country code, the selected - // country code is set to that value. Otherwise, it is set to the default - // country code. - NSString* countryCode = + // If an address is being edited and it has a valid country code or a valid + // country name for the autofill::ADDRESS_HOME_COUNTRY field, the selected + // country code is set to the respective country code. Otherwise, the selected + // country code is set to the default country code. + NSString* country = [self fieldValueFromProfile:_address fieldType:autofill::ADDRESS_HOME_COUNTRY]; - _selectedCountryCode = - countryCode && [_countries objectForKey:countryCode] - ? countryCode - : base::SysUTF8ToNSString(countryModel.GetDefaultCountryCode()); + + if ([countries objectForKey:country]) { + _selectedCountryCode = country; + } else if ([[countries allKeysForObject:country] count]) { + DCHECK_EQ(1U, [[countries allKeysForObject:country] count]); + _selectedCountryCode = [countries allKeysForObject:country][0]; + } else { + _selectedCountryCode = + base::SysUTF8ToNSString(countryModel.GetDefaultCountryCode()); + } } // Queries the region names based on the selected country code.
diff --git a/ios/chrome/browser/ui/popup_menu/BUILD.gn b/ios/chrome/browser/ui/popup_menu/BUILD.gn index cdeab0698..2d08db0c 100644 --- a/ios/chrome/browser/ui/popup_menu/BUILD.gn +++ b/ios/chrome/browser/ui/popup_menu/BUILD.gn
@@ -2,17 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -bundle_data("resources") { - sources = [ - "resources/popup_background.png", - "resources/popup_background@2x.png", - "resources/popup_background@3x.png", - ] - outputs = [ - "{{bundle_resources_dir}}/{{source_file_part}}", - ] -} - source_set("popup_menu") { configs += [ "//build/config/compiler:enable_arc" ] sources = [ @@ -22,7 +11,7 @@ "popup_menu_view.mm", ] deps = [ - ":resources", + "resources:popup_background", "//base", "//ios/chrome/app/strings", "//ios/chrome/browser/ui",
diff --git a/ios/chrome/browser/ui/popup_menu/resources/BUILD.gn b/ios/chrome/browser/ui/popup_menu/resources/BUILD.gn new file mode 100644 index 0000000..e7591410 --- /dev/null +++ b/ios/chrome/browser/ui/popup_menu/resources/BUILD.gn
@@ -0,0 +1,14 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/ios/imageset.gni") + +imageset("popup_background") { + sources = [ + "popup_background.imageset/Contents.json", + "popup_background.imageset/popup_background.png", + "popup_background.imageset/popup_background@2x.png", + "popup_background.imageset/popup_background@3x.png", + ] +}
diff --git a/ios/chrome/browser/ui/popup_menu/resources/popup_background.imageset/Contents.json b/ios/chrome/browser/ui/popup_menu/resources/popup_background.imageset/Contents.json new file mode 100644 index 0000000..435d8198 --- /dev/null +++ b/ios/chrome/browser/ui/popup_menu/resources/popup_background.imageset/Contents.json
@@ -0,0 +1,23 @@ +{ + "images": [ + { + "idiom": "universal", + "scale": "1x", + "filename": "popup_background.png" + }, + { + "idiom": "universal", + "scale": "2x", + "filename": "popup_background@2x.png" + }, + { + "idiom": "universal", + "scale": "3x", + "filename": "popup_background@3x.png" + } + ], + "info": { + "version": 1, + "author": "xcode" + } +}
diff --git a/ios/chrome/browser/ui/popup_menu/resources/popup_background.png b/ios/chrome/browser/ui/popup_menu/resources/popup_background.imageset/popup_background.png similarity index 100% rename from ios/chrome/browser/ui/popup_menu/resources/popup_background.png rename to ios/chrome/browser/ui/popup_menu/resources/popup_background.imageset/popup_background.png Binary files differ
diff --git a/ios/chrome/browser/ui/popup_menu/resources/popup_background@2x.png b/ios/chrome/browser/ui/popup_menu/resources/popup_background.imageset/popup_background@2x.png similarity index 100% rename from ios/chrome/browser/ui/popup_menu/resources/popup_background@2x.png rename to ios/chrome/browser/ui/popup_menu/resources/popup_background.imageset/popup_background@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/popup_menu/resources/popup_background@3x.png b/ios/chrome/browser/ui/popup_menu/resources/popup_background.imageset/popup_background@3x.png similarity index 100% rename from ios/chrome/browser/ui/popup_menu/resources/popup_background@3x.png rename to ios/chrome/browser/ui/popup_menu/resources/popup_background.imageset/popup_background@3x.png Binary files differ
diff --git a/ios/chrome/browser/ui/settings/password_details_collection_view_controller.mm b/ios/chrome/browser/ui/settings/password_details_collection_view_controller.mm index cd1cd98..b9271376 100644 --- a/ios/chrome/browser/ui/settings/password_details_collection_view_controller.mm +++ b/ios/chrome/browser/ui/settings/password_details_collection_view_controller.mm
@@ -7,9 +7,11 @@ #import <UIKit/UIKit.h> #include "base/mac/foundation_util.h" +#include "base/metrics/histogram_macros.h" #include "base/strings/sys_string_conversions.h" #include "components/autofill/core/common/password_form.h" #include "components/password_manager/core/browser/android_affiliation/affiliation_utils.h" +#include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/password_manager/core/browser/password_store.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome.h" @@ -324,6 +326,10 @@ [[strongSelf collectionView].collectionViewLayout invalidateLayout]; strongSelf->_plainTextPasswordShown = YES; [strongSelf toggleShowHideButton]; + UMA_HISTOGRAM_ENUMERATION( + "PasswordManager.AccessPasswordInSettings", + password_manager::metrics_util::ACCESS_PASSWORD_VIEWED, + password_manager::metrics_util::ACCESS_PASSWORD_COUNT); }; [_weakReauthenticationModule @@ -355,6 +361,14 @@ [self showCopyResultToast:l10n_util::GetNSString( IDS_IOS_SETTINGS_PASSWORD_WAS_COPIED_MESSAGE)]; + UMA_HISTOGRAM_ENUMERATION( + "PasswordManager.AccessPasswordInSettings", + password_manager::metrics_util::ACCESS_PASSWORD_COPIED, + password_manager::metrics_util::ACCESS_PASSWORD_COUNT); + UMA_HISTOGRAM_ENUMERATION( + "PasswordManager.ReauthToAccessPasswordInSettings", + password_manager::metrics_util::REAUTH_SKIPPED, + password_manager::metrics_util::REAUTH_COUNT); } else if ([_weakReauthenticationModule canAttemptReauth]) { __weak PasswordDetailsCollectionViewController* weakSelf = self; void (^copyPasswordHandler)(BOOL) = ^(BOOL success) { @@ -368,6 +382,10 @@ [strongSelf showCopyResultToast: l10n_util::GetNSString( IDS_IOS_SETTINGS_PASSWORD_WAS_COPIED_MESSAGE)]; + UMA_HISTOGRAM_ENUMERATION( + "PasswordManager.AccessPasswordInSettings", + password_manager::metrics_util::ACCESS_PASSWORD_COPIED, + password_manager::metrics_util::ACCESS_PASSWORD_COUNT); } else { TriggerHapticFeedbackForNotification(UINotificationFeedbackTypeError); [strongSelf showCopyResultToast:
diff --git a/ios/chrome/browser/ui/settings/reauthentication_module.mm b/ios/chrome/browser/ui/settings/reauthentication_module.mm index dbffe5d..336331b 100644 --- a/ios/chrome/browser/ui/settings/reauthentication_module.mm +++ b/ios/chrome/browser/ui/settings/reauthentication_module.mm
@@ -6,6 +6,8 @@ #import <LocalAuthentication/LocalAuthentication.h> #import "base/logging.h" +#include "base/metrics/histogram_macros.h" +#include "components/password_manager/core/browser/password_manager_metrics_util.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -42,6 +44,10 @@ handler:(void (^)(BOOL success))handler { if ([self isPreviousAuthValid]) { handler(YES); + UMA_HISTOGRAM_ENUMERATION( + "PasswordManager.ReauthToAccessPasswordInSettings", + password_manager::metrics_util::REAUTH_SKIPPED, + password_manager::metrics_util::REAUTH_COUNT); return; } @@ -60,6 +66,11 @@ [strongSelf->_successfulReauthTimeAccessor updateSuccessfulReauthTime]; } handler(success); + UMA_HISTOGRAM_ENUMERATION( + "PasswordManager.ReauthToAccessPasswordInSettings", + success ? password_manager::metrics_util::REAUTH_SUCCESS + : password_manager::metrics_util::REAUTH_FAILURE, + password_manager::metrics_util::REAUTH_COUNT); }); };
diff --git a/ios/chrome/browser/ui/settings/settings_collection_view_controller.mm b/ios/chrome/browser/ui/settings/settings_collection_view_controller.mm index e6671a9..6be3942 100644 --- a/ios/chrome/browser/ui/settings/settings_collection_view_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_collection_view_controller.mm
@@ -144,8 +144,7 @@ // SigninManagerBase::Observer implementation: void GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) override; + const std::string& username) override; void GoogleSignedOut(const std::string& account_id, const std::string& username) override; @@ -167,8 +166,7 @@ } void SigninObserverBridge::GoogleSigninSucceeded(const std::string& account_id, - const std::string& username, - const std::string& password) { + const std::string& username) { [owner_ onSignInStateChanged]; }
diff --git a/ios/public/provider/chrome/browser/chrome_browser_provider.h b/ios/public/provider/chrome/browser/chrome_browser_provider.h index 0407c6d..5a0c81a4 100644 --- a/ios/public/provider/chrome/browser/chrome_browser_provider.h +++ b/ios/public/provider/chrome/browser/chrome_browser_provider.h
@@ -71,7 +71,7 @@ Observer() {} virtual ~Observer() {} - // Called when a new ChromeIdentityService has been changed. + // Called when a new ChromeIdentityService has been installed. virtual void OnChromeIdentityServiceDidChange( ChromeIdentityService* new_service) {}
diff --git a/media/BUILD.gn b/media/BUILD.gn index 5436d6f3..bd12c8a 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn
@@ -594,6 +594,13 @@ "base/vector_math.h", "base/vector_math_testing.h", ] + if (is_mac) { + # These need to be included here because audio_latency.cc depends on them. + sources += [ + "base/mac/audio_latency_mac.cc", + "base/mac/audio_latency_mac.h", + ] + } configs += [ ":media_config", ":media_implementation",
diff --git a/media/audio/audio_manager_unittest.cc b/media/audio/audio_manager_unittest.cc index 904ee12..db92da8 100644 --- a/media/audio/audio_manager_unittest.cc +++ b/media/audio/audio_manager_unittest.cc
@@ -26,6 +26,7 @@ #include "media/audio/fake_audio_log_factory.h" #include "media/audio/fake_audio_manager.h" #include "media/audio/test_audio_thread.h" +#include "media/base/limits.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -33,6 +34,11 @@ #include "media/audio/alsa/audio_manager_alsa.h" #endif // defined(USE_ALSA) +#if defined(OS_MACOSX) +#include "media/audio/mac/audio_manager_mac.h" +#include "media/base/mac/audio_latency_mac.h" +#endif + #if defined(OS_WIN) #include "base/win/scoped_com_initializer.h" #include "media/audio/win/audio_manager_win.h" @@ -677,4 +683,102 @@ audio_manager_->DisableOutputDebugRecording(); } +#if defined(OS_MACOSX) || defined(USE_CRAS) || defined(USE_PULSEAUDIO) +class TestAudioSourceCallback : public AudioOutputStream::AudioSourceCallback { + public: + TestAudioSourceCallback(int expected_frames_per_buffer, + base::WaitableEvent* event) + : expected_frames_per_buffer_(expected_frames_per_buffer), + event_(event){}; + ~TestAudioSourceCallback() override{}; + + int OnMoreData(base::TimeDelta, + base::TimeTicks, + int, + AudioBus* dest) override { + EXPECT_EQ(dest->frames(), expected_frames_per_buffer_); + event_->Signal(); + return 0; + } + + void OnError() override { FAIL(); } + + private: + DISALLOW_COPY_AND_ASSIGN(TestAudioSourceCallback); + + const int expected_frames_per_buffer_; + base::WaitableEvent* event_; +}; + +// Test that we can create an AudioOutputStream with kMinAudioBufferSize and +// kMaxAudioBufferSize and that the callback AudioBus is the expected size. +TEST_F(AudioManagerTest, CheckMinimumAudioBufferSizesCallbacks) { + ABORT_AUDIO_TEST_IF_NOT(OutputDevicesAvailable()); + +#if defined(OS_MACOSX) + CreateAudioManagerForTesting<AudioManagerMac>(); +#elif defined(USE_CRAS) + CreateAudioManagerForTesting<AudioManagerCras>(); +#elif defined(USE_PULSEAUDIO) + CreateAudioManagerForTesting<AudioManagerPulse>(); +#endif + + DCHECK(audio_manager_); + + AudioParameters default_params; + GetDefaultOutputStreamParameters(&default_params); + ASSERT_LT(default_params.frames_per_buffer(), + media::limits::kMaxAudioBufferSize); + +#if defined(OS_MACOSX) + // On OSX the preferred output buffer size is higher than the minimum + // but users may request the minimum size explicitly. + ASSERT_GT(default_params.frames_per_buffer(), + GetMinAudioBufferSizeMacOS(media::limits::kMinAudioBufferSize, + default_params.sample_rate())); +#elif defined(USE_CRAS) + // On CRAS the preferred output buffer size varies per board and may be as low + // as the minimum for some boards. + ASSERT_GE(default_params.frames_per_buffer(), + media::limits::kMinAudioBufferSize); +#elif defined(USE_PULSEAUDIO) + ASSERT_EQ(default_params.frames_per_buffer(), + media::limits::kMinAudioBufferSize); +#else + NOTREACHED(); +#endif + + AudioOutputStream* stream; + base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, + base::WaitableEvent::InitialState::NOT_SIGNALED); + + // Create an output stream with the minimum buffer size parameters and ensure + // that no errors are returned. + AudioParameters min_params = default_params; + min_params.set_frames_per_buffer(media::limits::kMinAudioBufferSize); + stream = audio_manager_->MakeAudioOutputStreamProxy(min_params, ""); + ASSERT_TRUE(stream); + EXPECT_TRUE(stream->Open()); + event.Reset(); + TestAudioSourceCallback min_source(min_params.frames_per_buffer(), &event); + stream->Start(&min_source); + event.Wait(); + stream->Stop(); + stream->Close(); + + // Verify the same for the maximum buffer size. + AudioParameters max_params = default_params; + max_params.set_frames_per_buffer(media::limits::kMaxAudioBufferSize); + stream = audio_manager_->MakeAudioOutputStreamProxy(max_params, ""); + ASSERT_TRUE(stream); + EXPECT_TRUE(stream->Open()); + event.Reset(); + TestAudioSourceCallback max_source(max_params.frames_per_buffer(), &event); + stream->Start(&max_source); + event.Wait(); + stream->Stop(); + stream->Close(); +} +#endif + } // namespace media
diff --git a/media/audio/cras/audio_manager_cras.cc b/media/audio/cras/audio_manager_cras.cc index 2e6d346..f3beab2 100644 --- a/media/audio/cras/audio_manager_cras.cc +++ b/media/audio/cras/audio_manager_cras.cc
@@ -24,6 +24,7 @@ #include "media/audio/cras/cras_input.h" #include "media/audio/cras/cras_unified.h" #include "media/base/channel_layout.h" +#include "media/base/limits.h" #include "media/base/localized_strings.h" // cras_util.h headers pull in min/max macros... @@ -40,10 +41,6 @@ // Default sample rate for input and output streams. const int kDefaultSampleRate = 48000; -// Define bounds for the output buffer size. -const int kMinimumOutputBufferSize = 512; -const int kMaximumOutputBufferSize = 8192; - // Default input buffer size. const int kDefaultInputBufferSize = 1024; @@ -308,7 +305,7 @@ return 768; else if (board == "samus") return 256; - return kMinimumOutputBufferSize; + return 512; } AudioParameters AudioManagerCras::GetPreferredOutputStreamParameters( @@ -323,8 +320,9 @@ bits_per_sample = input_params.bits_per_sample(); channel_layout = input_params.channel_layout(); buffer_size = - std::min(kMaximumOutputBufferSize, - std::max(buffer_size, input_params.frames_per_buffer())); + std::min(static_cast<int>(limits::kMaxAudioBufferSize), + std::max(static_cast<int>(limits::kMinAudioBufferSize), + input_params.frames_per_buffer())); } int user_buffer_size = GetUserBufferSize();
diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc index 09b6433..8478e0f 100644 --- a/media/audio/mac/audio_manager_mac.cc +++ b/media/audio/mac/audio_manager_mac.cc
@@ -27,6 +27,7 @@ #include "media/base/bind_to_current_loop.h" #include "media/base/channel_layout.h" #include "media/base/limits.h" +#include "media/base/mac/audio_latency_mac.h" #include "media/base/media_switches.h" namespace media { @@ -34,10 +35,6 @@ // Maximum number of output streams that can be open simultaneously. static const int kMaxOutputStreams = 50; -// Define bounds for for low-latency input and output streams. -static const int kMinimumInputOutputBufferSize = 128; -static const int kMaximumInputOutputBufferSize = 4096; - // Default sample-rate on most Apple hardware. static const int kFallbackSampleRate = 44100; @@ -836,11 +833,17 @@ // Allow pass through buffer sizes. If concurrent input and output streams // exist, they will use the smallest buffer size amongst them. As such, each // stream must be able to FIFO requests appropriately when this happens. - int buffer_size = ChooseBufferSize(false, hardware_sample_rate); + int buffer_size; if (has_valid_input_params) { + // If passed in via the input_params we allow buffer sizes to go as + // low as the the kMinAudioBufferSize, ignoring what + // ChooseBufferSize() normally returns. buffer_size = - std::min(kMaximumInputOutputBufferSize, - std::max(input_params.frames_per_buffer(), buffer_size)); + std::min(static_cast<int>(limits::kMaxAudioBufferSize), + std::max(input_params.frames_per_buffer(), + static_cast<int>(limits::kMinAudioBufferSize))); + } else { + buffer_size = ChooseBufferSize(false, hardware_sample_rate); } int hardware_channels; @@ -887,7 +890,7 @@ } int AudioManagerMac::ChooseBufferSize(bool is_input, int sample_rate) { - // kMinimumInputOutputBufferSize is too small for the output side because + // kMinAudioBufferSize is too small for the output side because // CoreAudio can get into under-run if the renderer fails delivering data // to the browser within the allowed time by the OS. The workaround is to // use 256 samples as the default output buffer size for sample rates @@ -895,20 +898,12 @@ // TODO(xians): Remove this workaround after WebAudio supports user defined // buffer size. See https://github.com/WebAudio/web-audio-api/issues/348 // for details. - int buffer_size = is_input ? - kMinimumInputOutputBufferSize : 2 * kMinimumInputOutputBufferSize; + int buffer_size = + is_input ? limits::kMinAudioBufferSize : 2 * limits::kMinAudioBufferSize; const int user_buffer_size = GetUserBufferSize(); - if (user_buffer_size) { - buffer_size = user_buffer_size; - } else if (sample_rate > 48000) { - // The default buffer size is too small for higher sample rates and may lead - // to glitching. Adjust upwards by multiples of the default size. - if (sample_rate <= 96000) - buffer_size = 2 * kMinimumInputOutputBufferSize; - else if (sample_rate <= 192000) - buffer_size = 4 * kMinimumInputOutputBufferSize; - } - + buffer_size = user_buffer_size + ? user_buffer_size + : GetMinAudioBufferSizeMacOS(buffer_size, sample_rate); return buffer_size; }
diff --git a/media/audio/pulse/audio_manager_pulse.cc b/media/audio/pulse/audio_manager_pulse.cc index 6fa330f0..e1ea89a 100644 --- a/media/audio/pulse/audio_manager_pulse.cc +++ b/media/audio/pulse/audio_manager_pulse.cc
@@ -18,6 +18,7 @@ #include "media/audio/pulse/pulse_util.h" #include "media/base/audio_parameters.h" #include "media/base/channel_layout.h" +#include "media/base/limits.h" namespace media { @@ -27,10 +28,6 @@ // Maximum number of output streams that can be open simultaneously. static const int kMaxOutputStreams = 50; -// Define bounds for the output buffer size. -static const int kMinimumOutputBufferSize = 512; -static const int kMaximumOutputBufferSize = 8192; - // Default input buffer size. static const int kDefaultInputBufferSize = 1024; @@ -164,7 +161,7 @@ // TODO(tommi): Support |output_device_id|. VLOG_IF(0, !output_device_id.empty()) << "Not implemented!"; - int buffer_size = kMinimumOutputBufferSize; + int buffer_size = limits::kMinAudioBufferSize; int bits_per_sample = 16; // Query native parameters where applicable; Pulse does not require these to @@ -177,7 +174,7 @@ bits_per_sample = input_params.bits_per_sample(); channel_layout = input_params.channel_layout(); buffer_size = - std::min(kMaximumOutputBufferSize, + std::min(static_cast<int>(limits::kMaxAudioBufferSize), std::max(buffer_size, input_params.frames_per_buffer())); }
diff --git a/media/base/audio_latency.cc b/media/base/audio_latency.cc index 61b3724..d0988faa 100644 --- a/media/base/audio_latency.cc +++ b/media/base/audio_latency.cc
@@ -11,6 +11,11 @@ #include "base/logging.h" #include "base/time/time.h" #include "build/build_config.h" +#include "media/base/limits.h" + +#if defined(OS_MACOSX) +#include "media/base/mac/audio_latency_mac.h" +#endif namespace media { @@ -130,16 +135,32 @@ int AudioLatency::GetExactBufferSize(base::TimeDelta duration, int sample_rate, int hardware_buffer_size) { - const double requested_buffer_size = duration.InSecondsF() * sample_rate; - DCHECK_NE(0, hardware_buffer_size); +// Other platforms do not currently support custom buffer sizes. +#if !defined(OS_MACOSX) && !defined(USE_CRAS) && !defined(USE_PULSE) + return hardware_buffer_size; +#else + const double requested_buffer_size = duration.InSecondsF() * sample_rate; + int minimum_buffer_size = hardware_buffer_size; + +// On OSX and CRAS the preferred buffer size is larger than the minimum, +// however we allow values down to the minimum if requested explicitly. +#if defined(OS_MACOSX) + minimum_buffer_size = + GetMinAudioBufferSizeMacOS(limits::kMinAudioBufferSize, sample_rate); +#elif defined(USE_CRAS) + minimum_buffer_size = limits::kMinAudioBufferSize; +#endif + // Round the requested size to the nearest multiple of the hardware size const int buffer_size = std::round(std::max(requested_buffer_size, 1.0) / hardware_buffer_size) * hardware_buffer_size; - return std::max(buffer_size, hardware_buffer_size); + return std::min(static_cast<int>(limits::kMaxAudioBufferSize), + std::max(buffer_size, minimum_buffer_size)); +#endif } } // namespace media
diff --git a/media/base/limits.h b/media/base/limits.h index f936c8b..0853b58a 100644 --- a/media/base/limits.h +++ b/media/base/limits.h
@@ -7,6 +7,8 @@ #ifndef MEDIA_BASE_LIMITS_H_ #define MEDIA_BASE_LIMITS_H_ +#include "build/build_config.h" + namespace media { namespace limits { @@ -58,6 +60,20 @@ kMaxInitDataLength = 64 * 1024, // 64 KB kMaxSessionResponseLength = 64 * 1024, // 64 KB kMaxKeySystemLength = 256, + +// Minimum and maximum buffer sizes for certain audio platforms. +#if defined(OS_MACOSX) + kMinAudioBufferSize = 128, + kMaxAudioBufferSize = 4096, +#elif defined(USE_PULSEAUDIO) + kMinAudioBufferSize = 512, + kMaxAudioBufferSize = 8192, +#elif defined(USE_CRAS) + // Though CRAS has different per-board defaults, allow explicitly requesting + // this buffer size on any board. + kMinAudioBufferSize = 256, + kMaxAudioBufferSize = 8192, +#endif }; } // namespace limits
diff --git a/media/base/mac/audio_latency_mac.cc b/media/base/mac/audio_latency_mac.cc new file mode 100644 index 0000000..223e3ad --- /dev/null +++ b/media/base/mac/audio_latency_mac.cc
@@ -0,0 +1,23 @@ +// Copyright 2017 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 "media/base/mac/audio_latency_mac.h" +#include "media/base/limits.h" + +namespace media { + +int GetMinAudioBufferSizeMacOS(int min_buffer_size, int sample_rate) { + int buffer_size = min_buffer_size; + if (sample_rate > 48000) { + // The default buffer size is too small for higher sample rates and may lead + // to glitching. Adjust upwards by multiples of the default size. + if (sample_rate <= 96000) + buffer_size = 2 * limits::kMinAudioBufferSize; + else if (sample_rate <= 192000) + buffer_size = 4 * limits::kMinAudioBufferSize; + } + return buffer_size; +} + +} // namespace media
diff --git a/media/base/mac/audio_latency_mac.h b/media/base/mac/audio_latency_mac.h new file mode 100644 index 0000000..e6ad4ef7 --- /dev/null +++ b/media/base/mac/audio_latency_mac.h
@@ -0,0 +1,18 @@ +// Copyright 2017 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 MEDIA_BASE_MAC_AUDIO_LATENCY_MAC_H_ +#define MEDIA_BASE_MAC_AUDIO_LATENCY_MAC_H_ + +#include "base/macros.h" +#include "media/base/media_export.h" + +namespace media { + +MEDIA_EXPORT int GetMinAudioBufferSizeMacOS(int min_buffer_size, + int sample_rate); + +} // namespace media + +#endif // MEDIA_BASE_MAC_AUDIO_LATENCY_MAC_H_
diff --git a/media/midi/task_service.cc b/media/midi/task_service.cc index eb68e0e..188fcf7 100644 --- a/media/midi/task_service.cc +++ b/media/midi/task_service.cc
@@ -16,30 +16,26 @@ } // namespace TaskService::TaskService() - : next_instance_id_(0), bound_instance_id_(kInvalidInstanceId) { - thread_task_locks_.resize(1); - thread_task_locks_[0] = base::MakeUnique<base::Lock>(); - - // We do not need a dedicated thread for the default runner since it uses - // the thread that calls BindInstance(), but we allocates threads_ and keeps - // threads_[0] empty to use the same index between |thread_task_locks_| and - // |threads_| for readability. - threads_.resize(1); -} + : next_instance_id_(0), bound_instance_id_(kInvalidInstanceId) {} TaskService::~TaskService() { - base::AutoLock lock(lock_); - threads_.clear(); + std::vector<std::unique_ptr<base::Thread>> threads; + { + base::AutoLock lock(lock_); + threads = std::move(threads_); + DCHECK_EQ(kInvalidInstanceId, bound_instance_id_); + } + // Should not have any lock to perform thread joins on thread destruction. + // All posted tasks should run before quitting the thread message loop. + threads.clear(); } bool TaskService::BindInstance() { - { - base::AutoLock instance_lock(instance_lock_); - if (bound_instance_id_ != kInvalidInstanceId) - return false; - bound_instance_id_ = next_instance_id_++; - } base::AutoLock lock(lock_); + if (bound_instance_id_ != kInvalidInstanceId) + return false; + bound_instance_id_ = next_instance_id_++; + DCHECK(!default_task_runner_); default_task_runner_ = base::ThreadTaskRunnerHandle::Get(); return true; @@ -47,61 +43,57 @@ bool TaskService::UnbindInstance() { { - base::AutoLock instance_lock(instance_lock_); + base::AutoLock lock(lock_); if (bound_instance_id_ == kInvalidInstanceId) return false; bound_instance_id_ = kInvalidInstanceId; + + DCHECK(default_task_runner_); + default_task_runner_ = nullptr; } - base::AutoLock lock(lock_); - DCHECK(default_task_runner_); - default_task_runner_ = nullptr; // From now on RunTask will never run any task bound to the instance id. - // But invoked tasks might be still running here. To ensure no task run before - // quitting this method, take all |thread_task_locks_| once. - for (auto& task_lock : thread_task_locks_) - base::AutoLock auto_task_lock(*task_lock); + // But invoked tasks might be still running here. To ensure no task run on + // quitting this method, take writer lock of |task_lock_|. + base::subtle::AutoWriteLock task_lock(task_lock_); return true; } void TaskService::PostStaticTask(RunnerId runner_id, base::OnceClosure task) { - scoped_refptr<base::SingleThreadTaskRunner> runner; { + // Disallow to post a task when no instance is bound, so that new threads + // can not be created after the thread finalization in the destructor. base::AutoLock lock(lock_); - runner = GetTaskRunner(runner_id); + if (bound_instance_id_ == kInvalidInstanceId) + return; } - runner->PostTask(FROM_HERE, std::move(task)); + scoped_refptr<base::SingleThreadTaskRunner> runner; + GetTaskRunner(runner_id)->PostTask(FROM_HERE, std::move(task)); } void TaskService::PostBoundTask(RunnerId runner_id, base::OnceClosure task) { - base::AutoLock instance_lock(instance_lock_); - if (bound_instance_id_ == kInvalidInstanceId) - return; - scoped_refptr<base::SingleThreadTaskRunner> runner; InstanceId instance_id; { base::AutoLock lock(lock_); - runner = GetTaskRunner(runner_id); + if (bound_instance_id_ == kInvalidInstanceId) + return; instance_id = bound_instance_id_; } - runner->PostTask(FROM_HERE, - base::BindOnce(&TaskService::RunTask, base::Unretained(this), - instance_id, runner_id, std::move(task))); + GetTaskRunner(runner_id)->PostTask( + FROM_HERE, base::BindOnce(&TaskService::RunTask, base::Unretained(this), + instance_id, runner_id, std::move(task))); } void TaskService::PostBoundDelayedTask(RunnerId runner_id, base::OnceClosure task, base::TimeDelta delay) { - base::AutoLock instance_lock(instance_lock_); - if (bound_instance_id_ == kInvalidInstanceId) - return; - scoped_refptr<base::SingleThreadTaskRunner> runner; InstanceId instance_id; { base::AutoLock lock(lock_); - runner = GetTaskRunner(runner_id); + if (bound_instance_id_ == kInvalidInstanceId) + return; instance_id = bound_instance_id_; } - runner->PostDelayedTask( + GetTaskRunner(runner_id)->PostDelayedTask( FROM_HERE, base::BindOnce(&TaskService::RunTask, base::Unretained(this), instance_id, runner_id, std::move(task)), @@ -110,45 +102,34 @@ scoped_refptr<base::SingleThreadTaskRunner> TaskService::GetTaskRunner( RunnerId runner_id) { - lock_.AssertAcquired(); + base::AutoLock lock(lock_); if (runner_id == kDefaultRunnerId) return default_task_runner_; - DCHECK_EQ(threads_.size(), thread_task_locks_.size()); + if (threads_.size() < runner_id) + threads_.resize(runner_id); - if (threads_.size() <= runner_id) { - threads_.resize(runner_id + 1); - thread_task_locks_.resize(runner_id + 1); - } - if (!threads_[runner_id]) { - threads_[runner_id] = base::MakeUnique<base::Thread>( + size_t thread = runner_id - 1; + if (!threads_[thread]) { + threads_[thread] = base::MakeUnique<base::Thread>( base::StringPrintf("MidiService_TaskService_Thread(%zu)", runner_id)); #if defined(OS_WIN) - threads_[runner_id]->init_com_with_mta(true); + threads_[thread]->init_com_with_mta(true); #endif - threads_[runner_id]->Start(); - - DCHECK(!thread_task_locks_[runner_id]); - thread_task_locks_[runner_id] = base::MakeUnique<base::Lock>(); + threads_[thread]->Start(); } - return threads_[runner_id]->task_runner(); + return threads_[thread]->task_runner(); } void TaskService::RunTask(InstanceId instance_id, RunnerId runner_id, base::OnceClosure task) { - std::unique_ptr<base::AutoLock> task_lock; + base::subtle::AutoReadLock task_lock(task_lock_); { - base::AutoLock instance_lock(instance_lock_); + base::AutoLock lock(lock_); // If UnbindInstance() is already called, do nothing. if (instance_id != bound_instance_id_) return; - - // Obtains task lock to ensure that the instance should not complete - // UnbindInstance() while running the |task|. - base::AutoLock lock(lock_); - task_lock = - base::MakeUnique<base::AutoLock>(*thread_task_locks_[runner_id]); } std::move(task).Run(); }
diff --git a/media/midi/task_service.h b/media/midi/task_service.h index 4058aa5..59edd7c 100644 --- a/media/midi/task_service.h +++ b/media/midi/task_service.h
@@ -10,6 +10,7 @@ #include "base/memory/ref_counted.h" #include "base/single_thread_task_runner.h" #include "base/synchronization/lock.h" +#include "base/synchronization/read_write_lock.h" #include "base/threading/thread.h" #include "base/time/time.h" #include "media/midi/midi_export.h" @@ -69,8 +70,9 @@ // Holds threads to host SingleThreadTaskRunners. std::vector<std::unique_ptr<base::Thread>> threads_; - // Holds lock objects to ensure that tasks run while the instance is bound. - std::vector<std::unique_ptr<base::Lock>> thread_task_locks_; + // Holds readers writer lock to ensure that tasks run only while the instance + // is bound. Writer lock should not be taken while |lock_| is acquired. + base::subtle::ReadWriteLock task_lock_; // Holds InstanceId for the next bound instance. InstanceId next_instance_id_; @@ -78,16 +80,9 @@ // Holds InstanceId for the current bound instance. InstanceId bound_instance_id_; - // Protects |next_instance_id_| and |bound_instance_id_|. - base::Lock instance_lock_; - - // Protects all other members. + // Protects all members other than |task_lock_|. base::Lock lock_; - // If multiple locks should be obtained simultaneously, we should acquire them - // in the order below so to avoid deadklocks. - // |instance_lock_| -> |lock_| -> |(one of) thread_task_locks_|. - DISALLOW_COPY_AND_ASSIGN(TaskService); };
diff --git a/media/midi/task_service_unittest.cc b/media/midi/task_service_unittest.cc index 614e950f..f69e74e 100644 --- a/media/midi/task_service_unittest.cc +++ b/media/midi/task_service_unittest.cc
@@ -150,12 +150,6 @@ DISALLOW_COPY_AND_ASSIGN(MidiTaskServiceTest); }; -// Tests if posted static tasks can be processed without any bound instance. -TEST_F(MidiTaskServiceTest, RunStaticTask) { - task_service()->PostStaticTask(kFirstRunner, base::BindOnce(&SignalEvent)); - WaitEvent(); -} - // Tests if posted tasks without calling BindInstance() are ignored. TEST_F(MidiTaskServiceTest, RunUnauthorizedBoundTask) { std::unique_ptr<TaskServiceClient> client = @@ -186,13 +180,13 @@ EXPECT_FALSE(client->Unbind()); } -// Tests if posted static tasks can be processed even with a bound instance. -TEST_F(MidiTaskServiceTest, RunStaticTaskWithBoundInstance) { +// Tests if posted static tasks can be processed correctly. +TEST_F(MidiTaskServiceTest, RunStaticTask) { std::unique_ptr<TaskServiceClient> client = base::MakeUnique<TaskServiceClient>(task_service()); EXPECT_TRUE(client->Bind()); - // Should be able to post a static task even with a bound instance. + // Should be able to post a static task while an instance is bound. task_service()->PostStaticTask(kFirstRunner, base::BindOnce(&SignalEvent)); WaitEvent(); EXPECT_TRUE(client->Unbind());
diff --git a/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl b/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl index 8772a404..7772b20 100644 --- a/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl +++ b/mojo/public/tools/bindings/generators/js_templates/module.amd.tmpl
@@ -2,10 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -{%- if use_new_js_bindings %} +{%- if js_bindings_mode == "both" or js_bindings_mode == "new" %} +{{"new"|set_current_mode}} 'use strict'; +{%- if js_bindings_mode == "both" %} +if ((typeof mojo !== 'undefined') && mojo.internal && mojo.config) { +{%- endif %} + (function() { var mojomId = '{{module.path}}'; if (mojo.internal.isMojomLoaded(mojomId)) { @@ -21,6 +26,8 @@ var codec = mojo.internal; var validator = mojo.internal; + var exports = mojo.internal.exposeNamespace('{{module.namespace}}'); + {%- for import in imports %} var {{import.unique_name}} = mojo.internal.exposeNamespace('{{import.namespace}}'); @@ -35,7 +42,18 @@ {% include "module_definition.tmpl" %} })(); -{%- else %} +{%- if js_bindings_mode == "both" %} +} +{%- endif %} + +{%- endif %} + +{%- if js_bindings_mode == "both" or js_bindings_mode == "old" %} +{{"old"|set_current_mode}} + +{%- if js_bindings_mode == "both" %} +if ((typeof mojo === 'undefined') || !mojo.internal || !mojo.config) { +{%- endif %} define("{{module.path}}", [ {%- if module.path != @@ -62,10 +80,15 @@ , {{import.unique_name}} {%- endfor -%} ) { + var exports = {}; {%- include "module_definition.tmpl" %} return exports; }); +{%- if js_bindings_mode == "both" %} +} +{%- endif %} + {%- endif %}
diff --git a/mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl b/mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl index 7d7f0655..21165dd 100644 --- a/mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl +++ b/mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl
@@ -25,12 +25,6 @@ {%- include "interface_definition.tmpl" %} {%- endfor %} -{%- if use_new_js_bindings %} - var exports = mojo.internal.exposeNamespace("{{module.namespace}}"); -{%- else %} - var exports = {}; -{%- endif %} - {%- for constant in module.constants %} exports.{{constant.name}} = {{constant.name}}; {%- endfor %}
diff --git a/mojo/public/tools/bindings/generators/mojom_js_generator.py b/mojo/public/tools/bindings/generators/mojom_js_generator.py index 969a055b..62b3cda 100644 --- a/mojo/public/tools/bindings/generators/mojom_js_generator.py +++ b/mojo/public/tools/bindings/generators/mojom_js_generator.py
@@ -95,24 +95,64 @@ class JavaScriptStylizer(generator.Stylizer): - def __init__(self, use_new_js_bindings): - self.use_new_js_bindings = use_new_js_bindings + MODE_RESET = 0 + MODE_OLD = 1 + MODE_NEW = 2 + + def __init__(self, mode): + assert (mode == JavaScriptStylizer.MODE_RESET or + mode == JavaScriptStylizer.MODE_OLD or + mode == JavaScriptStylizer.MODE_NEW) + self.mode = mode + + def StylizeConstant(self, mojom_name): + if self.mode == JavaScriptStylizer.MODE_RESET: + return "" + return mojom_name def StylizeField(self, mojom_name): - if not self.use_new_js_bindings: + if self.mode == JavaScriptStylizer.MODE_RESET: + return "" + if self.mode == JavaScriptStylizer.MODE_OLD: return mojom_name return generator.ToCamel(mojom_name, lower_initial=True) + def StylizeStruct(self, mojom_name): + if self.mode == JavaScriptStylizer.MODE_RESET: + return "" + return mojom_name + + def StylizeUnion(self, mojom_name): + if self.mode == JavaScriptStylizer.MODE_RESET: + return "" + return mojom_name + def StylizeParameter(self, mojom_name): - if not self.use_new_js_bindings: + if self.mode == JavaScriptStylizer.MODE_RESET: + return "" + if self.mode == JavaScriptStylizer.MODE_OLD: return mojom_name return generator.ToCamel(mojom_name, lower_initial=True) def StylizeMethod(self, mojom_name): + if self.mode == JavaScriptStylizer.MODE_RESET: + return "" return generator.ToCamel(mojom_name, lower_initial=True) + def StylizeEnumField(self, mojom_name): + if self.mode == JavaScriptStylizer.MODE_RESET: + return "" + return mojom_name + + def StylizeEnum(self, mojom_name): + if self.mode == JavaScriptStylizer.MODE_RESET: + return "" + return mojom_name + def StylizeModule(self, mojom_namespace): - if not self.use_new_js_bindings: + if self.mode == JavaScriptStylizer.MODE_RESET: + return "" + if self.mode == JavaScriptStylizer.MODE_OLD: return mojom_namespace return '.'.join(generator.ToCamel(word, lower_initial=True) for word in mojom_namespace.split('.')) @@ -128,7 +168,7 @@ "module": self.module, "structs": self.module.structs + self._GetStructsFromMethods(), "unions": self.module.unions, - "use_new_js_bindings": self.use_new_js_bindings, + "js_bindings_mode": self.js_bindings_mode, } @staticmethod @@ -162,6 +202,7 @@ "js_type": self._JavaScriptType, "method_passes_associated_kinds": mojom.MethodPassesAssociatedKinds, "payload_size": JavaScriptPayloadSize, + "set_current_mode": self._SetCurrentMode, "to_camel": generator.ToCamel, "union_decode_snippet": self._JavaScriptUnionDecodeSnippet, "union_encode_snippet": self._JavaScriptUnionEncodeSnippet, @@ -182,7 +223,7 @@ if self.variant: raise Exception("Variants not supported in JavaScript bindings.") - self.module.Stylize(JavaScriptStylizer(self.use_new_js_bindings)) + self.module.Stylize(JavaScriptStylizer(JavaScriptStylizer.MODE_RESET)) # TODO(yzshen): Remove this method once the old JS bindings go away. self._SetUniqueNameForImports() @@ -407,3 +448,10 @@ if method.response_param_struct is not None: result.append(method.response_param_struct) return result + + def _SetCurrentMode(self, mode): + self.module.Stylize(JavaScriptStylizer( + JavaScriptStylizer.MODE_OLD if mode == "old" + else JavaScriptStylizer.MODE_NEW)) + return "" +
diff --git a/mojo/public/tools/bindings/mojom.gni b/mojo/public/tools/bindings/mojom.gni index b0bcce8..081636af 100644 --- a/mojo/public/tools/bindings/mojom.gni +++ b/mojo/public/tools/bindings/mojom.gni
@@ -158,6 +158,15 @@ # TODO(yzshen): Convert all users to use new JS bindings and remove the # old mode. # +# js_bindings_mode (optional) +# |js_bindings_mode| and |use_new_js_bindings| are mutually exclusive. You +# can only specify at most one of them. +# - "new" (default): generate only the new-style JS bindings; +# - "both": generate both the old- and new-style JS bindings; +# - "old": generate only the old-style JS bindings. +# TODO(yzshen): Convert all users to use new JS bindings and remove the +# old mode. +# # component_output_prefix (optional) # The prefix to use for the output_name of any component library emitted # for generated C++ bindings. If this is omitted, C++ bindings targets are @@ -212,6 +221,12 @@ defined(invoker.sources) || defined(invoker.deps) || defined(invoker.public_deps), "\"sources\" or \"deps\" must be defined for the $target_name template.") + + assert(!defined(invoker.use_new_js_bindings) || + !defined(invoker.js_bindings_mode), + "You shouldn't specify both \"use_new_js_bindings\" and " + + "\"js_bindings_mode\".") + if (defined(invoker.export_class_attribute) || defined(invoker.export_define) || defined(invoker.export_header)) { assert(defined(invoker.export_class_attribute)) @@ -238,10 +253,16 @@ assert(defined(invoker.component_deps_blink)) } - if (defined(invoker.use_new_js_bindings)) { - assert(invoker.use_new_js_bindings || !invoker.use_new_js_bindings, - "Surpress unused variable error when JS bindings are not needed.") + js_bindings_mode = "new" + if (defined(invoker.js_bindings_mode)) { + js_bindings_mode = invoker.js_bindings_mode } + if (defined(invoker.use_new_js_bindings) && !invoker.use_new_js_bindings) { + js_bindings_mode = "old" + } + assert(js_bindings_mode == "new" || js_bindings_mode == "both" || + js_bindings_mode == "old", + "Invalid js_bindings_mode value.") all_deps = [] if (defined(invoker.deps)) { @@ -877,10 +898,10 @@ "javascript", ] - if (!defined(invoker.use_new_js_bindings) || - invoker.use_new_js_bindings) { - args += [ "--use_new_js_bindings" ] - } + args += [ + "--js_bindings_mode", + js_bindings_mode, + ] } }
diff --git a/mojo/public/tools/bindings/mojom_bindings_generator.py b/mojo/public/tools/bindings/mojom_bindings_generator.py index c8ffc6e..a7f6233 100755 --- a/mojo/public/tools/bindings/mojom_bindings_generator.py +++ b/mojo/public/tools/bindings/mojom_bindings_generator.py
@@ -204,7 +204,7 @@ variant=args.variant, bytecode_path=args.bytecode_path, for_blink=args.for_blink, use_once_callback=args.use_once_callback, - use_new_js_bindings=args.use_new_js_bindings, + js_bindings_mode=args.js_bindings_mode, export_attribute=args.export_attribute, export_header=args.export_header, generate_non_variant_code=args.generate_non_variant_code) @@ -336,9 +336,12 @@ "--use_once_callback", action="store_true", help="Use base::OnceCallback instead of base::RepeatingCallback.") generate_parser.add_argument( - "--use_new_js_bindings", action="store_true", - help="Use the new module loading approach and the core API exposed by " - "Web IDL. This option only affects the JavaScript bindings.") + "--js_bindings_mode", choices=["new", "both", "old"], default="new", + help="This option only affects the JavaScript bindings. The value could " + "be: \"new\" - generate only the new-style JS bindings, which use the " + "new module loading approach and the core api exposed by Web IDL; " + "\"both\" - generate both the old- and new-style bindings; \"old\" - " + "generate only the old-style bindings.") generate_parser.add_argument( "--export_attribute", default="", help="Optional attribute to specify on class declaration to export it "
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/generator.py b/mojo/public/tools/bindings/pylib/mojom/generate/generator.py index 2778dcb2..56546c2 100644 --- a/mojo/public/tools/bindings/pylib/mojom/generate/generator.py +++ b/mojo/public/tools/bindings/pylib/mojom/generate/generator.py
@@ -155,7 +155,7 @@ # files to stdout. def __init__(self, module, output_dir=None, typemap=None, variant=None, bytecode_path=None, for_blink=False, use_once_callback=False, - use_new_js_bindings=False, export_attribute=None, + js_bindings_mode="new", export_attribute=None, export_header=None, generate_non_variant_code=False): self.module = module self.output_dir = output_dir @@ -164,7 +164,7 @@ self.bytecode_path = bytecode_path self.for_blink = for_blink self.use_once_callback = use_once_callback - self.use_new_js_bindings = use_new_js_bindings + self.js_bindings_mode = js_bindings_mode self.export_attribute = export_attribute self.export_header = export_header self.generate_non_variant_code = generate_non_variant_code
diff --git a/net/nqe/network_quality_estimator_params.cc b/net/nqe/network_quality_estimator_params.cc index 348ae73e..3297f84 100644 --- a/net/nqe/network_quality_estimator_params.cc +++ b/net/nqe/network_quality_estimator_params.cc
@@ -422,7 +422,6 @@ } NetworkQualityEstimatorParams::~NetworkQualityEstimatorParams() { - DCHECK(thread_checker_.CalledOnValidThread()); } // static @@ -466,27 +465,27 @@ const nqe::internal::NetworkQuality& NetworkQualityEstimatorParams::DefaultObservation( NetworkChangeNotifier::ConnectionType type) const { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return default_observations_[type]; } const nqe::internal::NetworkQuality& NetworkQualityEstimatorParams::TypicalNetworkQuality( EffectiveConnectionType type) const { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return typical_network_quality_[type]; } const nqe::internal::NetworkQuality& NetworkQualityEstimatorParams::ConnectionThreshold( EffectiveConnectionType type) const { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return connection_thresholds_[type]; } NetworkQualityEstimatorParams::EffectiveConnectionTypeAlgorithm NetworkQualityEstimatorParams::GetEffectiveConnectionTypeAlgorithm() const { - DCHECK(thread_checker_.CalledOnValidThread()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return effective_connection_type_algorithm_; }
diff --git a/net/nqe/network_quality_estimator_params.h b/net/nqe/network_quality_estimator_params.h index f6ed1187..32adc77 100644 --- a/net/nqe/network_quality_estimator_params.h +++ b/net/nqe/network_quality_estimator_params.h
@@ -10,7 +10,7 @@ #include "base/macros.h" #include "base/optional.h" -#include "base/threading/thread_checker.h" +#include "base/sequence_checker.h" #include "net/base/net_export.h" #include "net/base/network_change_notifier.h" #include "net/nqe/effective_connection_type.h" @@ -96,14 +96,28 @@ // the effective connection type that has been forced. base::Optional<EffectiveConnectionType> forced_effective_connection_type() const { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return forced_effective_connection_type_; } + void SetForcedEffectiveConnectionType( + EffectiveConnectionType forced_effective_connection_type) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + forced_effective_connection_type_ = forced_effective_connection_type; + } + // Returns true if reading from the persistent cache is enabled. bool persistent_cache_reading_enabled() const { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return persistent_cache_reading_enabled_; } + void set_persistent_cache_reading_enabled( + bool persistent_cache_reading_enabled) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + persistent_cache_reading_enabled_ = persistent_cache_reading_enabled; + } + // Returns the the minimum interval betweeen consecutive notifications to a // single socket watcher. base::TimeDelta min_socket_watcher_notification_interval() const { @@ -117,6 +131,12 @@ GetEffectiveConnectionTypeAlgorithmFromString( const std::string& algorithm_param_value); + void SetEffectiveConnectionTypeAlgorithm( + EffectiveConnectionTypeAlgorithm algorithm) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + effective_connection_type_algorithm_ = algorithm; + } + private: // Map containing all field trial parameters related to // NetworkQualityEstimator field trial. @@ -126,9 +146,8 @@ const double weight_multiplier_per_second_; const double weight_multiplier_per_signal_strength_level_; const double correlation_uma_logging_probability_; - const base::Optional<EffectiveConnectionType> - forced_effective_connection_type_; - const bool persistent_cache_reading_enabled_; + base::Optional<EffectiveConnectionType> forced_effective_connection_type_; + bool persistent_cache_reading_enabled_; const base::TimeDelta min_socket_watcher_notification_interval_; EffectiveConnectionTypeAlgorithm effective_connection_type_algorithm_; @@ -148,7 +167,7 @@ nqe::internal::NetworkQuality connection_thresholds_ [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST]; - base::ThreadChecker thread_checker_; + SEQUENCE_CHECKER(sequence_checker_); DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimatorParams); };
diff --git a/services/identity/README.md b/services/identity/README.md index 59356b93..3058778 100644 --- a/services/identity/README.md +++ b/services/identity/README.md
@@ -1,3 +1,5 @@ +# Identity Service User Manual + The Identity Service maintains and provides access to the user's signed-in identities with Google. @@ -6,3 +8,108 @@ https://docs.google.com/document/d/1EPLEJTZewjiShBemNP5Zyk3b_9sgdbrZlXn7j1fubW0 The tracking bug is https://crbug.com/654990. + +Below, we provide a user manual to performing various tasks via the Identity +Service, comparing to how you would have performed these tasks via the relevant +interfaces from //google_apis/gaia and //components/signin. + +## Connecting to the Identity Manager + +The primary interface exposed by the Identity Service is the Identity Manager. +Here is an [example CL](https://chromium-review.googlesource.com/c/539637/) +illustrating connection to the Identity Manager from a client +(specifically, IdentitySigninFlow). + +## Obtaining the Information of the Primary Account + +There is no way to obtain the information of the primary account synchronously, +i.e., there is no literal equivalent to +SigninManagerBase::GetAuthenticatedAccountInfo(). Instead, you should call the +asynchronous method IdentityManager::GetPrimaryAccountInfo(). To date, all use +cases of SigninManagerBase::GetAuthenticatedAccountInfo() that we have seen have +been part of a larger asynchronous flow (e.g., obtaining an access token in +response to an invocation of the chrome.identity extension API). In these use +cases, you can simply fold the asynchronous obtaining of the authenticated +account info into the larger asynchronous flow. + +There is no one way to do this as the "larger asynchronous flow" in question +will be different from case to case, but here are a +[couple](https://chromium-review.googlesource.com/c/536754/) +[example](https://chromium-review.googlesource.com/c/558096/) CLs. + +If the above guidance does not suffice for your use case, please contact +blundell@chromium.org. + +## Obtaining an Access Token + +Where you would have called OAuth2TokenService::StartRequest(), you should +instead call IdentityManager::GetAccessToken(). This interface is a 1:1 +correspondence that should transparently work in all use cases, although there +are currently still some input parameters that need to be added to its API to +match esoteric variants of the OAuth2TokenService API. Here is an [example +CL](https://chromium-review.googlesource.com/c/514047/) that illustrates +conversion of a client. + +If you were using or looking to use MintOAuth2TokenFlow, please contact +blundell@chromium.org. There is currently no corresponding interface in the +Identity Service, and we are looking to understand whether/how it is necessary +to work this class into the Identity Service interface. + +## Being Notified on Signin of the Primary Account + +If you were previously listening to SigninManagerBase::GoogleSigninSucceeded() +or OAuth2TokenService::OnRefreshTokenIsAvailable() to determine when the primary +account is available, you should call +IdentityManager::GetPrimaryAccountWhenAvailable(). This method will fire when +the authenticated account is signed in and has a refresh token available. Here +is an [example CL](https://chromium-review.googlesource.com/c/539637/) +illustrating this pattern. + +## Determining if an Account Has a Refresh Token Available + +There is no way to determine this information synchronously, i.e., there is no +literal equivalent to OAuth2TokenService::IsRefreshTokenAvailable(). To date, +all use cases of this method that we have seen have been part of a larger +asynchronous flow (e.g., determining whether the user needs to sign in before we +can obtain an access token in response to an invocation of the chrome.identity +extension API). In these use cases, you can simply call +IdentityManager::GetPrimaryAccountInfo() and check the AccountState that is +returned from that call, folding the asynchronous checking into the larger +asynchronous flow. Here is an [example +CL](https://chromium-review.googlesource.com/c/538672/) illustrating this +pattern. + +If the above guidance does not suffice for your use case, please contact +blundell@chromium.org. + +## Being Notified When An Account Has a Refresh Token Available + +All of the use cases of OAuth2TokenService::OnRefreshTokenAvailable() that we +have seen to date have been for the purpose of knowing when the authenticated +account is available (i.e., signed in with a refresh token available). For this +purpose, you should call IdentityManager::GetPrimaryAccountWhenAvailable(). Here +is an [example CL](https://chromium-review.googlesource.com/c/539637/) illustrating the conversion. + +If the above guidance does not suffice for your use case, please contact +blundell@chromium.org. + +## Observing Signin-Related Events + +There are plans to build a unified Observer interface that will supersede the +various current Observer interfaces (AccountTracker, OAuth2TokenService, +SigninManager, AccountTrackerService). However, this functionality has not yet +been built. Contact blundell@chromium.org with your use case, which can help +drive the bringup of this interface. + +## Obtaining the Information of All Accounts + +If you are currently calling AccountTracker::GetAccounts() or +AccountTrackerService::GetAccounts(), the corresponding interface does not yet +exist in the Identity Service. When we bring it up, it will have the same +constraints and guidance as that for getting the info of the [primary +account](#obtaining-the-information-of-the-primary-account). + +## Other Needs + +If you have any need that is not covered by the above guidance, contact +blundell@chromium.org.
diff --git a/testing/buildbot/chromium.perf.fyi.json b/testing/buildbot/chromium.perf.fyi.json index 6ed33aa..bbcb21ac 100644 --- a/testing/buildbot/chromium.perf.fyi.json +++ b/testing/buildbot/chromium.perf.fyi.json
@@ -713,65 +713,6 @@ }, { "args": [ - "blob_storage.blob_storage", - "-v", - "--upload-results", - "--output-format=chartjson", - "--browser=android-chromium" - ], - "isolate_name": "telemetry_perf_tests", - "name": "blob_storage.blob_storage", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "android_devices": "1", - "id": "build248-m4--device6", - "os": "Android", - "pool": "Chrome-perf-fyi" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 3600 - } - }, - { - "args": [ - "blob_storage.blob_storage", - "-v", - "--upload-results", - "--output-format=chartjson", - "--browser=reference", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "blob_storage.blob_storage.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "android_devices": "1", - "id": "build248-m4--device6", - "os": "Android", - "pool": "Chrome-perf-fyi" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 3600 - } - }, - { - "args": [ "dromaeo.domcoreattr", "-v", "--upload-results",
diff --git a/testing/buildbot/chromium.perf.json b/testing/buildbot/chromium.perf.json index bccb223..37055978 100644 --- a/testing/buildbot/chromium.perf.json +++ b/testing/buildbot/chromium.perf.json
@@ -717,65 +717,6 @@ } }, { - "args": [ - "blob_storage.blob_storage", - "-v", - "--upload-results", - "--output-format=chartjson", - "--browser=android-chromium" - ], - "isolate_name": "telemetry_perf_tests", - "name": "blob_storage.blob_storage", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "android_devices": "1", - "id": "build14-b1--device6", - "os": "Android", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 3600 - } - }, - { - "args": [ - "blob_storage.blob_storage", - "-v", - "--upload-results", - "--output-format=chartjson", - "--browser=reference", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "blob_storage.blob_storage.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "android_devices": "1", - "id": "build14-b1--device6", - "os": "Android", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 3600 - } - }, - { "args": [], "isolate_name": "cc_perftests", "name": "cc_perftests", @@ -5590,65 +5531,6 @@ }, { "args": [ - "blob_storage.blob_storage", - "-v", - "--upload-results", - "--output-format=chartjson", - "--browser=android-chromium" - ], - "isolate_name": "telemetry_perf_tests", - "name": "blob_storage.blob_storage", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "android_devices": "1", - "id": "build74-b1--device6", - "os": "Android", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 3600 - } - }, - { - "args": [ - "blob_storage.blob_storage", - "-v", - "--upload-results", - "--output-format=chartjson", - "--browser=reference", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "blob_storage.blob_storage.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "android_devices": "1", - "id": "build74-b1--device6", - "os": "Android", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 3600 - } - }, - { - "args": [ "dromaeo.domcoreattr", "-v", "--upload-results", @@ -10094,36 +9976,6 @@ }, { "args": [ - "blob_storage.blob_storage", - "-v", - "--upload-results", - "--output-format=chartjson", - "--browser=android-webview", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "blob_storage.blob_storage", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "android_devices": "1", - "id": "build166-b1--device7", - "os": "Android", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 3600 - } - }, - { - "args": [ "dromaeo.domcoreattr", "-v", "--upload-results", @@ -12905,65 +12757,6 @@ } }, { - "args": [ - "blob_storage.blob_storage", - "-v", - "--upload-results", - "--output-format=chartjson", - "--browser=android-chromium" - ], - "isolate_name": "telemetry_perf_tests", - "name": "blob_storage.blob_storage", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "android_devices": "1", - "id": "build16-b1--device6", - "os": "Android", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 3600 - } - }, - { - "args": [ - "blob_storage.blob_storage", - "-v", - "--upload-results", - "--output-format=chartjson", - "--browser=reference", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "blob_storage.blob_storage.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "android_devices": "1", - "id": "build16-b1--device6", - "os": "Android", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 3600 - } - }, - { "args": [], "isolate_name": "cc_perftests", "name": "cc_perftests", @@ -17430,36 +17223,6 @@ }, { "args": [ - "blob_storage.blob_storage", - "-v", - "--upload-results", - "--output-format=chartjson", - "--browser=android-webview", - "--webview-embedder-apk=../../out/Release/apks/SystemWebViewShell.apk" - ], - "isolate_name": "telemetry_perf_webview_tests", - "name": "blob_storage.blob_storage", - "override_compile_targets": [ - "telemetry_perf_webview_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "android_devices": "1", - "id": "build114-b1--device7", - "os": "Android", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 3600 - } - }, - { - "args": [ "dromaeo.domcoreattr", "-v", "--upload-results", @@ -20241,65 +20004,6 @@ } }, { - "args": [ - "blob_storage.blob_storage", - "-v", - "--upload-results", - "--output-format=chartjson", - "--browser=android-chromium" - ], - "isolate_name": "telemetry_perf_tests", - "name": "blob_storage.blob_storage", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "android_devices": "1", - "id": "build10-b1--device6", - "os": "Android", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 3600 - } - }, - { - "args": [ - "blob_storage.blob_storage", - "-v", - "--upload-results", - "--output-format=chartjson", - "--browser=reference", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "blob_storage.blob_storage.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "android_devices": "1", - "id": "build10-b1--device6", - "os": "Android", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 3600 - } - }, - { "args": [], "isolate_name": "cc_perftests", "name": "cc_perftests", @@ -25114,65 +24818,6 @@ }, { "args": [ - "blob_storage.blob_storage", - "-v", - "--upload-results", - "--output-format=chartjson", - "--browser=android-chromium" - ], - "isolate_name": "telemetry_perf_tests", - "name": "blob_storage.blob_storage", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "android_devices": "1", - "id": "build18-b1--device7", - "os": "Android", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": false, - "io_timeout": 3600 - } - }, - { - "args": [ - "blob_storage.blob_storage", - "-v", - "--upload-results", - "--output-format=chartjson", - "--browser=reference", - "--output-trace-tag=_ref" - ], - "isolate_name": "telemetry_perf_tests", - "name": "blob_storage.blob_storage.reference", - "override_compile_targets": [ - "telemetry_perf_tests" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "android_devices": "1", - "id": "build18-b1--device7", - "os": "Android", - "pool": "Chrome-perf" - } - ], - "expiration": 36000, - "hard_timeout": 10800, - "ignore_task_failure": true, - "io_timeout": 3600 - } - }, - { - "args": [ "dromaeo.domcoreattr", "-v", "--upload-results",
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG index a785468..82f6d37 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -3934,7 +3934,6 @@ crbug.com/591099 editing/selection/select_all/select_all_textarea.html [ Crash ] crbug.com/591099 editing/selection/select_all/select_all_user_select_none.html [ Failure ] crbug.com/591099 editing/selection/selection-3748164-fix.html [ Failure ] -crbug.com/591099 editing/selection/selection-actions.html [ Failure ] crbug.com/591099 editing/selection/selection-background.html [ Failure ] crbug.com/591099 editing/selection/selection-button-text.html [ Failure ] crbug.com/591099 editing/selection/selection-crash.html [ Crash ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 0fd4cfe1..4991a15 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -2020,6 +2020,7 @@ crbug.com/626703 external/wpt/html/webappapis/idle-callbacks/callback-xhr-sync.html [ Timeout ] crbug.com/626703 external/wpt/service-workers/service-worker/update-bytecheck.https.html [ Timeout ] crbug.com/626703 virtual/off-main-thread-fetch/external/wpt/service-workers/service-worker/update-bytecheck.https.html [ Timeout ] +crbug.com/626703 virtual/service-worker-script-streaming/external/wpt/service-workers/service-worker/update-bytecheck.https.html [ Timeout ] crbug.com/626703 [ Mac ] external/wpt/css/css-flexbox-1/auto-margins-001.html [ Failure ] crbug.com/626703 external/wpt/workers/name-property.html [ Timeout ] crbug.com/626703 external/wpt/pointerevents/pointerevent_disabled_form_control-manual.html [ Timeout Pass ] @@ -2378,6 +2379,7 @@ crbug.com/713732 http/tests/serviceworker/chromium/frame-detached-by-navigation.html [ NeedsManualRebaseline ] crbug.com/713732 virtual/mojo-loading/http/tests/serviceworker/chromium/frame-detached-by-navigation.html [ NeedsManualRebaseline ] crbug.com/713732 virtual/off-main-thread-fetch/http/tests/serviceworker/chromium/frame-detached-by-navigation.html [ NeedsManualRebaseline ] +crbug.com/713732 virtual/service-worker-script-streaming/http/tests/serviceworker/chromium/frame-detached-by-navigation.html [ NeedsManualRebaseline ] # Crashes with DCHECK enabled, but not on normal Release builds. crbug.com/626703 external/wpt/workers/opaque-origin.html [ Failure Crash Timeout ] @@ -2442,6 +2444,7 @@ crbug.com/675540 virtual/off-main-thread-fetch/external/wpt/service-workers/service-worker/claim-with-redirect.https.html [ Skip ] crbug.com/658997 external/wpt/service-workers/service-worker/clients-matchall-client-types.https.html [ Skip ] crbug.com/658997 virtual/off-main-thread-fetch/external/wpt/service-workers/service-worker/clients-matchall-client-types.https.html [ Skip ] +crbug.com/658997 virtual/service-worker-script-streaming/external/wpt/service-workers/service-worker/clients-matchall-client-types.https.html [ Skip ] crbug.com/435547 http/tests/cachestorage/serviceworker/ignore-search-with-credentials.html [ Skip ] crbug.com/435547 virtual/mojo-loading/http/tests/cachestorage/serviceworker/ignore-search-with-credentials.html [ Skip ] @@ -2588,16 +2591,20 @@ crbug.com/602693 external/wpt/service-workers/service-worker/fetch-frame-resource.https.html [ Timeout ] crbug.com/602693 virtual/off-main-thread-fetch/external/wpt/service-workers/service-worker/fetch-frame-resource.https.html [ Timeout ] +crbug.com/602693 virtual/service-worker-script-streaming/external/wpt/service-workers/service-worker/fetch-frame-resource.https.html [ Timeout ] # This test requires a special browser flag and seems not suitable for a wpt test, see bug. crbug.com/691944 external/wpt/service-workers/service-worker/update-after-oneday.https.html [ Skip ] crbug.com/691944 virtual/off-main-thread-fetch/external/wpt/service-workers/service-worker/update-after-oneday.https.html [ Skip ] +crbug.com/691944 virtual/service-worker-script-streaming/external/wpt/service-workers/service-worker/update-after-oneday.https.html [ Skip ] # These tests (erroneously) see a platform-specific User-Agent header crbug.com/595993 external/wpt/service-workers/service-worker/fetch-header-visibility.https.html [ Failure ] crbug.com/595993 virtual/off-main-thread-fetch/external/wpt/service-workers/service-worker/fetch-header-visibility.https.html [ Failure ] +crbug.com/595993 virtual/service-worker-script-streaming/external/wpt/service-workers/service-worker/fetch-header-visibility.https.html [ Failure ] crbug.com/595993 external/wpt/service-workers/service-worker/request-end-to-end.https.html [ Failure ] crbug.com/595993 virtual/off-main-thread-fetch/external/wpt/service-workers/service-worker/request-end-to-end.https.html [ Failure ] +crbug.com/595993 virtual/service-worker-script-streaming/external/wpt/service-workers/service-worker/request-end-to-end.https.html [ Failure ] crbug.com/735883 external/wpt/service-workers/service-worker/fetch-canvas-tainting.https.html [ Pass Failure ] crbug.com/735883 virtual/off-main-thread-fetch/external/wpt/service-workers/service-worker/fetch-canvas-tainting.https.html [ Pass Failure ] @@ -2762,6 +2769,7 @@ # Flaky on trybots crbug.com/688486 external/wpt/service-workers/service-worker/fetch-request-resources.https.html [ Failure Pass ] crbug.com/688486 virtual/off-main-thread-fetch/external/wpt/service-workers/service-worker/fetch-request-resources.https.html [ Failure Pass ] +crbug.com/688486 virtual/service-worker-script-streaming/external/wpt/service-workers/service-worker/fetch-request-resources.https.html [ Failure Pass ] # Sheriff failures 2017-02-21 crbug.com/73609 http/tests/media/video-play-stall.html [ Pass Timeout ]
diff --git a/third_party/WebKit/LayoutTests/VirtualTestSuites b/third_party/WebKit/LayoutTests/VirtualTestSuites index 32ef585..36bed35 100644 --- a/third_party/WebKit/LayoutTests/VirtualTestSuites +++ b/third_party/WebKit/LayoutTests/VirtualTestSuites
@@ -401,6 +401,26 @@ "args": ["--disable-features=ServiceWorkerNavigationPreload"] }, { + "prefix": "service-worker-script-streaming", + "base": "external/wpt/service-workers", + "args": ["--enable-features=ServiceWorkerScriptStreaming"] + }, + { + "prefix": "service-worker-script-streaming", + "base": "http/tests/serviceworker", + "args": ["--enable-features=ServiceWorkerScriptStreaming"] + }, + { + "prefix": "service-worker-script-streaming", + "base": "http/tests/fetch/serviceworker", + "args": ["--enable-features=ServiceWorkerScriptStreaming"] + }, + { + "prefix": "service-worker-script-streaming", + "base": "http/tests/fetch/serviceworker-proxied", + "args": ["--enable-features=ServiceWorkerScriptStreaming"] + }, + { "prefix": "layout_ng", "base": "fast/block/basic", "args": ["--enable-blink-features=LayoutNG"]
diff --git a/third_party/WebKit/LayoutTests/W3CImportExpectations b/third_party/WebKit/LayoutTests/W3CImportExpectations index 5ce9785..f65ac1f 100644 --- a/third_party/WebKit/LayoutTests/W3CImportExpectations +++ b/third_party/WebKit/LayoutTests/W3CImportExpectations
@@ -259,7 +259,7 @@ # external/wpt/domxpath [ Pass ] external/wpt/dpub-aam [ Skip ] external/wpt/dpub-aria [ Skip ] -## Owners: dom-dev@chromium.org +## Owners: editing-dev@chromium.org # external/wpt/editing [ Pass ] ## Owners: jsbell@chromium.org # external/wpt/encoding [ Pass ] @@ -364,7 +364,7 @@ # external/wpt/screen-orientation [ Pass ] ## Owners: mkwst@chromium.org # external/wpt/secure-contexts [ Pass ] -## Owners: dom-dev@chromium.org +## Owners: editing-dev@chromium.org # external/wpt/selection [ Pass ] ## Owners: style-dev@chromium.org # external/wpt/selectors [ Pass ]
diff --git a/third_party/WebKit/LayoutTests/editing/selection/selection-actions.html b/third_party/WebKit/LayoutTests/editing/selection/selection-actions.html deleted file mode 100644 index e03bcaad..0000000 --- a/third_party/WebKit/LayoutTests/editing/selection/selection-actions.html +++ /dev/null
@@ -1,62 +0,0 @@ -<html> -<head> -<script> -if (window.testRunner) - testRunner.dumpEditingCallbacks(); -</script> - - -<script> - -function editingTest() { - var start = document.getElementById("start"); - - x = start.offsetLeft + 2; - y = start.offsetTop + 2; - - eventSender.mouseMoveTo(x, y); - eventSender.mouseDown(); - eventSender.mouseUp(); - eventSender.mouseDown(); - - y = y + 30; - - eventSender.mouseMoveTo(x, y); - eventSender.mouseUp(); - - testRunner.execCommand("MoveBackward"); - testRunner.execCommand("MoveDown"); - testRunner.execCommand("MoveForward"); - testRunner.execCommand("MoveLeft"); - testRunner.execCommand("MoveRight"); - testRunner.execCommand("MoveToBeginningOfDocument"); - testRunner.execCommand("MoveToBeginningOfLine"); - testRunner.execCommand("MoveToBeginningOfParagraph"); - testRunner.execCommand("MoveToEndOfDocument"); - testRunner.execCommand("MoveToEndOfLine"); - testRunner.execCommand("MoveToEndOfParagraph"); - testRunner.execCommand("MoveUp"); - testRunner.execCommand("MoveParagraphBackward"); - testRunner.execCommand("MoveParagraphForward"); - testRunner.execCommand("MoveWordBackward"); - testRunner.execCommand("MoveWordForward"); - testRunner.execCommand("MoveWordLeft"); - testRunner.execCommand("MoveWordRight"); - testRunner.execCommand("PageDown"); - testRunner.execCommand("PageUp"); -} - -</script> -</head> -<body style="overflow:hidden"> -This tests whether certain NSResponder methods that should only operate on editable regions modify a selection that is not in an editable region.<br> -This is a para<span style="color:blue;" id="start">g</span>raph.<br> -Some text<br> -Some text<br> -Some text<br> -Some text<br> -This is a paragraph. -<script> -editingTest(); -</script> -</html>
diff --git a/third_party/WebKit/LayoutTests/editing/selection/user-select-all-with-shift-expected.txt b/third_party/WebKit/LayoutTests/editing/selection/user-select-all-with-shift-expected.txt deleted file mode 100644 index e8319312..0000000 --- a/third_party/WebKit/LayoutTests/editing/selection/user-select-all-with-shift-expected.txt +++ /dev/null
@@ -1,206 +0,0 @@ -This tests shift + selecting two discontinuous elements with user-select: all. WebKit should select the both elements instead of moving the selection. -To manually test, click to select the first element and shift-click the second element. WebKit should select both elements. - -After clicking on the first element (Mac): -| " -" -| <div> -| class="select-all" -| id="first" -| "<#selection-anchor>First element<#selection-focus>" -| " -Some other text. -" -| <div> -| class="select-all" -| id="second" -| "Second element" -| " -" - -After shift clicking on the second element (Mac): -| " -" -| <div> -| class="select-all" -| id="first" -| "<#selection-anchor>First element" -| " -Some other text. -" -| <div> -| class="select-all" -| id="second" -| "Second element<#selection-focus>" -| " -" - -After clicking on the second element (Mac): -| " -" -| <div> -| class="select-all" -| id="first" -| "First element" -| " -Some other text. -" -| <div> -| class="select-all" -| id="second" -| "<#selection-anchor>Second element<#selection-focus>" -| " -" - -After shift clicking on the first element (Mac): -| " -" -| <div> -| class="select-all" -| id="first" -| "<#selection-focus>First element" -| " -Some other text. -" -| <div> -| class="select-all" -| id="second" -| "Second element<#selection-anchor>" -| " -" - -After clicking on the first element (Win): -| " -" -| <div> -| class="select-all" -| id="first" -| "<#selection-focus>First element" -| " -Some other text. -" -| <div> -| class="select-all" -| id="second" -| "Second element<#selection-anchor>" -| " -" - -After shift clicking on the second element (Win): -| " -" -| <div> -| class="select-all" -| id="first" -| "First element" -| " -Some other text. -" -| <div> -| class="select-all" -| id="second" -| "<#selection-focus>Second element<#selection-anchor>" -| " -" - -After clicking on the second element (Win): -| " -" -| <div> -| class="select-all" -| id="first" -| "First element" -| " -Some other text. -" -| <div> -| class="select-all" -| id="second" -| "<#selection-anchor>Second element<#selection-focus>" -| " -" - -After shift clicking on the first element (Win): -| " -" -| <div> -| class="select-all" -| id="first" -| "<#selection-focus>First element" -| " -Some other text. -" -| <div> -| class="select-all" -| id="second" -| "Second<#selection-anchor> element" -| " -" - -After clicking on the first element (Unix): -| " -" -| <div> -| class="select-all" -| id="first" -| "<#selection-focus>First element" -| " -Some other text. -" -| <div> -| class="select-all" -| id="second" -| "Second<#selection-anchor> element" -| " -" - -After shift clicking on the second element (Unix): -| " -" -| <div> -| class="select-all" -| id="first" -| "First element" -| " -Some other text. -" -| <div> -| class="select-all" -| id="second" -| "<#selection-anchor>Second element<#selection-focus>" -| " -" - -After clicking on the second element (Unix): -| " -" -| <div> -| class="select-all" -| id="first" -| "First element" -| " -Some other text. -" -| <div> -| class="select-all" -| id="second" -| "<#selection-anchor>Second element<#selection-focus>" -| " -" - -After shift clicking on the first element (Unix): -| " -" -| <div> -| class="select-all" -| id="first" -| "<#selection-focus>First element" -| " -Some other text. -" -| <div> -| class="select-all" -| id="second" -| "Second<#selection-anchor> element" -| " -"
diff --git a/third_party/WebKit/LayoutTests/editing/selection/user-select-all-with-shift.html b/third_party/WebKit/LayoutTests/editing/selection/user-select-all-with-shift.html index 880e23b..c8cdfec0 100644 --- a/third_party/WebKit/LayoutTests/editing/selection/user-select-all-with-shift.html +++ b/third_party/WebKit/LayoutTests/editing/selection/user-select-all-with-shift.html
@@ -1,61 +1,112 @@ -<!DOCTYPE html> -<html> -<body> -<style> -.select-all { - border: 1px solid black; - height: 100px; - width: 100px; - -webkit-user-select: all; - -moz-user-select: all; -} -</style> -<p id="description">This tests shift + selecting two discontinuous elements with user-select: all. WebKit should select the both elements instead of moving the selection. -To manually test, click to select the first element and shift-click the second element. WebKit should select both elements.</p> -<div id="test"> -<div id="first" class="select-all">First element</div> -Some other text. -<div id="second" class="select-all">Second element</div> -</div> -<script src="../../resources/dump-as-markup.js"></script> +<!doctype html> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="../assert_selection.js"></script> <script> +// This tests shift + selecting two discontinuous elements with user-select: +// all. Blink should select the both elements instead of moving the selection. +// To manually test, click to select the first element and shift-click the +// second element. WebKit should select both elements. -Markup.description(document.getElementById('description').textContent); +// TODO(editing-dev): Once http://crbug.com/736253 fixed, we should use +// |chrome.pointerActionSequence()| instead of |eventSender|. -function clickOnElement(element, keys) { - eventSender.mouseMoveTo(element.offsetLeft + 10, element.offsetTop + 10); - eventSender.mouseDown(0, keys); - eventSender.mouseUp(0, keys); +const kStyle = [ + '<style>', + '.select-all {', + 'border: 1px solid black;', + 'height: 100px;', + 'width: 100px;', + 'user-select: all;', + '}', + '</style>', +].join(''); + +const kSample = [ + kStyle, + '<div class="select-all" id="first">First element</div>', + 'Some other text.', + '<div class="select-all" id="second">Second element</div>', +].join(''); + +function clickOnElement(selection, id, keys) { + const element = selection.document.getElementById(id); + eventSender.mouseMoveTo(selection.computeLeft(element) + 10, + selection.computeTop(element) + 10); + eventSender.mouseDown(0, keys); + eventSender.mouseUp(0, keys); } -function runTest(editingBehavior) { - internals.settings.setEditingBehavior(editingBehavior); - - var postfix = ' (' + editingBehavior + ')'; - - clickOnElement(document.getElementById('first')); - Markup.dump('test', 'After clicking on the first element' + postfix); - eventSender.leapForward(300); - clickOnElement(document.getElementById('second'), ['shiftKey']); - Markup.dump('test', 'After shift clicking on the second element' + postfix); - - getSelection().removeAllRanges(); - - clickOnElement(document.getElementById('second')); - Markup.dump('test', 'After clicking on the second element' + postfix); - eventSender.leapForward(300); - clickOnElement(document.getElementById('first'), ['shiftKey']); - Markup.dump('test', 'After shift clicking on the first element' + postfix); +function resetMouseClick() { + eventSender.leapForward(1000); + eventSender.mouseMoveTo(0, 0); + eventSender.mouseDown(); + eventSender.mouseUp(); + eventSender.leapForward(1000); } -if (window.eventSender) { - runTest('Mac'); - runTest('Win'); - runTest('Unix'); +function doTest(behavior) { + assert_exists(window, 'eventSender', 'This test requires eventSender.'); + assert_exists(window, 'internals', 'This test requires internals.'); + internals.settings.setEditingBehavior(behavior); -} else - Markup.noAutoDump(); + assert_selection( + kSample, + selection => { + resetMouseClick(); + clickOnElement(selection, 'first'); + }, + [ + kStyle, + '<div class="select-all" id="first">^First element|</div>', + 'Some other text.', + '<div class="select-all" id="second">Second element</div>', + ].join(''), + `${behavior}-1: Click "first"`); + assert_selection( + kSample, + selection => { + resetMouseClick(); + clickOnElement(selection, 'first'); + clickOnElement(selection, 'second', ['shiftKey']); + }, + [ + kStyle, + '<div class="select-all" id="first">^First element</div>', + 'Some other text.', + '<div class="select-all" id="second">Second element|</div>', + ].join(''), + `${behavior}-2: Shift+Click "second"`); + + assert_selection( + kSample, + selection => clickOnElement(selection, 'second'), + [ + kStyle, + '<div class="select-all" id="first">First element</div>', + 'Some other text.', + '<div class="select-all" id="second">^Second element|</div>', + ].join(''), + `${behavior}-3: Click "second"`); + + assert_selection( + kSample, + selection => { + clickOnElement(selection, 'second'), + clickOnElement(selection, 'first', ['shiftKey']); + }, + [ + kStyle, + '<div class="select-all" id="first">|First element</div>', + 'Some other text.', + '<div class="select-all" id="second">Second element^</div>', + ].join(''), + `${behavior}-4: Shift-Click "first"`); +} + +for (const behavior of ['mac', 'win', 'unix']) { + test(() => doTest(behavior), + `${behavior}: Shift+Select on user-select:all`); +} </script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/appcache-worker.html b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/appcache-worker.html new file mode 100644 index 0000000..96fe5f2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/appcache-worker.html
@@ -0,0 +1,81 @@ +<html manifest="resources/appcache-worker.manifest"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +var resolveInitPromise; +var initPromise = new Promise(r => { resolveInitPromise = r; }); + +applicationCache.addEventListener('cached', resolveInitPromise, false); +applicationCache.addEventListener('noupdate', resolveInitPromise, false); + +promise_test(t => { + return initPromise.then(_ => { + var worker = + new Worker('resources/appcache-worker.py?type=cached'); + return new Promise(r => { worker.onmessage = r; }); + }).then(event => { + assert_equals(event.data, 'Done: cached'); + }); + }, 'Dedicated worker of the cached script'); + +promise_test(t => { + return initPromise.then(_ => { + var worker = + new Worker('resources/appcache-worker.py?type=fallingback'); + return new Promise(r => { worker.onmessage = r; }); + }).then(event => { + assert_equals(event.data, 'Done: fallbacked'); + }); + }, 'Dedicated worker of the fallbacked script'); + +promise_test(t => { + return initPromise.then(_ => { + var worker = + new Worker('resources/appcache-dedicated-worker-not-in-cache.js'); + return new Promise((resolve, reject) => { + worker.onerror = resolve; + worker.onmessage = _ => { + reject('The worker not in the AppCache must not be executed.'); + }; + }); + }); + }, 'Dedicated worker of the not-in-cache script'); + +promise_test(t => { + return initPromise.then(_ => { + var worker = + new SharedWorker('resources/appcache-worker.py?type=cached'); + var promise = new Promise(r => { worker.port.onmessage = r; }); + worker.port.start(); + return promise; + }).then(event => { + assert_equals(event.data, 'Done: cached'); + }); + }, 'Shared worker of the cached script'); + +promise_test(t => { + return initPromise.then(_ => { + var worker = + new SharedWorker('resources/appcache-worker.py?type=fallingback'); + var promise = new Promise(r => { worker.port.onmessage = r; }); + worker.port.start(); + return promise; + }).then(event => { + assert_equals(event.data, 'Done: fallbacked'); + }); + }, 'Shared worker of the fallbacked script'); + +promise_test(t => { + return initPromise.then(_ => { + var worker = + new SharedWorker( + 'resources/appcache-shared-worker-not-in-cache.js'); + var promise = new Promise(r => { worker.port.onmessage = r; }); + worker.port.start(); + return promise; + }).then(event => { + assert_equals(event.data, 'Done'); + }); + }, 'Shared worker of the not-in-cache script'); +</script> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-dedicated-worker-not-in-cache.js b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-dedicated-worker-not-in-cache.js new file mode 100644 index 0000000..d4ed500 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-dedicated-worker-not-in-cache.js
@@ -0,0 +1 @@ +postMessage('Done');
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-shared-worker-not-in-cache.js b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-shared-worker-not-in-cache.js new file mode 100644 index 0000000..303595c --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-shared-worker-not-in-cache.js
@@ -0,0 +1,64 @@ +var info = ''; + +var initPromise = new Promise(resolve => { + self.addEventListener('connect', event => { + self.postMessage = msg => { event.ports[0].postMessage(msg); }; + resolve(); + }); +}); + +function importNotInCacheSciptTest() { + return new Promise((resolve, reject) => { + try { + importScripts('appcache-worker-import.py?type=not-in-cache'); + } catch(e) { + reject(new Error('Error while importing the not-in-cache script: ' + + e.toString())); + return; + } + if (info != 'Set by the not-in-cache script') { + reject(new Error('The not-in-cache script was not correctly executed')); + } + resolve(); + }); +} + +function importFallbackSciptTest() { + return new Promise((resolve, reject) => { + try { + importScripts('appcache-worker-import.py?type=fallingback'); + reject(new Error('Importing a fallback script must fail.')); + } catch(e) { + resolve(); + } + }); +} + +function fetchNotInCacheFileTest() { + return fetch('appcache-worker-data.py?type=not-in-cache') + .then(res => res.text(), + _ => { throw new Error('Failed to fetch not-in-cache file'); }) + .then(text => { + if (text != 'not-in-cache') { + throw new Error('not-in-cache file mismatch'); + } + }) +} + +function fetchFallbackFileTest() { + return fetch('appcache-worker-data.py?type=fallingback') + .then(res => { + if (res.status != 404) { + throw new Error( + 'Fetching fallback file must resolve with 404 response'); + } + }, + _ => { throw new Error('Fetching fallback file must not fail'); }); +} + +initPromise + .then(importNotInCacheSciptTest) + .then(importFallbackSciptTest) + .then(fetchNotInCacheFileTest) + .then(fetchFallbackFileTest) + .then(_ => postMessage('Done'), error => postMessage(error.toString()));
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-worker-data.py b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-worker-data.py new file mode 100644 index 0000000..f92c511 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-worker-data.py
@@ -0,0 +1,5 @@ +def main(request, response): + type = request.GET['type'] + if request.GET['type'] == 'fallingback': + return 404, [('Content-Type', 'text/plain')], "Page not found" + return [('Content-Type', 'text/plain')], type
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-worker-import.py b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-worker-import.py new file mode 100644 index 0000000..650975b --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-worker-import.py
@@ -0,0 +1,7 @@ +script = 'info = \'Set by the %s script\';' + +def main(request, response): + type = request.GET['type'] + if request.GET['type'] == 'fallingback': + return 404, [('Content-Type', 'text/plain')], "Page not found" + return [('Content-Type', 'text/javascript')], script % type
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-worker.manifest b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-worker.manifest new file mode 100644 index 0000000..f369a76 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-worker.manifest
@@ -0,0 +1,10 @@ +CACHE MANIFEST + +appcache-worker.py?type=cached +appcache-worker-import.py?type=cached +appcache-worker-data.py?type=cached + +FALLBACK: +appcache-worker.py?type=fallingback appcache-worker.py?type=fallbacked +appcache-worker-import.py?type=fallingback appcache-worker-import.py?type=fallbacked +appcache-worker-data.py?type=fallingback appcache-worker-data.py?type=fallbacked
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-worker.py b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-worker.py new file mode 100644 index 0000000..22d02fe --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-worker.py
@@ -0,0 +1,102 @@ +script = ''' +var initPromise = Promise.resolve(); + +if ('SharedWorkerGlobalScope' in self && + self instanceof SharedWorkerGlobalScope) { + initPromise = new Promise(resolve => { + self.addEventListener('connect', event => { + self.postMessage = msg => { event.ports[0].postMessage(msg); }; + resolve(); + }); + }); +} + +var info = ''; + +function importCachedScriptTest() { + return new Promise((resolve, reject) => { + info = ''; + try { + importScripts('appcache-worker-import.py?type=cached'); + } catch(e) { + reject(new Error('Error while importing the cached script: ' + + e.toString())); + return; + } + if (info != 'Set by the cached script') { + reject(new Error('The cached script was not correctly executed')); + } + resolve(); + }); +} + +function importNotInCacheSciptTest() { + return new Promise((resolve, reject) => { + try { + importScripts('appcache-worker-import.py?type=not-in-cache'); + reject(new Error('Importing a non-cached script must fail.')); + } catch(e) { + resolve(); + } + }); +} + +function importFallbackSciptTest() { + return new Promise((resolve, reject) => { + info = ''; + try { + importScripts('appcache-worker-import.py?type=fallingback'); + } catch(e) { + reject(new Error('Error while importing the fallingback script: ' + + e.toString())); + } + if (info != 'Set by the fallbacked script') { + reject(new Error('The fallingback script was not correctly executed')); + } + resolve(); + }); +} + +function fetchCachedFileTest() { + return fetch('appcache-worker-data.py?type=cached') + .then(res => res.text(), + _ => { throw new Error('Failed to fetch cached file'); }) + .then(text => { + if (text != 'cached') { + throw new Error('cached file missmatch'); + } + }); +} + +function fetchNotInCacheFileTest() { + return fetch('appcache-worker-data.py?type=not-in-cache') + .then(_ => { throw new Error('Fetching not-in-cache file must fail'); }, + _ => {}); +} + +function fetchFallbackFileTest() { + return fetch('appcache-worker-data.py?type=fallingback') + .then(res => res.text(), + _ => { throw new Error('Failed to fetch fallingback file'); }) + .then(text => { + if (text != 'fallbacked') { + throw new Error('fallbacked file miss match'); + } + }); +} + +initPromise + .then(importCachedScriptTest) + .then(importNotInCacheSciptTest) + .then(importFallbackSciptTest) + .then(fetchCachedFileTest) + .then(fetchNotInCacheFileTest) + .then(_ => postMessage('Done: %s'), + error => postMessage(error.toString())); +''' + +def main(request, response): + type = request.GET['type'] + if request.GET['type'] == 'fallingback': + return 404, [('Content-Type', 'text/plain')], "Page not found" + return [('Content-Type', 'text/javascript')], script % type
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/editing/activation/OWNERS b/third_party/WebKit/LayoutTests/external/wpt/html/editing/activation/OWNERS index 422c227..f65b04ed 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/editing/activation/OWNERS +++ b/third_party/WebKit/LayoutTests/external/wpt/html/editing/activation/OWNERS
@@ -1 +1 @@ -# TEAM: dom-dev@chromium.org +# TEAM: editing-dev@chromium.org
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/editing/editing-0/contenteditable/OWNERS b/third_party/WebKit/LayoutTests/external/wpt/html/editing/editing-0/contenteditable/OWNERS index 422c227..f65b04ed 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/editing/editing-0/contenteditable/OWNERS +++ b/third_party/WebKit/LayoutTests/external/wpt/html/editing/editing-0/contenteditable/OWNERS
@@ -1 +1 @@ -# TEAM: dom-dev@chromium.org +# TEAM: editing-dev@chromium.org
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/editing/editing-0/making-entire-documents-editable-the-designmode-idl-attribute/OWNERS b/third_party/WebKit/LayoutTests/external/wpt/html/editing/editing-0/making-entire-documents-editable-the-designmode-idl-attribute/OWNERS index 422c227..f65b04ed 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/editing/editing-0/making-entire-documents-editable-the-designmode-idl-attribute/OWNERS +++ b/third_party/WebKit/LayoutTests/external/wpt/html/editing/editing-0/making-entire-documents-editable-the-designmode-idl-attribute/OWNERS
@@ -1 +1 @@ -# TEAM: dom-dev@chromium.org +# TEAM: editing-dev@chromium.org
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/editing/editing-0/spelling-and-grammar-checking/OWNERS b/third_party/WebKit/LayoutTests/external/wpt/html/editing/editing-0/spelling-and-grammar-checking/OWNERS index 422c227..f65b04ed 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/editing/editing-0/spelling-and-grammar-checking/OWNERS +++ b/third_party/WebKit/LayoutTests/external/wpt/html/editing/editing-0/spelling-and-grammar-checking/OWNERS
@@ -1 +1 @@ -# TEAM: dom-dev@chromium.org +# TEAM: editing-dev@chromium.org
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/editing/focus/document-level-focus-apis/OWNERS b/third_party/WebKit/LayoutTests/external/wpt/html/editing/focus/document-level-focus-apis/OWNERS index 422c227..f65b04ed 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/editing/focus/document-level-focus-apis/OWNERS +++ b/third_party/WebKit/LayoutTests/external/wpt/html/editing/focus/document-level-focus-apis/OWNERS
@@ -1 +1 @@ -# TEAM: dom-dev@chromium.org +# TEAM: editing-dev@chromium.org
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/editing/focus/focus-management/OWNERS b/third_party/WebKit/LayoutTests/external/wpt/html/editing/focus/focus-management/OWNERS index 422c227..f65b04ed 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/editing/focus/focus-management/OWNERS +++ b/third_party/WebKit/LayoutTests/external/wpt/html/editing/focus/focus-management/OWNERS
@@ -1 +1 @@ -# TEAM: dom-dev@chromium.org +# TEAM: editing-dev@chromium.org
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/OWNERS b/third_party/WebKit/LayoutTests/external/wpt/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/OWNERS index 422c227..f65b04ed 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/OWNERS +++ b/third_party/WebKit/LayoutTests/external/wpt/html/editing/focus/sequential-focus-navigation-and-the-tabindex-attribute/OWNERS
@@ -1 +1 @@ -# TEAM: dom-dev@chromium.org +# TEAM: editing-dev@chromium.org
diff --git a/third_party/WebKit/LayoutTests/fast/css3-text/css3-text-decoration/line-through-vertical-expected.html b/third_party/WebKit/LayoutTests/fast/css3-text/css3-text-decoration/line-through-vertical-expected.html new file mode 100644 index 0000000..9795127 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/css3-text/css3-text-decoration/line-through-vertical-expected.html
@@ -0,0 +1,13 @@ +<!DOCTYPE html> +<style> +div { + writing-mode: vertical-rl; + text-decoration: line-through; + font-family: Times; + font-size: 50px; +} +</style> +<div> + <span lang="en">ABC</span> + <span lang="en">ABC</span> +</div>
diff --git a/third_party/WebKit/LayoutTests/fast/css3-text/css3-text-decoration/line-through-vertical.html b/third_party/WebKit/LayoutTests/fast/css3-text/css3-text-decoration/line-through-vertical.html new file mode 100644 index 0000000..187f993 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/css3-text/css3-text-decoration/line-through-vertical.html
@@ -0,0 +1,13 @@ +<!DOCTYPE html> +<style> +div { + writing-mode: vertical-rl; + text-decoration: line-through; + font-family: Times; + font-size: 50px; +} +</style> +<div> + <span lang="ja">ABC</span> + <span lang="en">ABC</span> +</div>
diff --git a/third_party/WebKit/LayoutTests/fast/events/touch/gesture/pad-gesture-fling-expected.txt b/third_party/WebKit/LayoutTests/fast/events/touch/gesture/pad-gesture-fling-expected.txt index 2fc4f16..6229272 100644 --- a/third_party/WebKit/LayoutTests/fast/events/touch/gesture/pad-gesture-fling-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/events/touch/gesture/pad-gesture-fling-expected.txt
@@ -6,7 +6,7 @@ PASS successfullyParsed is true TEST COMPLETE -PASS actualWheelEventsOccurred is >= 1 +PASS actualWheelEventsOccurred is >= 2 PASS cumulativeScrollX is >= 300 PASS cumulativeScrollY is >= 300 PASS successfullyParsed is true
diff --git a/third_party/WebKit/LayoutTests/fast/events/touch/gesture/pad-gesture-fling.js b/third_party/WebKit/LayoutTests/fast/events/touch/gesture/pad-gesture-fling.js index 1f9bdea..c7628b73 100644 --- a/third_party/WebKit/LayoutTests/fast/events/touch/gesture/pad-gesture-fling.js +++ b/third_party/WebKit/LayoutTests/fast/events/touch/gesture/pad-gesture-fling.js
@@ -4,7 +4,7 @@ var cumulativeScrollX = 0; var cumulativeScrollY = 0; -var minimumWheelEventsExpected = "1"; +var minimumWheelEventsExpected = "2"; var minimumScrollXExpected = 300; var minimumScrollYExpected = 300; @@ -41,6 +41,9 @@ document.addEventListener("mousewheel", recordWheelEvent); if (window.testRunner && window.eventSender && window.eventSender.gestureFlingStart) { + // At least one wheel event must happen before touchpad fling start. + eventSender.mouseMoveTo(10, 11); + eventSender.mouseScrollBy(1, 1, false, true, 0, true, "phaseBegan"); eventSender.gestureFlingStart(positionX, positionY, velocityX, velocityY, "touchpad"); }
diff --git a/third_party/WebKit/LayoutTests/fast/text/selection-painting-hidpi.html b/third_party/WebKit/LayoutTests/fast/text/selection-painting-hidpi.html index 7074c92..36a4a7a 100644 --- a/third_party/WebKit/LayoutTests/fast/text/selection-painting-hidpi.html +++ b/third_party/WebKit/LayoutTests/fast/text/selection-painting-hidpi.html
@@ -1,4 +1,4 @@ -<!DOCTYPE html> +<!DOCTYPE html> <html> <head> <title>Selection painting test</title> @@ -17,7 +17,9 @@ <span>between</span> <span>words</span>. </div> <script> - window.getSelection().selectAllChildren(document.body.firstElementChild); + const div = document.querySelector('div'); + // Select from before |<span>There</span>| to after |<span>words</span>.|. + window.getSelection().setBaseAndExtent(div.firstChild, div.firstChild.length, div.lastChild, 1); </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/fast/text/selection-rect-line-height-too-big.html b/third_party/WebKit/LayoutTests/fast/text/selection-rect-line-height-too-big.html index 47b6d27..c024911 100644 --- a/third_party/WebKit/LayoutTests/fast/text/selection-rect-line-height-too-big.html +++ b/third_party/WebKit/LayoutTests/fast/text/selection-rect-line-height-too-big.html
@@ -5,5 +5,6 @@ The House </div> <script> - getSelection().setBaseAndExtent(target, 0, target, 1); + // Select |The House|. + getSelection().setBaseAndExtent(target.firstChild, 2, target.firstChild, 12); </script>
diff --git a/third_party/WebKit/LayoutTests/fast/text/selection-rect-line-height-too-small.html b/third_party/WebKit/LayoutTests/fast/text/selection-rect-line-height-too-small.html index d2a213b..4c45ac7 100644 --- a/third_party/WebKit/LayoutTests/fast/text/selection-rect-line-height-too-small.html +++ b/third_party/WebKit/LayoutTests/fast/text/selection-rect-line-height-too-small.html
@@ -5,5 +5,6 @@ The House </div> <script> - getSelection().setBaseAndExtent(target, 0, target, 1); + // Select |The House|. + getSelection().setBaseAndExtent(target.firstChild, 2, target.firstChild, 12); </script>
diff --git a/third_party/WebKit/LayoutTests/fast/text/selection-rect-rounding.html b/third_party/WebKit/LayoutTests/fast/text/selection-rect-rounding.html index 8731541..ab5fd618a 100644 --- a/third_party/WebKit/LayoutTests/fast/text/selection-rect-rounding.html +++ b/third_party/WebKit/LayoutTests/fast/text/selection-rect-rounding.html
@@ -3,5 +3,5 @@ </style> <div id="target" style="font: 11px 'lucida grande'; color: transparent; width: 100px; overflow: hidden;">i x m n o p q r s t u v w x y z i x m n o p q r s t u v w x y z i x m n o p q r s t u v w x y z i x m n o p q r s t u v w x y z i x m n o p q r s t u v w x y z i x m n o p q r s t u </div> <script> - getSelection().setBaseAndExtent(target, 0, target, 1); + getSelection().setBaseAndExtent(target.firstChild, 0, target.firstChild, target.firstChild.length - 2); </script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index 6afbb05..6b00495 100644 --- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -205,7 +205,6 @@ method rotateSelf method scale3dSelf method scaleSelf - method setMatrixValue method skewXSelf method skewYSelf method translateSelf @@ -275,7 +274,6 @@ method toFloat32Array method toFloat64Array method toJSON - method toString method transformPoint method translate interface DOMPoint : DOMPointReadOnly
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/selection-actions-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/selection-actions-expected.png deleted file mode 100644 index ed57f0f..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/selection-actions-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/selection-actions-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/selection-actions-expected.txt deleted file mode 100644 index f6a353dd3..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/selection-actions-expected.txt +++ /dev/null
@@ -1,36 +0,0 @@ -EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x600 - LayoutBlockFlow {HTML} at (0,0) size 800x600 - LayoutBlockFlow {BODY} at (8,8) size 784x584 - LayoutText {#text} at (0,0) size 772x39 - text run at (0,0) width 772: "This tests whether certain NSResponder methods that should only operate on editable regions modify a selection that is not" - text run at (0,20) width 132: "in an editable region." - LayoutBR {BR} at (132,35) size 0x0 - LayoutText {#text} at (0,40) size 84x19 - text run at (0,40) width 84: "This is a para" - LayoutInline {SPAN} at (0,0) size 8x19 [color=#0000FF] - LayoutText {#text} at (84,40) size 8x19 - text run at (84,40) width 8: "g" - LayoutText {#text} at (92,40) size 32x19 - text run at (92,40) width 32: "raph." - LayoutBR {BR} at (124,55) size 0x0 - LayoutText {#text} at (0,60) size 63x19 - text run at (0,60) width 63: "Some text" - LayoutBR {BR} at (63,75) size 0x0 - LayoutText {#text} at (0,80) size 63x19 - text run at (0,80) width 63: "Some text" - LayoutBR {BR} at (63,95) size 0x0 - LayoutText {#text} at (0,100) size 63x19 - text run at (0,100) width 63: "Some text" - LayoutBR {BR} at (63,115) size 0x0 - LayoutText {#text} at (0,120) size 63x19 - text run at (0,120) width 63: "Some text" - LayoutBR {BR} at (63,135) size 0x0 - LayoutText {#text} at (0,140) size 124x19 - text run at (0,140) width 124: "This is a paragraph." -selection start: position 11 of child 2 {#text} of body -selection end: position 1 of child 7 {BR} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-actions-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-actions-expected.png deleted file mode 100644 index f28c6382..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-actions-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-actions-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-actions-expected.txt deleted file mode 100644 index a061eff6..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-actions-expected.txt +++ /dev/null
@@ -1,36 +0,0 @@ -EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x600 - LayoutBlockFlow {HTML} at (0,0) size 800x600 - LayoutBlockFlow {BODY} at (8,8) size 784x584 - LayoutText {#text} at (0,0) size 764x36 - text run at (0,0) width 764: "This tests whether certain NSResponder methods that should only operate on editable regions modify a selection that is" - text run at (0,18) width 160: "not in an editable region." - LayoutBR {BR} at (159,32) size 1x0 - LayoutText {#text} at (0,36) size 86x18 - text run at (0,36) width 86: "This is a para" - LayoutInline {SPAN} at (0,0) size 9x18 [color=#0000FF] - LayoutText {#text} at (85,36) size 9x18 - text run at (85,36) width 9: "g" - LayoutText {#text} at (93,36) size 34x18 - text run at (93,36) width 34: "raph." - LayoutBR {BR} at (126,50) size 1x0 - LayoutText {#text} at (0,54) size 65x18 - text run at (0,54) width 65: "Some text" - LayoutBR {BR} at (64,68) size 1x0 - LayoutText {#text} at (0,72) size 65x18 - text run at (0,72) width 65: "Some text" - LayoutBR {BR} at (64,86) size 1x0 - LayoutText {#text} at (0,90) size 65x18 - text run at (0,90) width 65: "Some text" - LayoutBR {BR} at (64,104) size 1x0 - LayoutText {#text} at (0,108) size 65x18 - text run at (0,108) width 65: "Some text" - LayoutBR {BR} at (64,122) size 1x0 - LayoutText {#text} at (0,126) size 127x18 - text run at (0,126) width 127: "This is a paragraph." -selection start: position 11 of child 2 {#text} of body -selection end: position 1 of child 7 {BR} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index 7e6e3036..798e4e8 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -146,7 +146,6 @@ method rotateSelf method scale3dSelf method scaleSelf - method setMatrixValue method skewXSelf method skewYSelf method translateSelf @@ -216,7 +215,6 @@ method toFloat32Array method toFloat64Array method toJSON - method toString method transformPoint method translate interface DOMPoint : DOMPointReadOnly
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt index dd3bb68..9889630 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -137,7 +137,6 @@ [Worker] method rotateSelf [Worker] method scale3dSelf [Worker] method scaleSelf -[Worker] method setMatrixValue [Worker] method skewXSelf [Worker] method skewYSelf [Worker] method translateSelf @@ -207,7 +206,6 @@ [Worker] method toFloat32Array [Worker] method toFloat64Array [Worker] method toJSON -[Worker] method toString [Worker] method transformPoint [Worker] method translate [Worker] interface DOMPoint : DOMPointReadOnly
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt index fdd5392..593448a 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -137,7 +137,6 @@ [Worker] method rotateSelf [Worker] method scale3dSelf [Worker] method scaleSelf -[Worker] method setMatrixValue [Worker] method skewXSelf [Worker] method skewYSelf [Worker] method translateSelf @@ -207,7 +206,6 @@ [Worker] method toFloat32Array [Worker] method toFloat64Array [Worker] method toJSON -[Worker] method toString [Worker] method transformPoint [Worker] method translate [Worker] interface DOMPoint : DOMPointReadOnly
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/selection-actions-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/selection-actions-expected.png deleted file mode 100644 index 73e2c5e..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/selection-actions-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/selection-actions-expected.txt b/third_party/WebKit/LayoutTests/platform/win/editing/selection/selection-actions-expected.txt deleted file mode 100644 index 12a5ac2..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/selection-actions-expected.txt +++ /dev/null
@@ -1,36 +0,0 @@ -EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification -layer at (0,0) size 800x600 - LayoutView at (0,0) size 800x600 -layer at (0,0) size 800x600 - LayoutBlockFlow {HTML} at (0,0) size 800x600 - LayoutBlockFlow {BODY} at (8,8) size 784x584 - LayoutText {#text} at (0,0) size 769x39 - text run at (0,0) width 769: "This tests whether certain NSResponder methods that should only operate on editable regions modify a selection that is not in an" - text run at (0,20) width 92: "editable region." - LayoutBR {BR} at (92,35) size 0x0 - LayoutText {#text} at (0,40) size 80x19 - text run at (0,40) width 80: "This is a para" - LayoutInline {SPAN} at (0,0) size 7x19 [color=#0000FF] - LayoutText {#text} at (80,40) size 7x19 - text run at (80,40) width 7: "g" - LayoutText {#text} at (87,40) size 31x19 - text run at (87,40) width 31: "raph." - LayoutBR {BR} at (118,55) size 0x0 - LayoutText {#text} at (0,60) size 61x19 - text run at (0,60) width 61: "Some text" - LayoutBR {BR} at (61,75) size 0x0 - LayoutText {#text} at (0,80) size 61x19 - text run at (0,80) width 61: "Some text" - LayoutBR {BR} at (61,95) size 0x0 - LayoutText {#text} at (0,100) size 61x19 - text run at (0,100) width 61: "Some text" - LayoutBR {BR} at (61,115) size 0x0 - LayoutText {#text} at (0,120) size 61x19 - text run at (0,120) width 61: "Some text" - LayoutBR {BR} at (61,135) size 0x0 - LayoutText {#text} at (0,140) size 118x19 - text run at (0,140) width 118: "This is a paragraph." -selection start: position 11 of child 2 {#text} of body -selection end: position 1 of child 7 {BR} of body
diff --git a/third_party/WebKit/LayoutTests/sensor/resources/generic-sensor-tests.js b/third_party/WebKit/LayoutTests/sensor/resources/generic-sensor-tests.js index 0742e89..c749a64 100644 --- a/third_party/WebKit/LayoutTests/sensor/resources/generic-sensor-tests.js +++ b/third_party/WebKit/LayoutTests/sensor/resources/generic-sensor-tests.js
@@ -411,4 +411,31 @@ sensor.mockSensorProvider.setContinuousReportingMode(); return checkFrequencyHintWorks(sensor); }, prefix + 'Test that frequency hint works (continuous reporting).'); + + promise_test(() => { + return new Promise((resolve,reject) => { + let iframe = document.createElement('iframe'); + iframe.srcdoc = '<script>' + + ' window.onmessage = message => {' + + ' if (message.data === "LOADED") {' + + ' try {' + + ' new ' + sensorType.name + '();' + + ' parent.postMessage("FAIL", "*");' + + ' } catch (e) {' + + ' parent.postMessage("PASS", "*");' + + ' }' + + ' }' + + ' };' + + '<\/script>'; + iframe.onload = () => iframe.contentWindow.postMessage('LOADED', '*'); + document.body.appendChild(iframe); + window.onmessage = message => { + if (message.data == 'PASS') { + resolve(); + } else if (message.data == 'FAIL') { + reject(); + } + } + }); + }, prefix + 'Test that sensor cannot be constructed within iframe.'); }
diff --git a/third_party/WebKit/LayoutTests/vibration/vibration-expected.txt b/third_party/WebKit/LayoutTests/vibration/vibration-expected.txt index 2b6fbea..fdc5dd1 100644 --- a/third_party/WebKit/LayoutTests/vibration/vibration-expected.txt +++ b/third_party/WebKit/LayoutTests/vibration/vibration-expected.txt
@@ -1,4 +1,4 @@ -CONSOLE ERROR: line 311: Uncaught TypeError: Cannot read property 'then' of undefined +CONSOLE ERROR: line 313: Uncaught TypeError: Cannot read property 'then' of undefined This is a testharness.js-based test. Harness Error. harness_status.status = 1 , harness_status.message = Uncaught TypeError: Cannot read property 'then' of undefined PASS VibrationManager Mojo bindings and mock interfaces are available to tests.
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index c5bc0ba6..612e998 100644 --- a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -205,7 +205,6 @@ method rotateSelf method scale3dSelf method scaleSelf - method setMatrixValue method skewXSelf method skewYSelf method translateSelf @@ -275,7 +274,6 @@ method toFloat32Array method toFloat64Array method toJSON - method toString method transformPoint method translate interface DOMPoint : DOMPointReadOnly
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-dedicated-worker-expected.txt index 3a9a596..f5c0488 100644 --- a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -175,7 +175,6 @@ [Worker] method rotateSelf [Worker] method scale3dSelf [Worker] method scaleSelf -[Worker] method setMatrixValue [Worker] method skewXSelf [Worker] method skewYSelf [Worker] method translateSelf @@ -245,7 +244,6 @@ [Worker] method toFloat32Array [Worker] method toFloat64Array [Worker] method toJSON -[Worker] method toString [Worker] method transformPoint [Worker] method translate [Worker] interface DOMPoint : DOMPointReadOnly
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-shared-worker-expected.txt index b272baa..20e1ef5 100644 --- a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -175,7 +175,6 @@ [Worker] method rotateSelf [Worker] method scale3dSelf [Worker] method scaleSelf -[Worker] method setMatrixValue [Worker] method skewXSelf [Worker] method skewYSelf [Worker] method translateSelf @@ -245,7 +244,6 @@ [Worker] method toFloat32Array [Worker] method toFloat64Array [Worker] method toJSON -[Worker] method toString [Worker] method transformPoint [Worker] method translate [Worker] interface DOMPoint : DOMPointReadOnly
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index 99fbd6a..c16a810 100644 --- a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -177,7 +177,6 @@ method rotateSelf method scale3dSelf method scaleSelf - method setMatrixValue method skewXSelf method skewYSelf method translateSelf @@ -246,7 +245,6 @@ method toFloat32Array method toFloat64Array method toJSON - method toString method transformPoint method translate interface DOMPoint : DOMPointReadOnly
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-script-streaming/external/wpt/service-workers/README.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-script-streaming/external/wpt/service-workers/README.txt new file mode 100644 index 0000000..339e450 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/service-worker-script-streaming/external/wpt/service-workers/README.txt
@@ -0,0 +1 @@ +This directory is for testing the script streaming (Tracking bug: https://crbug.com/683037).
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-script-streaming/http/tests/fetch/serviceworker-proxied/README.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-script-streaming/http/tests/fetch/serviceworker-proxied/README.txt new file mode 100644 index 0000000..339e450 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/service-worker-script-streaming/http/tests/fetch/serviceworker-proxied/README.txt
@@ -0,0 +1 @@ +This directory is for testing the script streaming (Tracking bug: https://crbug.com/683037).
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-script-streaming/http/tests/fetch/serviceworker/README.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-script-streaming/http/tests/fetch/serviceworker/README.txt new file mode 100644 index 0000000..339e450 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/service-worker-script-streaming/http/tests/fetch/serviceworker/README.txt
@@ -0,0 +1 @@ +This directory is for testing the script streaming (Tracking bug: https://crbug.com/683037).
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-script-streaming/http/tests/serviceworker/README.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-script-streaming/http/tests/serviceworker/README.txt new file mode 100644 index 0000000..339e450 --- /dev/null +++ b/third_party/WebKit/LayoutTests/virtual/service-worker-script-streaming/http/tests/serviceworker/README.txt
@@ -0,0 +1 @@ +This directory is for testing the script streaming (Tracking bug: https://crbug.com/683037).
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index 7bc1dcf..09aa1e3 100644 --- a/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -146,7 +146,6 @@ method rotateSelf method scale3dSelf method scaleSelf - method setMatrixValue method skewXSelf method skewYSelf method translateSelf @@ -216,7 +215,6 @@ method toFloat32Array method toFloat64Array method toJSON - method toString method transformPoint method translate interface DOMPoint : DOMPointReadOnly
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt index fe36be44..029d6f1b7 100644 --- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -137,7 +137,6 @@ [Worker] method rotateSelf [Worker] method scale3dSelf [Worker] method scaleSelf -[Worker] method setMatrixValue [Worker] method skewXSelf [Worker] method skewYSelf [Worker] method translateSelf @@ -207,7 +206,6 @@ [Worker] method toFloat32Array [Worker] method toFloat64Array [Worker] method toJSON -[Worker] method toString [Worker] method transformPoint [Worker] method translate [Worker] interface DOMPoint : DOMPointReadOnly
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt index e248bd6..2ffc9bf 100644 --- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -137,7 +137,6 @@ [Worker] method rotateSelf [Worker] method scale3dSelf [Worker] method scaleSelf -[Worker] method setMatrixValue [Worker] method skewXSelf [Worker] method skewYSelf [Worker] method translateSelf @@ -207,7 +206,6 @@ [Worker] method toFloat32Array [Worker] method toFloat64Array [Worker] method toJSON -[Worker] method toString [Worker] method transformPoint [Worker] method translate [Worker] interface DOMPoint : DOMPointReadOnly
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt index 2278f6b..84c6ce2d 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -175,7 +175,6 @@ [Worker] method rotateSelf [Worker] method scale3dSelf [Worker] method scaleSelf -[Worker] method setMatrixValue [Worker] method skewXSelf [Worker] method skewYSelf [Worker] method translateSelf @@ -245,7 +244,6 @@ [Worker] method toFloat32Array [Worker] method toFloat64Array [Worker] method toJSON -[Worker] method toString [Worker] method transformPoint [Worker] method translate [Worker] interface DOMPoint : DOMPointReadOnly
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt index d0b071d..e1511a29 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -175,7 +175,6 @@ [Worker] method rotateSelf [Worker] method scale3dSelf [Worker] method scaleSelf -[Worker] method setMatrixValue [Worker] method skewXSelf [Worker] method skewYSelf [Worker] method translateSelf @@ -245,7 +244,6 @@ [Worker] method toFloat32Array [Worker] method toFloat64Array [Worker] method toJSON -[Worker] method toString [Worker] method transformPoint [Worker] method translate [Worker] interface DOMPoint : DOMPointReadOnly
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp index 01479869..5c43446 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp
@@ -12,9 +12,9 @@ #include "bindings/core/v8/V8ThrowDOMException.h" #include "core/dom/ExceptionCode.h" #include "core/dom/ExecutionContext.h" -#include "core/dom/custom/CustomElement.h" #include "core/events/ErrorEvent.h" #include "core/html/HTMLElement.h" +#include "core/html/custom/CustomElement.h" #include "core/html/imports/HTMLImportsController.h" #include "platform/bindings/ScriptState.h" #include "platform/bindings/V8BindingMacros.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.h b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.h index ad87c58..f7c9d6ce 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.h
@@ -6,7 +6,7 @@ #define ScriptCustomElementDefinition_h #include "core/CoreExport.h" -#include "core/dom/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDefinition.h" #include "platform/bindings/ScriptState.h" #include "platform/bindings/TraceWrapperV8Reference.h" #include "platform/wtf/Noncopyable.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinitionBuilder.h b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinitionBuilder.h index ee9c7af..feccd41c 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinitionBuilder.h +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinitionBuilder.h
@@ -6,7 +6,7 @@ #define ScriptCustomElementDefinitionBuilder_h #include "core/CoreExport.h" -#include "core/dom/custom/CustomElementDefinitionBuilder.h" +#include "core/html/custom/CustomElementDefinitionBuilder.h" #include "platform/heap/Handle.h" #include "platform/wtf/Allocator.h" #include "platform/wtf/HashSet.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.cpp b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.cpp index 8330faa3..d0a24586 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.cpp
@@ -40,11 +40,11 @@ #include "core/SVGNames.h" #include "core/dom/Document.h" #include "core/dom/ElementRegistrationOptions.h" -#include "core/dom/custom/V0CustomElementDefinition.h" -#include "core/dom/custom/V0CustomElementDescriptor.h" -#include "core/dom/custom/V0CustomElementException.h" -#include "core/dom/custom/V0CustomElementProcessingStack.h" #include "core/frame/UseCounter.h" +#include "core/html/custom/V0CustomElementDefinition.h" +#include "core/html/custom/V0CustomElementDescriptor.h" +#include "core/html/custom/V0CustomElementException.h" +#include "core/html/custom/V0CustomElementProcessingStack.h" #include "platform/bindings/DOMWrapperWorld.h" #include "platform/bindings/V0CustomElementBinding.h" #include "platform/bindings/V8PerContextData.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.h b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.h index 1d5001a..53d378ce 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.h +++ b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.h
@@ -34,7 +34,7 @@ #include "bindings/core/v8/ScriptValue.h" #include "bindings/core/v8/V8V0CustomElementLifecycleCallbacks.h" #include "core/dom/QualifiedName.h" -#include "core/dom/custom/V0CustomElementLifecycleCallbacks.h" +#include "core/html/custom/V0CustomElementLifecycleCallbacks.h" #include "platform/wtf/PassRefPtr.h" #include "platform/wtf/RefPtr.h" #include "platform/wtf/text/AtomicString.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8HTMLConstructor.cpp b/third_party/WebKit/Source/bindings/core/v8/V8HTMLConstructor.cpp index 809a7f5c..d585332 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8HTMLConstructor.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8HTMLConstructor.cpp
@@ -11,8 +11,8 @@ #include "core/dom/Document.h" #include "core/dom/Element.h" #include "core/dom/ExceptionCode.h" -#include "core/dom/custom/CustomElementRegistry.h" #include "core/frame/LocalDOMWindow.h" +#include "core/html/custom/CustomElementRegistry.h" #include "platform/bindings/DOMWrapperWorld.h" #include "platform/bindings/V8BindingMacros.h" #include "platform/bindings/V8DOMWrapper.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.h b/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.h index 23da1848..951df420 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.h
@@ -33,7 +33,7 @@ #include <memory> -#include "core/dom/custom/V0CustomElementLifecycleCallbacks.h" +#include "core/html/custom/V0CustomElementLifecycleCallbacks.h" #include "platform/bindings/ScopedPersistent.h" #include "platform/bindings/ScriptState.h" #include "platform/wtf/PassRefPtr.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp index f091e55..90042c7 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp
@@ -39,8 +39,8 @@ #include "core/css/CSSStyleDeclaration.h" #include "core/css/CSSValue.h" #include "core/css/parser/CSSParser.h" -#include "core/dom/custom/CEReactionsScope.h" #include "core/events/EventTarget.h" +#include "core/html/custom/CEReactionsScope.h" #include "platform/wtf/ASCIICType.h" #include "platform/wtf/PassRefPtr.h" #include "platform/wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_attributes.py b/third_party/WebKit/Source/bindings/scripts/v8_attributes.py index ba748ee..bfa1f8a 100644 --- a/third_party/WebKit/Source/bindings/scripts/v8_attributes.py +++ b/third_party/WebKit/Source/bindings/scripts/v8_attributes.py
@@ -87,12 +87,12 @@ # [CEReactions] is_ce_reactions = 'CEReactions' in extended_attributes if is_ce_reactions: - includes.add('core/dom/custom/CEReactionsScope.h') + includes.add('core/html/custom/CEReactionsScope.h') # [CustomElementCallbacks], [Reflect] is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes is_reflect = 'Reflect' in extended_attributes if is_custom_element_callbacks or is_reflect: - includes.add('core/dom/custom/V0CustomElementProcessingStack.h') + includes.add('core/html/custom/V0CustomElementProcessingStack.h') # [PerWorldBindings] if 'PerWorldBindings' in extended_attributes: assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes, '[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface.name, attribute.name)
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_interface.py b/third_party/WebKit/Source/bindings/scripts/v8_interface.py index 787f759d..3af2339 100644 --- a/third_party/WebKit/Source/bindings/scripts/v8_interface.py +++ b/third_party/WebKit/Source/bindings/scripts/v8_interface.py
@@ -366,7 +366,7 @@ has_ce_reactions = any(setter_or_deleter and 'CEReactions' in setter_or_deleter.extended_attributes for setter_or_deleter in setter_or_deleters) if has_ce_reactions: - includes.add('core/dom/custom/CEReactionsScope.h') + includes.add('core/html/custom/CEReactionsScope.h') context.update({ 'constructors': constructors,
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_methods.py b/third_party/WebKit/Source/bindings/scripts/v8_methods.py index 84b8c16..4c11111 100644 --- a/third_party/WebKit/Source/bindings/scripts/v8_methods.py +++ b/third_party/WebKit/Source/bindings/scripts/v8_methods.py
@@ -139,10 +139,10 @@ is_ce_reactions = 'CEReactions' in extended_attributes if is_ce_reactions: - includes.add('core/dom/custom/CEReactionsScope.h') + includes.add('core/html/custom/CEReactionsScope.h') is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes if is_custom_element_callbacks: - includes.add('core/dom/custom/V0CustomElementProcessingStack.h') + includes.add('core/html/custom/V0CustomElementProcessingStack.h') is_raises_exception = 'RaisesException' in extended_attributes is_custom_call_prologue = has_extended_attribute_value(method, 'Custom', 'CallPrologue')
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8SVGTestInterface.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8SVGTestInterface.cpp index c93a2dc..ab5eaae3 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8SVGTestInterface.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8SVGTestInterface.cpp
@@ -17,7 +17,7 @@ #include "bindings/core/v8/V8DOMConfiguration.h" #include "core/SVGNames.h" #include "core/dom/ExecutionContext.h" -#include "core/dom/custom/V0CustomElementProcessingStack.h" +#include "core/html/custom/V0CustomElementProcessingStack.h" #include "platform/bindings/V8ObjectConstructor.h" #include "platform/wtf/GetPtr.h" #include "platform/wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackFunctions.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackFunctions.cpp index 81b567e..a09ac74 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackFunctions.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackFunctions.cpp
@@ -19,7 +19,7 @@ #include "bindings/core/v8/V8DOMConfiguration.h" #include "bindings/core/v8/VoidCallbackFunction.h" #include "core/dom/ExecutionContext.h" -#include "core/dom/custom/V0CustomElementProcessingStack.h" +#include "core/html/custom/V0CustomElementProcessingStack.h" #include "platform/bindings/V8ObjectConstructor.h" #include "platform/wtf/GetPtr.h" #include "platform/wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp index 0779be6..7805513 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp
@@ -20,7 +20,7 @@ #include "bindings/core/v8/V8TestInterfaceEmpty.h" #include "core/HTMLNames.h" #include "core/dom/ExecutionContext.h" -#include "core/dom/custom/V0CustomElementProcessingStack.h" +#include "core/html/custom/V0CustomElementProcessingStack.h" #include "platform/bindings/V8ObjectConstructor.h" #include "platform/wtf/GetPtr.h" #include "platform/wtf/RefPtr.h"
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp index 325b494..77d33f80 100644 --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp
@@ -60,13 +60,13 @@ #include "core/dom/ExecutionContext.h" #include "core/dom/FlexibleArrayBufferView.h" #include "core/dom/TagCollection.h" -#include "core/dom/custom/V0CustomElementProcessingStack.h" #include "core/frame/Deprecation.h" #include "core/frame/UseCounter.h" #include "core/html/HTMLCollection.h" #include "core/html/HTMLDataListOptionsCollection.h" #include "core/html/HTMLFormControlsCollection.h" #include "core/html/HTMLTableRowsCollection.h" +#include "core/html/custom/V0CustomElementProcessingStack.h" #include "core/imagebitmap/ImageBitmap.h" #include "core/inspector/ConsoleMessage.h" #include "core/inspector/ScriptArguments.h"
diff --git a/third_party/WebKit/Source/build/scripts/make_computed_style_base.py b/third_party/WebKit/Source/build/scripts/make_computed_style_base.py index f70e525..541093e 100755 --- a/third_party/WebKit/Source/build/scripts/make_computed_style_base.py +++ b/third_party/WebKit/Source/build/scripts/make_computed_style_base.py
@@ -349,7 +349,17 @@ elif property_['field_template'] == 'storage_only': type_name = property_['type_name'] default_value = property_['default_value'] - size = 1 if type_name == 'bool' else property_['field_size'] + size = None + if type_name == 'bool': + size = 1 + elif len(property_["keywords"]) > 0 and len(property_["include_paths"]) == 0: + # Assume that no property will ever have one keyword. + assert len(property_['keywords']) > 1, "There must be more than 1 keywords in a CSS property" + # Each keyword is represented as a number and the number of bit + # to represent the maximum number is calculated here + size = int(math.ceil(math.log(len(property_['keywords']), 2))) + else: + size = property_["field_size"] elif property_['field_template'] == 'external': type_name = property_['type_name'] default_value = property_['default_value']
diff --git a/third_party/WebKit/Source/build/scripts/make_style_shorthands.py b/third_party/WebKit/Source/build/scripts/make_style_shorthands.py index 655f26fe..5110a30a 100755 --- a/third_party/WebKit/Source/build/scripts/make_style_shorthands.py +++ b/third_party/WebKit/Source/build/scripts/make_style_shorthands.py
@@ -51,7 +51,7 @@ self._properties = {property_id: property for property_id, property in self._properties.items() if property['longhands']} for property in self._properties.values(): - property['longhand_property_ids'] = map(enum_for_css_property, property['longhands'].split(';')) + property['longhand_property_ids'] = map(enum_for_css_property, property['longhands']) for longhand in property['longhand_property_ids']: self._longhand_dictionary[longhand].append(property) for longhands in self._longhand_dictionary.values():
diff --git a/third_party/WebKit/Source/build/scripts/templates/ElementFactory.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/ElementFactory.cpp.tmpl index 7f49dde..8327d67 100644 --- a/third_party/WebKit/Source/build/scripts/templates/ElementFactory.cpp.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/ElementFactory.cpp.tmpl
@@ -11,10 +11,10 @@ #include "core/{{namespace|lower}}/{{fallback_interface}}.h" {% endif %} {% if namespace == 'HTML' %} -#include "core/dom/custom/CustomElement.h" +#include "core/html/custom/CustomElement.h" {% endif %} -#include "core/dom/custom/V0CustomElement.h" -#include "core/dom/custom/V0CustomElementRegistrationContext.h" +#include "core/html/custom/V0CustomElement.h" +#include "core/html/custom/V0CustomElementRegistrationContext.h" #include "core/dom/Document.h" #include "core/frame/Settings.h" #include "platform/RuntimeEnabledFeatures.h"
diff --git a/third_party/WebKit/Source/controller/BUILD.gn b/third_party/WebKit/Source/controller/BUILD.gn new file mode 100644 index 0000000..4fbb554 --- /dev/null +++ b/third_party/WebKit/Source/controller/BUILD.gn
@@ -0,0 +1,52 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/ui.gni") +import("//testing/test.gni") +import("//third_party/WebKit/Source/bindings/bindings.gni") +import("//third_party/WebKit/Source/config.gni") +import("//third_party/WebKit/Source/core/core.gni") +import("//third_party/WebKit/Source/modules/modules.gni") + +visibility = [ "//third_party/WebKit/*" ] + +component("controller") { + output_name = "blink_controller" + + deps = [ + "//skia", + "//third_party/WebKit/Source/core", + "//third_party/WebKit/Source/modules", + "//third_party/WebKit/Source/platform", + "//v8", + ] + + configs += [ + "//build/config/compiler:wexit_time_destructors", + "//third_party/WebKit/Source:config", + "//third_party/WebKit/Source:inside_blink", + "//third_party/WebKit/Source:non_test_config", + "//third_party/WebKit/Source/core:blink_core_pch", + ] + + defines = [ "BLINK_CONTROLLER_IMPLEMENTATION=1" ] + + sources = [ + "BlinkInitializer.cpp", + "BlinkInitializer.h", + "ControllerExport.h", + ] + + if (is_mac) { + libs = [ + "AppKit.framework", + "Foundation.framework", + ] + } + + if (remove_webcore_debug_symbols) { + configs -= [ "//build/config/compiler:default_symbols" ] + configs += [ "//build/config/compiler:no_symbols" ] + } +}
diff --git a/third_party/WebKit/Source/controller/BlinkInitializer.cpp b/third_party/WebKit/Source/controller/BlinkInitializer.cpp new file mode 100644 index 0000000..8add6961 --- /dev/null +++ b/third_party/WebKit/Source/controller/BlinkInitializer.cpp
@@ -0,0 +1,84 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "controller/BlinkInitializer.h" + +#include "bindings/core/v8/V8Initializer.h" +#include "core/animation/AnimationClock.h" +#include "modules/ModulesInitializer.h" +#include "platform/bindings/Microtask.h" +#include "platform/bindings/V8PerIsolateData.h" +#include "platform/heap/Heap.h" +#include "platform/wtf/Assertions.h" +#include "platform/wtf/PtrUtil.h" +#include "platform/wtf/WTF.h" +#include "public/platform/Platform.h" +#include "public/platform/WebThread.h" +#include "v8/include/v8.h" + +namespace blink { + +namespace { + +class EndOfTaskRunner : public WebThread::TaskObserver { + public: + void WillProcessTask() override { AnimationClock::NotifyTaskStart(); } + void DidProcessTask() override { + Microtask::PerformCheckpoint(V8PerIsolateData::MainThreadIsolate()); + V8Initializer::ReportRejectedPromisesOnMainThread(); + } +}; + +} // namespace + +static WebThread::TaskObserver* g_end_of_task_runner = nullptr; + +static ModulesInitializer& GetModulesInitializer() { + DEFINE_STATIC_LOCAL(std::unique_ptr<ModulesInitializer>, initializer, + (WTF::WrapUnique(new ModulesInitializer))); + return *initializer; +} + +void InitializeBlink(Platform* platform) { + Platform::Initialize(platform); + + V8Initializer::InitializeMainThread(); + + GetModulesInitializer().Initialize(); + + // currentThread is null if we are running on a thread without a message loop. + if (WebThread* current_thread = platform->CurrentThread()) { + DCHECK(!g_end_of_task_runner); + g_end_of_task_runner = new EndOfTaskRunner; + current_thread->AddTaskObserver(g_end_of_task_runner); + } +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/controller/BlinkInitializer.h b/third_party/WebKit/Source/controller/BlinkInitializer.h new file mode 100644 index 0000000..98690599 --- /dev/null +++ b/third_party/WebKit/Source/controller/BlinkInitializer.h
@@ -0,0 +1,19 @@ +// Copyright 2017 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 BlinkInitializer_h +#define BlinkInitializer_h + +#include "controller/ControllerExport.h" + +namespace blink { + +class Platform; + +// The embedder must call this function before using blink. +CONTROLLER_EXPORT void InitializeBlink(Platform*); + +} // namespace blink + +#endif // BlinkInitializer_h
diff --git a/third_party/WebKit/Source/controller/ControllerExport.h b/third_party/WebKit/Source/controller/ControllerExport.h new file mode 100644 index 0000000..33e6f5d --- /dev/null +++ b/third_party/WebKit/Source/controller/ControllerExport.h
@@ -0,0 +1,29 @@ +// Copyright 2017 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 ControllerExport_h +#define ControllerExport_h + +namespace blink { + +// This macro is intended to export symbols in Source/controller/ which are +// still private to Blink (for instance, because they are used in unit tests). + +#if defined(COMPONENT_BUILD) +#if defined(WIN32) +#if BLINK_CONTROLLER_IMPLEMENTATION +#define CONTROLLER_EXPORT __declspec(dllexport) +#else +#define CONTROLLER_EXPORT __declspec(dllimport) +#endif // BLINK_CONTROLLER_IMPLEMENTATION +#else // defined(WIN32) +#define CONTROLLER_EXPORT __attribute__((visibility("default"))) +#endif +#else // defined(COMPONENT_BUILD) +#define CONTROLLER_EXPORT +#endif + +} // namespace blink + +#endif // ControllerExport_h
diff --git a/third_party/WebKit/Source/controller/DEPS b/third_party/WebKit/Source/controller/DEPS new file mode 100644 index 0000000..4369797 --- /dev/null +++ b/third_party/WebKit/Source/controller/DEPS
@@ -0,0 +1,11 @@ +include_rules = [ + "+..", + "+bindings", + "+core", + "+modules", + "+controller", + "+platform", + "+web", + "+public/platform", + "+public/web", +]
diff --git a/third_party/WebKit/Source/controller/OWNERS b/third_party/WebKit/Source/controller/OWNERS new file mode 100644 index 0000000..3ceeaa6 --- /dev/null +++ b/third_party/WebKit/Source/controller/OWNERS
@@ -0,0 +1,8 @@ +dcheng@chromium.org +haraken@chromium.org +slangley@chromium.org +tkent@chromium.org + + +# TEAM: platform-architecture-dev@chromium.org +# COMPONENT: Blink>Internals>Modularization
diff --git a/third_party/WebKit/Source/controller/README.md b/third_party/WebKit/Source/controller/README.md new file mode 100644 index 0000000..1309feb --- /dev/null +++ b/third_party/WebKit/Source/controller/README.md
@@ -0,0 +1,5 @@ +# The controller/ directory + +controller/ contains the system infrastructure of the renderer process that uses or drives the web platform. controller/ can directly use core/ and modules/ without using Web types (but with some DEPS rules). Examples are RenderProcess, RenderThread, Android View, Extensions, Native Client etc. + +We should avoid making controller/ a "catch-all" directory. Things that are part of core/ should go to core/. Things that are part of modules/ should go to modules/. Only things that lives outside the web platform should go to controller/.
diff --git a/third_party/WebKit/Source/core/BUILD.gn b/third_party/WebKit/Source/core/BUILD.gn index abebeeb..bd7fb58 100644 --- a/third_party/WebKit/Source/core/BUILD.gn +++ b/third_party/WebKit/Source/core/BUILD.gn
@@ -1255,16 +1255,6 @@ "dom/URLSearchParamsTest.cpp", "dom/UserGestureIndicatorTest.cpp", "dom/WhitespaceAttacherTest.cpp", - "dom/custom/CustomElementDefinitionTest.cpp", - "dom/custom/CustomElementDescriptorTest.cpp", - "dom/custom/CustomElementReactionQueueTest.cpp", - "dom/custom/CustomElementReactionStackTest.cpp", - "dom/custom/CustomElementReactionTestHelpers.h", - "dom/custom/CustomElementRegistryTest.cpp", - "dom/custom/CustomElementTest.cpp", - "dom/custom/CustomElementTestHelpers.cpp", - "dom/custom/CustomElementTestHelpers.h", - "dom/custom/CustomElementUpgradeSorterTest.cpp", "editing/CaretDisplayItemClientTest.cpp", "editing/KeyboardTest.cpp", "editing/LinkSelectionTest.cpp", @@ -1347,6 +1337,16 @@ "html/TimeRangesTest.cpp", "html/canvas/CanvasAsyncBlobCreatorTest.cpp", "html/canvas/CanvasFontCacheTest.cpp", + "html/custom/CustomElementDefinitionTest.cpp", + "html/custom/CustomElementDescriptorTest.cpp", + "html/custom/CustomElementReactionQueueTest.cpp", + "html/custom/CustomElementReactionStackTest.cpp", + "html/custom/CustomElementReactionTestHelpers.h", + "html/custom/CustomElementRegistryTest.cpp", + "html/custom/CustomElementTest.cpp", + "html/custom/CustomElementTestHelpers.cpp", + "html/custom/CustomElementTestHelpers.h", + "html/custom/CustomElementUpgradeSorterTest.cpp", "html/forms/EmailInputTypeTest.cpp", "html/forms/ExternalPopupMenuTest.cpp", "html/forms/FileInputTypeTest.cpp",
diff --git a/third_party/WebKit/Source/core/core_idl_files.gni b/third_party/WebKit/Source/core/core_idl_files.gni index 5a76b17..cbc6cad 100644 --- a/third_party/WebKit/Source/core/core_idl_files.gni +++ b/third_party/WebKit/Source/core/core_idl_files.gni
@@ -139,7 +139,6 @@ "dom/Uint8Array.idl", "dom/Uint8ClampedArray.idl", "dom/XMLDocument.idl", - "dom/custom/CustomElementRegistry.idl", "editing/Selection.idl", "events/AnimationEvent.idl", "events/AnimationPlaybackEvent.idl", @@ -267,6 +266,7 @@ "html/TimeRanges.idl", "html/ValidityState.idl", "html/VoidCallback.idl", + "html/custom/CustomElementRegistry.idl", "html/media/MediaError.idl", "html/track/AudioTrackList.idl", "html/track/TextTrack.idl",
diff --git a/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h b/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h index b0d9265..73fe941d 100644 --- a/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h +++ b/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h
@@ -96,10 +96,10 @@ template <> inline LineClampValue CSSPrimitiveValue::ConvertTo() const { if (GetType() == UnitType::kInteger) - return LineClampValue(clampTo<int>(value_.num), kLineClampLineCount); + return LineClampValue(clampTo<int>(value_.num), LineClampType::kLineCount); if (GetType() == UnitType::kPercentage) - return LineClampValue(clampTo<int>(value_.num), kLineClampPercentage); + return LineClampValue(clampTo<int>(value_.num), LineClampType::kPercentage); NOTREACHED(); return LineClampValue();
diff --git a/third_party/WebKit/Source/core/css/CSSProperties.json5 b/third_party/WebKit/Source/core/css/CSSProperties.json5 index c65a4f8..5fe54adc 100644 --- a/third_party/WebKit/Source/core/css/CSSProperties.json5 +++ b/third_party/WebKit/Source/core/css/CSSProperties.json5
@@ -29,10 +29,9 @@ default: true, }, - // - longhands: "property;other-property" + // - longhands: ["property", "other-property"] // The property is a shorthand for several other properties. longhands: { - default: '', }, // - api_class: true|"classname" @@ -2532,7 +2531,7 @@ { name: "text-decoration", api_class: true, - longhands: "text-decoration-line;text-decoration-style;text-decoration-color", + longhands: ["text-decoration-line", "text-decoration-style", "text-decoration-color"], use_handlers_for: "CSSPropertyTextDecorationLine", }, { @@ -3666,287 +3665,287 @@ { name: "animation", - longhands: "animation-name;animation-duration;animation-timing-function;animation-delay;animation-iteration-count;animation-direction;animation-fill-mode;animation-play-state", + longhands: ["animation-name", "animation-duration", "animation-timing-function", "animation-delay", "animation-iteration-count", "animation-direction", "animation-fill-mode", "animation-play-state"], api_class: true, api_methods: ["parseShorthand"], }, { name: "background", - longhands: "background-image;background-position-x;background-position-y;background-size;background-repeat-x;background-repeat-y;background-attachment;background-origin;background-clip;background-color", + longhands: ["background-image", "background-position-x", "background-position-y", "background-size", "background-repeat-x", "background-repeat-y", "background-attachment", "background-origin", "background-clip", "background-color"], }, { name: "background-position", - longhands: "background-position-x;background-position-y", + longhands: ["background-position-x", "background-position-y"], }, { name: "background-repeat", - longhands: "background-repeat-x;background-repeat-y", + longhands: ["background-repeat-x", "background-repeat-y"], }, { name: "border", - longhands: "border-top-color;border-top-style;border-top-width;border-right-color;border-right-style;border-right-width;border-bottom-color;border-bottom-style;border-bottom-width;border-left-color;border-left-style;border-left-width;border-image-source;border-image-slice;border-image-width;border-image-outset;border-image-repeat", + longhands: ["border-top-color", "border-top-style", "border-top-width", "border-right-color", "border-right-style", "border-right-width", "border-bottom-color", "border-bottom-style", "border-bottom-width", "border-left-color", "border-left-style", "border-left-width", "border-image-source", "border-image-slice", "border-image-width", "border-image-outset", "border-image-repeat"], }, { name: "border-bottom", - longhands: "border-bottom-width;border-bottom-style;border-bottom-color", + longhands: ["border-bottom-width", "border-bottom-style", "border-bottom-color"], }, { name: "border-color", - longhands: "border-top-color;border-right-color;border-bottom-color;border-left-color", + longhands: ["border-top-color", "border-right-color", "border-bottom-color", "border-left-color"], }, { name: "border-image", - longhands: "border-image-source;border-image-slice;border-image-width;border-image-outset;border-image-repeat", + longhands: ["border-image-source", "border-image-slice", "border-image-width", "border-image-outset", "border-image-repeat"], }, { name: "border-left", - longhands: "border-left-width;border-left-style;border-left-color", + longhands: ["border-left-width", "border-left-style", "border-left-color"], }, { name: "border-radius", - longhands: "border-top-left-radius;border-top-right-radius;border-bottom-right-radius;border-bottom-left-radius", + longhands: ["border-top-left-radius", "border-top-right-radius", "border-bottom-right-radius", "border-bottom-left-radius"], api_class: true, api_methods: ["parseShorthand"], }, { name: "border-right", - longhands: "border-right-width;border-right-style;border-right-color", + longhands: ["border-right-width", "border-right-style", "border-right-color"], }, { name: "border-spacing", - longhands: "-webkit-border-horizontal-spacing;-webkit-border-vertical-spacing", + longhands: ["-webkit-border-horizontal-spacing", "-webkit-border-vertical-spacing"], api_class: true, api_methods: ["parseShorthand"], }, { name: "border-style", - longhands: "border-top-style;border-right-style;border-bottom-style;border-left-style", + longhands: ["border-top-style", "border-right-style", "border-bottom-style", "border-left-style"], keywords: ["none"], typedom_types: ["Image"], }, { name: "border-top", - longhands: "border-top-width;border-top-style;border-top-color", + longhands: ["border-top-width", "border-top-style", "border-top-color"], }, { name: "border-width", - longhands: "border-top-width;border-right-width;border-bottom-width;border-left-width", + longhands: ["border-top-width", "border-right-width", "border-bottom-width", "border-left-width"], }, { name: "flex", - longhands: "flex-grow;flex-shrink;flex-basis", + longhands: ["flex-grow", "flex-shrink", "flex-basis"], api_class: true, api_methods: ["parseShorthand"], }, { name: "flex-flow", - longhands: "flex-direction;flex-wrap", + longhands: ["flex-direction", "flex-wrap"], }, { name: "font", - longhands: "font-style;font-variant-ligatures;font-variant-caps;font-variant-numeric;font-weight;font-stretch;font-size;line-height;font-family", + longhands: ["font-style", "font-variant-ligatures", "font-variant-caps", "font-variant-numeric", "font-weight", "font-stretch", "font-size", "line-height", "font-family"], api_class: true, api_methods: ["parseShorthand"], }, { name: "font-variant", - longhands: "font-variant-ligatures;font-variant-caps;font-variant-numeric", + longhands: ["font-variant-ligatures", "font-variant-caps", "font-variant-numeric"], api_class: true, api_methods: ["parseShorthand"], is_descriptor: true, }, { name: "grid", - longhands: "grid-template-rows;grid-template-columns;grid-template-areas;grid-auto-flow;grid-auto-rows;grid-auto-columns;grid-column-gap;grid-row-gap", + longhands: ["grid-template-rows", "grid-template-columns", "grid-template-areas", "grid-auto-flow", "grid-auto-rows", "grid-auto-columns", "grid-column-gap", "grid-row-gap"], runtime_flag: "CSSGridLayout", }, { name: "place-content", - longhands: "align-content;justify-content", + longhands: ["align-content", "justify-content"], runtime_flag: "CSSGridLayout", }, { name: "place-items", - longhands: "align-items;justify-items", + longhands: ["align-items", "justify-items"], runtime_flag: "CSSGridLayout", }, { name: "place-self", - longhands: "align-self;justify-self", + longhands: ["align-self", "justify-self"], runtime_flag: "CSSGridLayout", }, { name: "grid-area", - longhands: "grid-row-start;grid-column-start;grid-row-end;grid-column-end", + longhands: ["grid-row-start", "grid-column-start", "grid-row-end", "grid-column-end"], runtime_flag: "CSSGridLayout", }, { name: "grid-column", - longhands: "grid-column-start;grid-column-end", + longhands: ["grid-column-start", "grid-column-end"], runtime_flag: "CSSGridLayout", }, { name: "grid-gap", - longhands: "grid-row-gap;grid-column-gap", + longhands: ["grid-row-gap", "grid-column-gap"], runtime_flag: "CSSGridLayout", }, { name: "grid-row", - longhands: "grid-row-start;grid-row-end", + longhands: ["grid-row-start", "grid-row-end"], runtime_flag: "CSSGridLayout", }, { name: "grid-template", - longhands: "grid-template-rows;grid-template-columns;grid-template-areas", + longhands: ["grid-template-rows", "grid-template-columns", "grid-template-areas"], runtime_flag: "CSSGridLayout", }, { name: "list-style", - longhands: "list-style-type;list-style-position;list-style-image", + longhands: ["list-style-type", "list-style-position", "list-style-image"], }, { name: "margin", - longhands: "margin-top;margin-right;margin-bottom;margin-left", + longhands: ["margin-top", "margin-right", "margin-bottom", "margin-left"], }, { name: "marker", - longhands: "marker-start;marker-mid;marker-end", + longhands: ["marker-start", "marker-mid", "marker-end"], }, { name: "offset", - longhands: "offset-position;offset-path;offset-distance;offset-rotate;offset-anchor", + longhands: ["offset-position", "offset-path", "offset-distance", "offset-rotate", "offset-anchor"], api_class: true, api_methods: ["parseShorthand"], }, { name: "outline", - longhands: "outline-color;outline-style;outline-width", + longhands: ["outline-color", "outline-style", "outline-width"], }, { name: "overflow", - longhands: "overflow-x;overflow-y", + longhands: ["overflow-x", "overflow-y"], api_class: true, api_methods: ["parseShorthand"], }, { name: "padding", - longhands: "padding-top;padding-right;padding-bottom;padding-left", + longhands: ["padding-top", "padding-right", "padding-bottom", "padding-left"], }, { name: "page-break-after", - longhands: "break-after", + longhands: ["break-after"], }, { name: "page-break-before", - longhands: "break-before", + longhands: ["break-before"], }, { name: "page-break-inside", - longhands: "break-inside", + longhands: ["break-inside"], }, { name: "scroll-padding", - longhands: "scroll-padding-top;scroll-padding-right;scroll-padding-bottom;scroll-padding-left", + longhands: ["scroll-padding-top", "scroll-padding-right", "scroll-padding-bottom", "scroll-padding-left"], runtime_flag: "CSSScrollSnapPoints", }, { name: "scroll-padding-block", - longhands: "scroll-padding-block-start;scroll-padding-block-end", + longhands: ["scroll-padding-block-start", "scroll-padding-block-end"], runtime_flag: "CSSScrollSnapPoints", }, { name: "scroll-padding-inline", - longhands: "scroll-padding-inline-start;scroll-padding-inline-end", + longhands: ["scroll-padding-inline-start", "scroll-padding-inline-end"], runtime_flag: "CSSScrollSnapPoints", }, { name: "scroll-snap-margin", - longhands: "scroll-snap-margin-top;scroll-snap-margin-right;scroll-snap-margin-bottom;scroll-snap-margin-left", + longhands: ["scroll-snap-margin-top", "scroll-snap-margin-right", "scroll-snap-margin-bottom", "scroll-snap-margin-left"], runtime_flag: "CSSScrollSnapPoints", }, { name: "scroll-snap-margin-block", - longhands: "scroll-snap-margin-block-start;scroll-snap-margin-block-end", + longhands: ["scroll-snap-margin-block-start", "scroll-snap-margin-block-end"], runtime_flag: "CSSScrollSnapPoints", }, { name: "scroll-snap-margin-inline", - longhands: "scroll-snap-margin-inline-start;scroll-snap-margin-inline-end", + longhands: ["scroll-snap-margin-inline-start", "scroll-snap-margin-inline-end"], runtime_flag: "CSSScrollSnapPoints", }, { name: "transition", - longhands: "transition-property;transition-duration;transition-timing-function;transition-delay", + longhands: ["transition-property", "transition-duration", "transition-timing-function", "transition-delay"], api_class: true, api_methods: ["parseShorthand"], }, { name: "-webkit-border-after", - longhands: "-webkit-border-after-width;-webkit-border-after-style;-webkit-border-after-color", + longhands: ["-webkit-border-after-width", "-webkit-border-after-style", "-webkit-border-after-color"], }, { name: "-webkit-border-before", - longhands: "-webkit-border-before-width;-webkit-border-before-style;-webkit-border-before-color", + longhands: ["-webkit-border-before-width", "-webkit-border-before-style", "-webkit-border-before-color"], }, { name: "-webkit-border-end", - longhands: "-webkit-border-end-width;-webkit-border-end-style;-webkit-border-end-color", + longhands: ["-webkit-border-end-width", "-webkit-border-end-style", "-webkit-border-end-color"], }, { name: "-webkit-border-start", - longhands: "-webkit-border-start-width;-webkit-border-start-style;-webkit-border-start-color", + longhands: ["-webkit-border-start-width", "-webkit-border-start-style", "-webkit-border-start-color"], }, { name: "-webkit-column-break-after", - longhands: "break-after", + longhands: ["break-after"], }, { name: "-webkit-column-break-before", - longhands: "break-before", + longhands: ["break-before"], }, { name: "-webkit-column-break-inside", - longhands: "break-inside", + longhands: ["break-inside"], }, { name: "column-rule", - longhands: "column-rule-width;column-rule-style;column-rule-color", + longhands: ["column-rule-width", "column-rule-style", "column-rule-color"], }, { name: "columns", - longhands: "column-width;column-count", + longhands: ["column-width", "column-count"], api_class: true, api_methods: ["parseShorthand"], }, { name: "-webkit-margin-collapse", - longhands: "-webkit-margin-before-collapse;-webkit-margin-after-collapse", + longhands: ["-webkit-margin-before-collapse", "-webkit-margin-after-collapse"], api_class: true, api_methods: ["parseShorthand"], }, { name: "-webkit-mask", - longhands: "-webkit-mask-image;-webkit-mask-position-x;-webkit-mask-position-y;-webkit-mask-size;-webkit-mask-repeat-x;-webkit-mask-repeat-y;-webkit-mask-origin;-webkit-mask-clip", + longhands: ["-webkit-mask-image", "-webkit-mask-position-x", "-webkit-mask-position-y", "-webkit-mask-size", "-webkit-mask-repeat-x", "-webkit-mask-repeat-y", "-webkit-mask-origin", "-webkit-mask-clip"], }, { name: "-webkit-mask-box-image", - longhands: "-webkit-mask-box-image-source;-webkit-mask-box-image-slice;-webkit-mask-box-image-width;-webkit-mask-box-image-outset;-webkit-mask-box-image-repeat", + longhands: ["-webkit-mask-box-image-source", "-webkit-mask-box-image-slice", "-webkit-mask-box-image-width", "-webkit-mask-box-image-outset", "-webkit-mask-box-image-repeat"], }, { name: "-webkit-mask-position", - longhands: "-webkit-mask-position-x;-webkit-mask-position-y", + longhands: ["-webkit-mask-position-x", "-webkit-mask-position-y"], }, { name: "-webkit-mask-repeat", - longhands: "-webkit-mask-repeat-x;-webkit-mask-repeat-y", + longhands: ["-webkit-mask-repeat-x", "-webkit-mask-repeat-y"], }, { name: "-webkit-text-emphasis", - longhands: "-webkit-text-emphasis-style;-webkit-text-emphasis-color", + longhands: ["-webkit-text-emphasis-style", "-webkit-text-emphasis-color"], }, { name: "-webkit-text-stroke", - longhands: "-webkit-text-stroke-width;-webkit-text-stroke-color", + longhands: ["-webkit-text-stroke-width", "-webkit-text-stroke-color"], }, // Aliases; these map to the same CSSPropertyID
diff --git a/third_party/WebKit/Source/core/css/ComputedStyleExtraFields.json5 b/third_party/WebKit/Source/core/css/ComputedStyleExtraFields.json5 index 3386f60..2ef704d 100644 --- a/third_party/WebKit/Source/core/css/ComputedStyleExtraFields.json5 +++ b/third_party/WebKit/Source/core/css/ComputedStyleExtraFields.json5
@@ -192,7 +192,7 @@ { name: "VerticalAlign", field_template: "storage_only", - field_size: 4, + keywords: ["baseline", "sub", "super", "text-top", "text-bottom", "middle", "top", "bottom", "length"], default_value: "EVerticalAlign::kBaseline", type_name: "EVerticalAlign", },
diff --git a/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp b/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp index ecb2c85..244d0dea 100644 --- a/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp +++ b/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp
@@ -34,8 +34,8 @@ #include "core/dom/MutationRecord.h" #include "core/dom/StyleChangeReason.h" #include "core/dom/StyleEngine.h" -#include "core/dom/custom/CustomElement.h" -#include "core/dom/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElement.h" +#include "core/html/custom/CustomElementDefinition.h" #include "core/probe/CoreProbes.h" #include "platform/RuntimeEnabledFeatures.h"
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIContent.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIContent.cpp index b0f5ef2..15d9d08e 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIContent.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPIContent.cpp
@@ -67,7 +67,7 @@ if (!args.AtEnd()) return nullptr; - return CSSCounterValue::Create(identifier, list_style, separator); + return blink::CSSCounterValue::Create(identifier, list_style, separator); } } // namespace
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICursor.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICursor.cpp index 7df161d..7deca39 100644 --- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICursor.cpp +++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICursor.cpp
@@ -14,8 +14,6 @@ class CSSParserLocalContext; namespace blink { -using CSSCursorImageValue = cssvalue::CSSCursorImageValue; - const CSSValue* CSSPropertyAPICursor::parseSingleValue( CSSParserTokenRange& range, const CSSParserContext& context, @@ -39,8 +37,8 @@ if (!list) list = CSSValueList::CreateCommaSeparated(); - list->Append( - *CSSCursorImageValue::Create(*image, hot_spot_specified, hot_spot)); + list->Append(*cssvalue::CSSCursorImageValue::Create( + *image, hot_spot_specified, hot_spot)); if (!CSSPropertyParserHelpers::ConsumeCommaIncludingWhitespace(range)) return nullptr; }
diff --git a/third_party/WebKit/Source/core/dom/BUILD.gn b/third_party/WebKit/Source/core/dom/BUILD.gn index 7a5487e..687e822 100644 --- a/third_party/WebKit/Source/core/dom/BUILD.gn +++ b/third_party/WebKit/Source/core/dom/BUILD.gn
@@ -379,76 +379,6 @@ "WhitespaceAttacher.h", "XMLDocument.cpp", "XMLDocument.h", - "custom/CEReactionsScope.cpp", - "custom/CEReactionsScope.h", - "custom/CustomElement.cpp", - "custom/CustomElement.h", - "custom/CustomElementAdoptedCallbackReaction.cpp", - "custom/CustomElementAdoptedCallbackReaction.h", - "custom/CustomElementAttributeChangedCallbackReaction.cpp", - "custom/CustomElementAttributeChangedCallbackReaction.h", - "custom/CustomElementConnectedCallbackReaction.cpp", - "custom/CustomElementConnectedCallbackReaction.h", - "custom/CustomElementDefinition.cpp", - "custom/CustomElementDefinition.h", - "custom/CustomElementDefinitionBuilder.h", - "custom/CustomElementDescriptor.h", - "custom/CustomElementDescriptorHash.h", - "custom/CustomElementDisconnectedCallbackReaction.cpp", - "custom/CustomElementDisconnectedCallbackReaction.h", - "custom/CustomElementReaction.cpp", - "custom/CustomElementReaction.h", - "custom/CustomElementReactionQueue.cpp", - "custom/CustomElementReactionQueue.h", - "custom/CustomElementReactionStack.cpp", - "custom/CustomElementReactionStack.h", - "custom/CustomElementRegistry.cpp", - "custom/CustomElementRegistry.h", - "custom/CustomElementUpgradeReaction.cpp", - "custom/CustomElementUpgradeReaction.h", - "custom/CustomElementUpgradeSorter.cpp", - "custom/CustomElementUpgradeSorter.h", - "custom/V0CustomElement.cpp", - "custom/V0CustomElement.h", - "custom/V0CustomElementAsyncImportMicrotaskQueue.cpp", - "custom/V0CustomElementAsyncImportMicrotaskQueue.h", - "custom/V0CustomElementCallbackInvocation.cpp", - "custom/V0CustomElementCallbackInvocation.h", - "custom/V0CustomElementCallbackQueue.cpp", - "custom/V0CustomElementCallbackQueue.h", - "custom/V0CustomElementDefinition.cpp", - "custom/V0CustomElementDefinition.h", - "custom/V0CustomElementDescriptor.h", - "custom/V0CustomElementDescriptorHash.h", - "custom/V0CustomElementException.cpp", - "custom/V0CustomElementException.h", - "custom/V0CustomElementLifecycleCallbacks.h", - "custom/V0CustomElementMicrotaskDispatcher.cpp", - "custom/V0CustomElementMicrotaskDispatcher.h", - "custom/V0CustomElementMicrotaskImportStep.cpp", - "custom/V0CustomElementMicrotaskImportStep.h", - "custom/V0CustomElementMicrotaskQueueBase.cpp", - "custom/V0CustomElementMicrotaskQueueBase.h", - "custom/V0CustomElementMicrotaskResolutionStep.cpp", - "custom/V0CustomElementMicrotaskResolutionStep.h", - "custom/V0CustomElementMicrotaskRunQueue.cpp", - "custom/V0CustomElementMicrotaskRunQueue.h", - "custom/V0CustomElementMicrotaskStep.h", - "custom/V0CustomElementObserver.cpp", - "custom/V0CustomElementObserver.h", - "custom/V0CustomElementProcessingStack.cpp", - "custom/V0CustomElementProcessingStack.h", - "custom/V0CustomElementProcessingStep.h", - "custom/V0CustomElementRegistrationContext.cpp", - "custom/V0CustomElementRegistrationContext.h", - "custom/V0CustomElementRegistry.cpp", - "custom/V0CustomElementRegistry.h", - "custom/V0CustomElementScheduler.cpp", - "custom/V0CustomElementScheduler.h", - "custom/V0CustomElementSyncMicrotaskQueue.cpp", - "custom/V0CustomElementSyncMicrotaskQueue.h", - "custom/V0CustomElementUpgradeCandidateMap.cpp", - "custom/V0CustomElementUpgradeCandidateMap.h", ] jumbo_excluded_sources = [ "Modulator.cpp" ] # https://crbug.com/716395
diff --git a/third_party/WebKit/Source/core/dom/DOMImplementation.cpp b/third_party/WebKit/Source/core/dom/DOMImplementation.cpp index 63d8b98..9a2e9f7 100644 --- a/third_party/WebKit/Source/core/dom/DOMImplementation.cpp +++ b/third_party/WebKit/Source/core/dom/DOMImplementation.cpp
@@ -37,7 +37,6 @@ #include "core/dom/Element.h" #include "core/dom/Text.h" #include "core/dom/XMLDocument.h" -#include "core/dom/custom/V0CustomElementRegistrationContext.h" #include "core/frame/LocalFrame.h" #include "core/frame/UseCounter.h" #include "core/html/HTMLDocument.h" @@ -48,6 +47,7 @@ #include "core/html/ImageDocument.h" #include "core/html/PluginDocument.h" #include "core/html/TextDocument.h" +#include "core/html/custom/V0CustomElementRegistrationContext.h" #include "core/html/media/MediaDocument.h" #include "core/loader/FrameLoader.h" #include "core/page/Page.h"
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index 1237ded0..24d6081 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -111,12 +111,6 @@ #include "core/dom/VisitedLinkState.h" #include "core/dom/WhitespaceAttacher.h" #include "core/dom/XMLDocument.h" -#include "core/dom/custom/CustomElement.h" -#include "core/dom/custom/CustomElementDefinition.h" -#include "core/dom/custom/CustomElementDescriptor.h" -#include "core/dom/custom/CustomElementRegistry.h" -#include "core/dom/custom/V0CustomElementMicrotaskRunQueue.h" -#include "core/dom/custom/V0CustomElementRegistrationContext.h" #include "core/editing/EditingUtilities.h" #include "core/editing/FrameSelection.h" #include "core/editing/markers/DocumentMarkerController.h" @@ -171,6 +165,12 @@ #include "core/html/canvas/CanvasContextCreationAttributes.h" #include "core/html/canvas/CanvasFontCache.h" #include "core/html/canvas/CanvasRenderingContext.h" +#include "core/html/custom/CustomElement.h" +#include "core/html/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDescriptor.h" +#include "core/html/custom/CustomElementRegistry.h" +#include "core/html/custom/V0CustomElementMicrotaskRunQueue.h" +#include "core/html/custom/V0CustomElementRegistrationContext.h" #include "core/html/forms/FormController.h" #include "core/html/imports/HTMLImportLoader.h" #include "core/html/imports/HTMLImportsController.h"
diff --git a/third_party/WebKit/Source/core/dom/Document.h b/third_party/WebKit/Source/core/dom/Document.h index 89293da..03947a0c 100644 --- a/third_party/WebKit/Source/core/dom/Document.h +++ b/third_party/WebKit/Source/core/dom/Document.h
@@ -50,9 +50,9 @@ #include "core/dom/TreeScope.h" #include "core/dom/UserActionElementSet.h" #include "core/dom/ViewportDescription.h" -#include "core/dom/custom/V0CustomElement.h" #include "core/frame/DOMTimerCoordinator.h" #include "core/frame/HostsUsingFeatures.h" +#include "core/html/custom/V0CustomElement.h" #include "core/html/parser/ParserSynchronizationPolicy.h" #include "core/page/PageVisibilityState.h" #include "platform/Length.h"
diff --git a/third_party/WebKit/Source/core/dom/DocumentInit.cpp b/third_party/WebKit/Source/core/dom/DocumentInit.cpp index 11b4bad..2365811 100644 --- a/third_party/WebKit/Source/core/dom/DocumentInit.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentInit.cpp
@@ -30,9 +30,9 @@ #include "core/dom/DocumentInit.h" #include "core/dom/Document.h" -#include "core/dom/custom/V0CustomElementRegistrationContext.h" #include "core/frame/LocalFrame.h" #include "core/html/HTMLFrameOwnerElement.h" +#include "core/html/custom/V0CustomElementRegistrationContext.h" #include "core/html/imports/HTMLImportsController.h" #include "core/loader/DocumentLoader.h" #include "platform/RuntimeEnabledFeatures.h"
diff --git a/third_party/WebKit/Source/core/dom/DocumentInit.h b/third_party/WebKit/Source/core/dom/DocumentInit.h index 84d4e430..0694fb3 100644 --- a/third_party/WebKit/Source/core/dom/DocumentInit.h +++ b/third_party/WebKit/Source/core/dom/DocumentInit.h
@@ -33,7 +33,7 @@ #include "core/CoreExport.h" #include "core/dom/SandboxFlags.h" #include "core/dom/SecurityContext.h" -#include "core/dom/custom/V0CustomElementRegistrationContext.h" +#include "core/html/custom/V0CustomElementRegistrationContext.h" #include "platform/heap/Handle.h" #include "platform/weborigin/KURL.h" #include "public/platform/WebInsecureRequestPolicy.h"
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp index 309febbf..61de773 100644 --- a/third_party/WebKit/Source/core/dom/Element.cpp +++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -82,10 +82,6 @@ #include "core/dom/Text.h" #include "core/dom/V0InsertionPoint.h" #include "core/dom/WhitespaceAttacher.h" -#include "core/dom/custom/CustomElement.h" -#include "core/dom/custom/CustomElementRegistry.h" -#include "core/dom/custom/V0CustomElement.h" -#include "core/dom/custom/V0CustomElementRegistrationContext.h" #include "core/editing/EditingUtilities.h" #include "core/editing/FrameSelection.h" #include "core/editing/iterators/TextIterator.h" @@ -114,6 +110,10 @@ #include "core/html/HTMLSlotElement.h" #include "core/html/HTMLTableRowsCollection.h" #include "core/html/HTMLTemplateElement.h" +#include "core/html/custom/CustomElement.h" +#include "core/html/custom/CustomElementRegistry.h" +#include "core/html/custom/V0CustomElement.h" +#include "core/html/custom/V0CustomElementRegistrationContext.h" #include "core/html/parser/HTMLParserIdioms.h" #include "core/input/EventHandler.h" #include "core/layout/LayoutTextFragment.h"
diff --git a/third_party/WebKit/Source/core/dom/ElementRareData.h b/third_party/WebKit/Source/core/dom/ElementRareData.h index 0a30e78..9404312 100644 --- a/third_party/WebKit/Source/core/dom/ElementRareData.h +++ b/third_party/WebKit/Source/core/dom/ElementRareData.h
@@ -35,8 +35,8 @@ #include "core/dom/NodeRareData.h" #include "core/dom/PseudoElement.h" #include "core/dom/PseudoElementData.h" -#include "core/dom/custom/CustomElementDefinition.h" -#include "core/dom/custom/V0CustomElementDefinition.h" +#include "core/html/custom/CustomElementDefinition.h" +#include "core/html/custom/V0CustomElementDefinition.h" #include "platform/bindings/ScriptWrappableVisitor.h" #include "platform/heap/Handle.h" #include "platform/wtf/HashSet.h"
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp index 95fcd7a..b8ecabd4 100644 --- a/third_party/WebKit/Source/core/dom/Node.cpp +++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -62,7 +62,6 @@ #include "core/dom/TreeScopeAdopter.h" #include "core/dom/UserActionElementSet.h" #include "core/dom/V0InsertionPoint.h" -#include "core/dom/custom/CustomElement.h" #include "core/editing/EditingUtilities.h" #include "core/editing/markers/DocumentMarkerController.h" #include "core/events/Event.h" @@ -88,6 +87,7 @@ #include "core/html/HTMLDialogElement.h" #include "core/html/HTMLFrameOwnerElement.h" #include "core/html/HTMLSlotElement.h" +#include "core/html/custom/CustomElement.h" #include "core/input/EventHandler.h" #include "core/layout/LayoutBox.h" #include "core/layout/LayoutEmbeddedContent.h"
diff --git a/third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp b/third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp index 295258f..3c60adf 100644 --- a/third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp +++ b/third_party/WebKit/Source/core/dom/TreeScopeAdopter.cpp
@@ -32,7 +32,7 @@ #include "core/dom/NodeRareData.h" #include "core/dom/NodeTraversal.h" #include "core/dom/ShadowRoot.h" -#include "core/dom/custom/CustomElement.h" +#include "core/html/custom/CustomElement.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/editing/BUILD.gn b/third_party/WebKit/Source/core/editing/BUILD.gn index 6293673..f4a1489 100644 --- a/third_party/WebKit/Source/core/editing/BUILD.gn +++ b/third_party/WebKit/Source/core/editing/BUILD.gn
@@ -287,6 +287,13 @@ sources += [ "commands/SmartReplaceCF.cpp" ] } + if (is_mac) { + jumbo_excluded_sources = [ + # Using "using blink" in global scope. + "WebSubstringUtil.mm", + ] + } + configs += [ # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. "//build/config/compiler:no_size_t_to_int_warning",
diff --git a/third_party/WebKit/Source/core/editing/LinkSelectionTest.cpp b/third_party/WebKit/Source/core/editing/LinkSelectionTest.cpp index c9e5bdc..15e826a 100644 --- a/third_party/WebKit/Source/core/editing/LinkSelectionTest.cpp +++ b/third_party/WebKit/Source/core/editing/LinkSelectionTest.cpp
@@ -182,7 +182,7 @@ ->LocalFrameRoot() .GetEventHandler() .ScheduleCursorUpdate(); - testing::RunDelayedTasks(50); + testing::RunDelayedTasks(TimeDelta::FromMilliseconds(50)); const auto& cursor = main_frame_->GetFrame()->GetChromeClient().LastSetCursorForTesting(); EXPECT_EQ(Cursor::kHand, cursor.GetType()); @@ -195,7 +195,7 @@ ->LocalFrameRoot() .GetEventHandler() .ScheduleCursorUpdate(); - testing::RunDelayedTasks(50); + testing::RunDelayedTasks(TimeDelta::FromMilliseconds(50)); const auto& cursor = main_frame_->GetFrame()->GetChromeClient().LastSetCursorForTesting(); EXPECT_EQ(Cursor::kIBeam, cursor.GetType()); @@ -214,7 +214,7 @@ frame->GetPage()->GetContextMenuController().ClearContextMenu(); frame->LocalFrameRoot().GetEventHandler().ScheduleCursorUpdate(); - testing::RunDelayedTasks(50); + testing::RunDelayedTasks(TimeDelta::FromMilliseconds(50)); const auto& cursor = main_frame_->GetFrame()->GetChromeClient().LastSetCursorForTesting(); EXPECT_EQ(Cursor::kHand, cursor.GetType());
diff --git a/third_party/WebKit/Source/core/editing/SelectionController.cpp b/third_party/WebKit/Source/core/editing/SelectionController.cpp index 03c4b05..84d0b6a2 100644 --- a/third_party/WebKit/Source/core/editing/SelectionController.cpp +++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -164,6 +164,48 @@ return position; } +static SelectionInFlatTree ExtendSelectionAsDirectional( + const PositionInFlatTree& position, + const VisibleSelectionInFlatTree& selection, + TextGranularity granularity) { + DCHECK(!selection.IsNone()); + DCHECK(position.IsNotNull()); + return SelectionInFlatTree::Builder() + .SetBaseAndExtent(selection.Base(), position) + .SetGranularity(granularity) + .Build(); +} + +static SelectionInFlatTree ExtendSelectionAsNonDirectional( + const PositionInFlatTree& position, + const VisibleSelectionInFlatTree& selection, + TextGranularity granularity) { + DCHECK(!selection.IsNone()); + DCHECK(position.IsNotNull()); + // Shift+Click deselects when selection was created right-to-left + const PositionInFlatTree& start = selection.Start(); + const PositionInFlatTree& end = selection.End(); + if (position < start) { + return SelectionInFlatTree::Builder() + .SetBaseAndExtent(end, position) + .SetGranularity(granularity) + .Build(); + } + if (end < position) { + return SelectionInFlatTree::Builder() + .SetBaseAndExtent(start, position) + .SetGranularity(granularity) + .Build(); + } + const int distance_to_start = TextDistance(start, position); + const int distance_to_end = TextDistance(position, end); + return SelectionInFlatTree::Builder() + .SetBaseAndExtent(distance_to_start <= distance_to_end ? end : start, + position) + .SetGranularity(granularity) + .Build(); +} + // Updating the selection is considered side-effect of the event and so it // doesn't impact the handled state. bool SelectionController::HandleSingleClick( @@ -221,33 +263,19 @@ const PositionInFlatTree& pos = AdjustPositionRespectUserSelectAll( inner_node, selection.Start(), selection.End(), visible_pos.DeepEquivalent()); - SelectionInFlatTree::Builder builder; - builder.SetGranularity(this->Selection().Granularity()); - if (frame_->GetEditor().Behavior().ShouldConsiderSelectionAsDirectional()) { - builder.SetBaseAndExtent(selection.Base(), pos); - } else if (pos.IsNull()) { - builder.SetBaseAndExtent(selection.Base(), selection.Extent()); - } else { - // Shift+Click deselects when selection was created right-to-left - const PositionInFlatTree& start = selection.Start(); - const PositionInFlatTree& end = selection.End(); - if (pos < start) { - // |distance_to_start < distance_to_end|. - builder.SetBaseAndExtent(end, pos); - } else if (end < pos) { - // |distance_to_start > distance_to_end|. - builder.SetBaseAndExtent(start, pos); - } else { - const int distance_to_start = TextDistance(start, pos); - const int distance_to_end = TextDistance(pos, end); - builder.SetBaseAndExtent( - distance_to_start <= distance_to_end ? end : start, pos); - } + const TextGranularity granularity = Selection().Granularity(); + if (pos.IsNull()) { + UpdateSelectionForMouseDownDispatchingSelectStart( + inner_node, selection.AsSelection(), granularity, + HandleVisibility::kNotVisible); + return false; } - UpdateSelectionForMouseDownDispatchingSelectStart( - inner_node, builder.Build(), this->Selection().Granularity(), - HandleVisibility::kNotVisible); + inner_node, + frame_->GetEditor().Behavior().ShouldConsiderSelectionAsDirectional() + ? ExtendSelectionAsDirectional(pos, selection, granularity) + : ExtendSelectionAsNonDirectional(pos, selection, granularity), + granularity, HandleVisibility::kNotVisible); return false; } @@ -424,14 +452,12 @@ // |newSelection| are valid for |m_frame->document()|. // |dispatchSelectStart()| can change them by "selectstart" event handler. - PositionInFlatTree base_position; - if (selection_state_ != SelectionState::kExtendedSelection) { - // Always extend selection here because it's caused by a mouse drag - selection_state_ = SelectionState::kExtendedSelection; - base_position = target_position.DeepEquivalent(); - } else { - base_position = Selection().ComputeVisibleSelectionInFlatTree().Base(); - } + // Always extend selection here because it's caused by a mouse drag + const PositionInFlatTree base_position = + selection_state_ == SelectionState::kExtendedSelection + ? Selection().ComputeVisibleSelectionInFlatTree().Base() + : target_position.DeepEquivalent(); + selection_state_ = SelectionState::kExtendedSelection; if (base_position.IsNull()) return; @@ -490,8 +516,7 @@ const HitTestResult& result, AppendTrailingWhitespace append_trailing_whitespace, SelectInputEventType select_input_event_type) { - Node* inner_node = result.InnerNode(); - VisibleSelectionInFlatTree new_selection; + Node* const inner_node = result.InnerNode(); if (!inner_node || !inner_node->GetLayoutObject() || !inner_node->GetLayoutObject()->IsSelectable()) @@ -509,13 +534,13 @@ const VisiblePositionInFlatTree& pos = VisiblePositionOfHitTestResult(adjusted_hit_test_result); - if (pos.IsNotNull()) { - new_selection = - CreateVisibleSelection(SelectionInFlatTree::Builder() - .Collapse(pos.ToPositionWithAffinity()) - .SetGranularity(kWordGranularity) - .Build()); - } + const VisibleSelectionInFlatTree& new_selection = + pos.IsNotNull() + ? CreateVisibleSelection(SelectionInFlatTree::Builder() + .Collapse(pos.ToPositionWithAffinity()) + .SetGranularity(kWordGranularity) + .Build()) + : VisibleSelectionInFlatTree(); HandleVisibility visibility = HandleVisibility::kNotVisible; if (select_input_event_type == SelectInputEventType::kTouch) { @@ -539,12 +564,14 @@ visibility = HandleVisibility::kVisible; } - if (append_trailing_whitespace == AppendTrailingWhitespace::kShouldAppend) - new_selection = new_selection.AppendTrailingWhitespace(); + const VisibleSelectionInFlatTree& adjusted_selection = + append_trailing_whitespace == AppendTrailingWhitespace::kShouldAppend + ? new_selection.AppendTrailingWhitespace() + : new_selection; return UpdateSelectionForMouseDownDispatchingSelectStart( inner_node, - ExpandSelectionToRespectUserSelectAll(inner_node, new_selection), + ExpandSelectionToRespectUserSelectAll(inner_node, adjusted_selection), kWordGranularity, visibility); } @@ -577,18 +604,18 @@ return; } - Node* container_node = marker_position.ComputeContainerNode(); + Node* const container_node = marker_position.ComputeContainerNode(); const PositionInFlatTree start(container_node, marker->StartOffset()); const PositionInFlatTree end(container_node, marker->EndOffset()); - VisibleSelectionInFlatTree new_selection = CreateVisibleSelection( + const VisibleSelectionInFlatTree& new_selection = CreateVisibleSelection( SelectionInFlatTree::Builder().Collapse(start).Extend(end).Build()); - - if (append_trailing_whitespace == AppendTrailingWhitespace::kShouldAppend) - new_selection = new_selection.AppendTrailingWhitespace(); - + const VisibleSelectionInFlatTree& adjusted_selection = + append_trailing_whitespace == AppendTrailingWhitespace::kShouldAppend + ? new_selection.AppendTrailingWhitespace() + : new_selection; UpdateSelectionForMouseDownDispatchingSelectStart( inner_node, - ExpandSelectionToRespectUserSelectAll(inner_node, new_selection), + ExpandSelectionToRespectUserSelectAll(inner_node, adjusted_selection), kWordGranularity, HandleVisibility::kNotVisible); } @@ -631,21 +658,22 @@ return; } - Node* inner_node = result.InnerNode(); + Node* const inner_node = result.InnerNode(); if (!inner_node || !inner_node->GetLayoutObject() || !mouse_down_may_start_select_) return; - VisibleSelectionInFlatTree new_selection; Element* url_element = result.GetHitTestResult().URLElement(); const VisiblePositionInFlatTree pos = VisiblePositionOfHitTestResult(result.GetHitTestResult()); - if (pos.IsNotNull() && - pos.DeepEquivalent().AnchorNode()->IsDescendantOf(url_element)) { - new_selection = CreateVisibleSelection( - SelectionInFlatTree::Builder().SelectAllChildren(*url_element).Build()); - } + const VisibleSelectionInFlatTree& new_selection = + pos.IsNotNull() && + pos.DeepEquivalent().AnchorNode()->IsDescendantOf(url_element) + ? CreateVisibleSelection(SelectionInFlatTree::Builder() + .SelectAllChildren(*url_element) + .Build()) + : VisibleSelectionInFlatTree(); UpdateSelectionForMouseDownDispatchingSelectStart( inner_node, @@ -867,21 +895,20 @@ if (event.Event().button != WebPointerProperties::Button::kLeft) return false; - Node* inner_node = event.InnerNode(); + Node* const inner_node = event.InnerNode(); if (!(inner_node && inner_node->GetLayoutObject() && mouse_down_may_start_select_)) return false; - VisibleSelectionInFlatTree new_selection; const VisiblePositionInFlatTree& pos = VisiblePositionOfHitTestResult(event.GetHitTestResult()); - if (pos.IsNotNull()) { - new_selection = - CreateVisibleSelection(SelectionInFlatTree::Builder() - .Collapse(pos.ToPositionWithAffinity()) - .SetGranularity(kParagraphGranularity) - .Build()); - } + const VisibleSelectionInFlatTree new_selection = + pos.IsNotNull() + ? CreateVisibleSelection(SelectionInFlatTree::Builder() + .Collapse(pos.ToPositionWithAffinity()) + .SetGranularity(kParagraphGranularity) + .Build()) + : VisibleSelectionInFlatTree(); const bool is_handle_visible = event.Event().FromTouch() && new_selection.IsRange(); @@ -895,10 +922,10 @@ if (!did_select) return false; - if (Selection().IsHandleVisible()) { - frame_->GetEventHandler().ShowNonLocatedContextMenu(nullptr, - kMenuSourceTouch); - } + if (!Selection().IsHandleVisible()) + return true; + frame_->GetEventHandler().ShowNonLocatedContextMenu(nullptr, + kMenuSourceTouch); return true; }
diff --git a/third_party/WebKit/Source/core/editing/VisibleSelection.cpp b/third_party/WebKit/Source/core/editing/VisibleSelection.cpp index 3edc4f5..10de1780 100644 --- a/third_party/WebKit/Source/core/editing/VisibleSelection.cpp +++ b/third_party/WebKit/Source/core/editing/VisibleSelection.cpp
@@ -46,8 +46,7 @@ selection_type_(kNoSelection), base_is_first_(true), is_directional_(false), - granularity_(kCharacterGranularity), - has_trailing_whitespace_(false) {} + granularity_(kCharacterGranularity) {} template <typename Strategy> VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate( @@ -57,8 +56,7 @@ affinity_(selection.Affinity()), selection_type_(kNoSelection), is_directional_(selection.IsDirectional()), - granularity_(selection.Granularity()), - has_trailing_whitespace_(selection.HasTrailingWhitespace()) { + granularity_(selection.Granularity()) { Validate(granularity_); } @@ -104,8 +102,7 @@ selection_type_(other.selection_type_), base_is_first_(other.base_is_first_), is_directional_(other.is_directional_), - granularity_(other.granularity_), - has_trailing_whitespace_(other.has_trailing_whitespace_) {} + granularity_(other.granularity_) {} template <typename Strategy> VisibleSelectionTemplate<Strategy>& VisibleSelectionTemplate<Strategy>:: @@ -119,7 +116,6 @@ base_is_first_ = other.base_is_first_; is_directional_ = other.is_directional_; granularity_ = other.granularity_; - has_trailing_whitespace_ = other.has_trailing_whitespace_; return *this; } @@ -132,7 +128,6 @@ return builder.SetAffinity(affinity_) .SetGranularity(granularity_) .SetIsDirectional(is_directional_) - .SetHasTrailingWhitespace(has_trailing_whitespace_) .Build(); } @@ -191,7 +186,6 @@ if (end_ == new_end) return *this; VisibleSelectionTemplate<Strategy> result = *this; - result.has_trailing_whitespace_ = true; result.end_ = new_end; return result; } @@ -413,9 +407,6 @@ DCHECK(!NeedsLayoutTreeUpdate(extent_)); // TODO(xiaochengh): Add a DocumentLifecycle::DisallowTransitionScope here. - granularity_ = granularity; - if (granularity_ != kWordGranularity) - has_trailing_whitespace_ = false; SetBaseAndExtentToDeepEquivalents(); if (base_.IsNull() || extent_.IsNull()) { base_ = extent_ = start_ = end_ = PositionTemplate<Strategy>(); @@ -453,9 +444,6 @@ start_ = MostForwardCaretPosition(start_); end_ = MostBackwardCaretPosition(end_); } - if (!has_trailing_whitespace_) - return; - *this = AppendTrailingWhitespace(); } template <typename Strategy>
diff --git a/third_party/WebKit/Source/core/editing/VisibleSelection.h b/third_party/WebKit/Source/core/editing/VisibleSelection.h index 4414b04..a9ce896 100644 --- a/third_party/WebKit/Source/core/editing/VisibleSelection.h +++ b/third_party/WebKit/Source/core/editing/VisibleSelection.h
@@ -178,11 +178,6 @@ bool is_directional_ : 1; TextGranularity granularity_; - // |updateIfNeeded()| uses |m_hasTrailingWhitespace| for word granularity. - // |m_hasTrailingWhitespace| is set by |appendTrailingWhitespace()|. - // TODO(yosin): Once we unify start/end and base/extent, we should get rid - // of |m_hasTrailingWhitespace|. - bool has_trailing_whitespace_ : 1; }; extern template class CORE_EXTERN_TEMPLATE_EXPORT
diff --git a/third_party/WebKit/Source/core/events/EventTarget.cpp b/third_party/WebKit/Source/core/events/EventTarget.cpp index 427eb374..f0840b3e 100644 --- a/third_party/WebKit/Source/core/events/EventTarget.cpp +++ b/third_party/WebKit/Source/core/events/EventTarget.cpp
@@ -131,6 +131,18 @@ registered_listener->SetBlockedEventWarningEmitted(); } +// UseCounts the event if it has the specified type. Returns true iff the event +// type matches. +bool CheckTypeThenUseCount(const Event* event, + const AtomicString& event_type_to_count, + const WebFeature feature, + const Document* document) { + if (event->type() != event_type_to_count) + return false; + UseCounter::Count(*document, feature); + return true; +} + } // namespace EventTargetData::EventTargetData() {} @@ -354,27 +366,19 @@ void EventTarget::AddedEventListener( const AtomicString& event_type, RegisteredEventListener& registered_listener) { - if (event_type == EventTypeNames::auxclick) { - if (LocalDOMWindow* executing_window = this->ExecutingWindow()) { - UseCounter::Count(executing_window->document(), - WebFeature::kAuxclickAddListenerCount); + if (const LocalDOMWindow* executing_window = this->ExecutingWindow()) { + if (const Document* document = executing_window->document()) { + if (event_type == EventTypeNames::auxclick) + UseCounter::Count(*document, WebFeature::kAuxclickAddListenerCount); + else if (event_type == EventTypeNames::appinstalled) + UseCounter::Count(*document, WebFeature::kAppInstalledEventAddListener); + else if (EventUtil::IsPointerEventType(event_type)) + UseCounter::Count(*document, WebFeature::kPointerEventAddListenerCount); + else if (event_type == EventTypeNames::slotchange) + UseCounter::Count(*document, WebFeature::kSlotChangeEventAddListener); } - } else if (event_type == EventTypeNames::appinstalled) { - if (LocalDOMWindow* executing_window = this->ExecutingWindow()) { - UseCounter::Count(executing_window->document(), - WebFeature::kAppInstalledEventAddListener); - } - } else if (EventUtil::IsPointerEventType(event_type)) { - if (LocalDOMWindow* executing_window = this->ExecutingWindow()) { - UseCounter::Count(executing_window->document(), - WebFeature::kPointerEventAddListenerCount); - } - } else if (event_type == EventTypeNames::slotchange) { - if (LocalDOMWindow* executing_window = this->ExecutingWindow()) { - UseCounter::Count(executing_window->document(), - WebFeature::kSlotChangeEventAddListener); - } - } else if (EventUtil::IsDOMMutationEventType(event_type)) { + } + if (EventUtil::IsDOMMutationEventType(event_type)) { if (ExecutionContext* context = GetExecutionContext()) { String message_text = String::Format( "Added synchronous DOM mutation listener to a '%s' event. " @@ -586,15 +590,16 @@ return; } - if (LocalDOMWindow* executing_window = this->ExecutingWindow()) { - if (legacy_listeners_vector) { - if (listeners_vector) - UseCounter::Count(executing_window->document(), - prefixed_and_unprefixed_feature); - else - UseCounter::Count(executing_window->document(), prefixed_feature); - } else if (listeners_vector) { - UseCounter::Count(executing_window->document(), unprefixed_feature); + if (const LocalDOMWindow* executing_window = this->ExecutingWindow()) { + if (const Document* document = executing_window->document()) { + if (legacy_listeners_vector) { + if (listeners_vector) + UseCounter::Count(*document, prefixed_and_unprefixed_feature); + else + UseCounter::Count(*document, prefixed_feature); + } else if (listeners_vector) { + UseCounter::Count(*document, unprefixed_feature); + } } } } @@ -641,17 +646,6 @@ return GetDispatchEventResult(*event); } -bool EventTarget::CheckTypeThenUseCount(const Event* event, - const AtomicString& event_type_to_count, - const WebFeature feature) { - if (event->type() == event_type_to_count) { - if (LocalDOMWindow* executing_window = this->ExecutingWindow()) - UseCounter::Count(executing_window->document(), feature); - return true; - } - return false; -} - bool EventTarget::FireEventListeners(Event* event, EventTargetData* d, EventListenerVector& entry) { @@ -660,48 +654,56 @@ // dispatch. Conveniently, all new event listeners will be added after or at // index |size|, so iterating up to (but not including) |size| naturally // excludes new event listeners. - - if (CheckTypeThenUseCount(event, EventTypeNames::beforeunload, - WebFeature::kDocumentBeforeUnloadFired)) { - if (LocalDOMWindow* executing_window = this->ExecutingWindow()) { - if (executing_window != executing_window->top()) { - UseCounter::Count(executing_window->document(), - WebFeature::kSubFrameBeforeUnloadFired); + if (const LocalDOMWindow* executing_window = this->ExecutingWindow()) { + if (const Document* document = executing_window->document()) { + if (CheckTypeThenUseCount(event, EventTypeNames::beforeunload, + WebFeature::kDocumentBeforeUnloadFired, + document)) { + if (executing_window != executing_window->top()) + UseCounter::Count(*document, WebFeature::kSubFrameBeforeUnloadFired); + } else if (CheckTypeThenUseCount(event, EventTypeNames::unload, + WebFeature::kDocumentUnloadFired, + document)) { + } else if (CheckTypeThenUseCount(event, EventTypeNames::DOMFocusIn, + WebFeature::kDOMFocusInOutEvent, + document)) { + } else if (CheckTypeThenUseCount(event, EventTypeNames::DOMFocusOut, + WebFeature::kDOMFocusInOutEvent, + document)) { + } else if (CheckTypeThenUseCount(event, EventTypeNames::focusin, + WebFeature::kFocusInOutEvent, + document)) { + } else if (CheckTypeThenUseCount(event, EventTypeNames::focusout, + WebFeature::kFocusInOutEvent, + document)) { + } else if (CheckTypeThenUseCount(event, EventTypeNames::textInput, + WebFeature::kTextInputFired, document)) { + } else if (CheckTypeThenUseCount(event, EventTypeNames::touchstart, + WebFeature::kTouchStartFired, + document)) { + } else if (CheckTypeThenUseCount(event, EventTypeNames::mousedown, + WebFeature::kMouseDownFired, document)) { + } else if (CheckTypeThenUseCount(event, EventTypeNames::pointerdown, + WebFeature::kPointerDownFired, + document)) { + if (event->IsPointerEvent() && + static_cast<PointerEvent*>(event)->pointerType() == "touch") { + UseCounter::Count(*document, WebFeature::kPointerDownFiredForTouch); + } + } else if (CheckTypeThenUseCount(event, EventTypeNames::pointerenter, + WebFeature::kPointerEnterLeaveFired, + document)) { + } else if (CheckTypeThenUseCount(event, EventTypeNames::pointerleave, + WebFeature::kPointerEnterLeaveFired, + document)) { + } else if (CheckTypeThenUseCount(event, EventTypeNames::pointerover, + WebFeature::kPointerOverOutFired, + document)) { + } else if (CheckTypeThenUseCount(event, EventTypeNames::pointerout, + WebFeature::kPointerOverOutFired, + document)) { } } - } else if (CheckTypeThenUseCount(event, EventTypeNames::unload, - WebFeature::kDocumentUnloadFired)) { - } else if (CheckTypeThenUseCount(event, EventTypeNames::DOMFocusIn, - WebFeature::kDOMFocusInOutEvent)) { - } else if (CheckTypeThenUseCount(event, EventTypeNames::DOMFocusOut, - WebFeature::kDOMFocusInOutEvent)) { - } else if (CheckTypeThenUseCount(event, EventTypeNames::focusin, - WebFeature::kFocusInOutEvent)) { - } else if (CheckTypeThenUseCount(event, EventTypeNames::focusout, - WebFeature::kFocusInOutEvent)) { - } else if (CheckTypeThenUseCount(event, EventTypeNames::textInput, - WebFeature::kTextInputFired)) { - } else if (CheckTypeThenUseCount(event, EventTypeNames::touchstart, - WebFeature::kTouchStartFired)) { - } else if (CheckTypeThenUseCount(event, EventTypeNames::mousedown, - WebFeature::kMouseDownFired)) { - } else if (CheckTypeThenUseCount(event, EventTypeNames::pointerdown, - WebFeature::kPointerDownFired)) { - if (LocalDOMWindow* executing_window = this->ExecutingWindow()) { - if (event->IsPointerEvent() && - static_cast<PointerEvent*>(event)->pointerType() == "touch") { - UseCounter::Count(executing_window->document(), - WebFeature::kPointerDownFiredForTouch); - } - } - } else if (CheckTypeThenUseCount(event, EventTypeNames::pointerenter, - WebFeature::kPointerEnterLeaveFired)) { - } else if (CheckTypeThenUseCount(event, EventTypeNames::pointerleave, - WebFeature::kPointerEnterLeaveFired)) { - } else if (CheckTypeThenUseCount(event, EventTypeNames::pointerover, - WebFeature::kPointerOverOutFired)) { - } else if (CheckTypeThenUseCount(event, EventTypeNames::pointerout, - WebFeature::kPointerOverOutFired)) { } ExecutionContext* context = GetExecutionContext();
diff --git a/third_party/WebKit/Source/core/events/EventTarget.h b/third_party/WebKit/Source/core/events/EventTarget.h index 58a2819..9be4bcd 100644 --- a/third_party/WebKit/Source/core/events/EventTarget.h +++ b/third_party/WebKit/Source/core/events/EventTarget.h
@@ -56,7 +56,6 @@ class MessagePort; class Node; class ServiceWorker; -enum class WebFeature : uint32_t; struct FiringEventIterator { DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); @@ -211,12 +210,6 @@ EventListener*, AddEventListenerOptionsResolved&); - // UseCounts the event if it has the specified type. Returns true iff the - // event type matches. - bool CheckTypeThenUseCount(const Event*, - const AtomicString&, - const WebFeature); - bool FireEventListeners(Event*, EventTargetData*, EventListenerVector&); void CountLegacyEvents(const AtomicString& legacy_type_name, EventListenerVector*,
diff --git a/third_party/WebKit/Source/core/exported/WebCustomElement.cpp b/third_party/WebKit/Source/core/exported/WebCustomElement.cpp index f166750..a77277b 100644 --- a/third_party/WebKit/Source/core/exported/WebCustomElement.cpp +++ b/third_party/WebKit/Source/core/exported/WebCustomElement.cpp
@@ -30,7 +30,7 @@ #include "public/web/WebCustomElement.h" -#include "core/dom/custom/V0CustomElement.h" +#include "core/html/custom/V0CustomElement.h" #include "public/platform/WebString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/exported/WebElement.cpp b/third_party/WebKit/Source/core/exported/WebElement.cpp index 36f7fde8..38981fa74 100644 --- a/third_party/WebKit/Source/core/exported/WebElement.cpp +++ b/third_party/WebKit/Source/core/exported/WebElement.cpp
@@ -33,9 +33,9 @@ #include "bindings/core/v8/ExceptionState.h" #include "core/HTMLNames.h" #include "core/dom/Element.h" -#include "core/dom/custom/V0CustomElementProcessingStack.h" #include "core/editing/EditingUtilities.h" #include "core/html/TextControlElement.h" +#include "core/html/custom/V0CustomElementProcessingStack.h" #include "platform/graphics/Image.h" #include "platform/wtf/PassRefPtr.h" #include "platform/wtf/text/AtomicString.h"
diff --git a/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp b/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp index 3f07a02..52997f68 100644 --- a/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp +++ b/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp
@@ -369,12 +369,11 @@ // SharedWorker can sometimes run tasks that are initiated by/associated with // a document's frame but these documents can be from a different process. So - // we intentionally populate the task runners with null document in order to - // use the thread's default task runner. Note that |m_document| should not be - // used as it's a dummy document for loading that doesn't represent the frame - // of any associated document. - ParentFrameTaskRunners* task_runners = - ParentFrameTaskRunners::Create(nullptr); + // we intentionally populate the task runners with default task runners of the + // main thread. Note that |m_document| should not be used as it's a dummy + // document for loading that doesn't represent the frame of any associated + // document. + ParentFrameTaskRunners* task_runners = ParentFrameTaskRunners::Create(); reporting_proxy_ = new SharedWorkerReportingProxy(this, task_runners); worker_thread_ = WTF::MakeUnique<SharedWorkerThread>(
diff --git a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp index ea22e0a..2f0221a 100644 --- a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp +++ b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
@@ -47,7 +47,6 @@ #include "core/dom/SinkDocument.h" #include "core/dom/TaskRunnerHelper.h" #include "core/dom/UserGestureIndicator.h" -#include "core/dom/custom/CustomElementRegistry.h" #include "core/editing/Editor.h" #include "core/events/DOMWindowEventQueue.h" #include "core/events/HashChangeEvent.h" @@ -72,6 +71,7 @@ #include "core/frame/VisualViewport.h" #include "core/frame/csp/ContentSecurityPolicy.h" #include "core/html/HTMLFrameOwnerElement.h" +#include "core/html/custom/CustomElementRegistry.h" #include "core/input/EventHandler.h" #include "core/inspector/ConsoleMessage.h" #include "core/inspector/InspectorTraceEvents.h"
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.cpp b/third_party/WebKit/Source/core/frame/UseCounter.cpp index f801238..22b1d870 100644 --- a/third_party/WebKit/Source/core/frame/UseCounter.cpp +++ b/third_party/WebKit/Source/core/frame/UseCounter.cpp
@@ -1375,13 +1375,13 @@ // So instead we just use a dedicated histogram for the SVG case. DEFINE_STATIC_LOCAL(blink::EnumerationHistogram, svg_histogram, ("Blink.UseCounter.SVGImage.Features", - static_cast<uint32_t>(WebFeature::kNumberOfFeatures))); + static_cast<int32_t>(WebFeature::kNumberOfFeatures))); DEFINE_STATIC_LOCAL(blink::EnumerationHistogram, extension_histogram, ("Blink.UseCounter.Extensions.Features", - static_cast<uint32_t>(WebFeature::kNumberOfFeatures))); + static_cast<int32_t>(WebFeature::kNumberOfFeatures))); DEFINE_STATIC_LOCAL(blink::EnumerationHistogram, histogram, ("Blink.UseCounter.Features", - static_cast<uint32_t>(WebFeature::kNumberOfFeatures))); + static_cast<int32_t>(WebFeature::kNumberOfFeatures))); switch (context_) { case kSVGImageContext: return svg_histogram; @@ -1427,7 +1427,7 @@ static EnumerationHistogram& FeatureObserverHistogram() { DEFINE_STATIC_LOCAL(EnumerationHistogram, histogram, ("WebCore.FeatureObserver", - static_cast<uint32_t>(WebFeature::kNumberOfFeatures))); + static_cast<int32_t>(WebFeature::kNumberOfFeatures))); return histogram; }
diff --git a/third_party/WebKit/Source/core/geometry/DOMMatrix.idl b/third_party/WebKit/Source/core/geometry/DOMMatrix.idl index 94d0178..530347a 100644 --- a/third_party/WebKit/Source/core/geometry/DOMMatrix.idl +++ b/third_party/WebKit/Source/core/geometry/DOMMatrix.idl
@@ -69,5 +69,5 @@ DOMMatrix skewYSelf(optional unrestricted double sy = 0); DOMMatrix invertSelf(); - [RaisesException] DOMMatrix setMatrixValue(DOMString transformList); + [Exposed=Window, RaisesException] DOMMatrix setMatrixValue(DOMString transformList); };
diff --git a/third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.idl b/third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.idl index cc7f28b..c5e70131 100644 --- a/third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.idl +++ b/third_party/WebKit/Source/core/geometry/DOMMatrixReadOnly.idl
@@ -76,6 +76,6 @@ DOMPoint transformPoint(optional DOMPointInit point); Float32Array toFloat32Array(); Float64Array toFloat64Array(); - [RaisesException] stringifier; + [Exposed=Window, RaisesException] stringifier; serializer = { attribute }; };
diff --git a/third_party/WebKit/Source/core/html/BUILD.gn b/third_party/WebKit/Source/core/html/BUILD.gn index 942e2a6..5a97aad 100644 --- a/third_party/WebKit/Source/core/html/BUILD.gn +++ b/third_party/WebKit/Source/core/html/BUILD.gn
@@ -267,6 +267,76 @@ "canvas/CanvasRenderingContextHost.h", "canvas/ImageElementBase.cpp", "canvas/ImageElementBase.h", + "custom/CEReactionsScope.cpp", + "custom/CEReactionsScope.h", + "custom/CustomElement.cpp", + "custom/CustomElement.h", + "custom/CustomElementAdoptedCallbackReaction.cpp", + "custom/CustomElementAdoptedCallbackReaction.h", + "custom/CustomElementAttributeChangedCallbackReaction.cpp", + "custom/CustomElementAttributeChangedCallbackReaction.h", + "custom/CustomElementConnectedCallbackReaction.cpp", + "custom/CustomElementConnectedCallbackReaction.h", + "custom/CustomElementDefinition.cpp", + "custom/CustomElementDefinition.h", + "custom/CustomElementDefinitionBuilder.h", + "custom/CustomElementDescriptor.h", + "custom/CustomElementDescriptorHash.h", + "custom/CustomElementDisconnectedCallbackReaction.cpp", + "custom/CustomElementDisconnectedCallbackReaction.h", + "custom/CustomElementReaction.cpp", + "custom/CustomElementReaction.h", + "custom/CustomElementReactionQueue.cpp", + "custom/CustomElementReactionQueue.h", + "custom/CustomElementReactionStack.cpp", + "custom/CustomElementReactionStack.h", + "custom/CustomElementRegistry.cpp", + "custom/CustomElementRegistry.h", + "custom/CustomElementUpgradeReaction.cpp", + "custom/CustomElementUpgradeReaction.h", + "custom/CustomElementUpgradeSorter.cpp", + "custom/CustomElementUpgradeSorter.h", + "custom/V0CustomElement.cpp", + "custom/V0CustomElement.h", + "custom/V0CustomElementAsyncImportMicrotaskQueue.cpp", + "custom/V0CustomElementAsyncImportMicrotaskQueue.h", + "custom/V0CustomElementCallbackInvocation.cpp", + "custom/V0CustomElementCallbackInvocation.h", + "custom/V0CustomElementCallbackQueue.cpp", + "custom/V0CustomElementCallbackQueue.h", + "custom/V0CustomElementDefinition.cpp", + "custom/V0CustomElementDefinition.h", + "custom/V0CustomElementDescriptor.h", + "custom/V0CustomElementDescriptorHash.h", + "custom/V0CustomElementException.cpp", + "custom/V0CustomElementException.h", + "custom/V0CustomElementLifecycleCallbacks.h", + "custom/V0CustomElementMicrotaskDispatcher.cpp", + "custom/V0CustomElementMicrotaskDispatcher.h", + "custom/V0CustomElementMicrotaskImportStep.cpp", + "custom/V0CustomElementMicrotaskImportStep.h", + "custom/V0CustomElementMicrotaskQueueBase.cpp", + "custom/V0CustomElementMicrotaskQueueBase.h", + "custom/V0CustomElementMicrotaskResolutionStep.cpp", + "custom/V0CustomElementMicrotaskResolutionStep.h", + "custom/V0CustomElementMicrotaskRunQueue.cpp", + "custom/V0CustomElementMicrotaskRunQueue.h", + "custom/V0CustomElementMicrotaskStep.h", + "custom/V0CustomElementObserver.cpp", + "custom/V0CustomElementObserver.h", + "custom/V0CustomElementProcessingStack.cpp", + "custom/V0CustomElementProcessingStack.h", + "custom/V0CustomElementProcessingStep.h", + "custom/V0CustomElementRegistrationContext.cpp", + "custom/V0CustomElementRegistrationContext.h", + "custom/V0CustomElementRegistry.cpp", + "custom/V0CustomElementRegistry.h", + "custom/V0CustomElementScheduler.cpp", + "custom/V0CustomElementScheduler.h", + "custom/V0CustomElementSyncMicrotaskQueue.cpp", + "custom/V0CustomElementSyncMicrotaskQueue.h", + "custom/V0CustomElementUpgradeCandidateMap.cpp", + "custom/V0CustomElementUpgradeCandidateMap.h", "forms/BaseButtonInputType.cpp", "forms/BaseButtonInputType.h", "forms/BaseCheckableInputType.cpp",
diff --git a/third_party/WebKit/Source/core/html/TextControlElement.cpp b/third_party/WebKit/Source/core/html/TextControlElement.cpp index 5dd854b4..12bb8af 100644 --- a/third_party/WebKit/Source/core/html/TextControlElement.cpp +++ b/third_party/WebKit/Source/core/html/TextControlElement.cpp
@@ -503,7 +503,7 @@ GetDocument().Lifecycle()); const SelectionInDOMTree& selection = frame->Selection().GetSelectionInDOMTree(); - if (selection.Granularity() == kCharacterGranularity) { + if (frame->Selection().Granularity() == kCharacterGranularity) { return IndexForPosition(InnerEditorElement(), selection.ComputeStartPosition()); } @@ -534,7 +534,7 @@ GetDocument().Lifecycle()); const SelectionInDOMTree& selection = frame->Selection().GetSelectionInDOMTree(); - if (selection.Granularity() == kCharacterGranularity) { + if (frame->Selection().Granularity() == kCharacterGranularity) { return IndexForPosition(InnerEditorElement(), selection.ComputeEndPosition()); }
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp index 75a3ac6..5b0b0a9 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
@@ -194,7 +194,7 @@ num_rows_completed_ = 0; if (document) { parent_frame_task_runner_ = - ParentFrameTaskRunners::Create(document->GetFrame()); + ParentFrameTaskRunners::Create(*document->GetFrame()); } if (script_promise_resolver_) { function_type_ = kOffscreenCanvasToBlobPromise;
diff --git a/third_party/WebKit/Source/core/dom/custom/CEReactionsScope.cpp b/third_party/WebKit/Source/core/html/custom/CEReactionsScope.cpp similarity index 88% rename from third_party/WebKit/Source/core/dom/custom/CEReactionsScope.cpp rename to third_party/WebKit/Source/core/html/custom/CEReactionsScope.cpp index b16aaf1..86a24e3 100644 --- a/third_party/WebKit/Source/core/dom/custom/CEReactionsScope.cpp +++ b/third_party/WebKit/Source/core/html/custom/CEReactionsScope.cpp
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CEReactionsScope.h" +#include "core/html/custom/CEReactionsScope.h" #include "core/dom/Document.h" #include "core/dom/Element.h" -#include "core/dom/custom/CustomElementReactionStack.h" +#include "core/html/custom/CustomElementReactionStack.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/CEReactionsScope.h b/third_party/WebKit/Source/core/html/custom/CEReactionsScope.h similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/CEReactionsScope.h rename to third_party/WebKit/Source/core/html/custom/CEReactionsScope.h
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp b/third_party/WebKit/Source/core/html/custom/CustomElement.cpp similarity index 96% rename from third_party/WebKit/Source/core/dom/custom/CustomElement.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElement.cpp index f94f9118..e534de2 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElement.cpp
@@ -2,21 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElement.h" +#include "core/html/custom/CustomElement.h" #include "core/HTMLElementFactory.h" #include "core/HTMLElementTypeHelpers.h" #include "core/dom/Document.h" #include "core/dom/QualifiedName.h" -#include "core/dom/custom/CEReactionsScope.h" -#include "core/dom/custom/CustomElementDefinition.h" -#include "core/dom/custom/CustomElementReactionStack.h" -#include "core/dom/custom/CustomElementRegistry.h" -#include "core/dom/custom/V0CustomElement.h" -#include "core/dom/custom/V0CustomElementRegistrationContext.h" #include "core/frame/LocalDOMWindow.h" #include "core/html/HTMLElement.h" #include "core/html/HTMLUnknownElement.h" +#include "core/html/custom/CEReactionsScope.h" +#include "core/html/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementReactionStack.h" +#include "core/html/custom/CustomElementRegistry.h" +#include "core/html/custom/V0CustomElement.h" +#include "core/html/custom/V0CustomElementRegistrationContext.h" #include "platform/wtf/text/AtomicStringHash.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElement.h b/third_party/WebKit/Source/core/html/custom/CustomElement.h similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/CustomElement.h rename to third_party/WebKit/Source/core/html/custom/CustomElement.h
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementAdoptedCallbackReaction.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementAdoptedCallbackReaction.cpp similarity index 87% rename from third_party/WebKit/Source/core/dom/custom/CustomElementAdoptedCallbackReaction.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementAdoptedCallbackReaction.cpp index 3a882df..e34431a5 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementAdoptedCallbackReaction.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementAdoptedCallbackReaction.cpp
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementAdoptedCallbackReaction.h" +#include "core/html/custom/CustomElementAdoptedCallbackReaction.h" #include "core/dom/Document.h" -#include "core/dom/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDefinition.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementAdoptedCallbackReaction.h b/third_party/WebKit/Source/core/html/custom/CustomElementAdoptedCallbackReaction.h similarity index 94% rename from third_party/WebKit/Source/core/dom/custom/CustomElementAdoptedCallbackReaction.h rename to third_party/WebKit/Source/core/html/custom/CustomElementAdoptedCallbackReaction.h index 5e20dad..cc875cd 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementAdoptedCallbackReaction.h +++ b/third_party/WebKit/Source/core/html/custom/CustomElementAdoptedCallbackReaction.h
@@ -6,7 +6,7 @@ #define CustomElementAdoptedCallbackReaction_h #include "core/CoreExport.h" -#include "core/dom/custom/CustomElementReaction.h" +#include "core/html/custom/CustomElementReaction.h" #include "platform/heap/Handle.h" #include "platform/wtf/Noncopyable.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementAttributeChangedCallbackReaction.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementAttributeChangedCallbackReaction.cpp similarity index 86% rename from third_party/WebKit/Source/core/dom/custom/CustomElementAttributeChangedCallbackReaction.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementAttributeChangedCallbackReaction.cpp index 6ca1704..711ed314 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementAttributeChangedCallbackReaction.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementAttributeChangedCallbackReaction.cpp
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementAttributeChangedCallbackReaction.h" +#include "core/html/custom/CustomElementAttributeChangedCallbackReaction.h" -#include "core/dom/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDefinition.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementAttributeChangedCallbackReaction.h b/third_party/WebKit/Source/core/html/custom/CustomElementAttributeChangedCallbackReaction.h similarity index 95% rename from third_party/WebKit/Source/core/dom/custom/CustomElementAttributeChangedCallbackReaction.h rename to third_party/WebKit/Source/core/html/custom/CustomElementAttributeChangedCallbackReaction.h index eb8d761e..917a9c4 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementAttributeChangedCallbackReaction.h +++ b/third_party/WebKit/Source/core/html/custom/CustomElementAttributeChangedCallbackReaction.h
@@ -7,7 +7,7 @@ #include "core/CoreExport.h" #include "core/dom/QualifiedName.h" -#include "core/dom/custom/CustomElementReaction.h" +#include "core/html/custom/CustomElementReaction.h" #include "platform/heap/Handle.h" #include "platform/wtf/Noncopyable.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementConnectedCallbackReaction.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementConnectedCallbackReaction.cpp similarity index 81% rename from third_party/WebKit/Source/core/dom/custom/CustomElementConnectedCallbackReaction.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementConnectedCallbackReaction.cpp index 33af040..7f6e0aa4 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementConnectedCallbackReaction.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementConnectedCallbackReaction.cpp
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementConnectedCallbackReaction.h" +#include "core/html/custom/CustomElementConnectedCallbackReaction.h" -#include "core/dom/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDefinition.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementConnectedCallbackReaction.h b/third_party/WebKit/Source/core/html/custom/CustomElementConnectedCallbackReaction.h similarity index 93% rename from third_party/WebKit/Source/core/dom/custom/CustomElementConnectedCallbackReaction.h rename to third_party/WebKit/Source/core/html/custom/CustomElementConnectedCallbackReaction.h index c209c38..e8b4b46e 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementConnectedCallbackReaction.h +++ b/third_party/WebKit/Source/core/html/custom/CustomElementConnectedCallbackReaction.h
@@ -6,7 +6,7 @@ #define CustomElementConnectedCallbackReaction_h #include "core/CoreExport.h" -#include "core/dom/custom/CustomElementReaction.h" +#include "core/html/custom/CustomElementReaction.h" #include "platform/heap/Handle.h" #include "platform/wtf/Noncopyable.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementDefinition.cpp similarity index 93% rename from third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementDefinition.cpp index c406a9a..cf53d91 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementDefinition.cpp
@@ -2,19 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDefinition.h" #include "core/dom/Attr.h" #include "core/dom/ExceptionCode.h" -#include "core/dom/custom/CustomElement.h" -#include "core/dom/custom/CustomElementAdoptedCallbackReaction.h" -#include "core/dom/custom/CustomElementAttributeChangedCallbackReaction.h" -#include "core/dom/custom/CustomElementConnectedCallbackReaction.h" -#include "core/dom/custom/CustomElementDisconnectedCallbackReaction.h" -#include "core/dom/custom/CustomElementReaction.h" -#include "core/dom/custom/CustomElementReactionStack.h" -#include "core/dom/custom/CustomElementUpgradeReaction.h" #include "core/html/HTMLElement.h" +#include "core/html/custom/CustomElement.h" +#include "core/html/custom/CustomElementAdoptedCallbackReaction.h" +#include "core/html/custom/CustomElementAttributeChangedCallbackReaction.h" +#include "core/html/custom/CustomElementConnectedCallbackReaction.h" +#include "core/html/custom/CustomElementDisconnectedCallbackReaction.h" +#include "core/html/custom/CustomElementReaction.h" +#include "core/html/custom/CustomElementReactionStack.h" +#include "core/html/custom/CustomElementUpgradeReaction.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.h b/third_party/WebKit/Source/core/html/custom/CustomElementDefinition.h similarity index 98% rename from third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.h rename to third_party/WebKit/Source/core/html/custom/CustomElementDefinition.h index 5251ae4..82deeb3 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementDefinition.h +++ b/third_party/WebKit/Source/core/html/custom/CustomElementDefinition.h
@@ -7,7 +7,7 @@ #include "bindings/core/v8/ScriptValue.h" #include "core/CoreExport.h" -#include "core/dom/custom/CustomElementDescriptor.h" +#include "core/html/custom/CustomElementDescriptor.h" #include "platform/bindings/ScriptWrappable.h" // For TraceWrapperBase #include "platform/heap/Handle.h" #include "platform/wtf/HashSet.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementDefinitionBuilder.h b/third_party/WebKit/Source/core/html/custom/CustomElementDefinitionBuilder.h similarity index 96% rename from third_party/WebKit/Source/core/dom/custom/CustomElementDefinitionBuilder.h rename to third_party/WebKit/Source/core/html/custom/CustomElementDefinitionBuilder.h index 0988b3fb..eed206e0 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementDefinitionBuilder.h +++ b/third_party/WebKit/Source/core/html/custom/CustomElementDefinitionBuilder.h
@@ -6,7 +6,7 @@ #define CustomElementDefinitionBuilder_h #include "core/CoreExport.h" -#include "core/dom/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDefinition.h" #include "platform/wtf/Allocator.h" #include "platform/wtf/Noncopyable.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementDefinitionTest.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementDefinitionTest.cpp similarity index 88% rename from third_party/WebKit/Source/core/dom/custom/CustomElementDefinitionTest.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementDefinitionTest.cpp index 46aa0ab8..16350a3 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementDefinitionTest.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementDefinitionTest.cpp
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDefinition.h" #include "core/dom/Node.h" // CustomElementState -#include "core/dom/custom/CEReactionsScope.h" -#include "core/dom/custom/CustomElementDescriptor.h" -#include "core/dom/custom/CustomElementReactionTestHelpers.h" -#include "core/dom/custom/CustomElementTestHelpers.h" +#include "core/html/custom/CEReactionsScope.h" +#include "core/html/custom/CustomElementDescriptor.h" +#include "core/html/custom/CustomElementReactionTestHelpers.h" +#include "core/html/custom/CustomElementTestHelpers.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementDescriptor.h b/third_party/WebKit/Source/core/html/custom/CustomElementDescriptor.h similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/CustomElementDescriptor.h rename to third_party/WebKit/Source/core/html/custom/CustomElementDescriptor.h
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementDescriptorHash.h b/third_party/WebKit/Source/core/html/custom/CustomElementDescriptorHash.h similarity index 95% rename from third_party/WebKit/Source/core/dom/custom/CustomElementDescriptorHash.h rename to third_party/WebKit/Source/core/html/custom/CustomElementDescriptorHash.h index b6eede8..b486405 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementDescriptorHash.h +++ b/third_party/WebKit/Source/core/html/custom/CustomElementDescriptorHash.h
@@ -5,7 +5,7 @@ #ifndef CustomElementDescriptorHash_h #define CustomElementDescriptorHash_h -#include "core/dom/custom/CustomElementDescriptor.h" +#include "core/html/custom/CustomElementDescriptor.h" #include "platform/wtf/HashFunctions.h" #include "platform/wtf/HashTraits.h" #include "platform/wtf/text/AtomicStringHash.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementDescriptorTest.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementDescriptorTest.cpp similarity index 93% rename from third_party/WebKit/Source/core/dom/custom/CustomElementDescriptorTest.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementDescriptorTest.cpp index 671e8d09..85933b6 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementDescriptorTest.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementDescriptorTest.cpp
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementDescriptor.h" +#include "core/html/custom/CustomElementDescriptor.h" -#include "core/dom/custom/CustomElementDescriptorHash.h" -#include "core/dom/custom/CustomElementTestHelpers.h" +#include "core/html/custom/CustomElementDescriptorHash.h" +#include "core/html/custom/CustomElementTestHelpers.h" #include "platform/wtf/HashSet.h" #include "platform/wtf/text/AtomicString.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementDisconnectedCallbackReaction.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementDisconnectedCallbackReaction.cpp similarity index 81% rename from third_party/WebKit/Source/core/dom/custom/CustomElementDisconnectedCallbackReaction.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementDisconnectedCallbackReaction.cpp index 1a52b23..c81fc17 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementDisconnectedCallbackReaction.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementDisconnectedCallbackReaction.cpp
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementDisconnectedCallbackReaction.h" +#include "core/html/custom/CustomElementDisconnectedCallbackReaction.h" -#include "core/dom/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDefinition.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementDisconnectedCallbackReaction.h b/third_party/WebKit/Source/core/html/custom/CustomElementDisconnectedCallbackReaction.h similarity index 93% rename from third_party/WebKit/Source/core/dom/custom/CustomElementDisconnectedCallbackReaction.h rename to third_party/WebKit/Source/core/html/custom/CustomElementDisconnectedCallbackReaction.h index 49ff159..368f9249 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementDisconnectedCallbackReaction.h +++ b/third_party/WebKit/Source/core/html/custom/CustomElementDisconnectedCallbackReaction.h
@@ -6,7 +6,7 @@ #define CustomElementDisconnectedCallbackReaction_h #include "core/CoreExport.h" -#include "core/dom/custom/CustomElementReaction.h" +#include "core/html/custom/CustomElementReaction.h" #include "platform/heap/Handle.h" #include "platform/wtf/Noncopyable.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementReaction.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementReaction.cpp similarity index 79% rename from third_party/WebKit/Source/core/dom/custom/CustomElementReaction.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementReaction.cpp index e7486f3..6de32d1 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementReaction.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementReaction.cpp
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementReaction.h" +#include "core/html/custom/CustomElementReaction.h" -#include "core/dom/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDefinition.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementReaction.h b/third_party/WebKit/Source/core/html/custom/CustomElementReaction.h similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/CustomElementReaction.h rename to third_party/WebKit/Source/core/html/custom/CustomElementReaction.h
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionQueue.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementReactionQueue.cpp similarity index 92% rename from third_party/WebKit/Source/core/dom/custom/CustomElementReactionQueue.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementReactionQueue.cpp index daf103f..ea17bab 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionQueue.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementReactionQueue.cpp
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementReactionQueue.h" +#include "core/html/custom/CustomElementReactionQueue.h" #include "core/dom/Element.h" -#include "core/dom/custom/CustomElementReaction.h" +#include "core/html/custom/CustomElementReaction.h" #include "platform/instrumentation/tracing/TraceEvent.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionQueue.h b/third_party/WebKit/Source/core/html/custom/CustomElementReactionQueue.h similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/CustomElementReactionQueue.h rename to third_party/WebKit/Source/core/html/custom/CustomElementReactionQueue.h
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionQueueTest.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementReactionQueueTest.cpp similarity index 93% rename from third_party/WebKit/Source/core/dom/custom/CustomElementReactionQueueTest.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementReactionQueueTest.cpp index dc695398..92cb050 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionQueueTest.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementReactionQueueTest.cpp
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementReactionQueue.h" +#include "core/html/custom/CustomElementReactionQueue.h" #include <initializer_list> #include <vector> -#include "core/dom/custom/CustomElementReaction.h" -#include "core/dom/custom/CustomElementReactionTestHelpers.h" +#include "core/html/custom/CustomElementReaction.h" +#include "core/html/custom/CustomElementReactionTestHelpers.h" #include "platform/wtf/Functional.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionStack.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementReactionStack.cpp similarity index 95% rename from third_party/WebKit/Source/core/dom/custom/CustomElementReactionStack.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementReactionStack.cpp index 03a72c5..83d9b424 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionStack.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementReactionStack.cpp
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementReactionStack.h" +#include "core/html/custom/CustomElementReactionStack.h" #include "core/dom/Element.h" -#include "core/dom/custom/CEReactionsScope.h" -#include "core/dom/custom/CustomElementReactionQueue.h" +#include "core/html/custom/CEReactionsScope.h" +#include "core/html/custom/CustomElementReactionQueue.h" #include "platform/bindings/Microtask.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionStack.h b/third_party/WebKit/Source/core/html/custom/CustomElementReactionStack.h similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/CustomElementReactionStack.h rename to third_party/WebKit/Source/core/html/custom/CustomElementReactionStack.h
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionStackTest.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementReactionStackTest.cpp similarity index 95% rename from third_party/WebKit/Source/core/dom/custom/CustomElementReactionStackTest.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementReactionStackTest.cpp index 881115a..0cf3451 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionStackTest.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementReactionStackTest.cpp
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementReactionStack.h" +#include "core/html/custom/CustomElementReactionStack.h" #include <initializer_list> #include <vector> -#include "core/dom/custom/CustomElementReaction.h" -#include "core/dom/custom/CustomElementReactionTestHelpers.h" -#include "core/dom/custom/CustomElementTestHelpers.h" +#include "core/html/custom/CustomElementReaction.h" +#include "core/html/custom/CustomElementReactionTestHelpers.h" +#include "core/html/custom/CustomElementTestHelpers.h" #include "platform/wtf/text/AtomicString.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionTestHelpers.h b/third_party/WebKit/Source/core/html/custom/CustomElementReactionTestHelpers.h similarity index 95% rename from third_party/WebKit/Source/core/dom/custom/CustomElementReactionTestHelpers.h rename to third_party/WebKit/Source/core/html/custom/CustomElementReactionTestHelpers.h index 31fa7732..5e5e4f8 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementReactionTestHelpers.h +++ b/third_party/WebKit/Source/core/html/custom/CustomElementReactionTestHelpers.h
@@ -5,13 +5,13 @@ #ifndef CustomElementReactionTestHelpers_h #define CustomElementReactionTestHelpers_h -#include "core/dom/custom/CustomElementReaction.h" +#include "core/html/custom/CustomElementReaction.h" #include <initializer_list> #include <memory> #include <vector> -#include "core/dom/custom/CustomElementReactionQueue.h" -#include "core/dom/custom/CustomElementReactionStack.h" +#include "core/html/custom/CustomElementReactionQueue.h" +#include "core/html/custom/CustomElementReactionStack.h" #include "platform/heap/Handle.h" #include "platform/wtf/Functional.h" #include "platform/wtf/Noncopyable.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementRegistry.cpp similarity index 94% rename from third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementRegistry.cpp index ea2454774..0cbd11e 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementRegistry.cpp
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementRegistry.h" +#include "core/html/custom/CustomElementRegistry.h" #include "bindings/core/v8/ExceptionState.h" #include "bindings/core/v8/ScriptCustomElementDefinitionBuilder.h" @@ -13,16 +13,16 @@ #include "core/dom/Element.h" #include "core/dom/ElementDefinitionOptions.h" #include "core/dom/ExceptionCode.h" -#include "core/dom/custom/CEReactionsScope.h" -#include "core/dom/custom/CustomElement.h" -#include "core/dom/custom/CustomElementDefinition.h" -#include "core/dom/custom/CustomElementDefinitionBuilder.h" -#include "core/dom/custom/CustomElementDescriptor.h" -#include "core/dom/custom/CustomElementReactionStack.h" -#include "core/dom/custom/CustomElementUpgradeReaction.h" -#include "core/dom/custom/CustomElementUpgradeSorter.h" -#include "core/dom/custom/V0CustomElementRegistrationContext.h" #include "core/frame/LocalDOMWindow.h" +#include "core/html/custom/CEReactionsScope.h" +#include "core/html/custom/CustomElement.h" +#include "core/html/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDefinitionBuilder.h" +#include "core/html/custom/CustomElementDescriptor.h" +#include "core/html/custom/CustomElementReactionStack.h" +#include "core/html/custom/CustomElementUpgradeReaction.h" +#include "core/html/custom/CustomElementUpgradeSorter.h" +#include "core/html/custom/V0CustomElementRegistrationContext.h" #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/wtf/Allocator.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.h b/third_party/WebKit/Source/core/html/custom/CustomElementRegistry.h similarity index 98% rename from third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.h rename to third_party/WebKit/Source/core/html/custom/CustomElementRegistry.h index ca7a67d61..4ac056e 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.h +++ b/third_party/WebKit/Source/core/html/custom/CustomElementRegistry.h
@@ -8,7 +8,7 @@ #include "base/gtest_prod_util.h" #include "bindings/core/v8/ScriptPromise.h" #include "core/CoreExport.h" -#include "core/dom/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDefinition.h" #include "platform/bindings/ScriptWrappable.h" #include "platform/bindings/TraceWrapperMember.h" #include "platform/heap/Handle.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.idl b/third_party/WebKit/Source/core/html/custom/CustomElementRegistry.idl similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.idl rename to third_party/WebKit/Source/core/html/custom/CustomElementRegistry.idl
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistryTest.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementRegistryTest.cpp similarity index 97% rename from third_party/WebKit/Source/core/dom/custom/CustomElementRegistryTest.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementRegistryTest.cpp index e098cea..81ece43 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistryTest.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementRegistryTest.cpp
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementRegistry.h" +#include "core/html/custom/CustomElementRegistry.h" #include <memory> #include "bindings/core/v8/ExceptionState.h" @@ -12,11 +12,11 @@ #include "core/dom/ElementDefinitionOptions.h" #include "core/dom/ShadowRoot.h" #include "core/dom/ShadowRootInit.h" -#include "core/dom/custom/CEReactionsScope.h" -#include "core/dom/custom/CustomElementDefinition.h" -#include "core/dom/custom/CustomElementDefinitionBuilder.h" -#include "core/dom/custom/CustomElementDescriptor.h" -#include "core/dom/custom/CustomElementTestHelpers.h" +#include "core/html/custom/CEReactionsScope.h" +#include "core/html/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDefinitionBuilder.h" +#include "core/html/custom/CustomElementDescriptor.h" +#include "core/html/custom/CustomElementTestHelpers.h" #include "core/testing/DummyPageHolder.h" #include "platform/ScriptForbiddenScope.h" #include "platform/heap/Handle.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementTest.cpp similarity index 97% rename from third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementTest.cpp index 059e36cf..51aca60 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementTest.cpp
@@ -2,19 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElement.h" +#include "core/html/custom/CustomElement.h" +#include <ios> +#include <memory> #include "core/HTMLNames.h" #include "core/SVGNames.h" #include "core/dom/Document.h" -#include "core/dom/custom/CustomElementDefinition.h" -#include "core/dom/custom/CustomElementRegistry.h" -#include "core/dom/custom/CustomElementTestHelpers.h" #include "core/html/HTMLElement.h" +#include "core/html/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementRegistry.h" +#include "core/html/custom/CustomElementTestHelpers.h" #include "core/testing/DummyPageHolder.h" #include "testing/gtest/include/gtest/gtest.h" -#include <ios> -#include <memory> namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementTestHelpers.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementTestHelpers.cpp similarity index 88% rename from third_party/WebKit/Source/core/dom/custom/CustomElementTestHelpers.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementTestHelpers.cpp index 09cdd77..a73a123e 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementTestHelpers.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementTestHelpers.cpp
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementTestHelpers.h" +#include "core/html/custom/CustomElementTestHelpers.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementTestHelpers.h b/third_party/WebKit/Source/core/html/custom/CustomElementTestHelpers.h similarity index 96% rename from third_party/WebKit/Source/core/dom/custom/CustomElementTestHelpers.h rename to third_party/WebKit/Source/core/html/custom/CustomElementTestHelpers.h index 83041019c25..84acb05 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementTestHelpers.h +++ b/third_party/WebKit/Source/core/html/custom/CustomElementTestHelpers.h
@@ -10,10 +10,10 @@ #include "core/dom/Element.h" #include "core/dom/ElementDefinitionOptions.h" #include "core/dom/QualifiedName.h" -#include "core/dom/custom/CEReactionsScope.h" -#include "core/dom/custom/CustomElementDefinition.h" -#include "core/dom/custom/CustomElementDefinitionBuilder.h" #include "core/html/HTMLDocument.h" +#include "core/html/custom/CEReactionsScope.h" +#include "core/html/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDefinitionBuilder.h" #include "platform/heap/Handle.h" #include "platform/wtf/text/AtomicString.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeReaction.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementUpgradeReaction.cpp similarity index 86% rename from third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeReaction.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementUpgradeReaction.cpp index f9fba1fe..5e14321 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeReaction.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementUpgradeReaction.cpp
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementUpgradeReaction.h" +#include "core/html/custom/CustomElementUpgradeReaction.h" -#include "core/dom/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDefinition.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeReaction.h b/third_party/WebKit/Source/core/html/custom/CustomElementUpgradeReaction.h similarity index 92% rename from third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeReaction.h rename to third_party/WebKit/Source/core/html/custom/CustomElementUpgradeReaction.h index 9e335b7..3113859 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeReaction.h +++ b/third_party/WebKit/Source/core/html/custom/CustomElementUpgradeReaction.h
@@ -6,7 +6,7 @@ #define CustomElementUpgradeReaction_h #include "core/CoreExport.h" -#include "core/dom/custom/CustomElementReaction.h" +#include "core/html/custom/CustomElementReaction.h" #include "platform/heap/Handle.h" #include "platform/wtf/Noncopyable.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorter.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementUpgradeSorter.cpp similarity index 98% rename from third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorter.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementUpgradeSorter.cpp index 446bef3..4dd77a86 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorter.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementUpgradeSorter.cpp
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementUpgradeSorter.h" +#include "core/html/custom/CustomElementUpgradeSorter.h" #include "core/dom/Element.h" #include "core/dom/ElementTraversal.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorter.h b/third_party/WebKit/Source/core/html/custom/CustomElementUpgradeSorter.h similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorter.h rename to third_party/WebKit/Source/core/html/custom/CustomElementUpgradeSorter.h
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorterTest.cpp b/third_party/WebKit/Source/core/html/custom/CustomElementUpgradeSorterTest.cpp similarity index 98% rename from third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorterTest.cpp rename to third_party/WebKit/Source/core/html/custom/CustomElementUpgradeSorterTest.cpp index 215225a..e26847d 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorterTest.cpp +++ b/third_party/WebKit/Source/core/html/custom/CustomElementUpgradeSorterTest.cpp
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/CustomElementUpgradeSorter.h" +#include "core/html/custom/CustomElementUpgradeSorter.h" #include <memory> #include "bindings/core/v8/ExceptionState.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/README.md b/third_party/WebKit/Source/core/html/custom/README.md similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/README.md rename to third_party/WebKit/Source/core/html/custom/README.md
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElement.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElement.cpp similarity index 96% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElement.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElement.cpp index 2958ba2..7be37a7 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElement.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElement.cpp
@@ -28,17 +28,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/dom/custom/V0CustomElement.h" +#include "core/html/custom/V0CustomElement.h" #include "core/HTMLNames.h" #include "core/MathMLNames.h" #include "core/SVGNames.h" #include "core/dom/Document.h" #include "core/dom/Element.h" -#include "core/dom/custom/V0CustomElementMicrotaskRunQueue.h" -#include "core/dom/custom/V0CustomElementObserver.h" -#include "core/dom/custom/V0CustomElementScheduler.h" #include "core/frame/UseCounter.h" +#include "core/html/custom/V0CustomElementMicrotaskRunQueue.h" +#include "core/html/custom/V0CustomElementObserver.h" +#include "core/html/custom/V0CustomElementScheduler.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElement.h b/third_party/WebKit/Source/core/html/custom/V0CustomElement.h similarity index 97% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElement.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElement.h index 1e0a4d9..fbd71a0 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElement.h +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElement.h
@@ -32,7 +32,7 @@ #define V0CustomElement_h #include "core/CoreExport.h" -#include "core/dom/custom/V0CustomElementDefinition.h" +#include "core/html/custom/V0CustomElementDefinition.h" #include "platform/wtf/Allocator.h" #include "platform/wtf/HashMap.h" #include "platform/wtf/Vector.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementAsyncImportMicrotaskQueue.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementAsyncImportMicrotaskQueue.cpp similarity index 93% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementAsyncImportMicrotaskQueue.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementAsyncImportMicrotaskQueue.cpp index c98ab5b..af24e11f 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementAsyncImportMicrotaskQueue.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementAsyncImportMicrotaskQueue.cpp
@@ -28,9 +28,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/dom/custom/V0CustomElementAsyncImportMicrotaskQueue.h" +#include "core/html/custom/V0CustomElementAsyncImportMicrotaskQueue.h" -#include "core/dom/custom/V0CustomElementMicrotaskImportStep.h" +#include "core/html/custom/V0CustomElementMicrotaskImportStep.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementAsyncImportMicrotaskQueue.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementAsyncImportMicrotaskQueue.h similarity index 96% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementAsyncImportMicrotaskQueue.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementAsyncImportMicrotaskQueue.h index 790d92f..36da7bc 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementAsyncImportMicrotaskQueue.h +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementAsyncImportMicrotaskQueue.h
@@ -31,7 +31,7 @@ #ifndef V0CustomElementAsyncImportMicrotaskQueue_h #define V0CustomElementAsyncImportMicrotaskQueue_h -#include "core/dom/custom/V0CustomElementMicrotaskQueueBase.h" +#include "core/html/custom/V0CustomElementMicrotaskQueueBase.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementCallbackInvocation.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementCallbackInvocation.cpp similarity index 97% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementCallbackInvocation.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementCallbackInvocation.cpp index a4056ed..a1de5497 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementCallbackInvocation.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementCallbackInvocation.cpp
@@ -28,11 +28,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/dom/custom/V0CustomElementCallbackInvocation.h" +#include "core/html/custom/V0CustomElementCallbackInvocation.h" #include "core/dom/Document.h" #include "core/dom/Element.h" -#include "core/dom/custom/V0CustomElementScheduler.h" +#include "core/html/custom/V0CustomElementScheduler.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementCallbackInvocation.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementCallbackInvocation.h similarity index 95% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementCallbackInvocation.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementCallbackInvocation.h index c50d344..c1b7c08 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementCallbackInvocation.h +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementCallbackInvocation.h
@@ -31,8 +31,8 @@ #ifndef V0CustomElementCallbackInvocation_h #define V0CustomElementCallbackInvocation_h -#include "core/dom/custom/V0CustomElementLifecycleCallbacks.h" -#include "core/dom/custom/V0CustomElementProcessingStep.h" +#include "core/html/custom/V0CustomElementLifecycleCallbacks.h" +#include "core/html/custom/V0CustomElementProcessingStep.h" #include "platform/wtf/text/AtomicString.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementCallbackQueue.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementCallbackQueue.cpp similarity index 97% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementCallbackQueue.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementCallbackQueue.cpp index ee89d15..e9c62f2 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementCallbackQueue.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementCallbackQueue.cpp
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/dom/custom/V0CustomElementCallbackQueue.h" +#include "core/html/custom/V0CustomElementCallbackQueue.h" #include "core/dom/ShadowRoot.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementCallbackQueue.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementCallbackQueue.h similarity index 97% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementCallbackQueue.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementCallbackQueue.h index 329cd43..e33fdeb 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementCallbackQueue.h +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementCallbackQueue.h
@@ -32,7 +32,7 @@ #define V0CustomElementCallbackQueue_h #include "core/dom/Element.h" -#include "core/dom/custom/V0CustomElementProcessingStep.h" +#include "core/html/custom/V0CustomElementProcessingStep.h" #include "platform/heap/Handle.h" #include "platform/wtf/Vector.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementDefinition.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementDefinition.cpp similarity index 97% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementDefinition.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementDefinition.cpp index 0e55b22..3842abb 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementDefinition.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementDefinition.cpp
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/dom/custom/V0CustomElementDefinition.h" +#include "core/html/custom/V0CustomElementDefinition.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementDefinition.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementDefinition.h similarity index 95% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementDefinition.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementDefinition.h index de5b90c..5784efe 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementDefinition.h +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementDefinition.h
@@ -31,8 +31,8 @@ #ifndef V0CustomElementDefinition_h #define V0CustomElementDefinition_h -#include "core/dom/custom/V0CustomElementDescriptor.h" -#include "core/dom/custom/V0CustomElementLifecycleCallbacks.h" +#include "core/html/custom/V0CustomElementDescriptor.h" +#include "core/html/custom/V0CustomElementLifecycleCallbacks.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementDescriptor.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementDescriptor.h similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementDescriptor.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementDescriptor.h
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementDescriptorHash.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementDescriptorHash.h similarity index 97% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementDescriptorHash.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementDescriptorHash.h index e2b072a1..08a3a06 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementDescriptorHash.h +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementDescriptorHash.h
@@ -31,7 +31,7 @@ #ifndef V0CustomElementDescriptorHash_h #define V0CustomElementDescriptorHash_h -#include "core/dom/custom/V0CustomElementDescriptor.h" +#include "core/html/custom/V0CustomElementDescriptor.h" #include "platform/wtf/Allocator.h" #include "platform/wtf/HashFunctions.h" #include "platform/wtf/HashTraits.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementException.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementException.cpp similarity index 98% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementException.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementException.cpp index 7bf0ce2..1e26104c 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementException.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementException.cpp
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/dom/custom/V0CustomElementException.h" +#include "core/html/custom/V0CustomElementException.h" #include "bindings/core/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementException.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementException.h similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementException.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementException.h
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementLifecycleCallbacks.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementLifecycleCallbacks.h similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementLifecycleCallbacks.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementLifecycleCallbacks.h
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskDispatcher.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskDispatcher.cpp similarity index 88% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskDispatcher.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskDispatcher.cpp index 98527c5f..7a81ad7b 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskDispatcher.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskDispatcher.cpp
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/V0CustomElementMicrotaskDispatcher.h" +#include "core/html/custom/V0CustomElementMicrotaskDispatcher.h" -#include "core/dom/custom/V0CustomElementCallbackQueue.h" -#include "core/dom/custom/V0CustomElementMicrotaskImportStep.h" -#include "core/dom/custom/V0CustomElementProcessingStack.h" -#include "core/dom/custom/V0CustomElementScheduler.h" +#include "core/html/custom/V0CustomElementCallbackQueue.h" +#include "core/html/custom/V0CustomElementMicrotaskImportStep.h" +#include "core/html/custom/V0CustomElementProcessingStack.h" +#include "core/html/custom/V0CustomElementScheduler.h" #include "platform/bindings/Microtask.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskDispatcher.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskDispatcher.h similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskDispatcher.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskDispatcher.h
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskImportStep.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskImportStep.cpp similarity index 93% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskImportStep.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskImportStep.cpp index eaa435a..13aca8c 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskImportStep.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskImportStep.cpp
@@ -28,13 +28,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/dom/custom/V0CustomElementMicrotaskImportStep.h" +#include "core/html/custom/V0CustomElementMicrotaskImportStep.h" -#include "core/dom/custom/V0CustomElementMicrotaskDispatcher.h" -#include "core/dom/custom/V0CustomElementSyncMicrotaskQueue.h" +#include <stdio.h> +#include "core/html/custom/V0CustomElementMicrotaskDispatcher.h" +#include "core/html/custom/V0CustomElementSyncMicrotaskQueue.h" #include "core/html/imports/HTMLImportChild.h" #include "core/html/imports/HTMLImportLoader.h" -#include <stdio.h> namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskImportStep.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskImportStep.h similarity index 97% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskImportStep.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskImportStep.h index 8c2822db..0a5df60 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskImportStep.h +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskImportStep.h
@@ -31,7 +31,7 @@ #ifndef V0CustomElementMicrotaskImportStep_h #define V0CustomElementMicrotaskImportStep_h -#include "core/dom/custom/V0CustomElementMicrotaskStep.h" +#include "core/html/custom/V0CustomElementMicrotaskStep.h" #include "platform/heap/Handle.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskQueueBase.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskQueueBase.cpp similarity index 84% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskQueueBase.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskQueueBase.cpp index 52128b2..c5adb32 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskQueueBase.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskQueueBase.cpp
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/V0CustomElementMicrotaskQueueBase.h" +#include "core/html/custom/V0CustomElementMicrotaskQueueBase.h" -#include "core/dom/custom/V0CustomElementProcessingStack.h" +#include "core/html/custom/V0CustomElementProcessingStack.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskQueueBase.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskQueueBase.h similarity index 94% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskQueueBase.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskQueueBase.h index 6e5dd29..22841d2 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskQueueBase.h +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskQueueBase.h
@@ -5,7 +5,7 @@ #ifndef V0CustomElementMicrotaskQueueBase_h #define V0CustomElementMicrotaskQueueBase_h -#include "core/dom/custom/V0CustomElementMicrotaskStep.h" +#include "core/html/custom/V0CustomElementMicrotaskStep.h" #include "platform/heap/Handle.h" #include "platform/wtf/Vector.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskResolutionStep.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskResolutionStep.cpp similarity index 95% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskResolutionStep.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskResolutionStep.cpp index 43a15877..994dde0d 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskResolutionStep.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskResolutionStep.cpp
@@ -28,10 +28,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/dom/custom/V0CustomElementMicrotaskResolutionStep.h" +#include "core/html/custom/V0CustomElementMicrotaskResolutionStep.h" #include "core/dom/Element.h" -#include "core/dom/custom/V0CustomElementRegistrationContext.h" +#include "core/html/custom/V0CustomElementRegistrationContext.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskResolutionStep.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskResolutionStep.h similarity index 95% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskResolutionStep.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskResolutionStep.h index 987c15a..c84be5d 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskResolutionStep.h +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskResolutionStep.h
@@ -31,8 +31,8 @@ #ifndef V0CustomElementMicrotaskResolutionStep_h #define V0CustomElementMicrotaskResolutionStep_h -#include "core/dom/custom/V0CustomElementDescriptor.h" -#include "core/dom/custom/V0CustomElementMicrotaskStep.h" +#include "core/html/custom/V0CustomElementDescriptor.h" +#include "core/html/custom/V0CustomElementMicrotaskStep.h" #include "platform/heap/Handle.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskRunQueue.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskRunQueue.cpp similarity index 88% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskRunQueue.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskRunQueue.cpp index e627e183..3e7ebd9 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskRunQueue.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskRunQueue.cpp
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/V0CustomElementMicrotaskRunQueue.h" +#include "core/html/custom/V0CustomElementMicrotaskRunQueue.h" -#include "core/dom/custom/V0CustomElementAsyncImportMicrotaskQueue.h" -#include "core/dom/custom/V0CustomElementSyncMicrotaskQueue.h" +#include "core/html/custom/V0CustomElementAsyncImportMicrotaskQueue.h" +#include "core/html/custom/V0CustomElementSyncMicrotaskQueue.h" #include "core/html/imports/HTMLImportLoader.h" #include "platform/bindings/Microtask.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskRunQueue.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskRunQueue.h similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskRunQueue.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskRunQueue.h
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskStep.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskStep.h similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskStep.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementMicrotaskStep.h
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementObserver.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementObserver.cpp similarity index 97% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementObserver.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementObserver.cpp index c7f5245..7540aa8 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementObserver.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementObserver.cpp
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/dom/custom/V0CustomElementObserver.h" +#include "core/html/custom/V0CustomElementObserver.h" #include "core/dom/Element.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementObserver.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementObserver.h similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementObserver.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementObserver.h
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementProcessingStack.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementProcessingStack.cpp similarity index 95% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementProcessingStack.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementProcessingStack.cpp index 9b6d19b..9c5a81c 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementProcessingStack.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementProcessingStack.cpp
@@ -28,10 +28,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/dom/custom/V0CustomElementProcessingStack.h" +#include "core/html/custom/V0CustomElementProcessingStack.h" -#include "core/dom/custom/V0CustomElementCallbackQueue.h" -#include "core/dom/custom/V0CustomElementScheduler.h" +#include "core/html/custom/V0CustomElementCallbackQueue.h" +#include "core/html/custom/V0CustomElementScheduler.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementProcessingStack.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementProcessingStack.h similarity index 98% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementProcessingStack.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementProcessingStack.h index 90b8c02b..c179065 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementProcessingStack.h +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementProcessingStack.h
@@ -32,7 +32,7 @@ #define V0CustomElementProcessingStack_h #include "core/CoreExport.h" -#include "core/dom/custom/V0CustomElementCallbackQueue.h" +#include "core/html/custom/V0CustomElementCallbackQueue.h" #include "platform/wtf/Vector.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementProcessingStep.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementProcessingStep.h similarity index 100% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementProcessingStep.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementProcessingStep.h
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistrationContext.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementRegistrationContext.cpp similarity index 96% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistrationContext.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementRegistrationContext.cpp index 2ff9d0e..b808b106 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistrationContext.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementRegistrationContext.cpp
@@ -28,18 +28,18 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/dom/custom/V0CustomElementRegistrationContext.h" +#include "core/html/custom/V0CustomElementRegistrationContext.h" #include "bindings/core/v8/ExceptionState.h" #include "core/HTMLNames.h" #include "core/SVGNames.h" #include "core/dom/Document.h" #include "core/dom/Element.h" -#include "core/dom/custom/V0CustomElement.h" -#include "core/dom/custom/V0CustomElementDefinition.h" -#include "core/dom/custom/V0CustomElementScheduler.h" #include "core/html/HTMLElement.h" #include "core/html/HTMLUnknownElement.h" +#include "core/html/custom/V0CustomElement.h" +#include "core/html/custom/V0CustomElementDefinition.h" +#include "core/html/custom/V0CustomElementScheduler.h" #include "core/svg/SVGUnknownElement.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistrationContext.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementRegistrationContext.h similarity index 94% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistrationContext.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementRegistrationContext.h index fb3ffab..dfc106f4 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistrationContext.h +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementRegistrationContext.h
@@ -32,9 +32,9 @@ #define V0CustomElementRegistrationContext_h #include "core/dom/QualifiedName.h" -#include "core/dom/custom/V0CustomElementDescriptor.h" -#include "core/dom/custom/V0CustomElementRegistry.h" -#include "core/dom/custom/V0CustomElementUpgradeCandidateMap.h" +#include "core/html/custom/V0CustomElementDescriptor.h" +#include "core/html/custom/V0CustomElementRegistry.h" +#include "core/html/custom/V0CustomElementUpgradeCandidateMap.h" #include "platform/heap/Handle.h" #include "platform/wtf/text/AtomicString.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementRegistry.cpp similarity index 95% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementRegistry.cpp index 6ece6b0..5b10f83b 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementRegistry.cpp
@@ -28,17 +28,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/dom/custom/V0CustomElementRegistry.h" +#include "core/html/custom/V0CustomElementRegistry.h" #include "bindings/core/v8/V0CustomElementConstructorBuilder.h" #include "bindings/core/v8/V8BindingForCore.h" #include "core/HTMLNames.h" #include "core/SVGNames.h" #include "core/dom/Document.h" -#include "core/dom/custom/CustomElementRegistry.h" -#include "core/dom/custom/V0CustomElementException.h" -#include "core/dom/custom/V0CustomElementRegistrationContext.h" #include "core/frame/UseCounter.h" +#include "core/html/custom/CustomElementRegistry.h" +#include "core/html/custom/V0CustomElementException.h" +#include "core/html/custom/V0CustomElementRegistrationContext.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementRegistry.h similarity index 93% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementRegistry.h index be51cd7..d9d7eef 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.h +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementRegistry.h
@@ -31,10 +31,10 @@ #ifndef V0CustomElementRegistry_h #define V0CustomElementRegistry_h -#include "core/dom/custom/V0CustomElement.h" -#include "core/dom/custom/V0CustomElementDefinition.h" -#include "core/dom/custom/V0CustomElementDescriptor.h" -#include "core/dom/custom/V0CustomElementDescriptorHash.h" +#include "core/html/custom/V0CustomElement.h" +#include "core/html/custom/V0CustomElementDefinition.h" +#include "core/html/custom/V0CustomElementDescriptor.h" +#include "core/html/custom/V0CustomElementDescriptorHash.h" #include "platform/wtf/HashMap.h" #include "platform/wtf/HashSet.h" #include "platform/wtf/text/AtomicString.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementScheduler.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementScheduler.cpp similarity index 90% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementScheduler.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementScheduler.cpp index 4a38cce..0969dc910 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementScheduler.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementScheduler.cpp
@@ -28,19 +28,19 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/dom/custom/V0CustomElementScheduler.h" +#include "core/html/custom/V0CustomElementScheduler.h" #include "core/dom/Document.h" #include "core/dom/Element.h" -#include "core/dom/custom/V0CustomElementCallbackInvocation.h" -#include "core/dom/custom/V0CustomElementLifecycleCallbacks.h" -#include "core/dom/custom/V0CustomElementMicrotaskDispatcher.h" -#include "core/dom/custom/V0CustomElementMicrotaskImportStep.h" -#include "core/dom/custom/V0CustomElementMicrotaskResolutionStep.h" -#include "core/dom/custom/V0CustomElementMicrotaskRunQueue.h" -#include "core/dom/custom/V0CustomElementProcessingStack.h" -#include "core/dom/custom/V0CustomElementRegistrationContext.h" -#include "core/dom/custom/V0CustomElementSyncMicrotaskQueue.h" +#include "core/html/custom/V0CustomElementCallbackInvocation.h" +#include "core/html/custom/V0CustomElementLifecycleCallbacks.h" +#include "core/html/custom/V0CustomElementMicrotaskDispatcher.h" +#include "core/html/custom/V0CustomElementMicrotaskImportStep.h" +#include "core/html/custom/V0CustomElementMicrotaskResolutionStep.h" +#include "core/html/custom/V0CustomElementMicrotaskRunQueue.h" +#include "core/html/custom/V0CustomElementProcessingStack.h" +#include "core/html/custom/V0CustomElementRegistrationContext.h" +#include "core/html/custom/V0CustomElementSyncMicrotaskQueue.h" #include "core/html/imports/HTMLImportChild.h" #include "core/html/imports/HTMLImportsController.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementScheduler.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementScheduler.h similarity index 95% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementScheduler.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementScheduler.h index 81d772a6..60847902 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementScheduler.h +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementScheduler.h
@@ -31,8 +31,8 @@ #ifndef V0CustomElementScheduler_h #define V0CustomElementScheduler_h -#include "core/dom/custom/V0CustomElementCallbackQueue.h" -#include "core/dom/custom/V0CustomElementLifecycleCallbacks.h" +#include "core/html/custom/V0CustomElementCallbackQueue.h" +#include "core/html/custom/V0CustomElementLifecycleCallbacks.h" #include "platform/heap/Handle.h" #include "platform/wtf/HashMap.h" #include "platform/wtf/text/AtomicString.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementSyncMicrotaskQueue.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementSyncMicrotaskQueue.cpp similarity index 89% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementSyncMicrotaskQueue.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementSyncMicrotaskQueue.cpp index ee74130..a9d0781e 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementSyncMicrotaskQueue.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementSyncMicrotaskQueue.cpp
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/dom/custom/V0CustomElementSyncMicrotaskQueue.h" +#include "core/html/custom/V0CustomElementSyncMicrotaskQueue.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementSyncMicrotaskQueue.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementSyncMicrotaskQueue.h similarity index 91% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementSyncMicrotaskQueue.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementSyncMicrotaskQueue.h index ac185fa..b9ae3bb 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementSyncMicrotaskQueue.h +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementSyncMicrotaskQueue.h
@@ -5,7 +5,7 @@ #ifndef V0CustomElementSyncMicrotaskQueue_h #define V0CustomElementSyncMicrotaskQueue_h -#include "core/dom/custom/V0CustomElementMicrotaskQueueBase.h" +#include "core/html/custom/V0CustomElementMicrotaskQueueBase.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementUpgradeCandidateMap.cpp b/third_party/WebKit/Source/core/html/custom/V0CustomElementUpgradeCandidateMap.cpp similarity index 97% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementUpgradeCandidateMap.cpp rename to third_party/WebKit/Source/core/html/custom/V0CustomElementUpgradeCandidateMap.cpp index 416b7550..b602debc 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementUpgradeCandidateMap.cpp +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementUpgradeCandidateMap.cpp
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/dom/custom/V0CustomElementUpgradeCandidateMap.h" +#include "core/html/custom/V0CustomElementUpgradeCandidateMap.h" #include "core/dom/Element.h"
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementUpgradeCandidateMap.h b/third_party/WebKit/Source/core/html/custom/V0CustomElementUpgradeCandidateMap.h similarity index 94% rename from third_party/WebKit/Source/core/dom/custom/V0CustomElementUpgradeCandidateMap.h rename to third_party/WebKit/Source/core/html/custom/V0CustomElementUpgradeCandidateMap.h index d13c633..32643bc 100644 --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementUpgradeCandidateMap.h +++ b/third_party/WebKit/Source/core/html/custom/V0CustomElementUpgradeCandidateMap.h
@@ -31,9 +31,9 @@ #ifndef V0CustomElementUpgradeCandidateMap_h #define V0CustomElementUpgradeCandidateMap_h -#include "core/dom/custom/V0CustomElementDescriptor.h" -#include "core/dom/custom/V0CustomElementDescriptorHash.h" -#include "core/dom/custom/V0CustomElementObserver.h" +#include "core/html/custom/V0CustomElementDescriptor.h" +#include "core/html/custom/V0CustomElementDescriptorHash.h" +#include "core/html/custom/V0CustomElementObserver.h" #include "platform/wtf/HashMap.h" #include "platform/wtf/LinkedHashSet.h" #include "platform/wtf/Noncopyable.h"
diff --git a/third_party/WebKit/Source/core/html/imports/HTMLImport.h b/third_party/WebKit/Source/core/html/imports/HTMLImport.h index 06473fe..70f1f8f9 100644 --- a/third_party/WebKit/Source/core/html/imports/HTMLImport.h +++ b/third_party/WebKit/Source/core/html/imports/HTMLImport.h
@@ -41,58 +41,6 @@ class Document; class HTMLImportLoader; -// -// # Basic Data Structure and Algorithms of HTML Imports implemenation. -// -// ## The Import Tree -// -// HTML Imports form a tree: -// -// * The root of the tree is HTMLImportTreeRoot. -// -// * The HTMLImportTreeRoot is owned HTMLImportsController, which is owned by -// the master document as a DocumentSupplement. -// -// * The non-root nodes are HTMLImportChild. They are all owned by -// HTMLImporTreeRoot. LinkStyle is wired into HTMLImportChild by implementing -// HTMLImportChildClient interface -// -// * Both HTMLImportTreeRoot and HTMLImportChild are derived from HTMLImport -// superclass that models the tree data structure using WTF::TreeNode and -// provides a set of virtual functions. -// -// HTMLImportsController also owns all loaders in the tree and manages their -// lifetime through it. One assumption is that the tree is append-only and -// nodes are never inserted in the middle of the tree nor removed. -// -// Full diagram is here: -// https://docs.google.com/drawings/d/1jFQrO0IupWrlykTNzQ3Nv2SdiBiSz4UE9-V3-vDgBb0/ -// -// # Import Sharing and HTMLImportLoader -// -// The HTML Imports spec calls for de-dup mechanism to share already loaded -// imports. To implement this, the actual loading machinery is split out from -// HTMLImportChild to HTMLImportLoader, and each loader shares HTMLImportLoader -// with other loader if the URL is same. Check around -// HTMLImportsController::findLink() for more detail. -// -// HTMLImportLoader can be shared by multiple imports. -// -// HTMLImportChild (1)-->(*) HTMLImportLoader -// -// -// # Script Blocking -// -// - An import blocks the HTML parser of its own imported document from running -// <script> until all of its children are loaded. Note that dynamically added -// import won't block the parser. -// -// - An import under loading also blocks imported documents that follow from -// being created. This is because an import can include another import that -// has same URLs of following ones. In such case, the preceding import should -// be loaded and following ones should be de-duped. -// - // The superclass of HTMLImportTreeRoot and HTMLImportChild // This represents the import tree data structure. class HTMLImport : public GarbageCollectedFinalized<HTMLImport>,
diff --git a/third_party/WebKit/Source/core/html/imports/HTMLImportChild.cpp b/third_party/WebKit/Source/core/html/imports/HTMLImportChild.cpp index 3098ff2..e4e255a 100644 --- a/third_party/WebKit/Source/core/html/imports/HTMLImportChild.cpp +++ b/third_party/WebKit/Source/core/html/imports/HTMLImportChild.cpp
@@ -33,11 +33,11 @@ #include "core/css/StyleSheetList.h" #include "core/dom/Document.h" #include "core/dom/StyleEngine.h" -#include "core/dom/custom/V0CustomElement.h" -#include "core/dom/custom/V0CustomElementMicrotaskImportStep.h" -#include "core/dom/custom/V0CustomElementSyncMicrotaskQueue.h" #include "core/frame/Deprecation.h" #include "core/frame/UseCounter.h" +#include "core/html/custom/V0CustomElement.h" +#include "core/html/custom/V0CustomElementMicrotaskImportStep.h" +#include "core/html/custom/V0CustomElementSyncMicrotaskQueue.h" #include "core/html/imports/HTMLImportChildClient.h" #include "core/html/imports/HTMLImportLoader.h" #include "core/html/imports/HTMLImportTreeRoot.h"
diff --git a/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.cpp b/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.cpp index 3e0da90..7d0af359 100644 --- a/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.cpp +++ b/third_party/WebKit/Source/core/html/imports/HTMLImportLoader.cpp
@@ -30,16 +30,16 @@ #include "core/html/imports/HTMLImportLoader.h" +#include <memory> #include "core/dom/Document.h" #include "core/dom/DocumentParser.h" #include "core/dom/StyleEngine.h" -#include "core/dom/custom/V0CustomElementSyncMicrotaskQueue.h" #include "core/html/HTMLDocument.h" +#include "core/html/custom/V0CustomElementSyncMicrotaskQueue.h" #include "core/html/imports/HTMLImportChild.h" #include "core/html/imports/HTMLImportsController.h" #include "core/loader/DocumentWriter.h" #include "platform/network/ContentSecurityPolicyResponseHeaders.h" -#include <memory> namespace blink {
diff --git a/third_party/WebKit/Source/core/html/imports/README.md b/third_party/WebKit/Source/core/html/imports/README.md new file mode 100644 index 0000000..c31bf6d --- /dev/null +++ b/third_party/WebKit/Source/core/html/imports/README.md
@@ -0,0 +1,53 @@ +# HTML Imports + +The `Source/core/html/imports` directory contains the implementation of +HTML Imports. + +The spec can be found [here](https://w3c.github.io/webcomponents/spec/imports/). + +## Basic Data Structure and Algorithms of HTML Imports implementation. + +### The Import Tree + +HTML Imports form a tree: + +* The root of the tree is `HTMLImportTreeRoot`. +* The `HTMLImportTreeRoot` is owned by `HTMLImportsController`, which is owned + by the master document as a `DocumentSupplement`. +* The non-root nodes are `HTMLImportChild`. They are all owned by + `HTMLImporTreeRoot`. `LinkStyle` is wired into `HTMLImportChild` by + implementing `HTMLImportChildClient` interface. +* Both `HTMLImportTreeRoot` and `HTMLImportChild` are derived from `HTMLImport` + superclass that models the tree data structure using `WTF::TreeNode` and + provides a set of virtual functions. + +`HTMLImportsController` also owns all loaders in the tree and manages their +lifetime through it. One assumption is that the tree is append-only and +nodes are never inserted in the middle of the tree nor removed. + +Full diagram is [here](https://docs.google.com/drawings/d/1jFQrO0IupWrlykTNzQ3Nv2SdiBiSz4UE9-V3-vDgBb0/) + +## Import Sharing and `HTMLImportLoader` + +[The HTML Imports spec](https://w3c.github.io/webcomponents/spec/imports/) calls +for de-dup mechanism to share already loaded imports. +To implement this, the actual loading machinery is split out from +`HTMLImportChild` to `HTMLImportLoader`, and each loader shares +`HTMLImportLoader` with other loader if the URL is same. Check around +`HTMLImportTreeRoot::Find()` for more detail. + +`HTMLImportLoader` can be shared by multiple imports. + +``` + HTMLImportChild (1)-->(*) HTMLImportLoader +``` + +## Script Blocking + +- An import blocks the HTML parser of its own imported document from running + `<script>` until all of its children are loaded. Note that dynamically added + import won't block the parser. +- An import under loading also blocks imported documents that follow from + being created. This is because an import can include another import that + has same URLs of following ones. In such case, the preceding import should + be loaded and following ones should be de-duped. \ No newline at end of file
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp b/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp index 0ecc2af..1ebd3aa5 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp
@@ -38,10 +38,6 @@ #include "core/dom/TemplateContentDocumentFragment.h" #include "core/dom/Text.h" #include "core/dom/ThrowOnDynamicMarkupInsertionCountIncrementer.h" -#include "core/dom/custom/CEReactionsScope.h" -#include "core/dom/custom/CustomElementDefinition.h" -#include "core/dom/custom/CustomElementDescriptor.h" -#include "core/dom/custom/CustomElementRegistry.h" #include "core/frame/LocalDOMWindow.h" #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameClient.h" @@ -51,6 +47,10 @@ #include "core/html/HTMLPlugInElement.h" #include "core/html/HTMLScriptElement.h" #include "core/html/HTMLTemplateElement.h" +#include "core/html/custom/CEReactionsScope.h" +#include "core/html/custom/CustomElementDefinition.h" +#include "core/html/custom/CustomElementDescriptor.h" +#include "core/html/custom/CustomElementRegistry.h" #include "core/html/parser/AtomicHTMLToken.h" #include "core/html/parser/HTMLParserIdioms.h" #include "core/html/parser/HTMLParserReentryPermit.h"
diff --git a/third_party/WebKit/Source/core/input/MouseWheelEventManager.cpp b/third_party/WebKit/Source/core/input/MouseWheelEventManager.cpp index 6a8a308..cfaf8541 100644 --- a/third_party/WebKit/Source/core/input/MouseWheelEventManager.cpp +++ b/third_party/WebKit/Source/core/input/MouseWheelEventManager.cpp
@@ -61,10 +61,16 @@ return WebInputEventResult::kNotHandled; } - if (event.phase == WebMouseWheelEvent::kPhaseBegan) { + bool has_phase_info = + event.phase != WebMouseWheelEvent::kPhaseNone || + event.momentum_phase != WebMouseWheelEvent::kPhaseNone; + if (!has_phase_info) { + // Synthetic wheel events generated from GesturePinchUpdate don't have + // phase info. Send these events to the target under the cursor. + wheel_target_ = FindTargetNode(event, doc, view); + } else if (event.phase == WebMouseWheelEvent::kPhaseBegan) { // Find and save the wheel_target_, this target will be used for the rest // of the current scrolling sequence. - DCHECK(!wheel_target_); wheel_target_ = FindTargetNode(event, doc, view); } } else { // !wheel_scroll_latching, wheel_target_ will be updated for each
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp index b97e24561..0aca3ae0 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp +++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -78,6 +78,7 @@ #include "core/probe/CoreProbes.h" #include "core/svg/graphics/SVGImage.h" #include "core/xml/parser/XMLDocumentParser.h" +#include "platform/Histogram.h" #include "platform/InstanceCounters.h" #include "platform/PluginScriptForbiddenScope.h" #include "platform/ScriptForbiddenScope.h" @@ -195,6 +196,31 @@ return policy; } +static SinglePageAppNavigationType CategorizeSinglePageAppNavigation( + SameDocumentNavigationSource same_document_navigation_source, + FrameLoadType frame_load_type) { + // |SinglePageAppNavigationType| falls into this grid according to different + // combinations of |FrameLoadType| and |SameDocumentNavigationSource|: + // + // HistoryApi Default + // kFrameLoadTypeBackForward illegal otherFragmentNav + // !kFrameLoadTypeBackForward sameDocBack/Forward historyPushOrReplace + switch (same_document_navigation_source) { + case kSameDocumentNavigationDefault: + if (frame_load_type == kFrameLoadTypeBackForward) { + return kSPANavTypeSameDocumentBackwardOrForward; + } + return kSPANavTypeOtherFragmentNavigation; + case kSameDocumentNavigationHistoryApi: + // It's illegal to have both kSameDocumentNavigationHistoryApi and + // kFrameLoadTypeBackForward. + DCHECK(frame_load_type != kFrameLoadTypeBackForward); + return kSPANavTypeHistoryPushStateOrReplaceState; + } + NOTREACHED(); + return kSPANavTypeSameDocumentBackwardOrForward; +} + ResourceRequest FrameLoader::ResourceRequestForReload( FrameLoadType frame_load_type, const KURL& override_url, @@ -491,6 +517,12 @@ HistoryScrollRestorationType scroll_restoration_type, FrameLoadType type, Document* initiating_document) { + SinglePageAppNavigationType single_page_app_navigation_type = + CategorizeSinglePageAppNavigation(same_document_navigation_source, type); + UMA_HISTOGRAM_ENUMERATION( + "RendererScheduler.UpdateForSameDocumentNavigationCount", + single_page_app_navigation_type, kSPANavTypeCount); + TRACE_EVENT1("blink", "FrameLoader::updateForSameDocumentNavigation", "url", new_url.GetString().Ascii().data());
diff --git a/third_party/WebKit/Source/core/loader/FrameLoaderTypes.h b/third_party/WebKit/Source/core/loader/FrameLoaderTypes.h index 67fff48..b183492a 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoaderTypes.h +++ b/third_party/WebKit/Source/core/loader/FrameLoaderTypes.h
@@ -94,6 +94,17 @@ kResourcesBeforeDCLAndSameOriginIFrames }; +// This enum is used to index different kinds of single-page-application +// navigations for UMA enum histogram. New enum values can be added, but +// existing enums must never be renumbered or deleted and reused. +// This enum should be consistent with SinglePageAppNavigationType in +// tools/metrics/histograms/enums.xml. +enum SinglePageAppNavigationType { + kSPANavTypeHistoryPushStateOrReplaceState = 0, + kSPANavTypeSameDocumentBackwardOrForward = 1, + kSPANavTypeOtherFragmentNavigation = 2, + kSPANavTypeCount +}; } // namespace blink #endif
diff --git a/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp b/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp index fcd6e6c..108af2e 100644 --- a/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp +++ b/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp
@@ -235,7 +235,7 @@ reporting_proxy_ = WTF::MakeUnique<WorkerReportingProxy>(); security_origin_ = GetDocument().GetSecurityOrigin(); parent_frame_task_runners_ = - ParentFrameTaskRunners::Create(&dummy_page_holder_->GetFrame()); + ParentFrameTaskRunners::Create(dummy_page_holder_->GetFrame()); worker_thread_ = WTF::MakeUnique<WorkerThreadForTest>( ThreadableLoadingContext::Create(GetDocument()), *reporting_proxy_);
diff --git a/third_party/WebKit/Source/core/page/BUILD.gn b/third_party/WebKit/Source/core/page/BUILD.gn index fd6a5cc..902e434 100644 --- a/third_party/WebKit/Source/core/page/BUILD.gn +++ b/third_party/WebKit/Source/core/page/BUILD.gn
@@ -71,6 +71,8 @@ "ValidationMessageClient.h", "ValidationMessageClientImpl.cpp", "ValidationMessageClientImpl.h", + "ValidationMessageOverlayDelegate.cpp", + "ValidationMessageOverlayDelegate.h", "scrolling/OverscrollController.cpp", "scrolling/OverscrollController.h", "scrolling/RootScrollerController.cpp",
diff --git a/third_party/WebKit/Source/core/page/ValidationMessageClient.h b/third_party/WebKit/Source/core/page/ValidationMessageClient.h index fe2285f..2fd3fd69 100644 --- a/third_party/WebKit/Source/core/page/ValidationMessageClient.h +++ b/third_party/WebKit/Source/core/page/ValidationMessageClient.h
@@ -60,6 +60,9 @@ virtual void WillBeDestroyed() = 0; + virtual void LayoutOverlay() {} + virtual void PaintOverlay() {} + DEFINE_INLINE_VIRTUAL_TRACE() {} };
diff --git a/third_party/WebKit/Source/core/page/ValidationMessageClientImpl.cpp b/third_party/WebKit/Source/core/page/ValidationMessageClientImpl.cpp index 7eb5f345..173d58ae 100644 --- a/third_party/WebKit/Source/core/page/ValidationMessageClientImpl.cpp +++ b/third_party/WebKit/Source/core/page/ValidationMessageClientImpl.cpp
@@ -29,7 +29,9 @@ #include "core/dom/TaskRunnerHelper.h" #include "core/exported/WebViewBase.h" #include "core/frame/LocalFrameView.h" +#include "core/frame/WebLocalFrameBase.h" #include "core/page/ChromeClient.h" +#include "core/page/ValidationMessageOverlayDelegate.h" #include "platform/PlatformChromeClient.h" #include "platform/wtf/CurrentTime.h" #include "public/platform/WebRect.h" @@ -80,23 +82,38 @@ message_ = message; const double kMinimumSecondToShowValidationMessage = 5.0; const double kSecondPerCharacter = 0.05; - const double kStatusCheckInterval = 0.1; - - web_view_.Client()->ShowValidationMessage( - anchor_in_viewport, message_, ToWebTextDirection(message_dir), - sub_message, ToWebTextDirection(sub_message_dir)); - web_view_.GetChromeClient().RegisterPopupOpeningObserver(this); - finish_time_ = MonotonicallyIncreasingTime() + std::max(kMinimumSecondToShowValidationMessage, (message.length() + sub_message.length()) * kSecondPerCharacter); - // FIXME: We should invoke checkAnchorStatus actively when layout, scroll, - // or page scale change happen. - timer_ = WTF::MakeUnique<TaskRunnerTimer<ValidationMessageClientImpl>>( - TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &anchor.GetDocument()), - this, &ValidationMessageClientImpl::CheckAnchorStatus); - timer_->StartRepeating(kStatusCheckInterval, BLINK_FROM_HERE); + + if (!RuntimeEnabledFeatures::ValidationBubbleInRendererEnabled()) { + web_view_.Client()->ShowValidationMessage( + anchor_in_viewport, message_, ToWebTextDirection(message_dir), + sub_message, ToWebTextDirection(sub_message_dir)); + web_view_.GetChromeClient().RegisterPopupOpeningObserver(this); + + // FIXME: We should invoke checkAnchorStatus actively when layout, scroll, + // or page scale change happen. + const double kStatusCheckInterval = 0.1; + timer_ = WTF::MakeUnique<TaskRunnerTimer<ValidationMessageClientImpl>>( + TaskRunnerHelper::Get(TaskType::kUnspecedTimer, &anchor.GetDocument()), + this, &ValidationMessageClientImpl::CheckAnchorStatus); + timer_->StartRepeating(kStatusCheckInterval, BLINK_FROM_HERE); + return; + } + auto* target_frame = + web_view_.MainFrameImpl() + ? web_view_.MainFrameImpl() + : WebLocalFrameBase::FromFrame(anchor.GetDocument().GetFrame()); + overlay_ = PageOverlay::Create( + target_frame, ValidationMessageOverlayDelegate::Create( + *web_view_.GetPage(), anchor, message_, message_dir, + sub_message, sub_message_dir)); + target_frame->GetFrameView() + ->UpdateLifecycleToCompositingCleanPlusScrolling(); + web_view_.GetChromeClient().RegisterPopupOpeningObserver(this); + LayoutOverlay(); } void ValidationMessageClientImpl::HideValidationMessage(const Element& anchor) { @@ -106,7 +123,9 @@ current_anchor_ = nullptr; message_ = String(); finish_time_ = 0; - web_view_.Client()->HideValidationMessage(); + if (!RuntimeEnabledFeatures::ValidationBubbleInRendererEnabled()) + web_view_.Client()->HideValidationMessage(); + overlay_ = nullptr; web_view_.GetChromeClient().UnregisterPopupOpeningObserver(this); } @@ -134,6 +153,8 @@ return; } + if (RuntimeEnabledFeatures::ValidationBubbleInRendererEnabled()) + return; IntRect new_anchor_rect_in_viewport_in_screen = CurrentView()->GetChromeClient()->ViewportToScreen( new_anchor_rect_in_viewport, CurrentView()); @@ -155,6 +176,19 @@ HideValidationMessage(*current_anchor_); } +void ValidationMessageClientImpl::LayoutOverlay() { + if (!overlay_) + return; + CheckAnchorStatus(nullptr); + if (overlay_) + overlay_->Update(); +} + +void ValidationMessageClientImpl::PaintOverlay() { + if (overlay_) + overlay_->GetGraphicsLayer()->Paint(nullptr); +} + DEFINE_TRACE(ValidationMessageClientImpl) { visitor->Trace(current_anchor_); ValidationMessageClient::Trace(visitor);
diff --git a/third_party/WebKit/Source/core/page/ValidationMessageClientImpl.h b/third_party/WebKit/Source/core/page/ValidationMessageClientImpl.h index e261d96..56a8b45 100644 --- a/third_party/WebKit/Source/core/page/ValidationMessageClientImpl.h +++ b/third_party/WebKit/Source/core/page/ValidationMessageClientImpl.h
@@ -37,6 +37,7 @@ namespace blink { class LocalFrameView; +class PageOverlay; class WebViewBase; class CORE_EXPORT ValidationMessageClientImpl final @@ -65,6 +66,8 @@ bool IsValidationMessageVisible(const Element& anchor) override; void DocumentDetached(const Document&) override; void WillBeDestroyed() override; + void LayoutOverlay() override; + void PaintOverlay() override; // PopupOpeningObserver function void WillOpenPopup() override; @@ -76,6 +79,7 @@ float last_page_scale_factor_; double finish_time_; std::unique_ptr<TimerBase> timer_; + std::unique_ptr<PageOverlay> overlay_; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/page/ValidationMessageOverlayDelegate.cpp b/third_party/WebKit/Source/core/page/ValidationMessageOverlayDelegate.cpp new file mode 100644 index 0000000..00c27c8 --- /dev/null +++ b/third_party/WebKit/Source/core/page/ValidationMessageOverlayDelegate.cpp
@@ -0,0 +1,124 @@ +// Copyright 2017 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 "core/page/ValidationMessageOverlayDelegate.h" + +#include "core/frame/Settings.h" +#include "core/frame/VisualViewport.h" +#include "core/loader/EmptyClients.h" +#include "core/page/Page.h" +#include "platform/graphics/paint/CullRect.h" + +namespace blink { + +// ChromeClient for an internal page of ValidationMessageOverlayDelegate. +class ValidationMessageChromeClient : public EmptyChromeClient { + public: + explicit ValidationMessageChromeClient(ChromeClient& main_chrome_client, + PageOverlay& overlay) + : main_chrome_client_(main_chrome_client), overlay_(overlay) {} + + DEFINE_INLINE_TRACE() { + visitor->Trace(main_chrome_client_); + EmptyChromeClient::Trace(visitor); + } + + void InvalidateRect(const IntRect&) override { overlay_.Update(); } + + void ScheduleAnimation(const PlatformFrameView* frame_view) override { + main_chrome_client_->ScheduleAnimation(frame_view); + } + + private: + Member<ChromeClient> main_chrome_client_; + PageOverlay& overlay_; +}; + +inline ValidationMessageOverlayDelegate::ValidationMessageOverlayDelegate( + Page& page, + const Element& anchor, + const String& message, + TextDirection message_dir, + const String& sub_message, + TextDirection sub_message_dir) + : main_page_(page) {} + +std::unique_ptr<ValidationMessageOverlayDelegate> +ValidationMessageOverlayDelegate::Create(Page& page, + const Element& anchor, + const String& message, + TextDirection message_dir, + const String& sub_message, + TextDirection sub_message_dir) { + return WTF::WrapUnique(new ValidationMessageOverlayDelegate( + page, anchor, message, message_dir, sub_message, sub_message_dir)); +} + +ValidationMessageOverlayDelegate::~ValidationMessageOverlayDelegate() { + if (page_) + page_->WillBeDestroyed(); +} + +LocalFrameView& ValidationMessageOverlayDelegate::FrameView() const { + DCHECK(page_) + << "Do not call FrameView() before the first call of EnsurePage()"; + return *ToLocalFrame(page_->MainFrame())->View(); +} + +void ValidationMessageOverlayDelegate::PaintPageOverlay( + const PageOverlay& overlay, + GraphicsContext& context, + const WebSize& view_size) const { + const_cast<ValidationMessageOverlayDelegate*>(this)->UpdateFrameViewState( + overlay, view_size); + LocalFrameView& view = FrameView(); + view.Paint(context, CullRect(IntRect(0, 0, view.Width(), view.Height()))); +} + +void ValidationMessageOverlayDelegate::UpdateFrameViewState( + const PageOverlay& overlay, + const IntSize& view_size) { + EnsurePage(overlay, view_size); + if (FrameView().Size() != view_size) { + FrameView().Resize(view_size); + page_->GetVisualViewport().SetSize(view_size); + } + FrameView().UpdateAllLifecyclePhases(); +} + +void ValidationMessageOverlayDelegate::EnsurePage(const PageOverlay& overlay, + const IntSize& view_size) { + if (page_) + return; + // TODO(tkent): Can we share code with WebPagePopupImpl and + // InspectorOverlayAgent? + Page::PageClients page_clients; + FillWithEmptyClients(page_clients); + chrome_client_ = new ValidationMessageChromeClient( + main_page_->GetChromeClient(), const_cast<PageOverlay&>(overlay)); + page_clients.chrome_client = chrome_client_; + Settings& main_settings = main_page_->GetSettings(); + page_ = Page::Create(page_clients); + page_->GetSettings().SetMinimumFontSize(main_settings.GetMinimumFontSize()); + page_->GetSettings().SetMinimumLogicalFontSize( + main_settings.GetMinimumLogicalFontSize()); + page_->GetSettings().SetAcceleratedCompositingEnabled(false); + + LocalFrame* frame = + LocalFrame::Create(EmptyLocalFrameClient::Create(), *page_, nullptr); + frame->SetView(LocalFrameView::Create(*frame, view_size)); + frame->Init(); + frame->View()->SetCanHaveScrollbars(false); + frame->View()->SetBaseBackgroundColor(Color::kTransparent); + page_->GetVisualViewport().SetSize(view_size); + + RefPtr<SharedBuffer> data = SharedBuffer::Create(); + // TODO(tkent): Pour HTML into |data|. + frame->Loader().Load( + FrameLoadRequest(nullptr, ResourceRequest(BlankURL()), + SubstituteData(data, "text/html", "UTF-8", KURL(), + kForceSynchronousLoad))); +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/core/page/ValidationMessageOverlayDelegate.h b/third_party/WebKit/Source/core/page/ValidationMessageOverlayDelegate.h new file mode 100644 index 0000000..06baa59 --- /dev/null +++ b/third_party/WebKit/Source/core/page/ValidationMessageOverlayDelegate.h
@@ -0,0 +1,61 @@ +// Copyright 2017 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 ValidationMessageOverlayDelegate_h +#define ValidationMessageOverlayDelegate_h + +#include "core/page/PageOverlay.h" +#include "platform/text/TextDirection.h" +#include "platform/wtf/Forward.h" + +namespace blink { + +class ChromeClient; +class Element; +class LocalFrameView; +class Page; + +// A ValidationMessageOverlayDelegate is responsible for rendering a form +// validation message bubble. +// +// Lifetime: An instance is created by a ValidationMessageClientImpl when a +// bubble is shown, and deleted when the bubble is closed. +// +// Ownership: A PageOverlay instance owns a ValidationMessageOverlayDelegate. +class ValidationMessageOverlayDelegate : public PageOverlay::Delegate { + public: + static std::unique_ptr<ValidationMessageOverlayDelegate> Create( + Page&, + const Element& anchor, + const String& message, + TextDirection message_dir, + const String& sub_message, + TextDirection sub_message_dir); + ~ValidationMessageOverlayDelegate() override; + + void PaintPageOverlay(const PageOverlay&, + GraphicsContext&, + const WebSize& view_size) const override; + + private: + ValidationMessageOverlayDelegate(Page&, + const Element& anchor, + const String& message, + TextDirection message_dir, + const String& sub_message, + TextDirection sub_message_dir); + LocalFrameView& FrameView() const; + void UpdateFrameViewState(const PageOverlay&, const IntSize& view_size); + void EnsurePage(const PageOverlay&, const IntSize& view_size); + + // An internal Page and a ChromeClient for it. + Persistent<Page> page_; + Persistent<ChromeClient> chrome_client_; + + // A page which triggered this validation message. + Persistent<Page> main_page_; +}; + +} // namespace blink +#endif // ValidationMessageOverlayDelegate_h
diff --git a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp index 7fe7f7a..23c13dc 100644 --- a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp +++ b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
@@ -219,11 +219,12 @@ for (const AppliedTextDecoration& decoration : decorations) { TextDecoration lines = decoration.Lines(); + bool has_underline = EnumHasFlags(lines, TextDecoration::kUnderline); + bool has_overline = EnumHasFlags(lines, TextDecoration::kOverline); if (flip_underline_and_overline) { - lines ^= (TextDecoration::kUnderline | TextDecoration::kOverline); + std::swap(has_underline, has_overline); } - if (EnumHasFlags(lines, TextDecoration::kUnderline) && - decoration_info.font_data) { + if (has_underline && decoration_info.font_data) { const int underline_offset = ComputeUnderlineOffset( underline_position, *decoration_info.style, decoration_info.font_data->GetFontMetrics(), &box, decorating_box, @@ -232,7 +233,7 @@ context, decoration_info, decoration, underline_offset, decoration_info.double_offset); } - if (EnumHasFlags(lines, TextDecoration::kOverline)) { + if (has_overline) { const int overline_offset = ComputeUnderlineOffsetForUnder( *decoration_info.style, &box, decorating_box, decoration_info.thickness,
diff --git a/third_party/WebKit/Source/core/scheduler/ThrottlingTest.cpp b/third_party/WebKit/Source/core/scheduler/ThrottlingTest.cpp index 514bf76..32679ca 100644 --- a/third_party/WebKit/Source/core/scheduler/ThrottlingTest.cpp +++ b/third_party/WebKit/Source/core/scheduler/ThrottlingTest.cpp
@@ -60,7 +60,7 @@ // Run delayed tasks for 1 second. All tasks should be completed // with throttling disabled. - testing::RunDelayedTasks(1000); + testing::RunDelayedTasks(TimeDelta::FromSeconds(1)); EXPECT_THAT(ConsoleMessages(), ElementsAre("called f", "called f", "called f", "called f", "called f")); @@ -92,7 +92,7 @@ // Make sure that we run a task once a second. for (int i = 0; i < 3; ++i) { - testing::RunDelayedTasks(1000); + testing::RunDelayedTasks(TimeDelta::FromSeconds(1)); EXPECT_THAT(ConsoleMessages(), ElementsAre("called f")); ConsoleMessages().clear(); }
diff --git a/third_party/WebKit/Source/core/style/ComputedStyleConstants.h b/third_party/WebKit/Source/core/style/ComputedStyleConstants.h index 60579728..fb5bf4b 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyleConstants.h +++ b/third_party/WebKit/Source/core/style/ComputedStyleConstants.h
@@ -168,8 +168,6 @@ enum OffsetRotationType { kOffsetRotationAuto, kOffsetRotationFixed }; -enum ELineClampType { kLineClampLineCount, kLineClampPercentage }; - enum class TextEmphasisMark { kNone, kAuto,
diff --git a/third_party/WebKit/Source/core/style/LineClampValue.h b/third_party/WebKit/Source/core/style/LineClampValue.h index 2c43e227..8d3e194 100644 --- a/third_party/WebKit/Source/core/style/LineClampValue.h +++ b/third_party/WebKit/Source/core/style/LineClampValue.h
@@ -31,17 +31,19 @@ namespace blink { +enum class LineClampType { kLineCount, kPercentage }; + class LineClampValue { DISALLOW_NEW(); public: - LineClampValue() : type_(kLineClampLineCount), value_(-1) {} + LineClampValue() : type_(LineClampType::kLineCount), value_(-1) {} - LineClampValue(int value, ELineClampType type) : type_(type), value_(value) {} + LineClampValue(int value, LineClampType type) : type_(type), value_(value) {} int Value() const { return value_; } - bool IsPercentage() const { return type_ == kLineClampPercentage; } + bool IsPercentage() const { return type_ == LineClampType::kPercentage; } bool IsNone() const { return value_ == -1; } @@ -52,7 +54,7 @@ bool operator!=(const LineClampValue& o) const { return !(*this == o); } private: - ELineClampType type_; + LineClampType type_; int value_; };
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImageTest.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImageTest.cpp index b3d407cc..50bd450 100644 --- a/third_party/WebKit/Source/core/svg/graphics/SVGImageTest.cpp +++ b/third_party/WebKit/Source/core/svg/graphics/SVGImageTest.cpp
@@ -103,9 +103,8 @@ // Fire the timer/trigger a frame update. Since the observer always returns // true for shouldPauseAnimation, this will result in the timeline being // suspended. - // TODO(alexclarke): Move over to using base::TimeDelta and base::TimeTicks so - // we can avoid computations like this. - testing::RunDelayedTasks(1.0 + timer->NextFireInterval() * 1000.0); + testing::RunDelayedTasks(TimeDelta::FromMilliseconds(1) + + TimeDelta::FromSecondsD(timer->NextFireInterval())); EXPECT_TRUE(chrome_client.IsSuspended()); EXPECT_FALSE(timer->IsActive()); @@ -136,9 +135,8 @@ // Fire the timer/trigger a frame update. The timeline will remain // suspended and no frame will be scheduled. - // TODO(alexclarke): Move over to using base::TimeDelta and base::TimeTicks so - // we can avoid computations like this. - testing::RunDelayedTasks(1.0 + timer->NextFireInterval() * 1000.0); + testing::RunDelayedTasks(TimeDelta::FromMillisecondsD(1) + + TimeDelta::FromSecondsD(timer->NextFireInterval())); EXPECT_TRUE(chrome_client.IsSuspended()); EXPECT_FALSE(timer->IsActive());
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp index be475e92..2ddae2ac 100644 --- a/third_party/WebKit/Source/core/testing/Internals.cpp +++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -3262,7 +3262,7 @@ } bool Internals::isUseCounted(Document* document, uint32_t feature) { - if (feature >= static_cast<uint32_t>(WebFeature::kNumberOfFeatures)) + if (feature >= static_cast<int32_t>(WebFeature::kNumberOfFeatures)) return false; return UseCounter::IsCounted(*document, static_cast<WebFeature>(feature)); } @@ -3313,7 +3313,7 @@ uint32_t feature) { ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); ScriptPromise promise = resolver->Promise(); - if (feature >= static_cast<uint32_t>(WebFeature::kNumberOfFeatures)) { + if (feature >= static_cast<int32_t>(WebFeature::kNumberOfFeatures)) { resolver->Reject(); return promise; }
diff --git a/third_party/WebKit/Source/core/testing/WorkerInternals.cpp b/third_party/WebKit/Source/core/testing/WorkerInternals.cpp index 04ca57507..21866863 100644 --- a/third_party/WebKit/Source/core/testing/WorkerInternals.cpp +++ b/third_party/WebKit/Source/core/testing/WorkerInternals.cpp
@@ -24,7 +24,7 @@ void WorkerInternals::countFeature(ScriptState* script_state, uint32_t feature, ExceptionState& exception_state) { - if (static_cast<uint32_t>(WebFeature::kNumberOfFeatures) <= feature) { + if (static_cast<int32_t>(WebFeature::kNumberOfFeatures) <= feature) { exception_state.ThrowTypeError( "The given feature does not exist in WebFeature."); return; @@ -36,7 +36,7 @@ void WorkerInternals::countDeprecation(ScriptState* script_state, uint32_t feature, ExceptionState& exception_state) { - if (static_cast<uint32_t>(WebFeature::kNumberOfFeatures) <= feature) { + if (static_cast<int32_t>(WebFeature::kNumberOfFeatures) <= feature) { exception_state.ThrowTypeError( "The given feature does not exist in WebFeature."); return;
diff --git a/third_party/WebKit/Source/core/testing/data/mhtml/simple_test.mht b/third_party/WebKit/Source/core/testing/data/mhtml/simple_test.mht index cf0d82f..f0afef3 100644 --- a/third_party/WebKit/Source/core/testing/data/mhtml/simple_test.mht +++ b/third_party/WebKit/Source/core/testing/data/mhtml/simple_test.mht
@@ -1,19 +1,19 @@ -From: "Saved by Windows Internet Explorer 9" -Subject: A simple page -Date: Wed, 18 May 2011 16:50:01 -0700 -MIME-Version: 1.0 -Content-Type: text/html; - charset="Windows-1252" -Content-Transfer-Encoding: quoted-printable -Content-Location: http://localhost/simple_page.html -X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7600.16776 - -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> -<HTML><HEAD><TITLE>A simple page</TITLE> -<META content=3D"text/html; charset=3Dwindows-1252" = -http-equiv=3DContent-Type> - -<META name=3DGENERATOR content=3D"MSHTML 9.00.8112.16421"></HEAD> -<BODY> -<H1>This is a very simple page</H1>Very <B>basic</B> page. = -</BODY></HTML> +From: "Saved by Windows Internet Explorer 9" +Subject: A simple page +Date: Wed, 18 May 2011 16:50:01 -0700 +MIME-Version: 1.0 +Content-Type: text/html; + charset="Windows-1252" +Content-Transfer-Encoding: quoted-printable +Content-Location: http://localhost/simple_page.html +X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7600.16776 + +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<HTML><HEAD><TITLE>A simple page</TITLE> +<META content=3D"text/html; charset=3Dwindows-1252" = +http-equiv=3DContent-Type> + +<META name=3DGENERATOR content=3D"MSHTML 9.00.8112.16421"></HEAD> +<BODY> +<H1>This is a very simple page</H1>Very <B>basic</B> page. = +</BODY></HTML>
diff --git a/third_party/WebKit/Source/core/testing/sim/SimRequest.h b/third_party/WebKit/Source/core/testing/sim/SimRequest.h index 8984026..5030b6ca 100644 --- a/third_party/WebKit/Source/core/testing/sim/SimRequest.h +++ b/third_party/WebKit/Source/core/testing/sim/SimRequest.h
@@ -12,7 +12,6 @@ namespace blink { class SimNetwork; -class WebURLLoader; class WebURLLoaderClient; // Simulates a single request for a resource from the server. Requires a @@ -51,7 +50,6 @@ void DidFail(const WebURLError&); String url_; - WebURLLoader* loader_; WebURLResponse response_; WebURLError error_; WebURLLoaderClient* client_;
diff --git a/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp b/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp index c735ac1..1ebf952 100644 --- a/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp +++ b/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp
@@ -29,9 +29,9 @@ // activity report separately. If the intervals are very short, they are // notified to the main thread almost at the same time and the thread may miss // the second notification. -const double kDefaultIntervalInSec = 0.01; -const double kNextIntervalInSec = 0.01; -const double kMaxIntervalInSec = 0.02; +constexpr double kDefaultIntervalInSec = 0.01; +constexpr double kNextIntervalInSec = 0.01; +constexpr double kMaxIntervalInSec = 0.02; } // namespace @@ -384,8 +384,8 @@ // pending activity until it's stopped. The delay is equal to the max // interval so that the pending activity timer may be able to have a chance // to run before the next expectation check. - const double kDelayInMs = kMaxIntervalInSec * 1000; - testing::RunDelayedTasks(kDelayInMs); + constexpr TimeDelta kDelay = TimeDelta::FromSecondsD(kMaxIntervalInSec); + testing::RunDelayedTasks(kDelay); EXPECT_TRUE(WorkerMessagingProxy()->HasPendingActivity()); // Stop the timer.
diff --git a/third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.cpp b/third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.cpp index 02f5085..350f6c8 100644 --- a/third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.cpp +++ b/third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.cpp
@@ -12,17 +12,28 @@ namespace blink { +ParentFrameTaskRunners* ParentFrameTaskRunners::Create(LocalFrame& frame) { + DCHECK(frame.GetDocument()); + DCHECK(frame.GetDocument()->IsContextThread()); + DCHECK(IsMainThread()); + return new ParentFrameTaskRunners(&frame); +} + +ParentFrameTaskRunners* ParentFrameTaskRunners::Create() { + return new ParentFrameTaskRunners(nullptr); +} + ParentFrameTaskRunners::ParentFrameTaskRunners(LocalFrame* frame) : ContextLifecycleObserver(frame ? frame->GetDocument() : nullptr) { - if (frame && frame->GetDocument()) - DCHECK(frame->GetDocument()->IsContextThread()); - // For now we only support very limited task types. for (auto type : {TaskType::kUnspecedTimer, TaskType::kUnspecedLoading, TaskType::kNetworking, TaskType::kPostedMessage, TaskType::kCanvasBlobSerialization, TaskType::kUnthrottled}) { - task_runners_.insert(type, TaskRunnerHelper::Get(type, frame)); + auto task_runner = + frame ? TaskRunnerHelper::Get(type, frame) + : Platform::Current()->MainThread()->GetWebTaskRunner(); + task_runners_.insert(type, std::move(task_runner)); } }
diff --git a/third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.h b/third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.h index 9e5da927..398a8403 100644 --- a/third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.h +++ b/third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.h
@@ -20,12 +20,9 @@ class WebTaskRunner; // Represents a set of task runners of the parent (or associated) document's -// frame. This could be accessed from worker thread(s) and must be initialized -// on the parent context thread (i.e. MainThread) on construction time, rather -// than being done lazily. +// frame, or default task runners of the main thread. // -// This observes LocalFrame lifecycle only for in-process worker cases (i.e. -// only when a non-null LocalFrame is given). +// This observes LocalFrame lifecycle only when this is created with LocalFrame. class CORE_EXPORT ParentFrameTaskRunners final : public GarbageCollectedFinalized<ParentFrameTaskRunners>, public ContextLifecycleObserver { @@ -33,11 +30,18 @@ WTF_MAKE_NONCOPYABLE(ParentFrameTaskRunners); public: - static ParentFrameTaskRunners* Create(LocalFrame* frame) { - return new ParentFrameTaskRunners(frame); - } + // Returns task runners associated with a given frame. This must be called on + // the frame's context thread, that is, the main thread. The given frame must + // have a valid execution context. + static ParentFrameTaskRunners* Create(LocalFrame&); - // Might return nullptr for unsupported task types. + // Returns default task runners of the main thread. This can be called from + // any threads. This must be used only for shared workers, service workers and + // tests that don't have a parent frame. + static ParentFrameTaskRunners* Create(); + + // Might return nullptr for unsupported task types. This can be called from + // any threads. RefPtr<WebTaskRunner> Get(TaskType); DECLARE_VIRTUAL_TRACE();
diff --git a/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp b/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp index 7cba209..505b177 100644 --- a/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp +++ b/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp
@@ -34,7 +34,7 @@ worker_clients_(worker_clients), worker_inspector_proxy_(WorkerInspectorProxy::Create()), parent_frame_task_runners_(ParentFrameTaskRunners::Create( - ToDocument(execution_context_.Get())->GetFrame())), + *ToDocument(execution_context_.Get())->GetFrame())), asked_to_terminate_(false), keep_alive_(this) { DCHECK(IsParentContextThread());
diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.cpp b/third_party/WebKit/Source/core/workers/WorkerThread.cpp index ae873e0..99faf1b 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -46,6 +46,7 @@ #include "core/workers/WorkerThreadStartupData.h" #include "platform/CrossThreadFunctional.h" #include "platform/Histogram.h" +#include "platform/RuntimeEnabledFeatures.h" #include "platform/WaitableEvent.h" #include "platform/WebThreadSupportingGC.h" #include "platform/bindings/Microtask.h" @@ -66,7 +67,7 @@ using ExitCode = WorkerThread::ExitCode; // TODO(nhiroki): Adjust the delay based on UMA. -const long long kForcibleTerminationDelayInMs = 2000; // 2 secs +constexpr TimeDelta kForcibleTerminationDelay = TimeDelta::FromSeconds(2); static Mutex& ThreadSetMutex() { DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, ()); @@ -96,10 +97,7 @@ void WorkerThread::Start(std::unique_ptr<WorkerThreadStartupData> startup_data, ParentFrameTaskRunners* parent_frame_task_runners) { DCHECK(IsMainThread()); - if (requested_to_start_) - return; - - requested_to_start_ = true; + DCHECK(!parent_frame_task_runners_); parent_frame_task_runners_ = parent_frame_task_runners; // Synchronously initialize the per-global-scope scheduler to prevent someone @@ -120,20 +118,56 @@ void WorkerThread::Terminate() { DCHECK(IsMainThread()); - TerminateInternal(TerminationMode::kGraceful); + + { + MutexLocker lock(thread_state_mutex_); + + if (requested_to_terminate_) + return; + requested_to_terminate_ = true; + + if (ShouldScheduleToTerminateExecution(lock)) { + // Schedule a task to forcibly terminate the script execution in case that + // the shutdown sequence does not start on the worker thread in a certain + // time period. + DCHECK(!forcible_termination_task_handle_.IsActive()); + forcible_termination_task_handle_ = + parent_frame_task_runners_->Get(TaskType::kUnspecedTimer) + ->PostDelayedCancellableTask( + BLINK_FROM_HERE, + WTF::Bind(&WorkerThread::EnsureScriptExecutionTerminates, + WTF::Unretained(this), + ExitCode::kAsyncForciblyTerminated), + forcible_termination_delay_); + } + } + + worker_thread_lifecycle_context_->NotifyContextDestroyed(); + inspector_task_runner_->Kill(); + + GetWorkerBackingThread().BackingThread().PostTask( + BLINK_FROM_HERE, + CrossThreadBind(&WorkerThread::PrepareForShutdownOnWorkerThread, + CrossThreadUnretained(this))); + GetWorkerBackingThread().BackingThread().PostTask( + BLINK_FROM_HERE, + CrossThreadBind(&WorkerThread::PerformShutdownOnWorkerThread, + CrossThreadUnretained(this))); } -void WorkerThread::TerminateAndWaitForAllWorkers() { +void WorkerThread::TerminateAllWorkersForTesting() { DCHECK(IsMainThread()); // Keep this lock to prevent WorkerThread instances from being destroyed. MutexLocker lock(ThreadSetMutex()); HashSet<WorkerThread*> threads = WorkerThreads(); - // The main thread will be blocked, so asynchronous graceful shutdown does - // not work. - for (WorkerThread* thread : threads) - thread->TerminateInternal(TerminationMode::kForcible); + for (WorkerThread* thread : threads) { + // Schedule a regular async worker thread termination task, and forcibly + // terminate the V8 script execution to ensure the task runs. + thread->Terminate(); + thread->EnsureScriptExecutionTerminates(ExitCode::kSyncForciblyTerminated); + } for (WorkerThread* thread : threads) thread->shutdown_event_->Wait(); @@ -246,8 +280,6 @@ } PlatformThreadId WorkerThread::GetPlatformThreadId() { - if (!requested_to_start_) - return 0; return GetWorkerBackingThread().BackingThread().PlatformThread().ThreadId(); } @@ -268,6 +300,11 @@ return false; } +ExitCode WorkerThread::GetExitCodeForTesting() { + MutexLocker lock(thread_state_mutex_); + return exit_code_; +} + InterfaceProvider* WorkerThread::GetInterfaceProvider() { // TODO(https://crbug.com/734210): Instead of returning this interface // provider, which maps to a RenderProcessHost in the browser process, this @@ -279,7 +316,7 @@ WorkerThread::WorkerThread(ThreadableLoadingContext* loading_context, WorkerReportingProxy& worker_reporting_proxy) : worker_thread_id_(GetNextWorkerThreadId()), - forcible_termination_delay_in_ms_(kForcibleTerminationDelayInMs), + forcible_termination_delay_(kForcibleTerminationDelay), inspector_task_runner_(WTF::MakeUnique<InspectorTaskRunner>()), loading_context_(loading_context), worker_reporting_proxy_(worker_reporting_proxy), @@ -292,71 +329,6 @@ WorkerThreads().insert(this); } -void WorkerThread::TerminateInternal(TerminationMode mode) { - DCHECK(IsMainThread()); - DCHECK(requested_to_start_); - - { - // Protect against this method, initializeOnWorkerThread() or - // termination via the global scope racing each other. - MutexLocker lock(thread_state_mutex_); - - // If terminate has already been called. - if (requested_to_terminate_) { - if (running_debugger_task_) { - // Any debugger task is guaranteed to finish, so we can wait - // for the completion even if the synchronous forcible - // termination is requested. Shutdown sequence will start - // after the task. - DCHECK(!forcible_termination_task_handle_.IsActive()); - return; - } - - // The synchronous forcible termination request should overtake the - // scheduled termination task because the request will block the - // main thread and the scheduled termination task never runs. - if (mode == TerminationMode::kForcible && - exit_code_ == ExitCode::kNotTerminated) { - DCHECK(forcible_termination_task_handle_.IsActive()); - ForciblyTerminateExecution(lock, ExitCode::kSyncForciblyTerminated); - } - return; - } - requested_to_terminate_ = true; - - if (ShouldScheduleToTerminateExecution(lock)) { - switch (mode) { - case TerminationMode::kForcible: - ForciblyTerminateExecution(lock, ExitCode::kSyncForciblyTerminated); - break; - case TerminationMode::kGraceful: - DCHECK(!forcible_termination_task_handle_.IsActive()); - forcible_termination_task_handle_ = - parent_frame_task_runners_->Get(TaskType::kUnspecedTimer) - ->PostDelayedCancellableTask( - BLINK_FROM_HERE, - WTF::Bind(&WorkerThread::MayForciblyTerminateExecution, - WTF::Unretained(this)), - TimeDelta::FromMilliseconds( - forcible_termination_delay_in_ms_)); - break; - } - } - } - - worker_thread_lifecycle_context_->NotifyContextDestroyed(); - inspector_task_runner_->Kill(); - - GetWorkerBackingThread().BackingThread().PostTask( - BLINK_FROM_HERE, - CrossThreadBind(&WorkerThread::PrepareForShutdownOnWorkerThread, - CrossThreadUnretained(this))); - GetWorkerBackingThread().BackingThread().PostTask( - BLINK_FROM_HERE, - CrossThreadBind(&WorkerThread::PerformShutdownOnWorkerThread, - CrossThreadUnretained(this))); -} - bool WorkerThread::ShouldScheduleToTerminateExecution(const MutexLocker& lock) { DCHECK(IsMainThread()); DCHECK(IsThreadStateMutexLocked(lock)); @@ -380,17 +352,11 @@ return false; } -void WorkerThread::MayForciblyTerminateExecution() { +void WorkerThread::EnsureScriptExecutionTerminates(ExitCode exit_code) { DCHECK(IsMainThread()); MutexLocker lock(thread_state_mutex_); - if (ShouldScheduleToTerminateExecution(lock)) - ForciblyTerminateExecution(lock, ExitCode::kAsyncForciblyTerminated); -} - -void WorkerThread::ForciblyTerminateExecution(const MutexLocker& lock, - ExitCode exit_code) { - DCHECK(IsMainThread()); - DCHECK(IsThreadStateMutexLocked(lock)); + if (!ShouldScheduleToTerminateExecution(lock)) + return; DCHECK(exit_code == ExitCode::kSyncForciblyTerminated || exit_code == ExitCode::kAsyncForciblyTerminated); @@ -482,7 +448,8 @@ String source_code; std::unique_ptr<Vector<char>> cached_meta_data; - if (GetInstalledScriptsManager() && + if (RuntimeEnabledFeatures::ServiceWorkerScriptStreamingEnabled() && + GetInstalledScriptsManager() && GetInstalledScriptsManager()->IsScriptInstalled(script_url)) { // TODO(shimazu): Set ContentSecurityPolicy, ReferrerPolicy and // OriginTrialTokens to |startup_data|. @@ -643,9 +610,4 @@ return requested_to_terminate_; } -ExitCode WorkerThread::GetExitCodeForTesting() { - MutexLocker lock(thread_state_mutex_); - return exit_code_; -} - } // namespace blink
diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.h b/third_party/WebKit/Source/core/workers/WorkerThread.h index fcc6520ba..ef5b0c0 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThread.h +++ b/third_party/WebKit/Source/core/workers/WorkerThread.h
@@ -92,9 +92,12 @@ void Start(std::unique_ptr<WorkerThreadStartupData>, ParentFrameTaskRunners*); void Terminate(); - // Called on the main thread for the leak detector. Waits by *blocking* the - // calling thread until the workers are shut down. - static void TerminateAndWaitForAllWorkers(); + // Called on the main thread for the leak detector. Forcibly terminates the + // script execution and waits by *blocking* the calling thread until the + // workers are shut down. Please be careful when using this function, because + // after the synchronous termination any V8 APIs may suddenly start to return + // empty handles and it may cause crashes. + static void TerminateAllWorkersForTesting(); // WebThread::TaskObserver. void WillProcessTask() override; @@ -147,6 +150,7 @@ bool IsForciblyTerminated(); void WaitForShutdownForTesting() { shutdown_event_->Wait(); } + ExitCode GetExitCodeForTesting(); ParentFrameTaskRunners* GetParentFrameTaskRunners() const { return parent_frame_task_runners_.Get(); @@ -188,18 +192,6 @@ FRIEND_TEST_ALL_PREFIXES(WorkerThreadTest, Terminate_WhileDebuggerTaskIsRunning); - enum class TerminationMode { - // Synchronously terminate the worker execution. Please be careful to - // use this mode, because after the synchronous termination any V8 APIs - // may suddenly start to return empty handles and it may cause crashes. - kForcible, - - // Don't synchronously terminate the worker execution. Instead, schedule - // a task to terminate it in case that the shutdown sequence does not - // start on the worker thread in a certain time period. - kGraceful, - }; - // Represents the state of this worker thread. A caller may need to acquire // a lock |m_threadStateMutex| before accessing this: // - Only the worker thread can set this with the lock. @@ -211,24 +203,18 @@ kReadyToShutdown, }; - void TerminateInternal(TerminationMode); - // Returns true if we should synchronously terminate or schedule to // terminate the worker execution so that a shutdown task can be handled by // the thread event loop. This must be called with |m_threadStateMutex| // acquired. bool ShouldScheduleToTerminateExecution(const MutexLocker&); - // Called as a delayed task to terminate the worker execution from the main - // thread. This task is expected to run when the shutdown sequence does not - // start in a certain time period because of an inifite loop in the JS - // execution context etc. When the shutdown sequence is started before this - // task runs, the task is simply cancelled. - void MayForciblyTerminateExecution(); - - // Forcibly terminates the worker execution. This must be called with - // |m_threadStateMutex| acquired. - void ForciblyTerminateExecution(const MutexLocker&, ExitCode); + // Terminates worker script execution if the worker thread is running and not + // already shutting down. Does not terminate if a debugger task is running, + // because the debugger task is guaranteed to finish and it heavily uses V8 + // API calls which would crash after forcible script termination. Called on + // the main thread. + void EnsureScriptExecutionTerminates(ExitCode); void InitializeSchedulerOnWorkerThread(WaitableEvent*); void InitializeOnWorkerThread(std::unique_ptr<WorkerThreadStartupData>); @@ -250,14 +236,9 @@ // |m_requestedToTerminate|. bool CheckRequestedToTerminateOnWorkerThread(); - ExitCode GetExitCodeForTesting(); - // A unique identifier among all WorkerThreads. const int worker_thread_id_; - // Accessed only on the main thread. - bool requested_to_start_ = false; - // Set on the main thread and checked on both the main and worker threads. bool requested_to_terminate_ = false; @@ -270,7 +251,7 @@ ThreadState thread_state_ = ThreadState::kNotStarted; ExitCode exit_code_ = ExitCode::kNotTerminated; - long long forcible_termination_delay_in_ms_; + TimeDelta forcible_termination_delay_; std::unique_ptr<InspectorTaskRunner> inspector_task_runner_;
diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp index 1c608538..356dbdd 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
@@ -79,23 +79,21 @@ void TearDown() override {} void Start() { - worker_thread_->StartWithSourceCode( - security_origin_.Get(), "//fake source code", - ParentFrameTaskRunners::Create(nullptr)); + worker_thread_->StartWithSourceCode(security_origin_.Get(), + "//fake source code", + ParentFrameTaskRunners::Create()); } void StartWithSourceCodeNotToFinish() { // Use a JavaScript source code that makes an infinite loop so that we // can catch some kind of issues as a timeout. - worker_thread_->StartWithSourceCode( - security_origin_.Get(), "while(true) {}", - ParentFrameTaskRunners::Create(nullptr)); + worker_thread_->StartWithSourceCode(security_origin_.Get(), + "while(true) {}", + ParentFrameTaskRunners::Create()); } - void SetForcibleTerminationDelayInMs( - long long forcible_termination_delay_in_ms) { - worker_thread_->forcible_termination_delay_in_ms_ = - forcible_termination_delay_in_ms; + void SetForcibleTerminationDelay(TimeDelta forcible_termination_delay) { + worker_thread_->forcible_termination_delay_ = forcible_termination_delay; } bool IsForcibleTerminationTaskScheduled() { @@ -189,8 +187,13 @@ // idle. worker_thread_->WaitForInit(); - WorkerThread::TerminateAndWaitForAllWorkers(); - EXPECT_EQ(ExitCode::kSyncForciblyTerminated, GetExitCode()); + WorkerThread::TerminateAllWorkersForTesting(); + + // The worker thread may gracefully shut down before forcible termination + // runs. + ExitCode exit_code = GetExitCode(); + EXPECT_TRUE(ExitCode::kGracefullyTerminated == exit_code || + ExitCode::kSyncForciblyTerminated == exit_code); } TEST_F(WorkerThreadTest, AsyncTerminate_ImmediatelyAfterStart) { @@ -218,15 +221,15 @@ // TODO(nhiroki): Make this test deterministically pass through the case 1), // that is, terminateAndWait() is called before initializeOnWorkerThread(). // Then, rename this test to SyncTerminate_BeforeInitialization. - WorkerThread::TerminateAndWaitForAllWorkers(); + WorkerThread::TerminateAllWorkersForTesting(); ExitCode exit_code = GetExitCode(); EXPECT_TRUE(ExitCode::kGracefullyTerminated == exit_code || ExitCode::kSyncForciblyTerminated == exit_code); } TEST_F(WorkerThreadTest, AsyncTerminate_WhileTaskIsRunning) { - const long long kForcibleTerminationDelayInMs = 10; - SetForcibleTerminationDelayInMs(kForcibleTerminationDelayInMs); + constexpr TimeDelta kDelay = TimeDelta::FromMilliseconds(10); + SetForcibleTerminationDelay(kDelay); ExpectReportingCallsForWorkerForciblyTerminated(); StartWithSourceCodeNotToFinish(); @@ -243,7 +246,7 @@ EXPECT_EQ(ExitCode::kNotTerminated, GetExitCode()); // Wait until the force termination task runs. - testing::RunDelayedTasks(kForcibleTerminationDelayInMs); + testing::RunDelayedTasks(kDelay); worker_thread_->WaitForShutdownForTesting(); EXPECT_EQ(ExitCode::kAsyncForciblyTerminated, GetExitCode()); } @@ -254,14 +257,13 @@ reporting_proxy_->WaitUntilScriptEvaluation(); // terminateAndWait() synchronously terminates the worker execution. - WorkerThread::TerminateAndWaitForAllWorkers(); + WorkerThread::TerminateAllWorkersForTesting(); EXPECT_EQ(ExitCode::kSyncForciblyTerminated, GetExitCode()); } TEST_F(WorkerThreadTest, AsyncTerminateAndThenSyncTerminate_WhileTaskIsRunning) { - const long long kForcibleTerminationDelayInMs = 10; - SetForcibleTerminationDelayInMs(kForcibleTerminationDelayInMs); + SetForcibleTerminationDelay(TimeDelta::FromMilliseconds(10)); ExpectReportingCallsForWorkerForciblyTerminated(); StartWithSourceCodeNotToFinish(); @@ -273,7 +275,7 @@ EXPECT_EQ(ExitCode::kNotTerminated, GetExitCode()); // terminateAndWait() should overtake the scheduled force termination task. - WorkerThread::TerminateAndWaitForAllWorkers(); + WorkerThread::TerminateAllWorkersForTesting(); EXPECT_FALSE(IsForcibleTerminationTaskScheduled()); EXPECT_EQ(ExitCode::kSyncForciblyTerminated, GetExitCode()); } @@ -302,7 +304,7 @@ kWebAddressSpaceLocal, nullptr /* originTrialToken */, nullptr /* WorkerSettings */, WorkerV8Settings::Default()); worker_thread_->Start(std::move(startup_data), - ParentFrameTaskRunners::Create(nullptr)); + ParentFrameTaskRunners::Create()); // Used to wait for worker thread termination in a debugger task on the // worker thread. @@ -327,10 +329,10 @@ EXPECT_FALSE(IsForcibleTerminationTaskScheduled()); EXPECT_EQ(ExitCode::kNotTerminated, GetExitCode()); - // Focible termination request should also respect the running debugger + // Focible script termination request should also respect the running debugger // task. - worker_thread_->TerminateInternal(WorkerThread::TerminationMode::kForcible); - EXPECT_FALSE(IsForcibleTerminationTaskScheduled()); + worker_thread_->EnsureScriptExecutionTerminates( + ExitCode::kSyncForciblyTerminated); EXPECT_EQ(ExitCode::kNotTerminated, GetExitCode()); // Resume the debugger task. Shutdown starts after that. @@ -367,10 +369,10 @@ EXPECT_FALSE(IsForcibleTerminationTaskScheduled()); EXPECT_EQ(ExitCode::kNotTerminated, GetExitCode()); - // Focible termination request should also respect the running debugger + // Focible script termination request should also respect the running debugger // task. - worker_thread_->TerminateInternal(WorkerThread::TerminationMode::kForcible); - EXPECT_FALSE(IsForcibleTerminationTaskScheduled()); + worker_thread_->EnsureScriptExecutionTerminates( + ExitCode::kSyncForciblyTerminated); EXPECT_EQ(ExitCode::kNotTerminated, GetExitCode()); // Resume the debugger task. Shutdown starts after that.
diff --git a/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScopeTest.cpp b/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScopeTest.cpp index 276ffba..e1da93f9 100644 --- a/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScopeTest.cpp +++ b/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletGlobalScopeTest.cpp
@@ -51,7 +51,7 @@ nullptr, kDontPauseWorkerGlobalScopeOnStart, nullptr, "", security_origin_.Get(), clients, kWebAddressSpaceLocal, nullptr, nullptr, WorkerV8Settings::Default()), - ParentFrameTaskRunners::Create(nullptr)); + ParentFrameTaskRunners::Create()); return thread; }
diff --git a/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThreadTest.cpp b/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThreadTest.cpp index c35fa6b0..3897dd4 100644 --- a/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThreadTest.cpp +++ b/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThreadTest.cpp
@@ -87,7 +87,7 @@ nullptr, kDontPauseWorkerGlobalScopeOnStart, nullptr, "", security_origin_.Get(), clients, kWebAddressSpaceLocal, nullptr, nullptr, WorkerV8Settings::Default()), - ParentFrameTaskRunners::Create(nullptr)); + ParentFrameTaskRunners::Create()); return thread; }
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp index 6622674..1fee025 100644 --- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp +++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
@@ -96,7 +96,7 @@ public: void SetUp() override { CompositorWorkerThread::CreateSharedBackingThreadForTest(); - parent_frame_task_runners_ = ParentFrameTaskRunners::Create(nullptr); + parent_frame_task_runners_ = ParentFrameTaskRunners::Create(); object_proxy_ = TestCompositorWorkerObjectProxy::Create( parent_frame_task_runners_.Get()); security_origin_ =
diff --git a/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp b/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp index ff0faa6..48ea22b2 100644 --- a/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp +++ b/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp
@@ -105,9 +105,6 @@ installed_scripts_manager, std::unique_ptr<WebContentSettingsClient> content_settings_client) : worker_context_client_(std::move(client)), - installed_scripts_manager_( - WTF::MakeUnique<ServiceWorkerInstalledScriptsManager>( - std::move(installed_scripts_manager))), content_settings_client_(std::move(content_settings_client)), worker_inspector_proxy_(WorkerInspectorProxy::Create()), web_view_(nullptr), @@ -117,6 +114,13 @@ pause_after_download_state_(kDontPauseAfterDownload), waiting_for_debugger_state_(kNotWaitingForDebugger) { RunningWorkerInstances().insert(this); + + if (RuntimeEnabledFeatures::ServiceWorkerScriptStreamingEnabled()) { + DCHECK(installed_scripts_manager); + installed_scripts_manager_ = + WTF::MakeUnique<ServiceWorkerInstalledScriptsManager>( + std::move(installed_scripts_manager)); + } } WebEmbeddedWorkerImpl::~WebEmbeddedWorkerImpl() { @@ -339,7 +343,8 @@ // Kickstart the worker before loading the script when the script has been // installed. - if (installed_scripts_manager_->IsScriptInstalled( + if (RuntimeEnabledFeatures::ServiceWorkerScriptStreamingEnabled() && + installed_scripts_manager_->IsScriptInstalled( worker_start_data_.script_url)) { // TODO(shimazu): Move WorkerScriptLoaded to the correct place which is // after InstalledScriptsManager::GetScriptData() called at @@ -502,10 +507,9 @@ // We have a dummy document here for loading but it doesn't really represent // the document/frame of associated document(s) for this worker. Here we - // populate the task runners with null document not to confuse the frame - // scheduler (which will end up using the thread's default task runner). + // populate the task runners with default task runners of the main thread. worker_thread_->Start(std::move(startup_data), - ParentFrameTaskRunners::Create(nullptr)); + ParentFrameTaskRunners::Create()); worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), worker_start_data_.script_url);
diff --git a/third_party/WebKit/Source/modules/exported/WebLeakDetector.cpp b/third_party/WebKit/Source/modules/exported/WebLeakDetector.cpp index 15e2ab58..23e792a 100644 --- a/third_party/WebKit/Source/modules/exported/WebLeakDetector.cpp +++ b/third_party/WebKit/Source/modules/exported/WebLeakDetector.cpp
@@ -91,7 +91,7 @@ // here. V8PerIsolateData::From(isolate)->EnsureScriptRegexpContext(); - WorkerThread::TerminateAndWaitForAllWorkers(); + WorkerThread::TerminateAllWorkersForTesting(); GetMemoryCache()->EvictResources(); // If the spellchecker is allowed to continue issuing requests while the
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.cpp index e15b5d0..f7d96b7c 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.cpp
@@ -89,6 +89,8 @@ } // anonymous namespace +constexpr TimeDelta MediaControlsOrientationLockDelegate::kUnlockDelay; + MediaControlsOrientationLockDelegate::MediaControlsOrientationLockDelegate( HTMLVideoElement& video) : EventListener(kCPPEventListenerType), video_element_(video) { @@ -436,7 +438,7 @@ WTF::Bind( &MediaControlsOrientationLockDelegate::MaybeUnlockOrientation, WrapPersistent(this)), - TimeDelta::FromMilliseconds(kUnlockDelayMs)); + kUnlockDelay); } DEFINE_TRACE(MediaControlsOrientationLockDelegate) {
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h index d2ac59f3..d77fb91 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h
@@ -118,7 +118,8 @@ // Delay before unlocking - see `MaybeUnlockIfDeviceOrientationMatchesVideo`. // Emprically, 200ms is too short, but 250ms avoids glitches. 500ms gives us // a 2x margin in case the device is running slow, without being noticeable. - static constexpr int kUnlockDelayMs = 500; + MODULES_EXPORT static constexpr TimeDelta kUnlockDelay = + TimeDelta::FromMilliseconds(500); // Current state of the object. See comment at the top of the file for a // detailed description.
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp index f26a4d3..56baff26 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp
@@ -124,8 +124,10 @@ protected: using DeviceOrientationType = MediaControlsOrientationLockDelegate::DeviceOrientationType; - static constexpr int kUnlockDelayMs = - MediaControlsOrientationLockDelegate::kUnlockDelayMs; + + static constexpr TimeDelta GetUnlockDelay() { + return MediaControlsOrientationLockDelegate::kUnlockDelay; + } void SetUp() override { chrome_client_ = new MockChromeClient(); @@ -782,7 +784,7 @@ // Device orientation events received by MediaControlsOrientationLockDelegate // will confirm that the device is already landscape. RotateDeviceTo(90 /* landscape primary */); - testing::RunDelayedTasks(kUnlockDelayMs); + testing::RunDelayedTasks(GetUnlockDelay()); // MediaControlsOrientationLockDelegate should unlock orientation. CheckStatePendingFullscreen(); @@ -817,7 +819,7 @@ // Even though the device is still held in portrait. RotateDeviceTo(0 /* portrait primary */); - testing::RunDelayedTasks(kUnlockDelayMs); + testing::RunDelayedTasks(GetUnlockDelay()); // MediaControlsOrientationLockDelegate should remain locked to landscape. CheckStateMaybeLockedFullscreen(); @@ -843,7 +845,7 @@ // Simulate user rotating their device to landscape (matching the screen // orientation lock). RotateDeviceTo(90 /* landscape primary */); - testing::RunDelayedTasks(kUnlockDelayMs); + testing::RunDelayedTasks(GetUnlockDelay()); // MediaControlsOrientationLockDelegate should unlock orientation. CheckStatePendingFullscreen(); @@ -913,7 +915,7 @@ // orientation change. ASSERT_NO_FATAL_FAILURE( RotateScreenTo(kWebScreenOrientationPortraitPrimary, 0)); - testing::RunDelayedTasks(kUnlockDelayMs); + testing::RunDelayedTasks(GetUnlockDelay()); // Video should remain inline, unlocked. CheckStatePendingFullscreen(); @@ -947,7 +949,7 @@ // Device orientation events received by MediaControlsOrientationLockDelegate // will confirm that the device is already landscape. RotateDeviceTo(90 /* landscape primary */); - testing::RunDelayedTasks(kUnlockDelayMs); + testing::RunDelayedTasks(GetUnlockDelay()); // MediaControlsOrientationLockDelegate should unlock orientation. CheckStatePendingFullscreen(); @@ -966,7 +968,7 @@ // Initially fullscreen, unlocked orientation. SimulateEnterFullscreen(); RotateDeviceTo(90 /* landscape primary */); - testing::RunDelayedTasks(kUnlockDelayMs); + testing::RunDelayedTasks(GetUnlockDelay()); ASSERT_TRUE(Video().IsFullscreen()); CheckStatePendingFullscreen(); EXPECT_FALSE(DelegateWillUnlockFullscreen()); @@ -975,7 +977,7 @@ // orientation change. ASSERT_NO_FATAL_FAILURE( RotateScreenTo(kWebScreenOrientationPortraitPrimary, 0)); - testing::RunDelayedTasks(kUnlockDelayMs); + testing::RunDelayedTasks(GetUnlockDelay()); // MediaControlsRotateToFullscreenDelegate should exit fullscreen. EXPECT_FALSE(Video().IsFullscreen()); @@ -997,7 +999,7 @@ // Initially fullscreen, unlocked orientation. SimulateEnterFullscreen(); RotateDeviceTo(90 /* landscape primary */); - testing::RunDelayedTasks(kUnlockDelayMs); + testing::RunDelayedTasks(GetUnlockDelay()); ASSERT_TRUE(Video().IsFullscreen()); CheckStatePendingFullscreen(); EXPECT_FALSE(DelegateWillUnlockFullscreen()); @@ -1042,7 +1044,7 @@ // Even though the device is still held in portrait. RotateDeviceTo(0 /* portrait primary */); - testing::RunDelayedTasks(kUnlockDelayMs); + testing::RunDelayedTasks(GetUnlockDelay()); // MediaControlsOrientationLockDelegate should remain locked to landscape. CheckStateMaybeLockedFullscreen(); @@ -1071,7 +1073,7 @@ // Simulate user rotating their device to landscape (matching the screen // orientation lock). RotateDeviceTo(90 /* landscape primary */); - testing::RunDelayedTasks(kUnlockDelayMs); + testing::RunDelayedTasks(GetUnlockDelay()); // MediaControlsOrientationLockDelegate should remain locked to landscape even // though the screen orientation is now landscape, since the user has disabled @@ -1152,7 +1154,7 @@ // rotation lock, but perpendicular to MediaControlsOrientationLockDelegate's // screen orientation lock which overrides it). RotateDeviceTo(0 /* portrait primary */); - testing::RunDelayedTasks(kUnlockDelayMs); + testing::RunDelayedTasks(GetUnlockDelay()); // Video should remain locked and fullscreen. This may disappoint users who // expect MediaControlsRotateToFullscreenDelegate to let them always leave @@ -1245,7 +1247,7 @@ // Device orientation events received by MediaControlsOrientationLockDelegate // will confirm that the device is already portrait. RotateDeviceTo(0 /* portrait primary */); - testing::RunDelayedTasks(kUnlockDelayMs); + testing::RunDelayedTasks(GetUnlockDelay()); // MediaControlsOrientationLockDelegate should unlock orientation. CheckStatePendingFullscreen(); @@ -1296,7 +1298,7 @@ // Device orientation events received by MediaControlsOrientationLockDelegate // will confirm that the device is already landscape. RotateDeviceTo(0 /* landscape primary */); - testing::RunDelayedTasks(kUnlockDelayMs); + testing::RunDelayedTasks(GetUnlockDelay()); // MediaControlsOrientationLockDelegate should unlock orientation. CheckStatePendingFullscreen(); @@ -1347,7 +1349,7 @@ // MediaControlsOrientationLockDelegate should remain locked to landscape // indefinitely. - testing::RunDelayedTasks(kUnlockDelayMs); + testing::RunDelayedTasks(GetUnlockDelay()); CheckStateMaybeLockedFullscreen(); EXPECT_EQ(kWebScreenOrientationLockLandscape, DelegateOrientationLock()); @@ -1367,15 +1369,15 @@ // delegate unlocks the screen orientation, so Android changes the screen // orientation back to portrait because it hasn't yet processed the device // orientation change to landscape. - constexpr int kMinUnlockDelayMs = 249; - static_assert(kUnlockDelayMs > kMinUnlockDelayMs, - "kUnlockDelayMs should significantly exceed kMinUnlockDelayMs"); - testing::RunDelayedTasks(kMinUnlockDelayMs); + constexpr TimeDelta kMinUnlockDelay = TimeDelta::FromMilliseconds(249); + static_assert(GetUnlockDelay() > kMinUnlockDelay, + "GetUnlockDelay() should significantly exceed kMinUnlockDelay"); + testing::RunDelayedTasks(kMinUnlockDelay); CheckStateMaybeLockedFullscreen(); EXPECT_EQ(kWebScreenOrientationLockLandscape, DelegateOrientationLock()); // Simulate the OS processing the device orientation change after a delay of - // `kMinUnlockDelayMs` and hence changing the screen orientation. + // `kMinUnlockDelay` and hence changing the screen orientation. ASSERT_NO_FATAL_FAILURE( RotateScreenTo(kWebScreenOrientationLandscapeSecondary, 270)); @@ -1384,7 +1386,7 @@ EXPECT_EQ(kWebScreenOrientationLockLandscape, DelegateOrientationLock()); // Wait for the rest of the unlock delay. - testing::RunDelayedTasks(kUnlockDelayMs - kMinUnlockDelayMs); + testing::RunDelayedTasks(GetUnlockDelay() - kMinUnlockDelay); // MediaControlsOrientationLockDelegate should now have unlocked. CheckStatePendingFullscreen();
diff --git a/third_party/WebKit/Source/modules/payments/PaymentInstruments.cpp b/third_party/WebKit/Source/modules/payments/PaymentInstruments.cpp index 2da969b6..003d89d 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentInstruments.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentInstruments.cpp
@@ -11,6 +11,7 @@ #include "bindings/core/v8/ScriptPromiseResolver.h" #include "bindings/core/v8/V8BindingForCore.h" #include "core/dom/DOMException.h" +#include "core/inspector/ConsoleMessage.h" #include "modules/payments/PaymentInstrument.h" #include "modules/payments/PaymentManager.h" #include "platform/wtf/Vector.h" @@ -46,6 +47,21 @@ resolver->Reject(DOMException::Create( kNotFoundError, "Fetch or decode instrument icon failed")); return true; + case payments::mojom::blink::PaymentHandlerStatus:: + FETCH_PAYMENT_APP_INFO_FAILED: + // FETCH_PAYMENT_APP_INFO_FAILED indicates everything works well except + // fetching payment handler's name and/or icon from its web app manifest. + // The origin or name will be used to label this payment handler in + // UI in this case, so only show warnning message instead of reject the + // promise. + ExecutionContext* context = + ExecutionContext::From(resolver->GetScriptState()); + context->AddConsoleMessage(ConsoleMessage::Create( + kJSMessageSource, kWarningMessageLevel, + "Unable to fetch payment handler's name and icon from its web app " + "manifest. User may not recognize this payment handler in UI, " + "because it will be labeled only by its origin.")); + return false; } NOTREACHED(); return false;
diff --git a/third_party/WebKit/Source/modules/payments/PaymentManager.cpp b/third_party/WebKit/Source/modules/payments/PaymentManager.cpp index 8b04369..7f69bdef 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentManager.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentManager.cpp
@@ -53,7 +53,8 @@ manager_.set_connection_error_handler(ConvertToBaseCallback(WTF::Bind( &PaymentManager::OnServiceConnectionError, WrapWeakPersistent(this)))); - manager_->Init(registration_->scope()); + manager_->Init(registration_->GetExecutionContext()->Url().GetString(), + registration_->scope()); } void PaymentManager::OnServiceConnectionError() {
diff --git a/third_party/WebKit/Source/modules/plugins/DOMMimeType.cpp b/third_party/WebKit/Source/modules/plugins/DOMMimeType.cpp index eed77485..7d992cd 100644 --- a/third_party/WebKit/Source/modules/plugins/DOMMimeType.cpp +++ b/third_party/WebKit/Source/modules/plugins/DOMMimeType.cpp
@@ -35,8 +35,6 @@ const MimeClassInfo& mime_class_info) : ContextClient(frame), mime_class_info_(&mime_class_info) {} -DOMMimeType::~DOMMimeType() {} - DEFINE_TRACE(DOMMimeType) { ContextClient::Trace(visitor); visitor->Trace(mime_class_info_);
diff --git a/third_party/WebKit/Source/modules/plugins/DOMMimeType.h b/third_party/WebKit/Source/modules/plugins/DOMMimeType.h index de887f7f..a242e43d 100644 --- a/third_party/WebKit/Source/modules/plugins/DOMMimeType.h +++ b/third_party/WebKit/Source/modules/plugins/DOMMimeType.h
@@ -32,7 +32,7 @@ class DOMPlugin; class LocalFrame; -class DOMMimeType final : public GarbageCollectedFinalized<DOMMimeType>, +class DOMMimeType final : public GarbageCollected<DOMMimeType>, public ScriptWrappable, public ContextClient { USING_GARBAGE_COLLECTED_MIXIN(DOMMimeType); @@ -43,7 +43,6 @@ const MimeClassInfo& mime_class_info) { return new DOMMimeType(frame, mime_class_info); } - virtual ~DOMMimeType(); const String& type() const; String suffixes() const;
diff --git a/third_party/WebKit/Source/modules/plugins/DOMPlugin.cpp b/third_party/WebKit/Source/modules/plugins/DOMPlugin.cpp index f9a22d6..2b8bcc1 100644 --- a/third_party/WebKit/Source/modules/plugins/DOMPlugin.cpp +++ b/third_party/WebKit/Source/modules/plugins/DOMPlugin.cpp
@@ -27,8 +27,6 @@ DOMPlugin::DOMPlugin(LocalFrame* frame, const PluginInfo& plugin_info) : ContextClient(frame), plugin_info_(&plugin_info) {} -DOMPlugin::~DOMPlugin() {} - DEFINE_TRACE(DOMPlugin) { ContextClient::Trace(visitor); visitor->Trace(plugin_info_);
diff --git a/third_party/WebKit/Source/modules/plugins/DOMPlugin.h b/third_party/WebKit/Source/modules/plugins/DOMPlugin.h index 0e94e8f1..ba5267c 100644 --- a/third_party/WebKit/Source/modules/plugins/DOMPlugin.h +++ b/third_party/WebKit/Source/modules/plugins/DOMPlugin.h
@@ -29,7 +29,7 @@ namespace blink { -class DOMPlugin final : public GarbageCollectedFinalized<DOMPlugin>, +class DOMPlugin final : public GarbageCollected<DOMPlugin>, public ScriptWrappable, public ContextClient { USING_GARBAGE_COLLECTED_MIXIN(DOMPlugin); @@ -39,7 +39,6 @@ static DOMPlugin* Create(LocalFrame* frame, const PluginInfo& plugin_info) { return new DOMPlugin(frame, plugin_info); } - virtual ~DOMPlugin(); String name() const; String filename() const;
diff --git a/third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp b/third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp index d22ed06..15e309f3 100644 --- a/third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp +++ b/third_party/WebKit/Source/modules/plugins/DOMPluginArray.cpp
@@ -55,27 +55,6 @@ if (index >= dom_plugins_.size()) return nullptr; - // TODO(lfg): Temporary to track down https://crbug.com/731239. - if (!GetPluginData()) { - LocalFrame* frame = GetFrame(); - LocalFrameClient* client = GetFrame()->Client(); - Settings* settings = GetFrame()->GetSettings(); - ExecutionContext* context = GetExecutionContext(); - Page* page = GetFrame()->GetPage(); - bool allow_plugins = - frame->Loader().AllowPlugins(kNotAboutToInstantiatePlugin); - - CHECK(false); - - WTF::debug::Alias(frame); - WTF::debug::Alias(client); - WTF::debug::Alias(settings); - WTF::debug::Alias(context); - WTF::debug::Alias(page); - WTF::debug::Alias(&allow_plugins); - } - CHECK(main_frame_origin_->IsSameSchemeHostPort(GetPluginData()->Origin())); - if (!dom_plugins_[index]) { dom_plugins_[index] = DOMPlugin::Create(GetFrame(), *GetPluginData()->Plugins()[index]); @@ -134,8 +113,6 @@ return; } - main_frame_origin_ = data->Origin(); - HeapVector<Member<DOMPlugin>> old_dom_plugins(std::move(dom_plugins_)); dom_plugins_.clear(); dom_plugins_.resize(data->Plugins().size());
diff --git a/third_party/WebKit/Source/modules/plugins/DOMPluginArray.h b/third_party/WebKit/Source/modules/plugins/DOMPluginArray.h index a87d841..67ebfd7 100644 --- a/third_party/WebKit/Source/modules/plugins/DOMPluginArray.h +++ b/third_party/WebKit/Source/modules/plugins/DOMPluginArray.h
@@ -34,7 +34,7 @@ class LocalFrame; class PluginData; -class DOMPluginArray final : public GarbageCollectedFinalized<DOMPluginArray>, +class DOMPluginArray final : public GarbageCollected<DOMPluginArray>, public ScriptWrappable, public ContextLifecycleObserver, public PluginsChangedObserver { @@ -64,9 +64,6 @@ void ContextDestroyed(ExecutionContext*) override; HeapVector<Member<DOMPlugin>> dom_plugins_; - - // TODO(lfg): Temporary to track down https://crbug.com/731239. - RefPtr<const SecurityOrigin> main_frame_origin_; }; } // namespace blink
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeProxy.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeProxy.cpp index 8cf550e6..e29973f 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeProxy.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeProxy.cpp
@@ -584,9 +584,9 @@ worker_global_scope_(nullptr) { // ServiceWorker can sometimes run tasks that are initiated by/associated with // a document's frame but these documents can be from a different process. So - // we intentionally populate the task runners with null document in order to - // use the thread's default task runner. - parent_frame_task_runners_ = ParentFrameTaskRunners::Create(nullptr); + // we intentionally populate the task runners with default task runners of the + // main thread. + parent_frame_task_runners_ = ParentFrameTaskRunners::Create(); } void ServiceWorkerGlobalScopeProxy::Detach() {
diff --git a/third_party/WebKit/Source/modules/serviceworkers/WebEmbeddedWorkerImplTest.cpp b/third_party/WebKit/Source/modules/serviceworkers/WebEmbeddedWorkerImplTest.cpp index 64fd62f..3559fbf 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/WebEmbeddedWorkerImplTest.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/WebEmbeddedWorkerImplTest.cpp
@@ -5,6 +5,7 @@ #include "public/web/WebEmbeddedWorker.h" #include <memory> +#include "platform/RuntimeEnabledFeatures.h" #include "platform/WaitableEvent.h" #include "platform/WebTaskRunner.h" #include "platform/testing/URLTestHelpers.h" @@ -130,7 +131,11 @@ auto installed_scripts_manager = WTF::MakeUnique<MockServiceWorkerInstalledScriptsManager>(); mock_client_ = client.get(); - mock_installed_scripts_manager_ = installed_scripts_manager.get(); + if (RuntimeEnabledFeatures::ServiceWorkerScriptStreamingEnabled()) { + mock_installed_scripts_manager_ = installed_scripts_manager.get(); + } else { + mock_installed_scripts_manager_ = nullptr; + } worker_ = WebEmbeddedWorker::Create( std::move(client), std::move(installed_scripts_manager), nullptr); @@ -168,7 +173,6 @@ EXPECT_CALL(*mock_client_, WorkerReadyForInspection()).Times(1); worker_->StartWorkerContext(start_data_); ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); EXPECT_CALL(*mock_client_, WorkerContextFailedToStart()).Times(1); worker_->TerminateWorkerContext(); @@ -181,7 +185,6 @@ WebEmbeddedWorkerStartData::kWaitForDebugger; worker_->StartWorkerContext(start_data_); ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); EXPECT_CALL(*mock_client_, WorkerContextFailedToStart()).Times(1); worker_->TerminateWorkerContext(); @@ -192,18 +195,22 @@ EXPECT_CALL(*mock_client_, WorkerReadyForInspection()).Times(1); worker_->StartWorkerContext(start_data_); ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Load the shadow page. EXPECT_CALL(*mock_client_, CreateServiceWorkerNetworkProviderProxy()) .WillOnce(::testing::Return(nullptr)); - EXPECT_CALL(*mock_installed_scripts_manager_, - IsScriptInstalled(start_data_.script_url)) - .Times(1) - .WillOnce(::testing::Return(false)); + if (mock_installed_scripts_manager_) { + EXPECT_CALL(*mock_installed_scripts_manager_, + IsScriptInstalled(start_data_.script_url)) + .Times(1) + .WillOnce(::testing::Return(false)); + } Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); + if (mock_installed_scripts_manager_) { + ::testing::Mock::VerifyAndClearExpectations( + mock_installed_scripts_manager_); + } // Terminate before loading the script. EXPECT_CALL(*mock_client_, WorkerContextFailedToStart()).Times(1); @@ -221,13 +228,18 @@ // Load the shadow page. EXPECT_CALL(*mock_client_, CreateServiceWorkerNetworkProviderProxy()) .WillOnce(::testing::Return(nullptr)); - EXPECT_CALL(*mock_installed_scripts_manager_, - IsScriptInstalled(start_data_.script_url)) - .Times(1) - .WillOnce(::testing::Return(false)); + if (mock_installed_scripts_manager_) { + EXPECT_CALL(*mock_installed_scripts_manager_, + IsScriptInstalled(start_data_.script_url)) + .Times(1) + .WillOnce(::testing::Return(false)); + } Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); + if (mock_installed_scripts_manager_) { + ::testing::Mock::VerifyAndClearExpectations( + mock_installed_scripts_manager_); + } // Load the script. EXPECT_CALL(*mock_client_, WorkerScriptLoaded()).Times(1); @@ -262,13 +274,18 @@ // Load the shadow page. EXPECT_CALL(*mock_client_, CreateServiceWorkerNetworkProviderProxy()) .WillOnce(::testing::Return(nullptr)); - EXPECT_CALL(*mock_installed_scripts_manager_, - IsScriptInstalled(start_data_.script_url)) - .Times(1) - .WillOnce(::testing::Return(false)); + if (mock_installed_scripts_manager_) { + EXPECT_CALL(*mock_installed_scripts_manager_, + IsScriptInstalled(start_data_.script_url)) + .Times(1) + .WillOnce(::testing::Return(false)); + } Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); + if (mock_installed_scripts_manager_) { + ::testing::Mock::VerifyAndClearExpectations( + mock_installed_scripts_manager_); + } // Load the script. EXPECT_CALL(*mock_client_, WorkerScriptLoaded()).Times(0); @@ -288,13 +305,18 @@ // Load the shadow page. EXPECT_CALL(*mock_client_, CreateServiceWorkerNetworkProviderProxy()) .WillOnce(::testing::Return(nullptr)); - EXPECT_CALL(*mock_installed_scripts_manager_, - IsScriptInstalled(start_data_.script_url)) - .Times(1) - .WillOnce(::testing::Return(false)); + if (mock_installed_scripts_manager_) { + EXPECT_CALL(*mock_installed_scripts_manager_, + IsScriptInstalled(start_data_.script_url)) + .Times(1) + .WillOnce(::testing::Return(false)); + } Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); + if (mock_installed_scripts_manager_) { + ::testing::Mock::VerifyAndClearExpectations( + mock_installed_scripts_manager_); + } // Load the script. mock_client_->SetHasAssociatedRegistration(false); @@ -320,27 +342,37 @@ // Load the shadow page. EXPECT_CALL(*mock_client_, CreateServiceWorkerNetworkProviderProxy()) .WillOnce(::testing::Return(nullptr)); - EXPECT_CALL(*mock_installed_scripts_manager_, - IsScriptInstalled(start_data_.script_url)) - .Times(1) - .WillOnce(::testing::Return(false)); + if (mock_installed_scripts_manager_) { + EXPECT_CALL(*mock_installed_scripts_manager_, + IsScriptInstalled(start_data_.script_url)) + .Times(1) + .WillOnce(::testing::Return(false)); + } Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); + if (mock_installed_scripts_manager_) { + ::testing::Mock::VerifyAndClearExpectations( + mock_installed_scripts_manager_); + } // Load the script. EXPECT_CALL(*mock_client_, WorkerScriptLoaded()).Times(1); EXPECT_CALL(*mock_client_, CreateServiceWorkerProviderProxy()) .WillOnce(::testing::Return(nullptr)); // This is called on the worker thread. - EXPECT_CALL(*mock_installed_scripts_manager_, - IsScriptInstalled(start_data_.script_url)) - .Times(1) - .WillOnce(::testing::Return(false)); + if (mock_installed_scripts_manager_) { + EXPECT_CALL(*mock_installed_scripts_manager_, + IsScriptInstalled(start_data_.script_url)) + .Times(1) + .WillOnce(::testing::Return(false)); + } Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); mock_client_->WaitUntilScriptEvaluated(); ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); + if (mock_installed_scripts_manager_) { + ::testing::Mock::VerifyAndClearExpectations( + mock_installed_scripts_manager_); + } // Terminate the running worker thread. EXPECT_CALL(*mock_client_, WorkerContextFailedToStart()).Times(0); @@ -365,12 +397,18 @@ // Load the shadow page. EXPECT_CALL(*mock_client_, CreateServiceWorkerNetworkProviderProxy()) .WillOnce(::testing::Return(nullptr)); - EXPECT_CALL(*mock_installed_scripts_manager_, - IsScriptInstalled(start_data_.script_url)) - .Times(1) - .WillOnce(::testing::Return(false)); + if (mock_installed_scripts_manager_) { + EXPECT_CALL(*mock_installed_scripts_manager_, + IsScriptInstalled(start_data_.script_url)) + .Times(1) + .WillOnce(::testing::Return(false)); + } Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); ::testing::Mock::VerifyAndClearExpectations(mock_client_); + if (mock_installed_scripts_manager_) { + ::testing::Mock::VerifyAndClearExpectations( + mock_installed_scripts_manager_); + } // Load the script. EXPECT_CALL(*mock_client_, WorkerScriptLoaded()).Times(1); @@ -382,14 +420,19 @@ EXPECT_CALL(*mock_client_, CreateServiceWorkerProviderProxy()) .WillOnce(::testing::Return(nullptr)); // This is called on the worker thread. - EXPECT_CALL(*mock_installed_scripts_manager_, - IsScriptInstalled(start_data_.script_url)) - .Times(1) - .WillOnce(::testing::Return(false)); + if (mock_installed_scripts_manager_) { + EXPECT_CALL(*mock_installed_scripts_manager_, + IsScriptInstalled(start_data_.script_url)) + .Times(1) + .WillOnce(::testing::Return(false)); + } worker_->ResumeAfterDownload(); mock_client_->WaitUntilScriptEvaluated(); ::testing::Mock::VerifyAndClearExpectations(mock_client_); - ::testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); + if (mock_installed_scripts_manager_) { + ::testing::Mock::VerifyAndClearExpectations( + mock_installed_scripts_manager_); + } // Terminate the running worker thread. EXPECT_CALL(*mock_client_, WorkerContextFailedToStart()).Times(0);
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScopeTest.cpp b/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScopeTest.cpp index d002990..8964619 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScopeTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletGlobalScopeTest.cpp
@@ -57,7 +57,7 @@ nullptr, kDontPauseWorkerGlobalScopeOnStart, nullptr, "", security_origin_.Get(), nullptr, kWebAddressSpaceLocal, nullptr, nullptr, WorkerV8Settings::Default()), - ParentFrameTaskRunners::Create(nullptr)); + ParentFrameTaskRunners::Create()); return thread; }
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletThreadTest.cpp b/third_party/WebKit/Source/modules/webaudio/AudioWorkletThreadTest.cpp index 9723af46..f494b603 100644 --- a/third_party/WebKit/Source/modules/webaudio/AudioWorkletThreadTest.cpp +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletThreadTest.cpp
@@ -47,7 +47,7 @@ nullptr, kDontPauseWorkerGlobalScopeOnStart, nullptr, "", security_origin_.Get(), nullptr, kWebAddressSpaceLocal, nullptr, nullptr, WorkerV8Settings::Default()), - ParentFrameTaskRunners::Create(nullptr)); + ParentFrameTaskRunners::Create()); return thread; }
diff --git a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 index 343e739..ff4f60b 100644 --- a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 +++ b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5
@@ -933,6 +933,9 @@ status: "stable", }, { + name: "ServiceWorkerScriptStreaming", + }, + { name: "SetRootScroller", status: "experimental", }, @@ -1037,6 +1040,9 @@ name: "V8IdleTasks", }, { + name: "ValidationBubbleInRenderer", + }, + { name: "VibrateRequiresUserGesture", status: "stable", },
diff --git a/third_party/WebKit/Source/platform/audio/AudioDestination.cpp b/third_party/WebKit/Source/platform/audio/AudioDestination.cpp index b3075646..75aaa58 100644 --- a/third_party/WebKit/Source/platform/audio/AudioDestination.cpp +++ b/third_party/WebKit/Source/platform/audio/AudioDestination.cpp
@@ -50,6 +50,12 @@ // that we would ever need. The current UMA stats indicates that this is, in // fact, probably too small. There are Android devices out there with a size of // 8000 or so. We might need to make this larger. See: crbug.com/670747 +// TODO(andrew.macpherson): This either needs to be bigger since some OSes allow +// buffer sizes of 8192 via latencyHint now or else we need to do some +// validation of the latencyHint 'exact' size before passing it to +// CreateAudioDevice. Clamping may be tricky though as the buffer size is +// dependent on the sample rate for some platforms and we're passing in a time +// value and not a buffer size in the latencyHint. See: crbug.com/737047 const size_t kFIFOSize = 8192; std::unique_ptr<AudioDestination> AudioDestination::Create(
diff --git a/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp b/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp index 7a0bd44..584a51f7 100644 --- a/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp +++ b/third_party/WebKit/Source/platform/exported/WebRuntimeFeatures.cpp
@@ -364,6 +364,10 @@ RuntimeEnabledFeatures::SetServiceWorkerNavigationPreloadEnabled(enable); } +void WebRuntimeFeatures::EnableServiceWorkerScriptStreaming(bool enable) { + RuntimeEnabledFeatures::SetServiceWorkerScriptStreamingEnabled(enable); +} + void WebRuntimeFeatures::EnableAutoplayMutedVideos(bool enable) { RuntimeEnabledFeatures::SetAutoplayMutedVideosEnabled(enable); }
diff --git a/third_party/WebKit/Source/platform/fonts/FontGlobalContext.cpp b/third_party/WebKit/Source/platform/fonts/FontGlobalContext.cpp index d01fc38..36f39ae 100644 --- a/third_party/WebKit/Source/platform/fonts/FontGlobalContext.cpp +++ b/third_party/WebKit/Source/platform/fonts/FontGlobalContext.cpp
@@ -19,7 +19,7 @@ return *font_persistent; } -FontGlobalContext::FontGlobalContext() {} +FontGlobalContext::FontGlobalContext() : harfbuzz_font_funcs_(nullptr) {} void FontGlobalContext::ClearMemory() { if (!Get(kDoNotCreate))
diff --git a/third_party/WebKit/Source/platform/fonts/FontGlobalContext.h b/third_party/WebKit/Source/platform/fonts/FontGlobalContext.h index c3fa40e..fe315ab 100644 --- a/third_party/WebKit/Source/platform/fonts/FontGlobalContext.h +++ b/third_party/WebKit/Source/platform/fonts/FontGlobalContext.h
@@ -7,10 +7,18 @@ #include "platform/PlatformExport.h" #include "platform/fonts/FontCache.h" +#include "platform/fonts/SimpleFontData.h" +#include "platform/fonts/shaping/HarfBuzzFontCache.h" +#include "platform/wtf/HashMap.h" #include "platform/wtf/StdLibExtras.h" +#include "platform/wtf/text/AtomicStringHash.h" + +struct hb_font_funcs_t; namespace blink { +class FontCache; + enum CreateIfNeeded { kDoNotCreate, kCreate }; // FontGlobalContext contains non-thread-safe, thread-specific data used for @@ -21,7 +29,19 @@ public: static FontGlobalContext* Get(CreateIfNeeded = kCreate); - static inline FontCache& GetFontCache() { return Get()->font_cache; } + static inline FontCache& GetFontCache() { return Get()->font_cache_; } + + static inline HarfBuzzFontCache& GetHarfBuzzFontCache() { + return Get()->harf_buzz_font_cache_; + } + + static hb_font_funcs_t* GetHarfBuzzFontFuncs() { + return Get()->harfbuzz_font_funcs_; + } + + static void SetHarfBuzzFontFuncs(hb_font_funcs_t* funcs) { + Get()->harfbuzz_font_funcs_ = funcs; + } // Called by MemoryCoordinator to clear memory. static void ClearMemory(); @@ -31,7 +51,11 @@ FontGlobalContext(); - FontCache font_cache; + FontCache font_cache_; + + HarfBuzzFontCache harf_buzz_font_cache_; + + hb_font_funcs_t* harfbuzz_font_funcs_; }; } // namespace blink
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp index faf1f1e6..548e4e5 100644 --- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp +++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
@@ -33,9 +33,11 @@ #include <memory> #include "platform/Histogram.h" #include "platform/fonts/FontCache.h" +#include "platform/fonts/FontGlobalContext.h" #include "platform/fonts/FontPlatformData.h" #include "platform/fonts/SimpleFontData.h" #include "platform/fonts/UnicodeRangeSet.h" +#include "platform/fonts/shaping/HarfBuzzFontCache.h" #include "platform/fonts/shaping/HarfBuzzShaper.h" #include "platform/fonts/skia/SkiaTextMetrics.h" #include "platform/wtf/HashMap.h" @@ -57,88 +59,14 @@ namespace blink { -struct HbFontDeleter { - void operator()(hb_font_t* font) { - if (font) - hb_font_destroy(font); - } -}; +void HbFontDeleter::operator()(hb_font_t* font) { + if (font) + hb_font_destroy(font); +} -using HbFontUniquePtr = std::unique_ptr<hb_font_t, HbFontDeleter>; - -struct HbFaceDeleter { - void operator()(hb_face_t* face) { - if (face) - hb_face_destroy(face); - } -}; - -using HbFaceUniquePtr = std::unique_ptr<hb_face_t, HbFaceDeleter>; - -// struct to carry user-pointer data for hb_font_t callback functions. -struct HarfBuzzFontData { - USING_FAST_MALLOC(HarfBuzzFontData); - WTF_MAKE_NONCOPYABLE(HarfBuzzFontData); - - public: - HarfBuzzFontData() - : paint_(), simple_font_data_(nullptr), range_set_(nullptr) {} - - ~HarfBuzzFontData() { - if (simple_font_data_) - FontCache::GetFontCache()->ReleaseFontData(simple_font_data_); - } - - void UpdateSimpleFontData(FontPlatformData* platform_data) { - SimpleFontData* simple_font_data = - FontCache::GetFontCache() - ->FontDataFromFontPlatformData(platform_data) - .Get(); - if (simple_font_data_) - FontCache::GetFontCache()->ReleaseFontData(simple_font_data_); - simple_font_data_ = simple_font_data; - } - - SkPaint paint_; - SimpleFontData* simple_font_data_; - RefPtr<UnicodeRangeSet> range_set_; -}; - -// Though we have FontCache class, which provides the cache mechanism for -// WebKit's font objects, we also need additional caching layer for HarfBuzz to -// reduce the number of hb_font_t objects created. Without it, we would create -// an hb_font_t object for every FontPlatformData object. But insted, we only -// need one for each unique SkTypeface. -// FIXME, crbug.com/609099: We should fix the FontCache to only keep one -// FontPlatformData object independent of size, then consider using this here. -class HbFontCacheEntry : public RefCounted<HbFontCacheEntry> { - public: - static PassRefPtr<HbFontCacheEntry> Create(hb_font_t* hb_font) { - DCHECK(hb_font); - return AdoptRef(new HbFontCacheEntry(hb_font)); - } - - hb_font_t* HbFont() { return hb_font_.get(); } - HarfBuzzFontData* HbFontData() { return hb_font_data_.get(); } - - private: - explicit HbFontCacheEntry(hb_font_t* font) - : hb_font_(HbFontUniquePtr(font)), - hb_font_data_(WTF::MakeUnique<HarfBuzzFontData>()){}; - - HbFontUniquePtr hb_font_; - std::unique_ptr<HarfBuzzFontData> hb_font_data_; -}; - -typedef HashMap<uint64_t, - RefPtr<HbFontCacheEntry>, - WTF::IntHash<uint64_t>, - WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> - HarfBuzzFontCache; - -static HarfBuzzFontCache* GetHarfBuzzFontCache() { - DEFINE_STATIC_LOCAL(HarfBuzzFontCache, harf_buzz_font_cache, ()); - return &harf_buzz_font_cache; +void HbFaceDeleter::operator()(hb_face_t* face) { + if (face) + hb_face_destroy(face); } static PassRefPtr<HbFontCacheEntry> CreateHbFontCacheEntry(hb_face_t*); @@ -146,7 +74,7 @@ HarfBuzzFace::HarfBuzzFace(FontPlatformData* platform_data, uint64_t unique_id) : platform_data_(platform_data), unique_id_(unique_id) { HarfBuzzFontCache::AddResult result = - GetHarfBuzzFontCache()->insert(unique_id_, nullptr); + FontGlobalContext::GetHarfBuzzFontCache().insert(unique_id_, nullptr); if (result.is_new_entry) { HbFaceUniquePtr face(CreateFace()); result.stored_value->value = CreateHbFontCacheEntry(face.get()); @@ -157,17 +85,18 @@ } HarfBuzzFace::~HarfBuzzFace() { - HarfBuzzFontCache::iterator result = GetHarfBuzzFontCache()->find(unique_id_); - SECURITY_DCHECK(result != GetHarfBuzzFontCache()->end()); + HarfBuzzFontCache::iterator result = + FontGlobalContext::GetHarfBuzzFontCache().find(unique_id_); + SECURITY_DCHECK(result != FontGlobalContext::GetHarfBuzzFontCache().end()); DCHECK_GT(result.Get()->value->RefCount(), 1); result.Get()->value->Deref(); if (result.Get()->value->RefCount() == 1) - GetHarfBuzzFontCache()->erase(unique_id_); + FontGlobalContext::GetHarfBuzzFontCache().erase(unique_id_); } static hb_position_t SkiaScalarToHarfBuzzPosition(SkScalar value) { // We treat HarfBuzz hb_position_t as 16.16 fixed-point. - static const int kHbPosition1 = 1 << 16; + static constexpr int kHbPosition1 = 1 << 16; return clampTo<int>(value * kHbPosition1); } @@ -284,27 +213,27 @@ } static hb_font_funcs_t* HarfBuzzSkiaGetFontFuncs() { - static hb_font_funcs_t* harf_buzz_skia_font_funcs = 0; + hb_font_funcs_t* funcs = FontGlobalContext::GetHarfBuzzFontFuncs(); // We don't set callback functions which we can't support. // HarfBuzz will use the fallback implementation if they aren't set. - if (!harf_buzz_skia_font_funcs) { - harf_buzz_skia_font_funcs = hb_font_funcs_create(); - hb_font_funcs_set_glyph_func(harf_buzz_skia_font_funcs, HarfBuzzGetGlyph, 0, - 0); + if (!funcs) { + funcs = hb_font_funcs_create(); + hb_font_funcs_set_glyph_func(funcs, HarfBuzzGetGlyph, 0, 0); hb_font_funcs_set_glyph_h_advance_func( - harf_buzz_skia_font_funcs, HarfBuzzGetGlyphHorizontalAdvance, 0, 0); + funcs, HarfBuzzGetGlyphHorizontalAdvance, 0, 0); hb_font_funcs_set_glyph_h_kerning_func( - harf_buzz_skia_font_funcs, HarfBuzzGetGlyphHorizontalKerning, 0, 0); + funcs, HarfBuzzGetGlyphHorizontalKerning, 0, 0); hb_font_funcs_set_glyph_v_advance_func( - harf_buzz_skia_font_funcs, HarfBuzzGetGlyphVerticalAdvance, 0, 0); - hb_font_funcs_set_glyph_v_origin_func(harf_buzz_skia_font_funcs, - HarfBuzzGetGlyphVerticalOrigin, 0, 0); - hb_font_funcs_set_glyph_extents_func(harf_buzz_skia_font_funcs, - HarfBuzzGetGlyphExtents, 0, 0); - hb_font_funcs_make_immutable(harf_buzz_skia_font_funcs); + funcs, HarfBuzzGetGlyphVerticalAdvance, 0, 0); + hb_font_funcs_set_glyph_v_origin_func(funcs, HarfBuzzGetGlyphVerticalOrigin, + 0, 0); + hb_font_funcs_set_glyph_extents_func(funcs, HarfBuzzGetGlyphExtents, 0, 0); + hb_font_funcs_make_immutable(funcs); + FontGlobalContext::SetHarfBuzzFontFuncs(funcs); } - return harf_buzz_skia_font_funcs; + DCHECK(funcs); + return funcs; } static hb_blob_t* HarfBuzzSkiaGetTable(hb_face_t* face, @@ -351,8 +280,8 @@ #endif hb_face_t* face = nullptr; - DEFINE_STATIC_LOCAL(BooleanHistogram, zero_copy_success_histogram, - ("Blink.Fonts.HarfBuzzFaceZeroCopyAccess")); + DEFINE_THREAD_SAFE_STATIC_LOCAL(BooleanHistogram, zero_copy_success_histogram, + ("Blink.Fonts.HarfBuzzFaceZeroCopyAccess")); SkTypeface* typeface = platform_data_->Typeface(); CHECK(typeface); int ttc_index = 0;
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFontCache.h b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFontCache.h new file mode 100644 index 0000000..b41e55b --- /dev/null +++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFontCache.h
@@ -0,0 +1,92 @@ +// Copyright 2017 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 HarfBuzzFontCache_h +#define HarfBuzzFontCache_h + +#include "platform/fonts/UnicodeRangeSet.h" + +struct hb_font_t; +struct hb_face_t; + +namespace blink { + +class SimpleFontData; + +struct HbFontDeleter { + void operator()(hb_font_t* font); +}; + +using HbFontUniquePtr = std::unique_ptr<hb_font_t, HbFontDeleter>; + +struct HbFaceDeleter { + void operator()(hb_face_t* face); +}; + +using HbFaceUniquePtr = std::unique_ptr<hb_face_t, HbFaceDeleter>; + +// struct to carry user-pointer data for hb_font_t callback functions. +struct HarfBuzzFontData { + USING_FAST_MALLOC(HarfBuzzFontData); + WTF_MAKE_NONCOPYABLE(HarfBuzzFontData); + + public: + HarfBuzzFontData() + : paint_(), simple_font_data_(nullptr), range_set_(nullptr) {} + + ~HarfBuzzFontData() { + if (simple_font_data_) + FontCache::GetFontCache()->ReleaseFontData(simple_font_data_); + } + + void UpdateSimpleFontData(FontPlatformData* platform_data) { + SimpleFontData* simple_font_data = + FontCache::GetFontCache() + ->FontDataFromFontPlatformData(platform_data) + .Get(); + if (simple_font_data_) + FontCache::GetFontCache()->ReleaseFontData(simple_font_data_); + simple_font_data_ = simple_font_data; + } + + SkPaint paint_; + SimpleFontData* simple_font_data_; + RefPtr<UnicodeRangeSet> range_set_; +}; + +// Though we have FontCache class, which provides the cache mechanism for +// WebKit's font objects, we also need additional caching layer for HarfBuzz to +// reduce the number of hb_font_t objects created. Without it, we would create +// an hb_font_t object for every FontPlatformData object. But insted, we only +// need one for each unique SkTypeface. +// FIXME, crbug.com/609099: We should fix the FontCache to only keep one +// FontPlatformData object independent of size, then consider using this here. +class HbFontCacheEntry : public RefCounted<HbFontCacheEntry> { + public: + static PassRefPtr<HbFontCacheEntry> Create(hb_font_t* hb_font) { + DCHECK(hb_font); + return AdoptRef(new HbFontCacheEntry(hb_font)); + } + + hb_font_t* HbFont() { return hb_font_.get(); } + HarfBuzzFontData* HbFontData() { return hb_font_data_.get(); } + + private: + explicit HbFontCacheEntry(hb_font_t* font) + : hb_font_(HbFontUniquePtr(font)), + hb_font_data_(WTF::MakeUnique<HarfBuzzFontData>()){}; + + HbFontUniquePtr hb_font_; + std::unique_ptr<HarfBuzzFontData> hb_font_data_; +}; + +typedef HashMap<uint64_t, + RefPtr<HbFontCacheEntry>, + WTF::IntHash<uint64_t>, + WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> + HarfBuzzFontCache; + +} // namespace blink + +#endif
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp index 90b8b4db..36286e71 100644 --- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp +++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
@@ -12,6 +12,7 @@ #include "platform/WebTaskRunner.h" #include "platform/graphics/OffscreenCanvasPlaceholder.h" #include "platform/graphics/gpu/SharedGpuContext.h" +#include "platform/scheduler/child/web_scheduler.h" #include "platform/wtf/typed_arrays/ArrayBuffer.h" #include "platform/wtf/typed_arrays/Uint8Array.h" #include "public/platform/InterfaceProvider.h" @@ -56,8 +57,20 @@ Platform::Current()->GetInterfaceProvider()->GetInterface( mojo::MakeRequest(&provider)); + scoped_refptr<base::SequencedTaskRunner> task_runner; + auto scheduler = blink::Platform::Current()->CurrentThread()->Scheduler(); + if (scheduler) { + WebTaskRunner* web_task_runner = scheduler->CompositorTaskRunner(); + if (web_task_runner) { + task_runner = web_task_runner->ToSingleThreadTaskRunner(); + } + } + if (!task_runner) { + task_runner = base::SequencedTaskRunnerHandle::Get(); + } + cc::mojom::blink::CompositorFrameSinkClientPtr client; - binding_.Bind(mojo::MakeRequest(&client)); + binding_.Bind(mojo::MakeRequest(&client), task_runner); provider->CreateCompositorFrameSink(frame_sink_id_, std::move(client), mojo::MakeRequest(&sink_)); } @@ -211,12 +224,15 @@ RefPtr<WebTaskRunner> dispatcher_task_runner = Platform::Current()->CurrentThread()->GetWebTaskRunner(); - Platform::Current()->MainThread()->GetWebTaskRunner()->PostTask( - BLINK_FROM_HERE, - CrossThreadBind(UpdatePlaceholderImage, this->CreateWeakPtr(), - WTF::Passed(std::move(dispatcher_task_runner)), - placeholder_canvas_id_, std::move(image), - next_resource_id_)); + Platform::Current() + ->MainThread() + ->Scheduler() + ->CompositorTaskRunner() + ->PostTask(BLINK_FROM_HERE, + CrossThreadBind(UpdatePlaceholderImage, this->CreateWeakPtr(), + WTF::Passed(std::move(dispatcher_task_runner)), + placeholder_canvas_id_, std::move(image), + next_resource_id_)); } void OffscreenCanvasFrameDispatcherImpl::DispatchFrame(
diff --git a/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.cc index 21880f1..94eff7d 100644 --- a/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.cc +++ b/third_party/WebKit/Source/platform/scheduler/child/web_scheduler_impl.cc
@@ -71,7 +71,6 @@ } blink::WebTaskRunner* WebSchedulerImpl::CompositorTaskRunner() { - NOTREACHED(); return nullptr; }
diff --git a/third_party/WebKit/Source/platform/testing/UnitTestHelpers.cpp b/third_party/WebKit/Source/platform/testing/UnitTestHelpers.cpp index cc8a2b2..7bbc713d 100644 --- a/third_party/WebKit/Source/platform/testing/UnitTestHelpers.cpp +++ b/third_party/WebKit/Source/platform/testing/UnitTestHelpers.cpp
@@ -31,7 +31,6 @@ #include "base/path_service.h" #include "base/run_loop.h" #include "platform/SharedBuffer.h" -#include "platform/Timer.h" #include "platform/WebTaskRunner.h" #include "platform/heap/Handle.h" #include "platform/wtf/text/StringUTF8Adaptor.h" @@ -66,10 +65,9 @@ ThreadState::Current()->LeaveGCForbiddenScope(); } -void RunDelayedTasks(double delay_ms) { +void RunDelayedTasks(TimeDelta delay) { Platform::Current()->CurrentThread()->GetWebTaskRunner()->PostDelayedTask( - BLINK_FROM_HERE, WTF::Bind(&ExitRunLoop), - TimeDelta::FromMillisecondsD(delay_ms)); + BLINK_FROM_HERE, WTF::Bind(&ExitRunLoop), delay); EnterRunLoop(); }
diff --git a/third_party/WebKit/Source/platform/testing/UnitTestHelpers.h b/third_party/WebKit/Source/platform/testing/UnitTestHelpers.h index f2df9867..52920284 100644 --- a/third_party/WebKit/Source/platform/testing/UnitTestHelpers.h +++ b/third_party/WebKit/Source/platform/testing/UnitTestHelpers.h
@@ -26,6 +26,7 @@ #ifndef UnitTestHelpers_h #define UnitTestHelpers_h +#include "platform/Timer.h" #include "platform/wtf/PassRefPtr.h" #include "platform/wtf/text/WTFString.h" @@ -39,9 +40,8 @@ // provides runUntilIdle() method that can work with WebURLLoaderMockFactory. void RunPendingTasks(); -// Waits for delayed task to complete or timers to fire for |delayMs| -// milliseconds. -void RunDelayedTasks(double delay_ms); +// Waits for delayed task to complete or timers to fire for |delay|. +void RunDelayedTasks(TimeDelta delay); void EnterRunLoop(); void ExitRunLoop();
diff --git a/third_party/WebKit/Source/platform/text/LocaleToScriptMapping.cpp b/third_party/WebKit/Source/platform/text/LocaleToScriptMapping.cpp index 592135e..3980f33 100644 --- a/third_party/WebKit/Source/platform/text/LocaleToScriptMapping.cpp +++ b/third_party/WebKit/Source/platform/text/LocaleToScriptMapping.cpp
@@ -41,23 +41,13 @@ UScriptCode script; }; -using SubtagScriptMap = HashMap<String, UScriptCode, CaseFoldingHash>; - -static void CreateSubtagScriptMap(SubtagScriptMap& map, - const SubtagScript list[], - size_t size) { - map.ReserveCapacityForSize(size); - for (size_t i = 0; i < size; ++i) - map.Set(list[i].subtag, list[i].script); -} - UScriptCode ScriptNameToCode(const String& script_name) { // This generally maps an ISO 15924 script code to its UScriptCode, but // certain families of script codes are treated as a single script for // assigning a per-script font in Settings. For example, "hira" is mapped to // USCRIPT_KATAKANA_OR_HIRAGANA instead of USCRIPT_HIRAGANA, since we want all // Japanese scripts to be rendered using the same font setting. - static const SubtagScript kScriptNameCodeList[] = { + static constexpr SubtagScript kScriptNameCodeList[] = { {"zyyy", USCRIPT_COMMON}, {"qaai", USCRIPT_INHERITED}, {"arab", USCRIPT_ARABIC}, @@ -164,19 +154,15 @@ {"kore", USCRIPT_HANGUL}, {"zxxx", USCRIPT_UNWRITTEN_LANGUAGES}, {"zzzz", USCRIPT_UNKNOWN}}; - DEFINE_STATIC_LOCAL(SubtagScriptMap, script_name_code_map, ()); - if (script_name_code_map.IsEmpty()) - CreateSubtagScriptMap(script_name_code_map, kScriptNameCodeList, - WTF_ARRAY_LENGTH(kScriptNameCodeList)); - - const auto& it = script_name_code_map.find(script_name); - if (it != script_name_code_map.end()) - return it->value; + for (const auto& kv : kScriptNameCodeList) { + if (CodePointCompareIgnoringASCIICase(script_name, kv.subtag) == 0) + return kv.script; + } return USCRIPT_INVALID_CODE; } UScriptCode LocaleToScriptCodeForFontSelection(const String& locale) { - static const SubtagScript kLocaleScriptList[] = { + static constexpr SubtagScript kLocaleScriptList[] = { {"aa", USCRIPT_LATIN}, {"ab", USCRIPT_CYRILLIC}, {"ady", USCRIPT_CYRILLIC}, @@ -453,19 +439,18 @@ {"zh-mo", USCRIPT_TRADITIONAL_HAN}, {"zh-tw", USCRIPT_TRADITIONAL_HAN}, }; - DEFINE_STATIC_LOCAL(SubtagScriptMap, locale_script_map, ()); - if (locale_script_map.IsEmpty()) - CreateSubtagScriptMap(locale_script_map, kLocaleScriptList, - WTF_ARRAY_LENGTH(kLocaleScriptList)); // BCP 47 uses '-' as the delimiter but ICU uses '_'. // https://tools.ietf.org/html/bcp47 String canonical_locale = locale; canonical_locale.Replace('_', '-'); + while (!canonical_locale.IsEmpty()) { - const auto& it = locale_script_map.find(canonical_locale); - if (it != locale_script_map.end()) - return it->value; + for (const auto& kv : kLocaleScriptList) { + if (CodePointCompareIgnoringASCIICase(canonical_locale, kv.subtag) == 0) + return kv.script; + } + size_t pos = canonical_locale.ReverseFind('-'); if (pos == kNotFound) break; @@ -481,18 +466,16 @@ } static UScriptCode ScriptCodeForHanFromRegion(const String& region) { - static const SubtagScript kRegionScriptList[] = { + static constexpr SubtagScript kRegionScriptList[] = { {"hk", USCRIPT_TRADITIONAL_HAN}, {"jp", USCRIPT_KATAKANA_OR_HIRAGANA}, {"kr", USCRIPT_HANGUL}, {"mo", USCRIPT_TRADITIONAL_HAN}, {"tw", USCRIPT_TRADITIONAL_HAN}, }; - DEFINE_STATIC_LOCAL(SubtagScriptMap, region_script_map, ()); - if (region_script_map.IsEmpty()) - CreateSubtagScriptMap(region_script_map, kRegionScriptList, - WTF_ARRAY_LENGTH(kRegionScriptList)); - - const auto& it = region_script_map.find(region); - return it != region_script_map.end() ? it->value : USCRIPT_COMMON; + for (const auto& kv : kRegionScriptList) { + if (CodePointCompareIgnoringASCIICase(region, kv.subtag) == 0) + return kv.script; + } + return USCRIPT_COMMON; } UScriptCode ScriptCodeForHanFromSubtags(const String& locale, char delimiter) {
diff --git a/third_party/WebKit/Source/web/BUILD.gn b/third_party/WebKit/Source/web/BUILD.gn index 0050f8a3..fab628a 100644 --- a/third_party/WebKit/Source/web/BUILD.gn +++ b/third_party/WebKit/Source/web/BUILD.gn
@@ -16,6 +16,7 @@ deps = [ "//skia", + "//third_party/WebKit/Source/controller", "//third_party/WebKit/Source/core", "//third_party/WebKit/Source/modules", "//third_party/WebKit/Source/platform", @@ -108,6 +109,7 @@ "//gpu:test_support", "//testing/gmock", "//testing/gtest", + "//third_party/WebKit/Source/controller", "//third_party/WebKit/Source/core:unit_tests", "//third_party/WebKit/Source/modules:unit_tests", "//third_party/WebKit/Source/modules/exported:test_support",
diff --git a/third_party/WebKit/Source/web/DEPS b/third_party/WebKit/Source/web/DEPS index 0c646884..0ec881c 100644 --- a/third_party/WebKit/Source/web/DEPS +++ b/third_party/WebKit/Source/web/DEPS
@@ -1,6 +1,7 @@ include_rules = [ "+..", "+bindings", + "+controller", "+core", "+gin/public", "+modules",
diff --git a/third_party/WebKit/Source/web/WebFactoryImpl.h b/third_party/WebKit/Source/web/WebFactoryImpl.h index 4b1c4b0b..674a7a5d 100644 --- a/third_party/WebKit/Source/web/WebFactoryImpl.h +++ b/third_party/WebKit/Source/web/WebFactoryImpl.h
@@ -6,6 +6,7 @@ #define WebFactoryImpl_h #include "core/exported/WebFactory.h" +#include "web/WebExport.h" namespace blink { @@ -15,7 +16,7 @@ ~WebFactoryImpl() {} // Sets WebFactory to have a new instance of WebFactoryImpl. - static void Initialize(); + WEB_EXPORT static void Initialize(); ChromeClient* CreateChromeClient(WebViewBase*) const override; WebViewBase* CreateWebViewBase(WebViewClient*,
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp index ef725e4e..347146b 100644 --- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp +++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
@@ -61,6 +61,7 @@ #include "core/page/FocusController.h" #include "core/page/Page.h" #include "core/page/PointerLockController.h" +#include "core/page/ValidationMessageClient.h" #include "modules/compositorworker/AnimationWorkletProxyClientImpl.h" #include "modules/compositorworker/CompositorWorkerProxyClientImpl.h" #include "platform/KeyboardCodes.h" @@ -250,6 +251,7 @@ last_frame_time_monotonic); DCHECK(last_frame_time_monotonic); PageWidgetDelegate::Animate(*GetPage(), last_frame_time_monotonic); + GetPage()->GetValidationMessageClient().LayoutOverlay(); } void WebFrameWidgetImpl::UpdateAllLifecyclePhases() {
diff --git a/third_party/WebKit/Source/web/WebKit.cpp b/third_party/WebKit/Source/web/WebKit.cpp index 993a156..b0df44c 100644 --- a/third_party/WebKit/Source/web/WebKit.cpp +++ b/third_party/WebKit/Source/web/WebKit.cpp
@@ -34,15 +34,12 @@ #include "bindings/core/v8/V8BindingForCore.h" #include "bindings/core/v8/V8GCController.h" -#include "bindings/core/v8/V8Initializer.h" -#include "core/animation/AnimationClock.h" +#include "controller/BlinkInitializer.h" #include "core/layout/LayoutTheme.h" #include "core/page/Page.h" #include "core/workers/WorkerBackingThread.h" #include "gin/public/v8_platform.h" -#include "modules/ModulesInitializer.h" #include "platform/LayoutTestSupport.h" -#include "platform/bindings/Microtask.h" #include "platform/heap/Heap.h" #include "platform/wtf/Assertions.h" #include "platform/wtf/PtrUtil.h" @@ -50,49 +47,14 @@ #include "platform/wtf/allocator/Partitions.h" #include "platform/wtf/text/AtomicString.h" #include "platform/wtf/text/TextEncoding.h" -#include "public/platform/Platform.h" -#include "public/platform/WebThread.h" -#include "v8/include/v8.h" #include "web/WebFactoryImpl.h" namespace blink { -namespace { - -class EndOfTaskRunner : public WebThread::TaskObserver { - public: - void WillProcessTask() override { AnimationClock::NotifyTaskStart(); } - void DidProcessTask() override { - Microtask::PerformCheckpoint(MainThreadIsolate()); - V8Initializer::ReportRejectedPromisesOnMainThread(); - } -}; - -} // namespace - -static WebThread::TaskObserver* g_end_of_task_runner = nullptr; - -static ModulesInitializer& GetModulesInitializer() { - DEFINE_STATIC_LOCAL(std::unique_ptr<ModulesInitializer>, initializer, - (WTF::WrapUnique(new ModulesInitializer))); - return *initializer; -} - void Initialize(Platform* platform) { - Platform::Initialize(platform); - - V8Initializer::InitializeMainThread(); - - GetModulesInitializer().Initialize(); + InitializeBlink(platform); WebFactoryImpl::Initialize(); - - // currentThread is null if we are running on a thread without a message loop. - if (WebThread* current_thread = platform->CurrentThread()) { - DCHECK(!g_end_of_task_runner); - g_end_of_task_runner = new EndOfTaskRunner; - current_thread->AddTaskObserver(g_end_of_task_runner); - } } v8::Isolate* MainThreadIsolate() {
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp index 6727f0dd..ab712080 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.cpp +++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -415,6 +415,10 @@ DCHECK(link_highlights_.IsEmpty()); } +ValidationMessageClient* WebViewImpl::GetValidationMessageClient() const { + return page_ ? &page_->GetValidationMessageClient() : nullptr; +} + WebDevToolsAgentImpl* WebViewImpl::MainFrameDevToolsAgentImpl() { WebLocalFrameBase* main_frame = MainFrameImpl(); return main_frame ? main_frame->DevToolsAgentImpl() : nullptr; @@ -599,6 +603,7 @@ synthetic_wheel.wheel_ticks_x = delta.width / kTickDivisor; synthetic_wheel.wheel_ticks_y = delta.height / kTickDivisor; synthetic_wheel.has_precise_scrolling_deltas = true; + synthetic_wheel.phase = WebMouseWheelEvent::kPhaseChanged; synthetic_wheel.SetPositionInWidget(position_on_fling_start_.x, position_on_fling_start_.y); synthetic_wheel.SetPositionInScreen(global_position_on_fling_start_.x, @@ -2004,6 +2009,8 @@ DocumentLifecycle::AllowThrottlingScope throttling_scope( MainFrameImpl()->GetFrame()->GetDocument()->Lifecycle()); PageWidgetDelegate::Animate(*page_, last_frame_time_monotonic); + if (auto* client = GetValidationMessageClient()) + client->LayoutOverlay(); } void WebViewImpl::UpdateAllLifecyclePhases() { @@ -2018,6 +2025,8 @@ *MainFrameImpl()->GetFrame()); UpdateLayerTreeBackgroundColor(); + if (auto* client = GetValidationMessageClient()) + client->PaintOverlay(); if (WebDevToolsAgentImpl* devtools = MainFrameDevToolsAgentImpl()) devtools->PaintOverlay(); if (page_color_overlay_) @@ -4109,6 +4118,8 @@ void WebViewImpl::UpdatePageOverlays() { if (page_color_overlay_) page_color_overlay_->Update(); + if (auto* client = GetValidationMessageClient()) + client->LayoutOverlay(); if (WebDevToolsAgentImpl* devtools = MainFrameDevToolsAgentImpl()) devtools->LayoutOverlay(); }
diff --git a/third_party/WebKit/Source/web/WebViewImpl.h b/third_party/WebKit/Source/web/WebViewImpl.h index fc0fc718..6d82359 100644 --- a/third_party/WebKit/Source/web/WebViewImpl.h +++ b/third_party/WebKit/Source/web/WebViewImpl.h
@@ -82,6 +82,7 @@ class PageScaleConstraintsSet; class PaintLayerCompositor; class UserGestureToken; +class ValidationMessageClient; class WebActiveGestureAnimation; class WebDevToolsAgentImpl; class WebElement; @@ -285,6 +286,8 @@ // the page is shutting down, but will be valid at all other times. Page* GetPage() const override { return page_.Get(); } + // Returns a ValidationMessageClient associated to the Page. This is nullable. + ValidationMessageClient* GetValidationMessageClient() const; WebDevToolsAgentImpl* MainFrameDevToolsAgentImpl(); DevToolsEmulator* GetDevToolsEmulator() const override {
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp index ee41798d..55d80016 100644 --- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -112,6 +112,7 @@ #include "platform/scroll/ScrollbarTheme.h" #include "platform/scroll/ScrollbarThemeMock.h" #include "platform/scroll/ScrollbarThemeOverlayMock.h" +#include "platform/testing/HistogramTester.h" #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" #include "platform/testing/URLTestHelpers.h" #include "platform/testing/UnitTestHelpers.h" @@ -11504,6 +11505,8 @@ nullptr, nullptr, nullptr, &DisableCompositing); constexpr double kMockOverlayFadeOutDelayMs = 5.0; + constexpr TimeDelta kMockOverlayFadeOutDelay = + TimeDelta::FromMillisecondsD(kMockOverlayFadeOutDelayMs); ScrollbarTheme& theme = ScrollbarTheme::GetTheme(); // This test relies on mock overlay scrollbars. @@ -11545,14 +11548,14 @@ ToLayoutBox(container->GetLayoutObject())->GetScrollableArea(); EXPECT_FALSE(scrollable_area->ScrollbarsHidden()); - testing::RunDelayedTasks(kMockOverlayFadeOutDelayMs); + testing::RunDelayedTasks(kMockOverlayFadeOutDelay); EXPECT_TRUE(scrollable_area->ScrollbarsHidden()); scrollable_area->SetScrollOffset(ScrollOffset(10, 10), kProgrammaticScroll, kScrollBehaviorInstant); EXPECT_FALSE(scrollable_area->ScrollbarsHidden()); - testing::RunDelayedTasks(kMockOverlayFadeOutDelayMs); + testing::RunDelayedTasks(kMockOverlayFadeOutDelay); EXPECT_TRUE(scrollable_area->ScrollbarsHidden()); frame->ExecuteScript(WebScriptSource( @@ -11565,7 +11568,7 @@ frame->View()->UpdateAllLifecyclePhases(); EXPECT_FALSE(scrollable_area->ScrollbarsHidden()); - testing::RunDelayedTasks(kMockOverlayFadeOutDelayMs); + testing::RunDelayedTasks(kMockOverlayFadeOutDelay); EXPECT_TRUE(scrollable_area->ScrollbarsHidden()); // Non-composited scrollbars don't fade out while mouse is over. @@ -11574,10 +11577,10 @@ kScrollBehaviorInstant); EXPECT_FALSE(scrollable_area->ScrollbarsHidden()); scrollable_area->MouseEnteredScrollbar(*scrollable_area->VerticalScrollbar()); - testing::RunDelayedTasks(kMockOverlayFadeOutDelayMs); + testing::RunDelayedTasks(kMockOverlayFadeOutDelay); EXPECT_FALSE(scrollable_area->ScrollbarsHidden()); scrollable_area->MouseExitedScrollbar(*scrollable_area->VerticalScrollbar()); - testing::RunDelayedTasks(kMockOverlayFadeOutDelayMs); + testing::RunDelayedTasks(kMockOverlayFadeOutDelay); EXPECT_TRUE(scrollable_area->ScrollbarsHidden()); mock_overlay_theme.SetOverlayScrollbarFadeOutDelay(0.0); @@ -12025,4 +12028,45 @@ EXPECT_EQ(0, result->Int32Value()); } +TEST_F(WebFrameTest, RecordSameDocumentNavigationToHistogram) { + const char* histogramName = + "RendererScheduler.UpdateForSameDocumentNavigationCount"; + FrameTestHelpers::WebViewHelper web_view_helper; + HistogramTester tester; + web_view_helper.InitializeAndLoad("about:blank"); + LocalFrame* frame = + ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()); + + FrameLoader& main_frame_loader = + web_view_helper.WebView()->MainFrameImpl()->GetFrame()->Loader(); + RefPtr<SerializedScriptValue> message = + SerializeString("message", ToScriptStateForMainWorld(frame)); + tester.ExpectTotalCount(histogramName, 0); + main_frame_loader.UpdateForSameDocumentNavigation( + ToKURL("about:blank"), kSameDocumentNavigationHistoryApi, message, + kScrollRestorationAuto, kFrameLoadTypeInitialHistoryLoad, + frame->GetDocument()); + // The bucket index corresponds to the definition of + // |SinglePageAppNavigationType|. + tester.ExpectBucketCount(histogramName, + kSPANavTypeHistoryPushStateOrReplaceState, 1); + main_frame_loader.UpdateForSameDocumentNavigation( + ToKURL("about:blank"), kSameDocumentNavigationDefault, message, + kScrollRestorationManual, kFrameLoadTypeBackForward, + frame->GetDocument()); + tester.ExpectBucketCount(histogramName, + kSPANavTypeSameDocumentBackwardOrForward, 1); + main_frame_loader.UpdateForSameDocumentNavigation( + ToKURL("about:blank"), kSameDocumentNavigationDefault, message, + kScrollRestorationManual, kFrameLoadTypeInitialHistoryLoad, + frame->GetDocument()); + tester.ExpectBucketCount(histogramName, kSPANavTypeOtherFragmentNavigation, + 1); + // kSameDocumentNavigationHistoryApi and kFrameLoadTypeBackForward is an + // illegal combination, which has been caught by DCHECK in + // UpdateForSameDocumentNavigation(). + + tester.ExpectTotalCount(histogramName, 3); +} + } // namespace blink
diff --git a/third_party/WebKit/public/BUILD.gn b/third_party/WebKit/public/BUILD.gn index 410a3b5..a7b56c5 100644 --- a/third_party/WebKit/public/BUILD.gn +++ b/third_party/WebKit/public/BUILD.gn
@@ -18,6 +18,7 @@ ":blink_headers", ] deps = [ + "//third_party/WebKit/Source/controller", "//third_party/WebKit/Source/core", "//third_party/WebKit/Source/modules", "//third_party/WebKit/Source/platform", @@ -39,6 +40,7 @@ testonly = true public_deps = [ + "//third_party/WebKit/Source/controller", "//third_party/WebKit/Source/core", "//third_party/WebKit/Source/modules", "//third_party/WebKit/Source/platform:blink_platform_unittests", @@ -740,6 +742,7 @@ "platform/referrer.mojom", "platform/reporting.mojom", "platform/site_engagement.mojom", + "platform/web_feature.mojom", "web/console_message.mojom", "web/window_features.mojom", ]
diff --git a/third_party/WebKit/public/platform/PRESUBMIT.py b/third_party/WebKit/public/platform/PRESUBMIT.py index f3743b6..9748ab29 100644 --- a/third_party/WebKit/public/platform/PRESUBMIT.py +++ b/third_party/WebKit/public/platform/PRESUBMIT.py
@@ -23,13 +23,13 @@ source_path = '' for f in input_api.AffectedFiles(): - if f.LocalPath().endswith('WebFeature.h'): + if f.LocalPath().endswith('web_feature.mojom'): source_path = f.LocalPath() break else: return [] - start_marker = '^enum class WebFeature : uint32_t {' + start_marker = '^enum WebFeature {' end_marker = '^kNumberOfFeatures' presubmit_error = update_histogram_enum.CheckPresubmitErrors( histogram_enum_name='FeatureObserver',
diff --git a/third_party/WebKit/public/platform/WebFeature.h b/third_party/WebKit/public/platform/WebFeature.h index bea2b32..5aa8433 100644 --- a/third_party/WebKit/public/platform/WebFeature.h +++ b/third_party/WebKit/public/platform/WebFeature.h
@@ -1,1596 +1,16 @@ +// Copyright 2017 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 WebFeature_h #define WebFeature_h +#include "public/platform/web_feature.mojom-blink.h" + namespace blink { -// ============ Definition for WebFeature used for UseCounter =============== -// -// Do not change assigned numbers of existing items: add new features -// to the end of the list. -// -// A WebFeature conceptually represents some particular web-exposed API -// or code path which can be used/triggered by a web page. -// TODO(rbyers): Add CSS and animated CSS feature types by making this a -// more sophisticated class. -enum class WebFeature : uint32_t { - kOBSOLETE_PageDestruction = 0, - kWorkerStart = 4, - kSharedWorkerStart = 5, - kUnprefixedIndexedDB = 9, - kOpenWebDatabase = 10, - kUnprefixedRequestAnimationFrame = 13, - kPrefixedRequestAnimationFrame = 14, - kContentSecurityPolicy = 15, - kContentSecurityPolicyReportOnly = 16, - kPrefixedTransitionEndEvent = 18, - kUnprefixedTransitionEndEvent = 19, - kPrefixedAndUnprefixedTransitionEndEvent = 20, - kAutoFocusAttribute = 21, - kDataListElement = 23, - kFormAttribute = 24, - kIncrementalAttribute = 25, - kInputTypeColor = 26, - kInputTypeDate = 27, - kInputTypeDateTimeFallback = 29, - kInputTypeDateTimeLocal = 30, - kInputTypeEmail = 31, - kInputTypeMonth = 32, - kInputTypeNumber = 33, - kInputTypeRange = 34, - kInputTypeSearch = 35, - kInputTypeTel = 36, - kInputTypeTime = 37, - kInputTypeURL = 38, - kInputTypeWeek = 39, - kInputTypeWeekFallback = 40, - kListAttribute = 41, - kMaxAttribute = 42, - kMinAttribute = 43, - kPatternAttribute = 44, - kPlaceholderAttribute = 45, - kPrefixedDirectoryAttribute = 47, - kRequiredAttribute = 49, - kStepAttribute = 51, - kPageVisits = 52, - kHTMLMarqueeElement = 53, - kReflection = 55, - kPrefixedStorageInfo = 57, - kDeprecatedFlexboxWebContent = 61, - kDeprecatedFlexboxChrome = 62, - kDeprecatedFlexboxChromeExtension = 63, - kUnprefixedPerformanceTimeline = 65, - kUnprefixedUserTiming = 67, - kWindowEvent = 69, - kContentSecurityPolicyWithBaseElement = 70, - kDocumentClear = 74, - kXMLDocument = 77, - kXSLProcessingInstruction = 78, - kXSLTProcessor = 79, - kSVGSwitchElement = 80, - kDocumentAll = 83, - kFormElement = 84, - kDemotedFormElement = 85, - kSVGAnimationElement = 90, - kLineClamp = 96, - kSubFrameBeforeUnloadRegistered = 97, - kSubFrameBeforeUnloadFired = 98, - kConsoleMarkTimeline = 102, - kDocumentCreateAttribute = 111, - kDocumentCreateAttributeNS = 112, - kDocumentXMLEncoding = 115, // Removed from DOM4. - kDocumentXMLStandalone = 116, // Removed from DOM4. - kDocumentXMLVersion = 117, // Removed from DOM4. - kNavigatorProductSub = 123, - kNavigatorVendor = 124, - kNavigatorVendorSub = 125, - kPrefixedAnimationEndEvent = 128, - kUnprefixedAnimationEndEvent = 129, - kPrefixedAndUnprefixedAnimationEndEvent = 130, - kPrefixedAnimationStartEvent = 131, - kUnprefixedAnimationStartEvent = 132, - kPrefixedAndUnprefixedAnimationStartEvent = 133, - kPrefixedAnimationIterationEvent = 134, - kUnprefixedAnimationIterationEvent = 135, - kPrefixedAndUnprefixedAnimationIterationEvent = 136, - kEventReturnValue = 137, // Legacy IE extension. - kSVGSVGElement = 138, - kDOMSubtreeModifiedEvent = 143, - kDOMNodeInsertedEvent = 144, - kDOMNodeRemovedEvent = 145, - kDOMNodeRemovedFromDocumentEvent = 146, - kDOMNodeInsertedIntoDocumentEvent = 147, - kDOMCharacterDataModifiedEvent = 148, - kDocumentAllLegacyCall = 150, - kGetMatchedCSSRules = 155, - kPrefixedAudioDecodedByteCount = 164, - kPrefixedVideoDecodedByteCount = 165, - kPrefixedVideoSupportsFullscreen = 166, - kPrefixedVideoDisplayingFullscreen = 167, - kPrefixedVideoEnterFullscreen = 168, - kPrefixedVideoExitFullscreen = 169, - kPrefixedVideoEnterFullScreen = 170, - kPrefixedVideoExitFullScreen = 171, - kPrefixedVideoDecodedFrameCount = 172, - kPrefixedVideoDroppedFrameCount = 173, - kPrefixedElementRequestFullscreen = 176, - kPrefixedElementRequestFullScreen = 177, - kBarPropLocationbar = 178, - kBarPropMenubar = 179, - kBarPropPersonalbar = 180, - kBarPropScrollbars = 181, - kBarPropStatusbar = 182, - kBarPropToolbar = 183, - kInputTypeEmailMultiple = 184, - kInputTypeEmailMaxLength = 185, - kInputTypeEmailMultipleMaxLength = 186, - kInputTypeText = 190, - kInputTypeTextMaxLength = 191, - kInputTypePassword = 192, - kInputTypePasswordMaxLength = 193, - kPrefixedPageVisibility = 196, - kDocumentBeforeUnloadRegistered = 200, - kDocumentBeforeUnloadFired = 201, - kDocumentUnloadRegistered = 202, - kDocumentUnloadFired = 203, - kSVGLocatableNearestViewportElement = 204, - kSVGLocatableFarthestViewportElement = 205, - kSVGPointMatrixTransform = 209, - kDOMFocusInOutEvent = 211, - kFileGetLastModifiedDate = 212, - kHTMLElementInnerText = 213, - kHTMLElementOuterText = 214, - kReplaceDocumentViaJavaScriptURL = 215, - kElementPrefixedMatchesSelector = 217, - kCSSStyleSheetRules = 219, - kCSSStyleSheetAddRule = 220, - kCSSStyleSheetRemoveRule = 221, - // The above items are available in M33 branch. - kInitMessageEvent = 222, - kPrefixedDevicePixelRatioMediaFeature = 233, - kPrefixedMaxDevicePixelRatioMediaFeature = 234, - kPrefixedMinDevicePixelRatioMediaFeature = 235, - kPrefixedTransform3dMediaFeature = 237, - kPrefixedStorageQuota = 240, - kResetReferrerPolicy = 243, - // Case-insensitivity dropped from specification. - kCaseInsensitiveAttrSelectorMatch = 244, - kFormNameAccessForImageElement = 246, - kFormNameAccessForPastNamesMap = 247, - kFormAssociationByParser = 248, - kSVGSVGElementInDocument = 250, - kSVGDocumentRootElement = 251, - kWorkerSubjectToCSP = 257, - kWorkerAllowedByChildBlockedByScript = 258, - kDeprecatedWebKitGradient = 260, - kDeprecatedWebKitLinearGradient = 261, - kDeprecatedWebKitRepeatingLinearGradient = 262, - kDeprecatedWebKitRadialGradient = 263, - kDeprecatedWebKitRepeatingRadialGradient = 264, - // The above items are available in M34 branch. - - kTextAutosizing = 274, - kHTMLAnchorElementPingAttribute = 276, - kSVGClassName = 279, - kHTMLMediaElementSeekToFragmentStart = 281, - kHTMLMediaElementPauseAtFragmentEnd = 282, - kPrefixedWindowURL = 283, - kWindowOrientation = 285, - kDocumentCaptureEvents = 287, - kDocumentReleaseEvents = 288, - kWindowCaptureEvents = 289, - kWindowReleaseEvents = 290, - kDocumentXPathCreateExpression = 295, - kDocumentXPathCreateNSResolver = 296, - kDocumentXPathEvaluate = 297, - kAnimationConstructorKeyframeListEffectObjectTiming = 300, - kAnimationConstructorKeyframeListEffectNoTiming = 302, - kPrefixedCancelAnimationFrame = 304, - kNamedNodeMapGetNamedItem = 306, - kNamedNodeMapSetNamedItem = 307, - kNamedNodeMapRemoveNamedItem = 308, - kNamedNodeMapItem = 309, - kNamedNodeMapGetNamedItemNS = 310, - kNamedNodeMapSetNamedItemNS = 311, - kNamedNodeMapRemoveNamedItemNS = 312, - kPrefixedDocumentIsFullscreen = 318, - kPrefixedDocumentCurrentFullScreenElement = 320, - kPrefixedDocumentCancelFullScreen = 321, - kPrefixedDocumentFullscreenEnabled = 322, - kPrefixedDocumentFullscreenElement = 323, - kPrefixedDocumentExitFullscreen = 324, - // The above items are available in M35 branch. - - kSVGForeignObjectElement = 325, - kSelectionSetPosition = 327, - kAnimationFinishEvent = 328, - kSVGSVGElementInXMLDocument = 329, - kEventSrcElement = 343, - kEventCancelBubble = 344, - kEventPath = 345, - kNodeIteratorDetach = 347, - kEventGetReturnValueTrue = 350, - kEventGetReturnValueFalse = 351, - kEventSetReturnValueTrue = 352, - kEventSetReturnValueFalse = 353, - kWindowOffscreenBuffering = 356, - kWindowDefaultStatus = 357, - kWindowDefaultstatus = 358, - kPrefixedTransitionEventConstructor = 361, - kPrefixedMutationObserverConstructor = 362, - kNotificationPermission = 371, - kRangeDetach = 372, - kPrefixedFileRelativePath = 386, - kDocumentCaretRangeFromPoint = 387, - kElementScrollIntoViewIfNeeded = 389, - kRangeExpand = 393, - kHTMLImageElementX = 396, - kHTMLImageElementY = 397, - kSelectionBaseNode = 400, - kSelectionBaseOffset = 401, - kSelectionExtentNode = 402, - kSelectionExtentOffset = 403, - kSelectionType = 404, - kSelectionModify = 405, - kSelectionSetBaseAndExtent = 406, - kSelectionEmpty = 407, - kVTTCue = 409, - kVTTCueRender = 410, - kVTTCueRenderVertical = 411, - kVTTCueRenderSnapToLinesFalse = 412, - kVTTCueRenderLineNotAuto = 413, - kVTTCueRenderPositionNot50 = 414, - kVTTCueRenderSizeNot100 = 415, - kVTTCueRenderAlignNotCenter = 416, - // The above items are available in M36 branch. - - kElementRequestPointerLock = 417, - kVTTCueRenderRtl = 418, - kPostMessageFromSecureToInsecure = 419, - kPostMessageFromInsecureToSecure = 420, - kDocumentExitPointerLock = 421, - kDocumentPointerLockElement = 422, - kPrefixedCursorZoomIn = 424, - kPrefixedCursorZoomOut = 425, - kTextEncoderConstructor = 429, - kTextEncoderEncode = 430, - kTextDecoderConstructor = 431, - kTextDecoderDecode = 432, - kFocusInOutEvent = 433, - kMouseEventMovementX = 434, - kMouseEventMovementY = 435, - kDocumentFonts = 440, - kMixedContentFormsSubmitted = 441, - kFormsSubmitted = 442, - kHTMLImports = 455, - kElementCreateShadowRoot = 456, - kDocumentRegisterElement = 457, - kEditingAppleInterchangeNewline = 458, - kEditingAppleConvertedSpace = 459, - kEditingApplePasteAsQuotation = 460, - kEditingAppleStyleSpanClass = 461, - kHTMLImportsAsyncAttribute = 463, - kXMLHttpRequestSynchronous = 465, - kCSSSelectorPseudoUnresolved = 466, - kCSSSelectorPseudoShadow = 467, - kCSSSelectorPseudoContent = 468, - kCSSSelectorPseudoHost = 469, - kCSSSelectorPseudoHostContext = 470, - kCSSDeepCombinator = 471, - // The above items are available in M37 branch. - - kUseAsm = 473, - kDOMWindowOpen = 475, - kDOMWindowOpenFeatures = 476, - kAspectRatioFlexItem = 479, - kDetailsElement = 480, - kDialogElement = 481, - kMapElement = 482, - kMeterElement = 483, - kProgressElement = 484, - kWheelEventWheelDeltaX = 491, - kWheelEventWheelDeltaY = 492, - kWheelEventWheelDelta = 493, - kSendBeacon = 494, - kSendBeaconQuotaExceeded = 495, - kSVGSMILElementInDocument = 501, - kMouseEventOffsetX = 502, - kMouseEventOffsetY = 503, - kMouseEventX = 504, - kMouseEventY = 505, - kMouseEventFromElement = 506, - kMouseEventToElement = 507, - kRequestFileSystem = 508, - kRequestFileSystemWorker = 509, - kRequestFileSystemSyncWorker = 510, - kSVGStyleElementTitle = 519, - kPictureSourceSrc = 520, - // The above items are available in M38 branch. - - kPicture = 521, - kSizes = 522, - kSrcsetXDescriptor = 523, - kSrcsetWDescriptor = 524, - kSelectionContainsNode = 525, - kXMLExternalResourceLoad = 529, - kMixedContentPrivateHostnameInPublicHostname = 530, - kLegacyProtocolEmbeddedAsSubresource = 531, - kRequestedSubresourceWithEmbeddedCredentials = 532, - kNotificationCreated = 533, - kNotificationClosed = 534, - kNotificationPermissionRequested = 535, - kConsoleTimeline = 538, - kConsoleTimelineEnd = 539, - kSRIElementWithMatchingIntegrityAttribute = 540, - kSRIElementWithNonMatchingIntegrityAttribute = 541, - kSRIElementWithUnparsableIntegrityAttribute = 542, - kV8Animation_StartTime_AttributeGetter = 545, - kV8Animation_StartTime_AttributeSetter = 546, - kV8Animation_CurrentTime_AttributeGetter = 547, - kV8Animation_CurrentTime_AttributeSetter = 548, - kV8Animation_PlaybackRate_AttributeGetter = 549, - kV8Animation_PlaybackRate_AttributeSetter = 550, - kV8Animation_PlayState_AttributeGetter = 551, - kV8Animation_Finish_Method = 552, - kV8Animation_Play_Method = 553, - kV8Animation_Pause_Method = 554, - kV8Animation_Reverse_Method = 555, - // The above items are available in M39 branch. - - kBreakIterator = 556, - kScreenOrientationAngle = 557, - kScreenOrientationType = 558, - kScreenOrientationLock = 559, - kScreenOrientationUnlock = 560, - kGeolocationSecureOrigin = 561, - kGeolocationInsecureOrigin = 562, - kNotificationSecureOrigin = 563, - kNotificationInsecureOrigin = 564, - kNotificationShowEvent = 565, - kSVGTransformListConsolidate = 569, - kSVGAnimatedTransformListBaseVal = 570, - kQuotedAnimationName = 571, - kQuotedKeyframesRule = 572, - kSrcsetDroppedCandidate = 573, - kWindowPostMessage = 574, - kRenderRuby = 576, - kScriptElementWithInvalidTypeHasSrc = 578, - kXMLHttpRequestSynchronousInNonWorkerOutsideBeforeUnload = 581, - kCSSSelectorPseudoScrollbar = 582, - kCSSSelectorPseudoScrollbarButton = 583, - kCSSSelectorPseudoScrollbarThumb = 584, - kCSSSelectorPseudoScrollbarTrack = 585, - kCSSSelectorPseudoScrollbarTrackPiece = 586, - kLangAttribute = 587, - kLangAttributeOnHTML = 588, - kLangAttributeOnBody = 589, - kLangAttributeDoesNotMatchToUILocale = 590, - kInputTypeSubmit = 591, - kInputTypeSubmitWithValue = 592, - // The above items are available in M40 branch. - - kSetReferrerPolicy = 593, - kTextWholeText = 599, - kNotificationCloseEvent = 603, - kStyleMedia = 606, - kStyleMediaType = 607, - kStyleMediaMatchMedium = 608, - kMixedContentPresent = 609, - kMixedContentBlockable = 610, - kMixedContentAudio = 611, - kMixedContentDownload = 612, - kMixedContentFavicon = 613, - kMixedContentImage = 614, - kMixedContentInternal = 615, - kMixedContentPlugin = 616, - kMixedContentPrefetch = 617, - kMixedContentVideo = 618, - kCSSSelectorPseudoFullScreenAncestor = 628, - kCSSSelectorPseudoFullScreen = 629, - kWebKitCSSMatrix = 630, - kAudioContextCreateAnalyser = 631, - kAudioContextCreateBiquadFilter = 632, - kAudioContextCreateBufferSource = 633, - kAudioContextCreateChannelMerger = 634, - kAudioContextCreateChannelSplitter = 635, - kAudioContextCreateConvolver = 636, - kAudioContextCreateDelay = 637, - kAudioContextCreateDynamicsCompressor = 638, - kAudioContextCreateGain = 639, - kAudioContextCreateMediaElementSource = 640, - kAudioContextCreateMediaStreamDestination = 641, - kAudioContextCreateMediaStreamSource = 642, - kAudioContextCreateOscillator = 643, - kAudioContextCreatePeriodicWave = 645, - kAudioContextCreateScriptProcessor = 646, - kAudioContextCreateStereoPanner = 647, - kAudioContextCreateWaveShaper = 648, - kAudioContextDecodeAudioData = 649, - kAudioContextResume = 650, - kAudioContextSuspend = 651, - kMixedContentInNonHTTPSFrameThatRestrictsMixedContent = 661, - kMixedContentInSecureFrameThatDoesNotRestrictMixedContent = 662, - kMixedContentWebSocket = 663, - kSyntheticKeyframesInCompositedCSSAnimation = 664, - kMixedContentFormPresent = 665, - kGetUserMediaInsecureOrigin = 666, - kGetUserMediaSecureOrigin = 667, - // The above items are available in M41 branch. - - kDeviceMotionInsecureOrigin = 668, - kDeviceMotionSecureOrigin = 669, - kDeviceOrientationInsecureOrigin = 670, - kDeviceOrientationSecureOrigin = 671, - kSandboxViaIFrame = 672, - kSandboxViaCSP = 673, - kBlockedSniffingImageToScript = 674, - kFetch = 675, - kFetchBodyStream = 676, - kXMLHttpRequestAsynchronous = 677, - kWhiteSpacePreFromXMLSpace = 679, - kWhiteSpaceNowrapFromXMLSpace = 680, - kSVGSVGElementForceRedraw = 685, - kSVGSVGElementSuspendRedraw = 686, - kSVGSVGElementUnsuspendRedraw = 687, - kSVGSVGElementUnsuspendRedrawAll = 688, - kAudioContextClose = 689, - kCSSZoomNotEqualToOne = 691, - // The above items are available in M42 branch. - - kClientRectListItem = 694, - kWindowClientInformation = 695, - kWindowFind = 696, - kWindowScreenLeft = 697, - kWindowScreenTop = 698, - kV8Animation_Cancel_Method = 699, - kV8Animation_Onfinish_AttributeGetter = 700, - kV8Animation_Onfinish_AttributeSetter = 701, - kV8Window_WebKitAnimationEvent_ConstructorGetter = 707, - kCryptoGetRandomValues = 710, - kSubtleCryptoEncrypt = 711, - kSubtleCryptoDecrypt = 712, - kSubtleCryptoSign = 713, - kSubtleCryptoVerify = 714, - kSubtleCryptoDigest = 715, - kSubtleCryptoGenerateKey = 716, - kSubtleCryptoImportKey = 717, - kSubtleCryptoExportKey = 718, - kSubtleCryptoDeriveBits = 719, - kSubtleCryptoDeriveKey = 720, - kSubtleCryptoWrapKey = 721, - kSubtleCryptoUnwrapKey = 722, - kCryptoAlgorithmAesCbc = 723, - kCryptoAlgorithmHmac = 724, - kCryptoAlgorithmRsaSsaPkcs1v1_5 = 725, - kCryptoAlgorithmSha1 = 726, - kCryptoAlgorithmSha256 = 727, - kCryptoAlgorithmSha384 = 728, - kCryptoAlgorithmSha512 = 729, - kCryptoAlgorithmAesGcm = 730, - kCryptoAlgorithmRsaOaep = 731, - kCryptoAlgorithmAesCtr = 732, - kCryptoAlgorithmAesKw = 733, - kCryptoAlgorithmRsaPss = 734, - kCryptoAlgorithmEcdsa = 735, - kCryptoAlgorithmEcdh = 736, - kCryptoAlgorithmHkdf = 737, - kCryptoAlgorithmPbkdf2 = 738, - kDocumentSetDomain = 739, - kUpgradeInsecureRequestsEnabled = 740, - kUpgradeInsecureRequestsUpgradedRequest = 741, - kDocumentDesignMode = 742, - kGlobalCacheStorage = 743, - kNetInfo = 744, - kBackgroundSync = 745, - kLegacyConst = 748, - kV8Permissions_Query_Method = 750, - // The above items are available in M43 branch. - - kV8HTMLInputElement_Autocapitalize_AttributeGetter = 754, - kV8HTMLInputElement_Autocapitalize_AttributeSetter = 755, - kV8HTMLTextAreaElement_Autocapitalize_AttributeGetter = 756, - kV8HTMLTextAreaElement_Autocapitalize_AttributeSetter = 757, - kSVGHrefBaseVal = 758, - kSVGHrefAnimVal = 759, - kV8CSSRuleList_Item_Method = 760, - kV8MediaList_Item_Method = 761, - kV8StyleSheetList_Item_Method = 762, - kStyleSheetListAnonymousNamedGetter = 763, - kAutocapitalizeAttribute = 764, - kFullscreenSecureOrigin = 765, - kFullscreenInsecureOrigin = 766, - kDialogInSandboxedContext = 767, - kSVGSMILAnimationInImageRegardlessOfCache = 768, - kEncryptedMediaSecureOrigin = 770, - kPerformanceFrameTiming = 772, - kV8Element_Animate_Method = 773, - // The above items are available in M44 branch. - - kV8SVGSVGElement_GetElementById_Method = 778, - kElementCreateShadowRootMultiple = 779, - kV8MessageChannel_Constructor = 780, - kV8MessagePort_PostMessage_Method = 781, - kV8MessagePort_Start_Method = 782, - kV8MessagePort_Close_Method = 783, - kMessagePortsTransferred = 784, - kCSSKeyframesRuleAnonymousIndexedGetter = 785, - kV8Screen_AvailLeft_AttributeGetter = 786, - kV8Screen_AvailTop_AttributeGetter = 787, - kV8SVGFEConvolveMatrixElement_PreserveAlpha_AttributeGetter = 791, - kV8SVGStyleElement_Disabled_AttributeGetter = 798, - kV8SVGStyleElement_Disabled_AttributeSetter = 799, - kInputTypeFileSecureOrigin = 801, - kInputTypeFileInsecureOrigin = 802, - kElementAttachShadow = 804, - kV8SecurityPolicyViolationEvent_DocumentURI_AttributeGetter = 806, - kV8SecurityPolicyViolationEvent_BlockedURI_AttributeGetter = 807, - kV8SecurityPolicyViolationEvent_StatusCode_AttributeGetter = 808, - kHTMLLinkElementDisabled = 809, - kV8HTMLLinkElement_Disabled_AttributeGetter = 810, - kV8HTMLLinkElement_Disabled_AttributeSetter = 811, - kV8HTMLStyleElement_Disabled_AttributeGetter = 812, - kV8HTMLStyleElement_Disabled_AttributeSetter = 813, - kV8DOMError_Constructor = 816, - kV8DOMError_Name_AttributeGetter = 817, - kV8DOMError_Message_AttributeGetter = 818, - kTextInputFired = 830, - kV8TextEvent_Data_AttributeGetter = 831, - kV8TextEvent_InitTextEvent_Method = 832, - kClientHintsDPR = 835, - kClientHintsResourceWidth = 836, - kClientHintsViewportWidth = 837, - kSRIElementIntegrityAttributeButIneligible = 838, - kFormDataAppendNull = 843, - kNonHTMLElementSetAttributeNodeFromHTMLDocumentNameNotLowercase = 845, - kNavigatorVibrate = 850, - kNavigatorVibrateSubFrame = 851, - kV8XPathEvaluator_Constructor = 853, - kV8XPathEvaluator_CreateExpression_Method = 854, - kV8XPathEvaluator_CreateNSResolver_Method = 855, - kV8XPathEvaluator_Evaluate_Method = 856, - kRequestMIDIAccess = 857, - kV8MouseEvent_LayerX_AttributeGetter = 858, - kV8MouseEvent_LayerY_AttributeGetter = 859, - kInnerTextWithShadowTree = 860, - kSelectionToStringWithShadowTree = 861, - kWindowFindWithShadowTree = 862, - kV8CompositionEvent_InitCompositionEvent_Method = 863, - kV8CustomEvent_InitCustomEvent_Method = 864, - kV8DeviceMotionEvent_InitDeviceMotionEvent_Method = 865, - kV8DeviceOrientationEvent_InitDeviceOrientationEvent_Method = 866, - kV8Event_InitEvent_Method = 867, - kV8KeyboardEvent_InitKeyboardEvent_Method = 868, - kV8MouseEvent_InitMouseEvent_Method = 869, - kV8MutationEvent_InitMutationEvent_Method = 870, - kV8StorageEvent_InitStorageEvent_Method = 871, - kV8UIEvent_InitUIEvent_Method = 873, - kV8Document_CreateTouch_Method = 874, - kRequestFileSystemNonWebbyOrigin = 876, - kV8MemoryInfo_TotalJSHeapSize_AttributeGetter = 879, - kV8MemoryInfo_UsedJSHeapSize_AttributeGetter = 880, - kV8MemoryInfo_JSHeapSizeLimit_AttributeGetter = 881, - kV8Performance_Timing_AttributeGetter = 882, - kV8Performance_Navigation_AttributeGetter = 883, - kV8Performance_Memory_AttributeGetter = 884, - kV8SharedWorker_WorkerStart_AttributeGetter = 885, - // The above items are available in M45 branch. - - kHTMLMediaElementPreloadNone = 892, - kHTMLMediaElementPreloadMetadata = 893, - kHTMLMediaElementPreloadAuto = 894, - kHTMLMediaElementPreloadDefault = 895, - kMixedContentBlockableAllowed = 896, - kPseudoBeforeAfterForInputElement = 897, - kV8Permissions_Revoke_Method = 898, - kLinkRelDnsPrefetch = 899, - kLinkRelPreconnect = 900, - kLinkRelPreload = 901, - kLinkHeaderDnsPrefetch = 902, - kLinkHeaderPreconnect = 903, - kClientHintsMetaAcceptCH = 904, - kHTMLElementDeprecatedWidth = 905, - kClientHintsContentDPR = 906, - kElementAttachShadowOpen = 907, - kElementAttachShadowClosed = 908, - kAudioParamSetValueAtTime = 909, - kAudioParamLinearRampToValueAtTime = 910, - kAudioParamExponentialRampToValueAtTime = 911, - kAudioParamSetTargetAtTime = 912, - kAudioParamSetValueCurveAtTime = 913, - kAudioParamCancelScheduledValues = 914, - kV8Permissions_Request_Method = 915, - kLinkRelPrefetch = 917, - kLinkRelPrerender = 918, - kLinkRelNext = 919, - kCSSValuePrefixedMinContent = 921, - kCSSValuePrefixedMaxContent = 922, - kCSSValuePrefixedFitContent = 923, - kCSSValuePrefixedFillAvailable = 924, - kPresentationDefaultRequest = 926, - kPresentationAvailabilityChangeEventListener = 927, - kPresentationRequestConstructor = 928, - kPresentationRequestStart = 929, - kPresentationRequestReconnect = 930, - kPresentationRequestGetAvailability = 931, - kPresentationRequestConnectionAvailableEventListener = 932, - kPresentationConnectionTerminate = 933, - kPresentationConnectionSend = 934, - kPresentationConnectionMessageEventListener = 936, - kCSSAnimationsStackedNeutralKeyframe = 937, - kReadingCheckedInClickHandler = 938, - kFlexboxIntrinsicSizeAlgorithmIsDifferent = 939, - // The above items are available in M46 branch. - - kHTMLImportsHasStyleSheets = 940, - kNetInfoType = 946, - kNetInfoDownlinkMax = 947, - kNetInfoOnChange = 948, - kNetInfoOnTypeChange = 949, - kV8Window_Alert_Method = 950, - kV8Window_Confirm_Method = 951, - kV8Window_Prompt_Method = 952, - kV8Window_Print_Method = 953, - kV8Window_RequestIdleCallback_Method = 954, - kFlexboxPercentagePaddingVertical = 955, - kFlexboxPercentageMarginVertical = 956, - kCSPSourceWildcardWouldMatchExactHost = 959, - kCredentialManagerGet = 960, - kCredentialManagerGetMediationOptional = 961, - kCredentialManagerGetMediationSilent = 962, - kCredentialManagerStore = 963, - kCredentialManagerRequireUserMediation = 964, - // The above items are available in M47 branch. - - kBlockableMixedContentInSubframeBlocked = 966, - kAddEventListenerThirdArgumentIsObject = 967, - kRemoveEventListenerThirdArgumentIsObject = 968, - kCSSAtRuleCharset = 969, - kCSSAtRuleFontFace = 970, - kCSSAtRuleImport = 971, - kCSSAtRuleKeyframes = 972, - kCSSAtRuleMedia = 973, - kCSSAtRuleNamespace = 974, - kCSSAtRulePage = 975, - kCSSAtRuleSupports = 976, - kCSSAtRuleViewport = 977, - kCSSAtRuleWebkitKeyframes = 978, - kV8HTMLFieldSetElement_Elements_AttributeGetter = 979, - kHTMLMediaElementPreloadForcedNone = 980, - kExternalAddSearchProvider = 981, - kExternalIsSearchProviderInstalled = 982, - kV8Permissions_RequestAll_Method = 983, - kDeviceOrientationAbsoluteInsecureOrigin = 987, - kDeviceOrientationAbsoluteSecureOrigin = 988, - kFontFaceConstructor = 989, - kServiceWorkerControlledPage = 990, - kMeterElementWithMeterAppearance = 993, - kMeterElementWithNoneAppearance = 994, - kSelectionAnchorNode = 997, - kSelectionAnchorOffset = 998, - kSelectionFocusNode = 999, - kSelectionFocusOffset = 1000, - kSelectionIsCollapsed = 1001, - kSelectionRangeCount = 1002, - kSelectionGetRangeAt = 1003, - kSelectionAddRange = 1004, - kSelectionRemoveAllRanges = 1005, - kSelectionCollapse = 1006, - kSelectionCollapseToStart = 1007, - kSelectionCollapseToEnd = 1008, - kSelectionExtend = 1009, - kSelectionSelectAllChildren = 1010, - kSelectionDeleteDromDocument = 1011, - kSelectionDOMString = 1012, - kInputTypeRangeVerticalAppearance = 1013, - // The above items are available in M48 branch. - - kCSSFilterReference = 1014, - kCSSFilterGrayscale = 1015, - kCSSFilterSepia = 1016, - kCSSFilterSaturate = 1017, - kCSSFilterHueRotate = 1018, - kCSSFilterInvert = 1019, - kCSSFilterOpacity = 1020, - kCSSFilterBrightness = 1021, - kCSSFilterContrast = 1022, - kCSSFilterBlur = 1023, - kCSSFilterDropShadow = 1024, - kBackgroundSyncRegister = 1025, - kExecCommandOnInputOrTextarea = 1027, - kV8History_ScrollRestoration_AttributeGetter = 1028, - kV8History_ScrollRestoration_AttributeSetter = 1029, - kSVG1DOMFilter = 1030, - kOfflineAudioContextStartRendering = 1031, - kOfflineAudioContextSuspend = 1032, - kOfflineAudioContextResume = 1033, - kSVG1DOMPaintServer = 1035, - kSVGSVGElementFragmentSVGView = 1036, - kSVGSVGElementFragmentSVGViewElement = 1037, - kPresentationConnectionClose = 1038, - kSVG1DOMShape = 1039, - kSVG1DOMText = 1040, - kRTCPeerConnectionConstructorConstraints = 1041, - kRTCPeerConnectionConstructorCompliant = 1042, - kRTCPeerConnectionCreateOfferLegacyFailureCallback = 1044, - kRTCPeerConnectionCreateOfferLegacyConstraints = 1045, - kRTCPeerConnectionCreateOfferLegacyOfferOptions = 1046, - kRTCPeerConnectionCreateOfferLegacyCompliant = 1047, - kRTCPeerConnectionCreateAnswerLegacyFailureCallback = 1049, - kRTCPeerConnectionCreateAnswerLegacyConstraints = 1050, - kRTCPeerConnectionCreateAnswerLegacyCompliant = 1051, - kRTCPeerConnectionSetLocalDescriptionLegacyNoSuccessCallback = 1052, - kRTCPeerConnectionSetLocalDescriptionLegacyNoFailureCallback = 1053, - kRTCPeerConnectionSetLocalDescriptionLegacyCompliant = 1054, - kRTCPeerConnectionSetRemoteDescriptionLegacyNoSuccessCallback = 1055, - kRTCPeerConnectionSetRemoteDescriptionLegacyNoFailureCallback = 1056, - kRTCPeerConnectionSetRemoteDescriptionLegacyCompliant = 1057, - kRTCPeerConnectionGetStatsLegacyNonCompliant = 1058, - kNodeFilterIsFunction = 1059, - kNodeFilterIsObject = 1060, - kCSSSelectorInternalPseudoListBox = 1062, - kCSSSelectorInternalMediaControlsOverlayCastButton = 1064, - kCSSSelectorInternalPseudoSpatialNavigationFocus = 1065, - kSameOriginTextScript = 1066, - kSameOriginApplicationScript = 1067, - kSameOriginOtherScript = 1068, - kCrossOriginTextScript = 1069, - kCrossOriginApplicationScript = 1070, - kCrossOriginOtherScript = 1071, - kSVG1DOMSVGTests = 1072, - kDisableRemotePlaybackAttribute = 1074, - kV8SloppyMode = 1075, - kV8StrictMode = 1076, - kV8StrongMode = 1077, - kAudioNodeConnectToAudioNode = 1078, - kAudioNodeConnectToAudioParam = 1079, - kAudioNodeDisconnectFromAudioNode = 1080, - kAudioNodeDisconnectFromAudioParam = 1081, - kV8CSSFontFaceRule_Style_AttributeGetter = 1082, - kSelectionCollapseNull = 1083, - kSelectionSetBaseAndExtentNull = 1084, - kV8SVGSVGElement_CreateSVGNumber_Method = 1085, - kV8SVGSVGElement_CreateSVGLength_Method = 1086, - kV8SVGSVGElement_CreateSVGAngle_Method = 1087, - kV8SVGSVGElement_CreateSVGPoint_Method = 1088, - kV8SVGSVGElement_CreateSVGMatrix_Method = 1089, - kV8SVGSVGElement_CreateSVGRect_Method = 1090, - kV8SVGSVGElement_CreateSVGTransform_Method = 1091, - kV8SVGSVGElement_CreateSVGTransformFromMatrix_Method = 1092, - kFormNameAccessForNonDescendantImageElement = 1093, - kV8RegExpPrototypeStickyGetter = 1096, - kV8RegExpPrototypeToString = 1097, - kV8InputDeviceCapabilities_FiresTouchEvents_AttributeGetter = 1098, - kDataElement = 1099, - kTimeElement = 1100, - kSVG1DOMUriReference = 1101, - kSVG1DOMZoomAndPan = 1102, - kV8SVGGraphicsElement_Transform_AttributeGetter = 1103, - kMenuItemElement = 1104, - kMenuItemCloseTag = 1105, - kSVG1DOMMarkerElement = 1106, - kSVG1DOMUseElement = 1107, - kSVG1DOMMaskElement = 1108, - kV8SVGAElement_Target_AttributeGetter = 1109, - kV8SVGClipPathElement_ClipPathUnits_AttributeGetter = 1110, - kSVG1DOMFitToViewBox = 1111, - kSVG1DOMSVGElement = 1114, - kSVG1DOMImageElement = 1115, - kSVG1DOMForeignObjectElement = 1116, - kAudioContextCreateIIRFilter = 1117, - // The above items are available in M49 branch - - kCSSSelectorPseudoSlotted = 1118, - kMediaDevicesEnumerateDevices = 1119, - kNonSecureSharedWorkerAccessedFromSecureContext = 1120, - kSecureSharedWorkerAccessedFromNonSecureContext = 1121, - kEventComposedPath = 1123, - kLinkHeaderPreload = 1124, - kMouseWheelEvent = 1125, - kWheelEvent = 1126, - kMouseWheelAndWheelEvent = 1127, - kBodyScrollsInAdditionToViewport = 1128, - kDocumentDesignModeEnabeld = 1129, - kContentEditableTrue = 1130, - kContentEditableTrueOnHTML = 1131, - kContentEditablePlainTextOnly = 1132, - kV8RegExpPrototypeUnicodeGetter = 1133, - kV8IntlV8Parse = 1134, - kV8IntlPattern = 1135, - kV8IntlResolved = 1136, - kV8PromiseChain = 1137, - kV8PromiseAccept = 1138, - kV8PromiseDefer = 1139, - kEventComposed = 1140, - kGeolocationInsecureOriginIframe = 1141, - kGeolocationSecureOriginIframe = 1142, - kRequestMIDIAccessIframe = 1143, - kGetUserMediaInsecureOriginIframe = 1144, - kGetUserMediaSecureOriginIframe = 1145, - kElementRequestPointerLockIframe = 1146, - kNotificationAPIInsecureOriginIframe = 1147, - kNotificationAPISecureOriginIframe = 1148, - kWebSocket = 1149, - kMediaStreamConstraintsNameValue = 1150, - kMediaStreamConstraintsFromDictionary = 1151, - kMediaStreamConstraintsConformant = 1152, - kCSSSelectorIndirectAdjacent = 1153, - kCreateImageBitmap = 1156, - kPresentationConnectionConnectEventListener = 1157, - kPresentationConnectionCloseEventListener = 1158, - kPresentationConnectionTerminateEventListener = 1159, - kDocumentCreateEventAnimationEvent = 1162, - kDocumentCreateEventBeforeUnloadEvent = 1166, - kDocumentCreateEventCompositionEvent = 1168, - kDocumentCreateEventDragEvent = 1169, - kDocumentCreateEventErrorEvent = 1170, - kDocumentCreateEventFocusEvent = 1171, - kDocumentCreateEventHashChangeEvent = 1172, - kDocumentCreateEventMutationEvent = 1173, - kDocumentCreateEventPageTransitionEvent = 1174, - kDocumentCreateEventPopStateEvent = 1176, - kDocumentCreateEventTextEvent = 1182, - kDocumentCreateEventTransitionEvent = 1183, - kDocumentCreateEventWheelEvent = 1184, - kDocumentCreateEventTrackEvent = 1186, - kDocumentCreateEventMutationEvents = 1188, - kDocumentCreateEventSVGEvents = 1190, - kDocumentCreateEventDeviceMotionEvent = 1195, - kDocumentCreateEventDeviceOrientationEvent = 1196, - kDocumentCreateEventIDBVersionChangeEvent = 1201, - kDocumentCreateEventStorageEvent = 1221, - kDocumentCreateEventWebGLContextEvent = 1224, - kDocumentCreateEventCloseEvent = 1227, - kDocumentCreateEventKeyboardEvents = 1228, - kHTMLMediaElement = 1229, - kHTMLMediaElementInDocument = 1230, - kHTMLMediaElementControlsAttribute = 1231, - kV8Animation_Oncancel_AttributeGetter = 1233, - kV8Animation_Oncancel_AttributeSetter = 1234, - kV8HTMLCommentInExternalScript = 1235, - kV8HTMLComment = 1236, - kV8SloppyModeBlockScopedFunctionRedefinition = 1237, - kV8ForInInitializer = 1238, - kV8Animation_Id_AttributeGetter = 1239, - kV8Animation_Id_AttributeSetter = 1240, - kApplicationCacheManifestSelectInsecureOrigin = 1245, - kApplicationCacheManifestSelectSecureOrigin = 1246, - kApplicationCacheAPIInsecureOrigin = 1247, - kApplicationCacheAPISecureOrigin = 1248, - // The above items are available in M50 branch - - kCSSAtRuleApply = 1249, - kCSSSelectorPseudoAny = 1250, - kDocumentAllItemNoArguments = 1252, - kDocumentAllItemNamed = 1253, - kDocumentAllItemIndexed = 1254, - kDocumentAllItemIndexedWithNonNumber = 1255, - kDocumentAllLegacyCallNoArguments = 1256, - kDocumentAllLegacyCallNamed = 1257, - kDocumentAllLegacyCallIndexed = 1258, - kDocumentAllLegacyCallIndexedWithNonNumber = 1259, - kDocumentAllLegacyCallTwoArguments = 1260, - kHTMLLabelElementControlForNonFormAssociatedElement = 1263, - kHTMLMediaElementLoadNetworkEmptyNotPaused = 1265, - kV8Window_WebkitSpeechGrammar_ConstructorGetter = 1267, - kV8Window_WebkitSpeechGrammarList_ConstructorGetter = 1268, - kV8Window_WebkitSpeechRecognition_ConstructorGetter = 1269, - kV8Window_WebkitSpeechRecognitionError_ConstructorGetter = 1270, - kV8Window_WebkitSpeechRecognitionEvent_ConstructorGetter = 1271, - kV8Window_SpeechSynthesis_AttributeGetter = 1272, - kV8IDBFactory_WebkitGetDatabaseNames_Method = 1273, - kImageDocument = 1274, - kScriptPassesCSPDynamic = 1275, - kCSPWithStrictDynamic = 1277, - kScrollAnchored = 1278, - kAddEventListenerFourArguments = 1279, - kRemoveEventListenerFourArguments = 1280, - kSVGCalcModeDiscrete = 1287, - kSVGCalcModeLinear = 1288, - kSVGCalcModePaced = 1289, - kSVGCalcModeSpline = 1290, - kFormSubmissionStarted = 1291, - kFormValidationStarted = 1292, - kFormValidationAbortedSubmission = 1293, - kFormValidationShowedMessage = 1294, - kWebAnimationsEasingAsFunctionLinear = 1295, - kWebAnimationsEasingAsFunctionOther = 1296, - // The above items are available in M51 branch - - kV8Document_Images_AttributeGetter = 1297, - kV8Document_Embeds_AttributeGetter = 1298, - kV8Document_Plugins_AttributeGetter = 1299, - kV8Document_Links_AttributeGetter = 1300, - kV8Document_Forms_AttributeGetter = 1301, - kV8Document_Scripts_AttributeGetter = 1302, - kV8Document_Anchors_AttributeGetter = 1303, - kV8Document_Applets_AttributeGetter = 1304, - kXMLHttpRequestCrossOriginWithCredentials = 1305, - kMediaStreamTrackRemote = 1306, - kV8Node_IsConnected_AttributeGetter = 1307, - kShadowRootDelegatesFocus = 1308, - kMixedShadowRootV0AndV1 = 1309, - kImageDocumentInFrame = 1310, - kMediaDocument = 1311, - kMediaDocumentInFrame = 1312, - kPluginDocument = 1313, - kPluginDocumentInFrame = 1314, - kSinkDocument = 1315, - kSinkDocumentInFrame = 1316, - kTextDocument = 1317, - kTextDocumentInFrame = 1318, - kViewSourceDocument = 1319, - kFileAPINativeLineEndings = 1320, - kPointerEventAttributeCount = 1321, - kCompositedReplication = 1322, - kV8DataTransferItem_WebkitGetAsEntry_Method = 1325, - kV8HTMLInputElement_WebkitEntries_AttributeGetter = 1326, - kEntry_Filesystem_AttributeGetter_IsolatedFileSystem = 1327, - kEntry_GetMetadata_Method_IsolatedFileSystem = 1328, - kEntry_MoveTo_Method_IsolatedFileSystem = 1329, - kEntry_CopyTo_Method_IsolatedFileSystem = 1330, - kEntry_Remove_Method_IsolatedFileSystem = 1331, - kEntry_GetParent_Method_IsolatedFileSystem = 1332, - kEntry_ToURL_Method_IsolatedFileSystem = 1333, - kDuring_Microtask_Alert = 1334, - kDuring_Microtask_Confirm = 1335, - kDuring_Microtask_Print = 1336, - kDuring_Microtask_Prompt = 1337, - kDuring_Microtask_SyncXHR = 1338, - kCredentialManagerGetReturnedCredential = 1342, - kGeolocationInsecureOriginDeprecatedNotRemoved = 1343, - kGeolocationInsecureOriginIframeDeprecatedNotRemoved = 1344, - kProgressElementWithNoneAppearance = 1345, - kProgressElementWithProgressBarAppearance = 1346, - kPointerEventAddListenerCount = 1347, - kCSSValueAppearanceNone = 1351, - kCSSValueAppearanceNotNone = 1352, - kCSSValueAppearanceOthers = 1353, - kCSSValueAppearanceButton = 1354, - kCSSValueAppearanceCaret = 1355, - kCSSValueAppearanceCheckbox = 1356, - kCSSValueAppearanceMenulist = 1357, - kCSSValueAppearanceMenulistButton = 1358, - kCSSValueAppearanceListbox = 1359, - kCSSValueAppearanceRadio = 1360, - kCSSValueAppearanceSearchField = 1361, - kCSSValueAppearanceTextField = 1362, - kAudioContextCreatePannerAutomated = 1363, - kPannerNodeSetPosition = 1364, - kPannerNodeSetOrientation = 1365, - kAudioListenerSetPosition = 1366, - kAudioListenerSetOrientation = 1367, - kIntersectionObserver_Constructor = 1368, - kDurableStoragePersist = 1369, - kDurableStoragePersisted = 1370, - kDurableStorageEstimate = 1371, - kCSSDeepCombinatorAndShadow = 1375, - kOpacityWithPreserve3DQuirk = 1376, - kCSSSelectorPseudoReadOnly = 1377, - kCSSSelectorPseudoReadWrite = 1378, - // The above items are available in M52 branch - - kCSSSelectorPseudoDefined = 1383, - kRTCPeerConnectionAddIceCandidatePromise = 1384, - kRTCPeerConnectionAddIceCandidateLegacy = 1385, - kRTCIceCandidateDefaultSdpMLineIndex = 1386, - kMediaStreamConstraintsOldAndNew = 1389, - kV8ArrayProtectorDirtied = 1390, - kV8ArraySpeciesModified = 1391, - kV8ArrayPrototypeConstructorModified = 1392, - kV8ArrayInstanceProtoModified = 1393, - kV8ArrayInstanceConstructorModified = 1394, - kV8LegacyFunctionDeclaration = 1395, - kV8RegExpPrototypeSourceGetter = 1396, - kV8RegExpPrototypeOldFlagGetter = 1397, - kV8DecimalWithLeadingZeroInStrictMode = 1398, - kGetUserMediaPrefixed = 1400, - kGetUserMediaLegacy = 1401, - kGetUserMediaPromise = 1402, - kCSSFilterFunctionNoArguments = 1403, - kV8LegacyDateParser = 1404, - kOpenSearchInsecureOriginInsecureTarget = 1405, - kOpenSearchInsecureOriginSecureTarget = 1406, - kOpenSearchSecureOriginInsecureTarget = 1407, - kOpenSearchSecureOriginSecureTarget = 1408, - kRegisterProtocolHandlerSecureOrigin = 1409, - kRegisterProtocolHandlerInsecureOrigin = 1410, - kCrossOriginWindowAlert = 1411, - kCrossOriginWindowConfirm = 1412, - kCrossOriginWindowPrompt = 1413, - kCrossOriginWindowPrint = 1414, - kMediaStreamOnActive = 1415, - kMediaStreamOnInactive = 1416, - kAddEventListenerPassiveTrue = 1417, - kAddEventListenerPassiveFalse = 1418, - kCSPReferrerDirective = 1419, - kDocumentOpen = 1420, - kElementRequestPointerLockInShadow = 1421, - kShadowRootPointerLockElement = 1422, - kDocumentPointerLockElementInV0Shadow = 1423, - kTextAreaMaxLength = 1424, - kTextAreaMinLength = 1425, - kTopNavigationFromSubFrame = 1426, - kPrefixedElementRequestFullscreenInShadow = 1427, - kMediaSourceAbortRemove = 1428, - kMediaSourceDurationTruncatingBuffered = 1429, - kAudioContextCrossOriginIframe = 1430, - // The above items are available in M53 branch - - kPointerEventSetCapture = 1431, - kPointerEventDispatch = 1432, - kMIDIMessageEventReceivedTime = 1433, - kSummaryElementWithDisplayBlockAuthorRule = 1434, - kV8MediaStream_Active_AttributeGetter = 1435, - kBeforeInstallPromptEvent = 1436, - kBeforeInstallPromptEventUserChoice = 1437, - kBeforeInstallPromptEventPreventDefault = 1438, - kBeforeInstallPromptEventPrompt = 1439, - kExecCommandAltersHTMLStructure = 1440, - kSecureContextCheckPassed = 1441, - kSecureContextCheckFailed = 1442, - kSecureContextCheckForSandboxedOriginPassed = 1443, - kSecureContextCheckForSandboxedOriginFailed = 1444, - kV8DefineGetterOrSetterWouldThrow = 1445, - kV8FunctionConstructorReturnedUndefined = 1446, - kV8BroadcastChannel_Constructor = 1447, - kV8BroadcastChannel_PostMessage_Method = 1448, - kV8BroadcastChannel_Close_Method = 1449, - kTouchStartFired = 1450, - kMouseDownFired = 1451, - kPointerDownFired = 1452, - kPointerDownFiredForTouch = 1453, - kPointerEventDispatchPointerDown = 1454, - kSVGSMILBeginOrEndEventValue = 1455, - kSVGSMILBeginOrEndSyncbaseValue = 1456, - kSVGSMILElementInsertedAfterLoad = 1457, - kV8VisualViewport_OffsetLeft_AttributeGetter = 1458, - kV8VisualViewport_OffsetTop_AttributeGetter = 1459, - kV8VisualViewport_PageLeft_AttributeGetter = 1460, - kV8VisualViewport_PageTop_AttributeGetter = 1461, - kV8VisualViewport_Width_AttributeGetter = 1462, - kV8VisualViewport_Height_AttributeGetter = 1463, - kV8VisualViewport_Scale_AttributeGetter = 1464, - kVisualViewportScrollFired = 1465, - kVisualViewportResizeFired = 1466, - kNodeGetRootNode = 1467, - kSlotChangeEventAddListener = 1468, - kCSSValueAppearanceButtonRendered = 1469, - kCSSValueAppearanceButtonForAnchor = 1470, - kCSSValueAppearanceButtonForButton = 1471, - kCSSValueAppearanceButtonForOtherButtons = 1472, - kCSSValueAppearanceTextFieldRendered = 1473, - kCSSValueAppearanceTextFieldForSearch = 1474, - kCSSValueAppearanceTextFieldForTextField = 1475, - kRTCPeerConnectionGetStats = 1476, - kSVGSMILAnimationAppliedEffect = 1477, - kPerformanceResourceTimingSizes = 1478, - kEventSourceDocument = 1479, - kEventSourceWorker = 1480, - kSingleOriginInTimingAllowOrigin = 1481, - kMultipleOriginsInTimingAllowOrigin = 1482, - kStarInTimingAllowOrigin = 1483, - kSVGSMILAdditiveAnimation = 1484, - kSendBeaconWithNonSimpleContentType = 1485, - kChromeLoadTimesRequestTime = 1486, - kChromeLoadTimesStartLoadTime = 1487, - kChromeLoadTimesCommitLoadTime = 1488, - kChromeLoadTimesFinishDocumentLoadTime = 1489, - kChromeLoadTimesFinishLoadTime = 1490, - kChromeLoadTimesFirstPaintTime = 1491, - kChromeLoadTimesFirstPaintAfterLoadTime = 1492, - kChromeLoadTimesNavigationType = 1493, - kChromeLoadTimesWasFetchedViaSpdy = 1494, - kChromeLoadTimesWasNpnNegotiated = 1495, - kChromeLoadTimesNpnNegotiatedProtocol = 1496, - kChromeLoadTimesWasAlternateProtocolAvailable = 1497, - kChromeLoadTimesConnectionInfo = 1498, - kChromeLoadTimesUnknown = 1499, - kSVGViewElement = 1500, - kWebShareShare = 1501, - kAuxclickAddListenerCount = 1502, - kHTMLCanvasElement = 1503, - kSVGSMILAnimationElementTiming = 1504, - kSVGSMILBeginEndAnimationElement = 1505, - kSVGSMILPausing = 1506, - kSVGSMILCurrentTime = 1507, - kHTMLBodyElementOnSelectionChangeAttribute = 1508, - kForeignFetchInterception = 1509, - kUsbGetDevices = 1519, - kUsbRequestDevice = 1520, - kUsbDeviceOpen = 1521, - kUsbDeviceClose = 1522, - kUsbDeviceSelectConfiguration = 1523, - kUsbDeviceClaimInterface = 1524, - kUsbDeviceReleaseInterface = 1525, - kUsbDeviceSelectAlternateInterface = 1526, - kUsbDeviceControlTransferIn = 1527, - kUsbDeviceControlTransferOut = 1528, - kUsbDeviceClearHalt = 1529, - kUsbDeviceTransferIn = 1530, - kUsbDeviceTransferOut = 1531, - kUsbDeviceIsochronousTransferIn = 1532, - kUsbDeviceIsochronousTransferOut = 1533, - kUsbDeviceReset = 1534, - // The above items are available in M54 branch - - kPointerEnterLeaveFired = 1535, - kPointerOverOutFired = 1536, - kDraggableAttribute = 1539, - kCleanScriptElementWithNonce = 1540, - kPotentiallyInjectedScriptElementWithNonce = 1541, - kPendingStylesheetAddedAfterBodyStarted = 1542, - kUntrustedMouseDownEventDispatchedToSelect = 1543, - kBlockedSniffingAudioToScript = 1544, - kBlockedSniffingVideoToScript = 1545, - kBlockedSniffingCSVToScript = 1546, - kMetaSetCookie = 1547, - kMetaRefresh = 1548, - kMetaSetCookieWhenCSPBlocksInlineScript = 1549, - kMetaRefreshWhenCSPBlocksInlineScript = 1550, - kMiddleClickAutoscrollStart = 1551, - kRTCPeerConnectionCreateOfferOptionsOfferToReceive = 1553, - kDragAndDropScrollStart = 1554, - kPresentationConnectionListConnectionAvailableEventListener = 1555, - kWebAudioAutoplayCrossOriginIframe = 1556, - kVRGetDisplays = 1558, - kXSSAuditorBlockedScript = 1581, - kXSSAuditorBlockedEntirePage = 1582, - kXSSAuditorDisabled = 1583, - kXSSAuditorEnabledFilter = 1584, - kXSSAuditorEnabledBlock = 1585, - kXSSAuditorInvalid = 1586, - kTextInputEventOnInput = 1589, - kTextInputEventOnTextArea = 1590, - kTextInputEventOnContentEditable = 1591, - kTextInputEventOnNotNode = 1592, - kWebkitBeforeTextInsertedOnInput = 1593, - kWebkitBeforeTextInsertedOnTextArea = 1594, - kWebkitBeforeTextInsertedOnContentEditable = 1595, - kWebkitBeforeTextInsertedOnNotNode = 1596, - kWebkitEditableContentChangedOnInput = 1597, - kWebkitEditableContentChangedOnTextArea = 1598, - kWebkitEditableContentChangedOnContentEditable = 1599, - kWebkitEditableContentChangedOnNotNode = 1600, - kV8NavigatorUserMediaError_ConstraintName_AttributeGetter = 1601, - kV8HTMLMediaElement_SrcObject_AttributeGetter = 1602, - kV8HTMLMediaElement_SrcObject_AttributeSetter = 1603, - kCreateObjectURLBlob = 1604, - kCreateObjectURLMediaSource = 1605, - kCreateObjectURLMediaStream = 1606, - kDocumentCreateTouchWindowNull = 1607, - kDocumentCreateTouchWindowWrongType = 1608, - kDocumentCreateTouchTargetNull = 1609, - kDocumentCreateTouchTargetWrongType = 1610, - kDocumentCreateTouchMoreThanSevenArguments = 1612, - kLongTaskObserver = 1615, - kCSSOffsetInEffect = 1617, - // The above items are available in M55 branch - - kVRGetDisplaysInsecureOrigin = 1618, - kVRRequestPresent = 1619, - kVRRequestPresentInsecureOrigin = 1620, - kVRDeprecatedFieldOfView = 1621, - kVideoInCanvas = 1622, - kHiddenAutoplayedVideoInCanvas = 1623, - kOffscreenCanvas = 1624, - kGamepadPose = 1625, - kGamepadHand = 1626, - kGamepadDisplayId = 1627, - kGamepadButtonTouched = 1628, - kGamepadPoseHasOrientation = 1629, - kGamepadPoseHasPosition = 1630, - kGamepadPosePosition = 1631, - kGamepadPoseLinearVelocity = 1632, - kGamepadPoseLinearAcceleration = 1633, - kGamepadPoseOrientation = 1634, - kGamepadPoseAngularVelocity = 1635, - kGamepadPoseAngularAcceleration = 1636, - kV8RTCDataChannel_MaxRetransmitTime_AttributeGetter = 1638, - kV8RTCDataChannel_MaxRetransmits_AttributeGetter = 1639, - kV8RTCDataChannel_Reliable_AttributeGetter = 1640, - kV8RTCPeerConnection_AddStream_Method = 1641, - kV8RTCPeerConnection_CreateDTMFSender_Method = 1642, - kV8RTCPeerConnection_GetLocalStreams_Method = 1643, - kV8RTCPeerConnection_GetRemoteStreams_Method = 1644, - kV8RTCPeerConnection_GetStreamById_Method = 1645, - kV8RTCPeerConnection_RemoveStream_Method = 1646, - kRTCPeerConnectionCreateDataChannelMaxRetransmitTime = 1648, - kRTCPeerConnectionCreateDataChannelMaxRetransmits = 1649, - kAudioContextCreateConstantSource = 1650, - kWebAudioConstantSourceNode = 1651, - kLoopbackEmbeddedInSecureContext = 1652, - kLoopbackEmbeddedInNonSecureContext = 1653, - kBlinkMacSystemFont = 1654, - kRTCIceServerURL = 1656, - kRTCIceServerURLs = 1657, - kOffscreenCanvasTransferToImageBitmap2D = 1658, - kOffscreenCanvasTransferToImageBitmapWebGL = 1659, - kOffscreenCanvasCommit2D = 1660, - kOffscreenCanvasCommitWebGL = 1661, - kRTCConfigurationIceTransportPolicy = 1662, - kRTCConfigurationIceTransports = 1664, - kDocumentFullscreenElementInV0Shadow = 1665, - kScriptWithCSPBypassingSchemeParserInserted = 1666, - kScriptWithCSPBypassingSchemeNotParserInserted = 1667, - kDocumentCreateElement2ndArgStringHandling = 1668, - kV8MediaRecorder_Start_Method = 1669, - kWebBluetoothRequestDevice = 1670, - kUnitlessPerspectiveInPerspectiveProperty = 1671, - kUnitlessPerspectiveInTransformProperty = 1672, - kV8RTCSessionDescription_Type_AttributeGetter = 1673, - kV8RTCSessionDescription_Type_AttributeSetter = 1674, - kV8RTCSessionDescription_Sdp_AttributeGetter = 1675, - kV8RTCSessionDescription_Sdp_AttributeSetter = 1676, - kRTCSessionDescriptionInitNoType = 1677, - kRTCSessionDescriptionInitNoSdp = 1678, - kHTMLMediaElementPreloadForcedMetadata = 1679, - kGenericSensorStart = 1680, - kGenericSensorStop = 1681, - kTouchEventPreventedNoTouchAction = 1682, - kTouchEventPreventedForcedDocumentPassiveNoTouchAction = 1683, - kV8Event_StopPropagation_Method = 1684, - kV8Event_StopImmediatePropagation_Method = 1685, - kImageCaptureConstructor = 1686, - kV8Document_RootScroller_AttributeGetter = 1687, - kV8Document_RootScroller_AttributeSetter = 1688, - kCustomElementRegistryDefine = 1689, - kLinkHeaderServiceWorker = 1690, - kCSSShadowPiercingDescendantCombinator = 1691, - // The above items are available in M56 branch. - - kCSSFlexibleBox = 1692, - kCSSGridLayout = 1693, - kFullscreenAllowedByOrientationChange = 1696, - kServiceWorkerRespondToNavigationRequestWithRedirectedResponse = 1697, - kV8AudioContext_Constructor = 1698, - kV8OfflineAudioContext_Constructor = 1699, - kAppInstalledEventAddListener = 1700, - kAudioContextGetOutputTimestamp = 1701, - kV8MediaStreamAudioDestinationNode_Constructor = 1702, - kV8AnalyserNode_Constructor = 1703, - kV8AudioBuffer_Constructor = 1704, - kV8AudioBufferSourceNode_Constructor = 1705, - kV8AudioProcessingEvent_Constructor = 1706, - kV8BiquadFilterNode_Constructor = 1707, - kV8ChannelMergerNode_Constructor = 1708, - kV8ChannelSplitterNode_Constructor = 1709, - kV8ConstantSourceNode_Constructor = 1710, - kV8ConvolverNode_Constructor = 1711, - kV8DelayNode_Constructor = 1712, - kV8DynamicsCompressorNode_Constructor = 1713, - kV8GainNode_Constructor = 1714, - kV8IIRFilterNode_Constructor = 1715, - kV8MediaElementAudioSourceNode_Constructor = 1716, - kV8MediaStreamAudioSourceNode_Constructor = 1717, - kV8OfflineAudioCompletionEvent_Constructor = 1718, - kV8OscillatorNode_Constructor = 1719, - kV8PannerNode_Constructor = 1720, - kV8PeriodicWave_Constructor = 1721, - kV8StereoPannerNode_Constructor = 1722, - kV8WaveShaperNode_Constructor = 1723, - kV8Headers_GetAll_Method = 1724, - kNavigatorVibrateEngagementNone = 1725, - kNavigatorVibrateEngagementMinimal = 1726, - kNavigatorVibrateEngagementLow = 1727, - kNavigatorVibrateEngagementMedium = 1728, - kNavigatorVibrateEngagementHigh = 1729, - kNavigatorVibrateEngagementMax = 1730, - kAlertEngagementNone = 1731, - kAlertEngagementMinimal = 1732, - kAlertEngagementLow = 1733, - kAlertEngagementMedium = 1734, - kAlertEngagementHigh = 1735, - kAlertEngagementMax = 1736, - kConfirmEngagementNone = 1737, - kConfirmEngagementMinimal = 1738, - kConfirmEngagementLow = 1739, - kConfirmEngagementMedium = 1740, - kConfirmEngagementHigh = 1741, - kConfirmEngagementMax = 1742, - kPromptEngagementNone = 1743, - kPromptEngagementMinimal = 1744, - kPromptEngagementLow = 1745, - kPromptEngagementMedium = 1746, - kPromptEngagementHigh = 1747, - kPromptEngagementMax = 1748, - kTopNavInSandbox = 1749, - kTopNavInSandboxWithoutGesture = 1750, - kTopNavInSandboxWithPerm = 1751, - kTopNavInSandboxWithPermButNoGesture = 1752, - kReferrerPolicyHeader = 1753, - kHTMLAnchorElementReferrerPolicyAttribute = 1754, - kHTMLIFrameElementReferrerPolicyAttribute = 1755, - kHTMLImageElementReferrerPolicyAttribute = 1756, - kHTMLLinkElementReferrerPolicyAttribute = 1757, - kBaseElement = 1758, - kBaseWithCrossOriginHref = 1759, - kBaseWithDataHref = 1760, - kBaseWithNewlinesInTarget = 1761, - kBaseWithOpenBracketInTarget = 1762, - kBaseWouldBeBlockedByDefaultSrc = 1763, - kV8AssigmentExpressionLHSIsCallInSloppy = 1764, - kV8AssigmentExpressionLHSIsCallInStrict = 1765, - kV8PromiseConstructorReturnedUndefined = 1766, - kFormSubmittedWithUnclosedFormControl = 1767, - kScrollbarUseVerticalScrollbarButton = 1777, - kScrollbarUseVerticalScrollbarThumb = 1778, - kScrollbarUseVerticalScrollbarTrack = 1779, - kScrollbarUseHorizontalScrollbarButton = 1780, - kScrollbarUseHorizontalScrollbarThumb = 1781, - kScrollbarUseHorizontalScrollbarTrack = 1782, - kHTMLTableCellElementColspan = 1783, - kHTMLTableCellElementColspanGreaterThan1000 = 1784, - kHTMLTableCellElementColspanGreaterThan8190 = 1785, - kSelectionAddRangeIntersect = 1786, - kPostMessageFromInsecureToSecureToplevel = 1787, - // The above items are available in M57 branch. - - kV8MediaSession_Metadata_AttributeGetter = 1788, - kV8MediaSession_Metadata_AttributeSetter = 1789, - kV8MediaSession_PlaybackState_AttributeGetter = 1790, - kV8MediaSession_PlaybackState_AttributeSetter = 1791, - kV8MediaSession_SetActionHandler_Method = 1792, - kWebNFCPush = 1793, - kWebNFCCancelPush = 1794, - kWebNFCWatch = 1795, - kWebNFCCancelWatch = 1796, - kAudioParamCancelAndHoldAtTime = 1797, - kCSSValueUserModifyReadOnly = 1798, - kCSSValueUserModifyReadWrite = 1799, - kCSSValueUserModifyReadWritePlaintextOnly = 1800, - kCSSValueOnDemand = 1802, - kServiceWorkerNavigationPreload = 1803, - kFullscreenRequestWithPendingElement = 1804, - kHTMLIFrameElementAllowfullscreenAttributeSetAfterContentLoad = 1805, - kPointerEventSetCaptureOutsideDispatch = 1806, - kNotificationPermissionRequestedInsecureOrigin = 1807, - kV8DeprecatedStorageInfo_QueryUsageAndQuota_Method = 1808, - kV8DeprecatedStorageInfo_RequestQuota_Method = 1809, - kV8DeprecatedStorageQuota_QueryUsageAndQuota_Method = 1810, - kV8DeprecatedStorageQuota_RequestQuota_Method = 1811, - kV8FileReaderSync_Constructor = 1812, - kUncancelableTouchEventPreventDefaulted = 1813, - kUncancelableTouchEventDueToMainThreadResponsivenessPreventDefaulted = 1814, - kV8HTMLVideoElement_Poster_AttributeGetter = 1815, - kV8HTMLVideoElement_Poster_AttributeSetter = 1816, - kNotificationPermissionRequestedIframe = 1817, - kPresentationReceiverInsecureOrigin = 1819, - kPresentationReceiverSecureOrigin = 1820, - kPresentationRequestInsecureOrigin = 1821, - kPresentationRequestSecureOrigin = 1822, - kRtcpMuxPolicyNegotiate = 1823, - kDOMClobberedVariableAccessed = 1824, - kHTMLDocumentCreateProcessingInstruction = 1825, - kFetchResponseConstructionWithStream = 1826, - kLocationOrigin = 1827, - kDocumentOrigin = 1828, - kCanvas2DFilter = 1830, - kCanvas2DImageSmoothingQuality = 1831, - kCanvasToBlob = 1832, - kCanvasToDataURL = 1833, - kOffscreenCanvasConvertToBlob = 1834, - kSVGInCanvas2D = 1835, - kSVGInWebGL = 1836, - kSelectionFuncionsChangeFocus = 1837, - kHTMLObjectElementGetter = 1838, - kHTMLObjectElementSetter = 1839, - kHTMLEmbedElementGetter = 1840, - kHTMLEmbedElementSetter = 1841, - kTransformUsesBoxSizeOnSVG = 1842, - // The above items are available in M58 branch. - - kScrollByKeyboardArrowKeys = 1843, - kScrollByKeyboardPageUpDownKeys = 1844, - kScrollByKeyboardHomeEndKeys = 1845, - kScrollByKeyboardSpacebarKey = 1846, - kScrollByTouch = 1847, - kScrollByWheel = 1848, - kScheduledActionIgnored = 1849, - kGetCanvas2DContextAttributes = 1850, - kV8HTMLInputElement_Capture_AttributeGetter = 1851, - kV8HTMLInputElement_Capture_AttributeSetter = 1852, - kHTMLMediaElementControlsListAttribute = 1853, - kHTMLMediaElementControlsListNoDownload = 1854, - kHTMLMediaElementControlsListNoFullscreen = 1855, - kHTMLMediaElementControlsListNoRemotePlayback = 1856, - kPointerEventClickRetargetCausedByCapture = 1857, - kVRDisplayDisplayName = 1861, - kVREyeParametersOffset = 1862, - kVRPoseLinearVelocity = 1863, - kVRPoseLinearAcceleration = 1864, - kVRPoseAngularVelocity = 1865, - kVRPoseAngularAcceleration = 1866, - kCSSOverflowPaged = 1867, - kChildSrcAllowedWorkerThatScriptSrcBlocked = 1868, - kHTMLTableElementPresentationAttributeBackground = 1869, - kV8Navigator_GetInstalledRelatedApps_Method = 1870, - kNamedAccessOnWindow_ChildBrowsingContext = 1871, - kNamedAccessOnWindow_ChildBrowsingContext_CrossOriginNameMismatch = 1872, - kV0CustomElementsRegisterHTMLCustomTag = 1873, - kV0CustomElementsRegisterHTMLTypeExtension = 1874, - kV0CustomElementsRegisterSVGElement = 1875, - kV0CustomElementsRegisterEmbedderElement = 1876, - kV0CustomElementsCreateCustomTagElement = 1877, - kV0CustomElementsCreateTypeExtensionElement = 1878, - kV0CustomElementsConstruct = 1879, - kV8IDBObserver_Observe_Method = 1880, - kV8IDBObserver_Unobserve_Method = 1881, - kWebBluetoothRemoteCharacteristicGetDescriptor = 1882, - kWebBluetoothRemoteCharacteristicGetDescriptors = 1883, - kWebBluetoothRemoteCharacteristicReadValue = 1884, - kWebBluetoothRemoteCharacteristicWriteValue = 1885, - kWebBluetoothRemoteCharacteristicStartNotifications = 1886, - kWebBluetoothRemoteCharacteristicStopNotifications = 1887, - kWebBluetoothRemoteDescriptorReadValue = 1888, - kWebBluetoothRemoteDescriptorWriteValue = 1889, - kWebBluetoothRemoteServerConnect = 1890, - kWebBluetoothRemoteServerDisconnect = 1891, - kWebBluetoothRemoteServerGetPrimaryService = 1892, - kWebBluetoothRemoteServerGetPrimaryServices = 1893, - kWebBluetoothRemoteServiceGetCharacteristic = 1894, - kWebBluetoothRemoteServiceGetCharacteristics = 1895, - kHTMLContentElement = 1896, - kHTMLShadowElement = 1897, - kHTMLSlotElement = 1898, - kAccelerometerConstructor = 1899, - kAbsoluteOrientationSensorConstructor = 1900, - kAmbientLightSensorConstructor = 1901, - kGenericSensorOnActivate = 1902, - kGenericSensorOnChange = 1903, - kGenericSensorOnError = 1904, - kGenericSensorActivated = 1905, - kGyroscopeConstructor = 1906, - kMagnetometerConstructor = 1907, - kOrientationSensorPopulateMatrix = 1908, - kWindowOpenWithInvalidURL = 1909, - kCrossOriginMainFrameNulledNameAccessed = 1910, - kMenuItemElementIconAttribute = 1911, - kWebkitCSSMatrixSetMatrixValue = 1912, - kWebkitCSSMatrixConstructFromString = 1913, - kCanRequestURLHTTPContainingNewline = 1914, - kGetGamepads = 1916, - kV8SVGPathElement_GetPathSegAtLength_Method = 1917, - kMediaStreamConstraintsAudio = 1918, - kMediaStreamConstraintsAudioUnconstrained = 1919, - kMediaStreamConstraintsVideo = 1920, - kMediaStreamConstraintsVideoUnconstrained = 1921, - kMediaStreamConstraintsWidth = 1922, - kMediaStreamConstraintsHeight = 1923, - kMediaStreamConstraintsAspectRatio = 1924, - kMediaStreamConstraintsFrameRate = 1925, - kMediaStreamConstraintsFacingMode = 1926, - kMediaStreamConstraintsVolume = 1927, - kMediaStreamConstraintsSampleRate = 1928, - kMediaStreamConstraintsSampleSize = 1929, - kMediaStreamConstraintsEchoCancellation = 1930, - kMediaStreamConstraintsLatency = 1931, - kMediaStreamConstraintsChannelCount = 1932, - kMediaStreamConstraintsDeviceIdAudio = 1933, - kMediaStreamConstraintsDeviceIdVideo = 1934, - kMediaStreamConstraintsDisableLocalEcho = 1935, - kMediaStreamConstraintsGroupIdAudio = 1936, - kMediaStreamConstraintsGroupIdVideo = 1937, - kMediaStreamConstraintsVideoKind = 1938, - kMediaStreamConstraintsDepthNear = 1939, - kMediaStreamConstraintsDepthFar = 1940, - kMediaStreamConstraintsFocalLengthX = 1941, - kMediaStreamConstraintsFocalLengthY = 1942, - kMediaStreamConstraintsMediaStreamSourceAudio = 1943, - kMediaStreamConstraintsMediaStreamSourceVideo = 1944, - kMediaStreamConstraintsRenderToAssociatedSink = 1945, - kMediaStreamConstraintsHotwordEnabled = 1946, - kMediaStreamConstraintsGoogEchoCancellation = 1947, - kMediaStreamConstraintsGoogExperimentalEchoCancellation = 1948, - kMediaStreamConstraintsGoogAutoGainControl = 1949, - kMediaStreamConstraintsGoogExperimentalAutoGainControl = 1950, - kMediaStreamConstraintsGoogNoiseSuppression = 1951, - kMediaStreamConstraintsGoogHighpassFilter = 1952, - kMediaStreamConstraintsGoogTypingNoiseDetection = 1953, - kMediaStreamConstraintsGoogExperimentalNoiseSuppression = 1954, - kMediaStreamConstraintsGoogBeamforming = 1955, - kMediaStreamConstraintsGoogArrayGeometry = 1956, - kMediaStreamConstraintsGoogAudioMirroring = 1957, - kMediaStreamConstraintsGoogDAEchoCancellation = 1958, - kMediaStreamConstraintsGoogNoiseReduction = 1959, - kMediaStreamConstraintsGoogPowerLineFrequency = 1960, - // The above items are available in M59 branch. - - kViewportFixedPositionUnderFilter = 1961, - kRequestMIDIAccessWithSysExOption = 1962, - kRequestMIDIAccessIframeWithSysExOption = 1963, - kGamepadAxes = 1964, - kGamepadButtons = 1965, - kVibrateWithoutUserGesture = 1966, - kDispatchMouseEventOnDisabledFormControl = 1967, - kElementNameDOMInvalidHTMLParserValid = 1968, - kElementNameDOMValidHTMLParserInvalid = 1969, - kGATTServerDisconnectedEvent = 1970, - kAnchorClickDispatchForNonConnectedNode = 1971, - kHTMLParseErrorNestedForm = 1972, - kFontShapingNotDefGlyphObserved = 1973, - kPostMessageOutgoingWouldBeBlockedByConnectSrc = 1974, - kPostMessageIncomingWouldBeBlockedByConnectSrc = 1975, - kPaymentRequestNetworkNameInSupportedMethods = 1976, - kCrossOriginPropertyAccess = 1977, - kCrossOriginPropertyAccessFromOpener = 1978, - kCredentialManagerCreate = 1979, - kWebDatabaseCreateDropFTS3Table = 1980, - kFieldEditInSecureContext = 1981, - kFieldEditInNonSecureContext = 1982, - kCredentialManagerCredentialRequestOptionsUnmediated = 1983, - kCredentialManagerGetMediationRequired = 1984, - kCredentialManagerIdName = 1985, - kCredentialManagerPasswordName = 1986, - kCredentialManagerAdditionalData = 1987, - kCredentialManagerCustomFetch = 1988, - kNetInfoRtt = 1989, - kNetInfoDownlink = 1990, - kShapeDetection_BarcodeDetectorConstructor = 1991, - kShapeDetection_FaceDetectorConstructor = 1992, - kShapeDetection_TextDetectorConstructor = 1993, - kCredentialManagerCredentialRequestOptionsOnlyUnmediated = 1994, - kInertAttribute = 1995, - kPluginInstanceAccessFromIsolatedWorld = 1996, - kPluginInstanceAccessFromMainWorld = 1997, - kRequestFullscreenForDialogElement = 1998, - kRequestFullscreenForDialogElementInTopLayer = 1999, - kShowModalForElementInFullscreenStack = 2000, - kThreeValuedPositionBackground = 2001, - kThreeValuedPositionBasicShape = 2002, - kThreeValuedPositionGradient = 2003, - kThreeValuedPositionObjectPosition = 2004, - kThreeValuedPositionPerspectiveOrigin = 2005, - kUnitlessZeroAngleFilter = 2007, - kUnitlessZeroAngleGradient = 2008, - kUnitlessZeroAngleTransform = 2010, - kHTMLOListElementStartGetterReversedWithoutStartAttribute = 2011, - kCredentialManagerPreventSilentAccess = 2012, - kNetInfoEffectiveType = 2013, - kV8SpeechRecognition_Start_Method = 2014, - kTableRowDirectionDifferentFromTable = 2015, - kTableSectionDirectionDifferentFromTable = 2016, - // The above items are available in M60 branch. - - kClientHintsDeviceRAM = 2017, - kCSSRegisterProperty = 2018, - kRelativeOrientationSensorConstructor = 2019, - kSmoothScrollJSInterventionActivated = 2020, - kBudgetAPIGetCost = 2021, - kBudgetAPIGetBudget = 2022, - kCrossOriginMainFrameNulledNonEmptyNameAccessed = 2023, - kDeprecatedTimingFunctionStepMiddle = 2024, - kDocumentDomainSetWithNonDefaultPort = 2025, - kDocumentDomainSetWithDefaultPort = 2026, - kFeaturePolicyHeader = 2027, - kFeaturePolicyAllowAttribute = 2028, - kMIDIPortOpen = 2029, - kMIDIOutputSend = 2030, - kMIDIMessageEvent = 2031, - kFetchEventIsReload = 2032, - kServiceWorkerClientFrameType = 2033, - kQuirksModeDocument = 2034, - kLimitedQuirksModeDocument = 2035, - kEncryptedMediaCrossOriginIframe = 2036, - kCSSSelectorWebkitMediaControls = 2037, - kCSSSelectorWebkitMediaControlsOverlayEnclosure = 2038, - kCSSSelectorWebkitMediaControlsOverlayPlayButton = 2039, - kCSSSelectorWebkitMediaControlsEnclosure = 2040, - kCSSSelectorWebkitMediaControlsPanel = 2041, - kCSSSelectorWebkitMediaControlsPlayButton = 2042, - kCSSSelectorWebkitMediaControlsCurrentTimeDisplay = 2043, - kCSSSelectorWebkitMediaControlsTimeRemainingDisplay = 2044, - kCSSSelectorWebkitMediaControlsTimeline = 2045, - kCSSSelectorWebkitMediaControlsTimelineContainer = 2046, - kCSSSelectorWebkitMediaControlsMuteButton = 2047, - kCSSSelectorWebkitMediaControlsVolumeSlider = 2048, - kCSSSelectorWebkitMediaControlsFullscreenButton = 2049, - kCSSSelectorWebkitMediaControlsToggleClosedCaptionsButton = 2050, - - // Add new features immediately above this line. Don't change assigned - // numbers of any item, and don't reuse removed slots. - // Also, run update_use_counter_feature_enum.py in - // chromium/src/tools/metrics/histograms/ to update the UMA mapping. - kNumberOfFeatures, // This enum value must be last. -}; +// All WebFeature enum valus are defined in public/platform/web_feature.mojom. +using WebFeature = mojom::WebFeature; } // namespace blink
diff --git a/third_party/WebKit/public/platform/WebMouseWheelEvent.h b/third_party/WebKit/public/platform/WebMouseWheelEvent.h index 4b498859..6db7a73 100644 --- a/third_party/WebKit/public/platform/WebMouseWheelEvent.h +++ b/third_party/WebKit/public/platform/WebMouseWheelEvent.h
@@ -17,12 +17,23 @@ class WebMouseWheelEvent : public WebMouseEvent { public: enum Phase { + // No phase information is avaiable. kPhaseNone = 0, + // This wheel event is the beginning of a scrolling sequence. kPhaseBegan = 1 << 0, + // Shows that scrolling is ongoing but the scroll delta for this wheel event + // is zero. kPhaseStationary = 1 << 1, + // Shows that a scroll is ongoing and the scroll delta for this wheel event + // is non-zero. kPhaseChanged = 1 << 2, + // This wheel event is the last event of a scrolling sequence. kPhaseEnded = 1 << 3, + // A wheel event with phase cancelled shows that the scrolling sequence is + // cancelled. kPhaseCancelled = 1 << 4, + // A wheel event with phase may begin shows that a scrolling sequence may + // start. kPhaseMayBegin = 1 << 5, };
diff --git a/third_party/WebKit/public/platform/WebRuntimeFeatures.h b/third_party/WebKit/public/platform/WebRuntimeFeatures.h index 1e2cc6d..1f73ba74 100644 --- a/third_party/WebKit/public/platform/WebRuntimeFeatures.h +++ b/third_party/WebKit/public/platform/WebRuntimeFeatures.h
@@ -118,6 +118,7 @@ BLINK_PLATFORM_EXPORT static void EnableScriptedSpeech(bool); BLINK_PLATFORM_EXPORT static void EnableScrollAnchoring(bool); BLINK_PLATFORM_EXPORT static void EnableServiceWorkerNavigationPreload(bool); + BLINK_PLATFORM_EXPORT static void EnableServiceWorkerScriptStreaming(bool); BLINK_PLATFORM_EXPORT static void EnableSharedArrayBuffer(bool); BLINK_PLATFORM_EXPORT static void EnableSharedWorker(bool); BLINK_PLATFORM_EXPORT static void EnableSkipCompositingSmallScrollers(bool);
diff --git a/third_party/WebKit/public/platform/modules/payments/payment_app.mojom b/third_party/WebKit/public/platform/modules/payments/payment_app.mojom index e43a88d..2b96fad1 100644 --- a/third_party/WebKit/public/platform/modules/payments/payment_app.mojom +++ b/third_party/WebKit/public/platform/modules/payments/payment_app.mojom
@@ -15,6 +15,7 @@ NO_ACTIVE_WORKER, STORAGE_OPERATION_FAILED, FETCH_INSTRUMENT_ICON_FAILED, + FETCH_PAYMENT_APP_INFO_FAILED, }; // This struct is provided to hold an image object from render side @@ -35,7 +36,7 @@ // This interface provides implementation of PaymentInstruments.idl // in render side. interface PaymentManager { - Init(string service_worker_scope); + Init(string service_worker_script_url, string service_worker_scope); DeletePaymentInstrument(string instrument_key) => (PaymentHandlerStatus status); GetPaymentInstrument(string instrument_key)
diff --git a/third_party/WebKit/public/platform/web_feature.mojom b/third_party/WebKit/public/platform/web_feature.mojom new file mode 100644 index 0000000..11670fa --- /dev/null +++ b/third_party/WebKit/public/platform/web_feature.mojom
@@ -0,0 +1,1595 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module blink.mojom; + +// ============ Definition for WebFeature used for UseCounter =============== +// +// Do not change assigned numbers of existing items: add new features +// to the end of the list. +// +// A WebFeature conceptually represents some particular web-exposed API +// or code path which can be used/triggered by a web page. +// TODO(rbyers): Add CSS and animated CSS feature types by making this a +// more sophisticated class. +enum WebFeature { + kOBSOLETE_PageDestruction = 0, + kWorkerStart = 4, + kSharedWorkerStart = 5, + kUnprefixedIndexedDB = 9, + kOpenWebDatabase = 10, + kUnprefixedRequestAnimationFrame = 13, + kPrefixedRequestAnimationFrame = 14, + kContentSecurityPolicy = 15, + kContentSecurityPolicyReportOnly = 16, + kPrefixedTransitionEndEvent = 18, + kUnprefixedTransitionEndEvent = 19, + kPrefixedAndUnprefixedTransitionEndEvent = 20, + kAutoFocusAttribute = 21, + kDataListElement = 23, + kFormAttribute = 24, + kIncrementalAttribute = 25, + kInputTypeColor = 26, + kInputTypeDate = 27, + kInputTypeDateTimeFallback = 29, + kInputTypeDateTimeLocal = 30, + kInputTypeEmail = 31, + kInputTypeMonth = 32, + kInputTypeNumber = 33, + kInputTypeRange = 34, + kInputTypeSearch = 35, + kInputTypeTel = 36, + kInputTypeTime = 37, + kInputTypeURL = 38, + kInputTypeWeek = 39, + kInputTypeWeekFallback = 40, + kListAttribute = 41, + kMaxAttribute = 42, + kMinAttribute = 43, + kPatternAttribute = 44, + kPlaceholderAttribute = 45, + kPrefixedDirectoryAttribute = 47, + kRequiredAttribute = 49, + kStepAttribute = 51, + kPageVisits = 52, + kHTMLMarqueeElement = 53, + kReflection = 55, + kPrefixedStorageInfo = 57, + kDeprecatedFlexboxWebContent = 61, + kDeprecatedFlexboxChrome = 62, + kDeprecatedFlexboxChromeExtension = 63, + kUnprefixedPerformanceTimeline = 65, + kUnprefixedUserTiming = 67, + kWindowEvent = 69, + kContentSecurityPolicyWithBaseElement = 70, + kDocumentClear = 74, + kXMLDocument = 77, + kXSLProcessingInstruction = 78, + kXSLTProcessor = 79, + kSVGSwitchElement = 80, + kDocumentAll = 83, + kFormElement = 84, + kDemotedFormElement = 85, + kSVGAnimationElement = 90, + kLineClamp = 96, + kSubFrameBeforeUnloadRegistered = 97, + kSubFrameBeforeUnloadFired = 98, + kConsoleMarkTimeline = 102, + kDocumentCreateAttribute = 111, + kDocumentCreateAttributeNS = 112, + kDocumentXMLEncoding = 115, // Removed from DOM4. + kDocumentXMLStandalone = 116, // Removed from DOM4. + kDocumentXMLVersion = 117, // Removed from DOM4. + kNavigatorProductSub = 123, + kNavigatorVendor = 124, + kNavigatorVendorSub = 125, + kPrefixedAnimationEndEvent = 128, + kUnprefixedAnimationEndEvent = 129, + kPrefixedAndUnprefixedAnimationEndEvent = 130, + kPrefixedAnimationStartEvent = 131, + kUnprefixedAnimationStartEvent = 132, + kPrefixedAndUnprefixedAnimationStartEvent = 133, + kPrefixedAnimationIterationEvent = 134, + kUnprefixedAnimationIterationEvent = 135, + kPrefixedAndUnprefixedAnimationIterationEvent = 136, + kEventReturnValue = 137, // Legacy IE extension. + kSVGSVGElement = 138, + kDOMSubtreeModifiedEvent = 143, + kDOMNodeInsertedEvent = 144, + kDOMNodeRemovedEvent = 145, + kDOMNodeRemovedFromDocumentEvent = 146, + kDOMNodeInsertedIntoDocumentEvent = 147, + kDOMCharacterDataModifiedEvent = 148, + kDocumentAllLegacyCall = 150, + kGetMatchedCSSRules = 155, + kPrefixedAudioDecodedByteCount = 164, + kPrefixedVideoDecodedByteCount = 165, + kPrefixedVideoSupportsFullscreen = 166, + kPrefixedVideoDisplayingFullscreen = 167, + kPrefixedVideoEnterFullscreen = 168, + kPrefixedVideoExitFullscreen = 169, + kPrefixedVideoEnterFullScreen = 170, + kPrefixedVideoExitFullScreen = 171, + kPrefixedVideoDecodedFrameCount = 172, + kPrefixedVideoDroppedFrameCount = 173, + kPrefixedElementRequestFullscreen = 176, + kPrefixedElementRequestFullScreen = 177, + kBarPropLocationbar = 178, + kBarPropMenubar = 179, + kBarPropPersonalbar = 180, + kBarPropScrollbars = 181, + kBarPropStatusbar = 182, + kBarPropToolbar = 183, + kInputTypeEmailMultiple = 184, + kInputTypeEmailMaxLength = 185, + kInputTypeEmailMultipleMaxLength = 186, + kInputTypeText = 190, + kInputTypeTextMaxLength = 191, + kInputTypePassword = 192, + kInputTypePasswordMaxLength = 193, + kPrefixedPageVisibility = 196, + kDocumentBeforeUnloadRegistered = 200, + kDocumentBeforeUnloadFired = 201, + kDocumentUnloadRegistered = 202, + kDocumentUnloadFired = 203, + kSVGLocatableNearestViewportElement = 204, + kSVGLocatableFarthestViewportElement = 205, + kSVGPointMatrixTransform = 209, + kDOMFocusInOutEvent = 211, + kFileGetLastModifiedDate = 212, + kHTMLElementInnerText = 213, + kHTMLElementOuterText = 214, + kReplaceDocumentViaJavaScriptURL = 215, + kElementPrefixedMatchesSelector = 217, + kCSSStyleSheetRules = 219, + kCSSStyleSheetAddRule = 220, + kCSSStyleSheetRemoveRule = 221, + // The above items are available in M33 branch. + + kInitMessageEvent = 222, + kPrefixedDevicePixelRatioMediaFeature = 233, + kPrefixedMaxDevicePixelRatioMediaFeature = 234, + kPrefixedMinDevicePixelRatioMediaFeature = 235, + kPrefixedTransform3dMediaFeature = 237, + kPrefixedStorageQuota = 240, + kResetReferrerPolicy = 243, + // Case-insensitivity dropped from specification. + kCaseInsensitiveAttrSelectorMatch = 244, + kFormNameAccessForImageElement = 246, + kFormNameAccessForPastNamesMap = 247, + kFormAssociationByParser = 248, + kSVGSVGElementInDocument = 250, + kSVGDocumentRootElement = 251, + kWorkerSubjectToCSP = 257, + kWorkerAllowedByChildBlockedByScript = 258, + kDeprecatedWebKitGradient = 260, + kDeprecatedWebKitLinearGradient = 261, + kDeprecatedWebKitRepeatingLinearGradient = 262, + kDeprecatedWebKitRadialGradient = 263, + kDeprecatedWebKitRepeatingRadialGradient = 264, + // The above items are available in M34 branch. + + kTextAutosizing = 274, + kHTMLAnchorElementPingAttribute = 276, + kSVGClassName = 279, + kHTMLMediaElementSeekToFragmentStart = 281, + kHTMLMediaElementPauseAtFragmentEnd = 282, + kPrefixedWindowURL = 283, + kWindowOrientation = 285, + kDocumentCaptureEvents = 287, + kDocumentReleaseEvents = 288, + kWindowCaptureEvents = 289, + kWindowReleaseEvents = 290, + kDocumentXPathCreateExpression = 295, + kDocumentXPathCreateNSResolver = 296, + kDocumentXPathEvaluate = 297, + kAnimationConstructorKeyframeListEffectObjectTiming = 300, + kAnimationConstructorKeyframeListEffectNoTiming = 302, + kPrefixedCancelAnimationFrame = 304, + kNamedNodeMapGetNamedItem = 306, + kNamedNodeMapSetNamedItem = 307, + kNamedNodeMapRemoveNamedItem = 308, + kNamedNodeMapItem = 309, + kNamedNodeMapGetNamedItemNS = 310, + kNamedNodeMapSetNamedItemNS = 311, + kNamedNodeMapRemoveNamedItemNS = 312, + kPrefixedDocumentIsFullscreen = 318, + kPrefixedDocumentCurrentFullScreenElement = 320, + kPrefixedDocumentCancelFullScreen = 321, + kPrefixedDocumentFullscreenEnabled = 322, + kPrefixedDocumentFullscreenElement = 323, + kPrefixedDocumentExitFullscreen = 324, + // The above items are available in M35 branch. + + kSVGForeignObjectElement = 325, + kSelectionSetPosition = 327, + kAnimationFinishEvent = 328, + kSVGSVGElementInXMLDocument = 329, + kEventSrcElement = 343, + kEventCancelBubble = 344, + kEventPath = 345, + kNodeIteratorDetach = 347, + kEventGetReturnValueTrue = 350, + kEventGetReturnValueFalse = 351, + kEventSetReturnValueTrue = 352, + kEventSetReturnValueFalse = 353, + kWindowOffscreenBuffering = 356, + kWindowDefaultStatus = 357, + kWindowDefaultstatus = 358, + kPrefixedTransitionEventConstructor = 361, + kPrefixedMutationObserverConstructor = 362, + kNotificationPermission = 371, + kRangeDetach = 372, + kPrefixedFileRelativePath = 386, + kDocumentCaretRangeFromPoint = 387, + kElementScrollIntoViewIfNeeded = 389, + kRangeExpand = 393, + kHTMLImageElementX = 396, + kHTMLImageElementY = 397, + kSelectionBaseNode = 400, + kSelectionBaseOffset = 401, + kSelectionExtentNode = 402, + kSelectionExtentOffset = 403, + kSelectionType = 404, + kSelectionModify = 405, + kSelectionSetBaseAndExtent = 406, + kSelectionEmpty = 407, + kVTTCue = 409, + kVTTCueRender = 410, + kVTTCueRenderVertical = 411, + kVTTCueRenderSnapToLinesFalse = 412, + kVTTCueRenderLineNotAuto = 413, + kVTTCueRenderPositionNot50 = 414, + kVTTCueRenderSizeNot100 = 415, + kVTTCueRenderAlignNotCenter = 416, + // The above items are available in M36 branch. + + kElementRequestPointerLock = 417, + kVTTCueRenderRtl = 418, + kPostMessageFromSecureToInsecure = 419, + kPostMessageFromInsecureToSecure = 420, + kDocumentExitPointerLock = 421, + kDocumentPointerLockElement = 422, + kPrefixedCursorZoomIn = 424, + kPrefixedCursorZoomOut = 425, + kTextEncoderConstructor = 429, + kTextEncoderEncode = 430, + kTextDecoderConstructor = 431, + kTextDecoderDecode = 432, + kFocusInOutEvent = 433, + kMouseEventMovementX = 434, + kMouseEventMovementY = 435, + kDocumentFonts = 440, + kMixedContentFormsSubmitted = 441, + kFormsSubmitted = 442, + kHTMLImports = 455, + kElementCreateShadowRoot = 456, + kDocumentRegisterElement = 457, + kEditingAppleInterchangeNewline = 458, + kEditingAppleConvertedSpace = 459, + kEditingApplePasteAsQuotation = 460, + kEditingAppleStyleSpanClass = 461, + kHTMLImportsAsyncAttribute = 463, + kXMLHttpRequestSynchronous = 465, + kCSSSelectorPseudoUnresolved = 466, + kCSSSelectorPseudoShadow = 467, + kCSSSelectorPseudoContent = 468, + kCSSSelectorPseudoHost = 469, + kCSSSelectorPseudoHostContext = 470, + kCSSDeepCombinator = 471, + // The above items are available in M37 branch. + + kUseAsm = 473, + kDOMWindowOpen = 475, + kDOMWindowOpenFeatures = 476, + kAspectRatioFlexItem = 479, + kDetailsElement = 480, + kDialogElement = 481, + kMapElement = 482, + kMeterElement = 483, + kProgressElement = 484, + kWheelEventWheelDeltaX = 491, + kWheelEventWheelDeltaY = 492, + kWheelEventWheelDelta = 493, + kSendBeacon = 494, + kSendBeaconQuotaExceeded = 495, + kSVGSMILElementInDocument = 501, + kMouseEventOffsetX = 502, + kMouseEventOffsetY = 503, + kMouseEventX = 504, + kMouseEventY = 505, + kMouseEventFromElement = 506, + kMouseEventToElement = 507, + kRequestFileSystem = 508, + kRequestFileSystemWorker = 509, + kRequestFileSystemSyncWorker = 510, + kSVGStyleElementTitle = 519, + kPictureSourceSrc = 520, + // The above items are available in M38 branch. + + kPicture = 521, + kSizes = 522, + kSrcsetXDescriptor = 523, + kSrcsetWDescriptor = 524, + kSelectionContainsNode = 525, + kXMLExternalResourceLoad = 529, + kMixedContentPrivateHostnameInPublicHostname = 530, + kLegacyProtocolEmbeddedAsSubresource = 531, + kRequestedSubresourceWithEmbeddedCredentials = 532, + kNotificationCreated = 533, + kNotificationClosed = 534, + kNotificationPermissionRequested = 535, + kConsoleTimeline = 538, + kConsoleTimelineEnd = 539, + kSRIElementWithMatchingIntegrityAttribute = 540, + kSRIElementWithNonMatchingIntegrityAttribute = 541, + kSRIElementWithUnparsableIntegrityAttribute = 542, + kV8Animation_StartTime_AttributeGetter = 545, + kV8Animation_StartTime_AttributeSetter = 546, + kV8Animation_CurrentTime_AttributeGetter = 547, + kV8Animation_CurrentTime_AttributeSetter = 548, + kV8Animation_PlaybackRate_AttributeGetter = 549, + kV8Animation_PlaybackRate_AttributeSetter = 550, + kV8Animation_PlayState_AttributeGetter = 551, + kV8Animation_Finish_Method = 552, + kV8Animation_Play_Method = 553, + kV8Animation_Pause_Method = 554, + kV8Animation_Reverse_Method = 555, + // The above items are available in M39 branch. + + kBreakIterator = 556, + kScreenOrientationAngle = 557, + kScreenOrientationType = 558, + kScreenOrientationLock = 559, + kScreenOrientationUnlock = 560, + kGeolocationSecureOrigin = 561, + kGeolocationInsecureOrigin = 562, + kNotificationSecureOrigin = 563, + kNotificationInsecureOrigin = 564, + kNotificationShowEvent = 565, + kSVGTransformListConsolidate = 569, + kSVGAnimatedTransformListBaseVal = 570, + kQuotedAnimationName = 571, + kQuotedKeyframesRule = 572, + kSrcsetDroppedCandidate = 573, + kWindowPostMessage = 574, + kRenderRuby = 576, + kScriptElementWithInvalidTypeHasSrc = 578, + kXMLHttpRequestSynchronousInNonWorkerOutsideBeforeUnload = 581, + kCSSSelectorPseudoScrollbar = 582, + kCSSSelectorPseudoScrollbarButton = 583, + kCSSSelectorPseudoScrollbarThumb = 584, + kCSSSelectorPseudoScrollbarTrack = 585, + kCSSSelectorPseudoScrollbarTrackPiece = 586, + kLangAttribute = 587, + kLangAttributeOnHTML = 588, + kLangAttributeOnBody = 589, + kLangAttributeDoesNotMatchToUILocale = 590, + kInputTypeSubmit = 591, + kInputTypeSubmitWithValue = 592, + // The above items are available in M40 branch. + + kSetReferrerPolicy = 593, + kTextWholeText = 599, + kNotificationCloseEvent = 603, + kStyleMedia = 606, + kStyleMediaType = 607, + kStyleMediaMatchMedium = 608, + kMixedContentPresent = 609, + kMixedContentBlockable = 610, + kMixedContentAudio = 611, + kMixedContentDownload = 612, + kMixedContentFavicon = 613, + kMixedContentImage = 614, + kMixedContentInternal = 615, + kMixedContentPlugin = 616, + kMixedContentPrefetch = 617, + kMixedContentVideo = 618, + kCSSSelectorPseudoFullScreenAncestor = 628, + kCSSSelectorPseudoFullScreen = 629, + kWebKitCSSMatrix = 630, + kAudioContextCreateAnalyser = 631, + kAudioContextCreateBiquadFilter = 632, + kAudioContextCreateBufferSource = 633, + kAudioContextCreateChannelMerger = 634, + kAudioContextCreateChannelSplitter = 635, + kAudioContextCreateConvolver = 636, + kAudioContextCreateDelay = 637, + kAudioContextCreateDynamicsCompressor = 638, + kAudioContextCreateGain = 639, + kAudioContextCreateMediaElementSource = 640, + kAudioContextCreateMediaStreamDestination = 641, + kAudioContextCreateMediaStreamSource = 642, + kAudioContextCreateOscillator = 643, + kAudioContextCreatePeriodicWave = 645, + kAudioContextCreateScriptProcessor = 646, + kAudioContextCreateStereoPanner = 647, + kAudioContextCreateWaveShaper = 648, + kAudioContextDecodeAudioData = 649, + kAudioContextResume = 650, + kAudioContextSuspend = 651, + kMixedContentInNonHTTPSFrameThatRestrictsMixedContent = 661, + kMixedContentInSecureFrameThatDoesNotRestrictMixedContent = 662, + kMixedContentWebSocket = 663, + kSyntheticKeyframesInCompositedCSSAnimation = 664, + kMixedContentFormPresent = 665, + kGetUserMediaInsecureOrigin = 666, + kGetUserMediaSecureOrigin = 667, + // The above items are available in M41 branch. + + kDeviceMotionInsecureOrigin = 668, + kDeviceMotionSecureOrigin = 669, + kDeviceOrientationInsecureOrigin = 670, + kDeviceOrientationSecureOrigin = 671, + kSandboxViaIFrame = 672, + kSandboxViaCSP = 673, + kBlockedSniffingImageToScript = 674, + kFetch = 675, + kFetchBodyStream = 676, + kXMLHttpRequestAsynchronous = 677, + kWhiteSpacePreFromXMLSpace = 679, + kWhiteSpaceNowrapFromXMLSpace = 680, + kSVGSVGElementForceRedraw = 685, + kSVGSVGElementSuspendRedraw = 686, + kSVGSVGElementUnsuspendRedraw = 687, + kSVGSVGElementUnsuspendRedrawAll = 688, + kAudioContextClose = 689, + kCSSZoomNotEqualToOne = 691, + // The above items are available in M42 branch. + + kClientRectListItem = 694, + kWindowClientInformation = 695, + kWindowFind = 696, + kWindowScreenLeft = 697, + kWindowScreenTop = 698, + kV8Animation_Cancel_Method = 699, + kV8Animation_Onfinish_AttributeGetter = 700, + kV8Animation_Onfinish_AttributeSetter = 701, + kV8Window_WebKitAnimationEvent_ConstructorGetter = 707, + kCryptoGetRandomValues = 710, + kSubtleCryptoEncrypt = 711, + kSubtleCryptoDecrypt = 712, + kSubtleCryptoSign = 713, + kSubtleCryptoVerify = 714, + kSubtleCryptoDigest = 715, + kSubtleCryptoGenerateKey = 716, + kSubtleCryptoImportKey = 717, + kSubtleCryptoExportKey = 718, + kSubtleCryptoDeriveBits = 719, + kSubtleCryptoDeriveKey = 720, + kSubtleCryptoWrapKey = 721, + kSubtleCryptoUnwrapKey = 722, + kCryptoAlgorithmAesCbc = 723, + kCryptoAlgorithmHmac = 724, + kCryptoAlgorithmRsaSsaPkcs1v1_5 = 725, + kCryptoAlgorithmSha1 = 726, + kCryptoAlgorithmSha256 = 727, + kCryptoAlgorithmSha384 = 728, + kCryptoAlgorithmSha512 = 729, + kCryptoAlgorithmAesGcm = 730, + kCryptoAlgorithmRsaOaep = 731, + kCryptoAlgorithmAesCtr = 732, + kCryptoAlgorithmAesKw = 733, + kCryptoAlgorithmRsaPss = 734, + kCryptoAlgorithmEcdsa = 735, + kCryptoAlgorithmEcdh = 736, + kCryptoAlgorithmHkdf = 737, + kCryptoAlgorithmPbkdf2 = 738, + kDocumentSetDomain = 739, + kUpgradeInsecureRequestsEnabled = 740, + kUpgradeInsecureRequestsUpgradedRequest = 741, + kDocumentDesignMode = 742, + kGlobalCacheStorage = 743, + kNetInfo = 744, + kBackgroundSync = 745, + kLegacyConst = 748, + kV8Permissions_Query_Method = 750, + // The above items are available in M43 branch. + + kV8HTMLInputElement_Autocapitalize_AttributeGetter = 754, + kV8HTMLInputElement_Autocapitalize_AttributeSetter = 755, + kV8HTMLTextAreaElement_Autocapitalize_AttributeGetter = 756, + kV8HTMLTextAreaElement_Autocapitalize_AttributeSetter = 757, + kSVGHrefBaseVal = 758, + kSVGHrefAnimVal = 759, + kV8CSSRuleList_Item_Method = 760, + kV8MediaList_Item_Method = 761, + kV8StyleSheetList_Item_Method = 762, + kStyleSheetListAnonymousNamedGetter = 763, + kAutocapitalizeAttribute = 764, + kFullscreenSecureOrigin = 765, + kFullscreenInsecureOrigin = 766, + kDialogInSandboxedContext = 767, + kSVGSMILAnimationInImageRegardlessOfCache = 768, + kEncryptedMediaSecureOrigin = 770, + kPerformanceFrameTiming = 772, + kV8Element_Animate_Method = 773, + // The above items are available in M44 branch. + + kV8SVGSVGElement_GetElementById_Method = 778, + kElementCreateShadowRootMultiple = 779, + kV8MessageChannel_Constructor = 780, + kV8MessagePort_PostMessage_Method = 781, + kV8MessagePort_Start_Method = 782, + kV8MessagePort_Close_Method = 783, + kMessagePortsTransferred = 784, + kCSSKeyframesRuleAnonymousIndexedGetter = 785, + kV8Screen_AvailLeft_AttributeGetter = 786, + kV8Screen_AvailTop_AttributeGetter = 787, + kV8SVGFEConvolveMatrixElement_PreserveAlpha_AttributeGetter = 791, + kV8SVGStyleElement_Disabled_AttributeGetter = 798, + kV8SVGStyleElement_Disabled_AttributeSetter = 799, + kInputTypeFileSecureOrigin = 801, + kInputTypeFileInsecureOrigin = 802, + kElementAttachShadow = 804, + kV8SecurityPolicyViolationEvent_DocumentURI_AttributeGetter = 806, + kV8SecurityPolicyViolationEvent_BlockedURI_AttributeGetter = 807, + kV8SecurityPolicyViolationEvent_StatusCode_AttributeGetter = 808, + kHTMLLinkElementDisabled = 809, + kV8HTMLLinkElement_Disabled_AttributeGetter = 810, + kV8HTMLLinkElement_Disabled_AttributeSetter = 811, + kV8HTMLStyleElement_Disabled_AttributeGetter = 812, + kV8HTMLStyleElement_Disabled_AttributeSetter = 813, + kV8DOMError_Constructor = 816, + kV8DOMError_Name_AttributeGetter = 817, + kV8DOMError_Message_AttributeGetter = 818, + kTextInputFired = 830, + kV8TextEvent_Data_AttributeGetter = 831, + kV8TextEvent_InitTextEvent_Method = 832, + kClientHintsDPR = 835, + kClientHintsResourceWidth = 836, + kClientHintsViewportWidth = 837, + kSRIElementIntegrityAttributeButIneligible = 838, + kFormDataAppendNull = 843, + kNonHTMLElementSetAttributeNodeFromHTMLDocumentNameNotLowercase = 845, + kNavigatorVibrate = 850, + kNavigatorVibrateSubFrame = 851, + kV8XPathEvaluator_Constructor = 853, + kV8XPathEvaluator_CreateExpression_Method = 854, + kV8XPathEvaluator_CreateNSResolver_Method = 855, + kV8XPathEvaluator_Evaluate_Method = 856, + kRequestMIDIAccess = 857, + kV8MouseEvent_LayerX_AttributeGetter = 858, + kV8MouseEvent_LayerY_AttributeGetter = 859, + kInnerTextWithShadowTree = 860, + kSelectionToStringWithShadowTree = 861, + kWindowFindWithShadowTree = 862, + kV8CompositionEvent_InitCompositionEvent_Method = 863, + kV8CustomEvent_InitCustomEvent_Method = 864, + kV8DeviceMotionEvent_InitDeviceMotionEvent_Method = 865, + kV8DeviceOrientationEvent_InitDeviceOrientationEvent_Method = 866, + kV8Event_InitEvent_Method = 867, + kV8KeyboardEvent_InitKeyboardEvent_Method = 868, + kV8MouseEvent_InitMouseEvent_Method = 869, + kV8MutationEvent_InitMutationEvent_Method = 870, + kV8StorageEvent_InitStorageEvent_Method = 871, + kV8UIEvent_InitUIEvent_Method = 873, + kV8Document_CreateTouch_Method = 874, + kRequestFileSystemNonWebbyOrigin = 876, + kV8MemoryInfo_TotalJSHeapSize_AttributeGetter = 879, + kV8MemoryInfo_UsedJSHeapSize_AttributeGetter = 880, + kV8MemoryInfo_JSHeapSizeLimit_AttributeGetter = 881, + kV8Performance_Timing_AttributeGetter = 882, + kV8Performance_Navigation_AttributeGetter = 883, + kV8Performance_Memory_AttributeGetter = 884, + kV8SharedWorker_WorkerStart_AttributeGetter = 885, + // The above items are available in M45 branch. + + kHTMLMediaElementPreloadNone = 892, + kHTMLMediaElementPreloadMetadata = 893, + kHTMLMediaElementPreloadAuto = 894, + kHTMLMediaElementPreloadDefault = 895, + kMixedContentBlockableAllowed = 896, + kPseudoBeforeAfterForInputElement = 897, + kV8Permissions_Revoke_Method = 898, + kLinkRelDnsPrefetch = 899, + kLinkRelPreconnect = 900, + kLinkRelPreload = 901, + kLinkHeaderDnsPrefetch = 902, + kLinkHeaderPreconnect = 903, + kClientHintsMetaAcceptCH = 904, + kHTMLElementDeprecatedWidth = 905, + kClientHintsContentDPR = 906, + kElementAttachShadowOpen = 907, + kElementAttachShadowClosed = 908, + kAudioParamSetValueAtTime = 909, + kAudioParamLinearRampToValueAtTime = 910, + kAudioParamExponentialRampToValueAtTime = 911, + kAudioParamSetTargetAtTime = 912, + kAudioParamSetValueCurveAtTime = 913, + kAudioParamCancelScheduledValues = 914, + kV8Permissions_Request_Method = 915, + kLinkRelPrefetch = 917, + kLinkRelPrerender = 918, + kLinkRelNext = 919, + kCSSValuePrefixedMinContent = 921, + kCSSValuePrefixedMaxContent = 922, + kCSSValuePrefixedFitContent = 923, + kCSSValuePrefixedFillAvailable = 924, + kPresentationDefaultRequest = 926, + kPresentationAvailabilityChangeEventListener = 927, + kPresentationRequestConstructor = 928, + kPresentationRequestStart = 929, + kPresentationRequestReconnect = 930, + kPresentationRequestGetAvailability = 931, + kPresentationRequestConnectionAvailableEventListener = 932, + kPresentationConnectionTerminate = 933, + kPresentationConnectionSend = 934, + kPresentationConnectionMessageEventListener = 936, + kCSSAnimationsStackedNeutralKeyframe = 937, + kReadingCheckedInClickHandler = 938, + kFlexboxIntrinsicSizeAlgorithmIsDifferent = 939, + // The above items are available in M46 branch. + + kHTMLImportsHasStyleSheets = 940, + kNetInfoType = 946, + kNetInfoDownlinkMax = 947, + kNetInfoOnChange = 948, + kNetInfoOnTypeChange = 949, + kV8Window_Alert_Method = 950, + kV8Window_Confirm_Method = 951, + kV8Window_Prompt_Method = 952, + kV8Window_Print_Method = 953, + kV8Window_RequestIdleCallback_Method = 954, + kFlexboxPercentagePaddingVertical = 955, + kFlexboxPercentageMarginVertical = 956, + kCSPSourceWildcardWouldMatchExactHost = 959, + kCredentialManagerGet = 960, + kCredentialManagerGetMediationOptional = 961, + kCredentialManagerGetMediationSilent = 962, + kCredentialManagerStore = 963, + kCredentialManagerRequireUserMediation = 964, + // The above items are available in M47 branch. + + kBlockableMixedContentInSubframeBlocked = 966, + kAddEventListenerThirdArgumentIsObject = 967, + kRemoveEventListenerThirdArgumentIsObject = 968, + kCSSAtRuleCharset = 969, + kCSSAtRuleFontFace = 970, + kCSSAtRuleImport = 971, + kCSSAtRuleKeyframes = 972, + kCSSAtRuleMedia = 973, + kCSSAtRuleNamespace = 974, + kCSSAtRulePage = 975, + kCSSAtRuleSupports = 976, + kCSSAtRuleViewport = 977, + kCSSAtRuleWebkitKeyframes = 978, + kV8HTMLFieldSetElement_Elements_AttributeGetter = 979, + kHTMLMediaElementPreloadForcedNone = 980, + kExternalAddSearchProvider = 981, + kExternalIsSearchProviderInstalled = 982, + kV8Permissions_RequestAll_Method = 983, + kDeviceOrientationAbsoluteInsecureOrigin = 987, + kDeviceOrientationAbsoluteSecureOrigin = 988, + kFontFaceConstructor = 989, + kServiceWorkerControlledPage = 990, + kMeterElementWithMeterAppearance = 993, + kMeterElementWithNoneAppearance = 994, + kSelectionAnchorNode = 997, + kSelectionAnchorOffset = 998, + kSelectionFocusNode = 999, + kSelectionFocusOffset = 1000, + kSelectionIsCollapsed = 1001, + kSelectionRangeCount = 1002, + kSelectionGetRangeAt = 1003, + kSelectionAddRange = 1004, + kSelectionRemoveAllRanges = 1005, + kSelectionCollapse = 1006, + kSelectionCollapseToStart = 1007, + kSelectionCollapseToEnd = 1008, + kSelectionExtend = 1009, + kSelectionSelectAllChildren = 1010, + kSelectionDeleteDromDocument = 1011, + kSelectionDOMString = 1012, + kInputTypeRangeVerticalAppearance = 1013, + // The above items are available in M48 branch. + + kCSSFilterReference = 1014, + kCSSFilterGrayscale = 1015, + kCSSFilterSepia = 1016, + kCSSFilterSaturate = 1017, + kCSSFilterHueRotate = 1018, + kCSSFilterInvert = 1019, + kCSSFilterOpacity = 1020, + kCSSFilterBrightness = 1021, + kCSSFilterContrast = 1022, + kCSSFilterBlur = 1023, + kCSSFilterDropShadow = 1024, + kBackgroundSyncRegister = 1025, + kExecCommandOnInputOrTextarea = 1027, + kV8History_ScrollRestoration_AttributeGetter = 1028, + kV8History_ScrollRestoration_AttributeSetter = 1029, + kSVG1DOMFilter = 1030, + kOfflineAudioContextStartRendering = 1031, + kOfflineAudioContextSuspend = 1032, + kOfflineAudioContextResume = 1033, + kSVG1DOMPaintServer = 1035, + kSVGSVGElementFragmentSVGView = 1036, + kSVGSVGElementFragmentSVGViewElement = 1037, + kPresentationConnectionClose = 1038, + kSVG1DOMShape = 1039, + kSVG1DOMText = 1040, + kRTCPeerConnectionConstructorConstraints = 1041, + kRTCPeerConnectionConstructorCompliant = 1042, + kRTCPeerConnectionCreateOfferLegacyFailureCallback = 1044, + kRTCPeerConnectionCreateOfferLegacyConstraints = 1045, + kRTCPeerConnectionCreateOfferLegacyOfferOptions = 1046, + kRTCPeerConnectionCreateOfferLegacyCompliant = 1047, + kRTCPeerConnectionCreateAnswerLegacyFailureCallback = 1049, + kRTCPeerConnectionCreateAnswerLegacyConstraints = 1050, + kRTCPeerConnectionCreateAnswerLegacyCompliant = 1051, + kRTCPeerConnectionSetLocalDescriptionLegacyNoSuccessCallback = 1052, + kRTCPeerConnectionSetLocalDescriptionLegacyNoFailureCallback = 1053, + kRTCPeerConnectionSetLocalDescriptionLegacyCompliant = 1054, + kRTCPeerConnectionSetRemoteDescriptionLegacyNoSuccessCallback = 1055, + kRTCPeerConnectionSetRemoteDescriptionLegacyNoFailureCallback = 1056, + kRTCPeerConnectionSetRemoteDescriptionLegacyCompliant = 1057, + kRTCPeerConnectionGetStatsLegacyNonCompliant = 1058, + kNodeFilterIsFunction = 1059, + kNodeFilterIsObject = 1060, + kCSSSelectorInternalPseudoListBox = 1062, + kCSSSelectorInternalMediaControlsOverlayCastButton = 1064, + kCSSSelectorInternalPseudoSpatialNavigationFocus = 1065, + kSameOriginTextScript = 1066, + kSameOriginApplicationScript = 1067, + kSameOriginOtherScript = 1068, + kCrossOriginTextScript = 1069, + kCrossOriginApplicationScript = 1070, + kCrossOriginOtherScript = 1071, + kSVG1DOMSVGTests = 1072, + kDisableRemotePlaybackAttribute = 1074, + kV8SloppyMode = 1075, + kV8StrictMode = 1076, + kV8StrongMode = 1077, + kAudioNodeConnectToAudioNode = 1078, + kAudioNodeConnectToAudioParam = 1079, + kAudioNodeDisconnectFromAudioNode = 1080, + kAudioNodeDisconnectFromAudioParam = 1081, + kV8CSSFontFaceRule_Style_AttributeGetter = 1082, + kSelectionCollapseNull = 1083, + kSelectionSetBaseAndExtentNull = 1084, + kV8SVGSVGElement_CreateSVGNumber_Method = 1085, + kV8SVGSVGElement_CreateSVGLength_Method = 1086, + kV8SVGSVGElement_CreateSVGAngle_Method = 1087, + kV8SVGSVGElement_CreateSVGPoint_Method = 1088, + kV8SVGSVGElement_CreateSVGMatrix_Method = 1089, + kV8SVGSVGElement_CreateSVGRect_Method = 1090, + kV8SVGSVGElement_CreateSVGTransform_Method = 1091, + kV8SVGSVGElement_CreateSVGTransformFromMatrix_Method = 1092, + kFormNameAccessForNonDescendantImageElement = 1093, + kV8RegExpPrototypeStickyGetter = 1096, + kV8RegExpPrototypeToString = 1097, + kV8InputDeviceCapabilities_FiresTouchEvents_AttributeGetter = 1098, + kDataElement = 1099, + kTimeElement = 1100, + kSVG1DOMUriReference = 1101, + kSVG1DOMZoomAndPan = 1102, + kV8SVGGraphicsElement_Transform_AttributeGetter = 1103, + kMenuItemElement = 1104, + kMenuItemCloseTag = 1105, + kSVG1DOMMarkerElement = 1106, + kSVG1DOMUseElement = 1107, + kSVG1DOMMaskElement = 1108, + kV8SVGAElement_Target_AttributeGetter = 1109, + kV8SVGClipPathElement_ClipPathUnits_AttributeGetter = 1110, + kSVG1DOMFitToViewBox = 1111, + kSVG1DOMSVGElement = 1114, + kSVG1DOMImageElement = 1115, + kSVG1DOMForeignObjectElement = 1116, + kAudioContextCreateIIRFilter = 1117, + // The above items are available in M49 branch + + kCSSSelectorPseudoSlotted = 1118, + kMediaDevicesEnumerateDevices = 1119, + kNonSecureSharedWorkerAccessedFromSecureContext = 1120, + kSecureSharedWorkerAccessedFromNonSecureContext = 1121, + kEventComposedPath = 1123, + kLinkHeaderPreload = 1124, + kMouseWheelEvent = 1125, + kWheelEvent = 1126, + kMouseWheelAndWheelEvent = 1127, + kBodyScrollsInAdditionToViewport = 1128, + kDocumentDesignModeEnabeld = 1129, + kContentEditableTrue = 1130, + kContentEditableTrueOnHTML = 1131, + kContentEditablePlainTextOnly = 1132, + kV8RegExpPrototypeUnicodeGetter = 1133, + kV8IntlV8Parse = 1134, + kV8IntlPattern = 1135, + kV8IntlResolved = 1136, + kV8PromiseChain = 1137, + kV8PromiseAccept = 1138, + kV8PromiseDefer = 1139, + kEventComposed = 1140, + kGeolocationInsecureOriginIframe = 1141, + kGeolocationSecureOriginIframe = 1142, + kRequestMIDIAccessIframe = 1143, + kGetUserMediaInsecureOriginIframe = 1144, + kGetUserMediaSecureOriginIframe = 1145, + kElementRequestPointerLockIframe = 1146, + kNotificationAPIInsecureOriginIframe = 1147, + kNotificationAPISecureOriginIframe = 1148, + kWebSocket = 1149, + kMediaStreamConstraintsNameValue = 1150, + kMediaStreamConstraintsFromDictionary = 1151, + kMediaStreamConstraintsConformant = 1152, + kCSSSelectorIndirectAdjacent = 1153, + kCreateImageBitmap = 1156, + kPresentationConnectionConnectEventListener = 1157, + kPresentationConnectionCloseEventListener = 1158, + kPresentationConnectionTerminateEventListener = 1159, + kDocumentCreateEventAnimationEvent = 1162, + kDocumentCreateEventBeforeUnloadEvent = 1166, + kDocumentCreateEventCompositionEvent = 1168, + kDocumentCreateEventDragEvent = 1169, + kDocumentCreateEventErrorEvent = 1170, + kDocumentCreateEventFocusEvent = 1171, + kDocumentCreateEventHashChangeEvent = 1172, + kDocumentCreateEventMutationEvent = 1173, + kDocumentCreateEventPageTransitionEvent = 1174, + kDocumentCreateEventPopStateEvent = 1176, + kDocumentCreateEventTextEvent = 1182, + kDocumentCreateEventTransitionEvent = 1183, + kDocumentCreateEventWheelEvent = 1184, + kDocumentCreateEventTrackEvent = 1186, + kDocumentCreateEventMutationEvents = 1188, + kDocumentCreateEventSVGEvents = 1190, + kDocumentCreateEventDeviceMotionEvent = 1195, + kDocumentCreateEventDeviceOrientationEvent = 1196, + kDocumentCreateEventIDBVersionChangeEvent = 1201, + kDocumentCreateEventStorageEvent = 1221, + kDocumentCreateEventWebGLContextEvent = 1224, + kDocumentCreateEventCloseEvent = 1227, + kDocumentCreateEventKeyboardEvents = 1228, + kHTMLMediaElement = 1229, + kHTMLMediaElementInDocument = 1230, + kHTMLMediaElementControlsAttribute = 1231, + kV8Animation_Oncancel_AttributeGetter = 1233, + kV8Animation_Oncancel_AttributeSetter = 1234, + kV8HTMLCommentInExternalScript = 1235, + kV8HTMLComment = 1236, + kV8SloppyModeBlockScopedFunctionRedefinition = 1237, + kV8ForInInitializer = 1238, + kV8Animation_Id_AttributeGetter = 1239, + kV8Animation_Id_AttributeSetter = 1240, + kApplicationCacheManifestSelectInsecureOrigin = 1245, + kApplicationCacheManifestSelectSecureOrigin = 1246, + kApplicationCacheAPIInsecureOrigin = 1247, + kApplicationCacheAPISecureOrigin = 1248, + // The above items are available in M50 branch + + kCSSAtRuleApply = 1249, + kCSSSelectorPseudoAny = 1250, + kDocumentAllItemNoArguments = 1252, + kDocumentAllItemNamed = 1253, + kDocumentAllItemIndexed = 1254, + kDocumentAllItemIndexedWithNonNumber = 1255, + kDocumentAllLegacyCallNoArguments = 1256, + kDocumentAllLegacyCallNamed = 1257, + kDocumentAllLegacyCallIndexed = 1258, + kDocumentAllLegacyCallIndexedWithNonNumber = 1259, + kDocumentAllLegacyCallTwoArguments = 1260, + kHTMLLabelElementControlForNonFormAssociatedElement = 1263, + kHTMLMediaElementLoadNetworkEmptyNotPaused = 1265, + kV8Window_WebkitSpeechGrammar_ConstructorGetter = 1267, + kV8Window_WebkitSpeechGrammarList_ConstructorGetter = 1268, + kV8Window_WebkitSpeechRecognition_ConstructorGetter = 1269, + kV8Window_WebkitSpeechRecognitionError_ConstructorGetter = 1270, + kV8Window_WebkitSpeechRecognitionEvent_ConstructorGetter = 1271, + kV8Window_SpeechSynthesis_AttributeGetter = 1272, + kV8IDBFactory_WebkitGetDatabaseNames_Method = 1273, + kImageDocument = 1274, + kScriptPassesCSPDynamic = 1275, + kCSPWithStrictDynamic = 1277, + kScrollAnchored = 1278, + kAddEventListenerFourArguments = 1279, + kRemoveEventListenerFourArguments = 1280, + kSVGCalcModeDiscrete = 1287, + kSVGCalcModeLinear = 1288, + kSVGCalcModePaced = 1289, + kSVGCalcModeSpline = 1290, + kFormSubmissionStarted = 1291, + kFormValidationStarted = 1292, + kFormValidationAbortedSubmission = 1293, + kFormValidationShowedMessage = 1294, + kWebAnimationsEasingAsFunctionLinear = 1295, + kWebAnimationsEasingAsFunctionOther = 1296, + // The above items are available in M51 branch + + kV8Document_Images_AttributeGetter = 1297, + kV8Document_Embeds_AttributeGetter = 1298, + kV8Document_Plugins_AttributeGetter = 1299, + kV8Document_Links_AttributeGetter = 1300, + kV8Document_Forms_AttributeGetter = 1301, + kV8Document_Scripts_AttributeGetter = 1302, + kV8Document_Anchors_AttributeGetter = 1303, + kV8Document_Applets_AttributeGetter = 1304, + kXMLHttpRequestCrossOriginWithCredentials = 1305, + kMediaStreamTrackRemote = 1306, + kV8Node_IsConnected_AttributeGetter = 1307, + kShadowRootDelegatesFocus = 1308, + kMixedShadowRootV0AndV1 = 1309, + kImageDocumentInFrame = 1310, + kMediaDocument = 1311, + kMediaDocumentInFrame = 1312, + kPluginDocument = 1313, + kPluginDocumentInFrame = 1314, + kSinkDocument = 1315, + kSinkDocumentInFrame = 1316, + kTextDocument = 1317, + kTextDocumentInFrame = 1318, + kViewSourceDocument = 1319, + kFileAPINativeLineEndings = 1320, + kPointerEventAttributeCount = 1321, + kCompositedReplication = 1322, + kV8DataTransferItem_WebkitGetAsEntry_Method = 1325, + kV8HTMLInputElement_WebkitEntries_AttributeGetter = 1326, + kEntry_Filesystem_AttributeGetter_IsolatedFileSystem = 1327, + kEntry_GetMetadata_Method_IsolatedFileSystem = 1328, + kEntry_MoveTo_Method_IsolatedFileSystem = 1329, + kEntry_CopyTo_Method_IsolatedFileSystem = 1330, + kEntry_Remove_Method_IsolatedFileSystem = 1331, + kEntry_GetParent_Method_IsolatedFileSystem = 1332, + kEntry_ToURL_Method_IsolatedFileSystem = 1333, + kDuring_Microtask_Alert = 1334, + kDuring_Microtask_Confirm = 1335, + kDuring_Microtask_Print = 1336, + kDuring_Microtask_Prompt = 1337, + kDuring_Microtask_SyncXHR = 1338, + kCredentialManagerGetReturnedCredential = 1342, + kGeolocationInsecureOriginDeprecatedNotRemoved = 1343, + kGeolocationInsecureOriginIframeDeprecatedNotRemoved = 1344, + kProgressElementWithNoneAppearance = 1345, + kProgressElementWithProgressBarAppearance = 1346, + kPointerEventAddListenerCount = 1347, + kCSSValueAppearanceNone = 1351, + kCSSValueAppearanceNotNone = 1352, + kCSSValueAppearanceOthers = 1353, + kCSSValueAppearanceButton = 1354, + kCSSValueAppearanceCaret = 1355, + kCSSValueAppearanceCheckbox = 1356, + kCSSValueAppearanceMenulist = 1357, + kCSSValueAppearanceMenulistButton = 1358, + kCSSValueAppearanceListbox = 1359, + kCSSValueAppearanceRadio = 1360, + kCSSValueAppearanceSearchField = 1361, + kCSSValueAppearanceTextField = 1362, + kAudioContextCreatePannerAutomated = 1363, + kPannerNodeSetPosition = 1364, + kPannerNodeSetOrientation = 1365, + kAudioListenerSetPosition = 1366, + kAudioListenerSetOrientation = 1367, + kIntersectionObserver_Constructor = 1368, + kDurableStoragePersist = 1369, + kDurableStoragePersisted = 1370, + kDurableStorageEstimate = 1371, + kCSSDeepCombinatorAndShadow = 1375, + kOpacityWithPreserve3DQuirk = 1376, + kCSSSelectorPseudoReadOnly = 1377, + kCSSSelectorPseudoReadWrite = 1378, + // The above items are available in M52 branch + + kCSSSelectorPseudoDefined = 1383, + kRTCPeerConnectionAddIceCandidatePromise = 1384, + kRTCPeerConnectionAddIceCandidateLegacy = 1385, + kRTCIceCandidateDefaultSdpMLineIndex = 1386, + kMediaStreamConstraintsOldAndNew = 1389, + kV8ArrayProtectorDirtied = 1390, + kV8ArraySpeciesModified = 1391, + kV8ArrayPrototypeConstructorModified = 1392, + kV8ArrayInstanceProtoModified = 1393, + kV8ArrayInstanceConstructorModified = 1394, + kV8LegacyFunctionDeclaration = 1395, + kV8RegExpPrototypeSourceGetter = 1396, + kV8RegExpPrototypeOldFlagGetter = 1397, + kV8DecimalWithLeadingZeroInStrictMode = 1398, + kGetUserMediaPrefixed = 1400, + kGetUserMediaLegacy = 1401, + kGetUserMediaPromise = 1402, + kCSSFilterFunctionNoArguments = 1403, + kV8LegacyDateParser = 1404, + kOpenSearchInsecureOriginInsecureTarget = 1405, + kOpenSearchInsecureOriginSecureTarget = 1406, + kOpenSearchSecureOriginInsecureTarget = 1407, + kOpenSearchSecureOriginSecureTarget = 1408, + kRegisterProtocolHandlerSecureOrigin = 1409, + kRegisterProtocolHandlerInsecureOrigin = 1410, + kCrossOriginWindowAlert = 1411, + kCrossOriginWindowConfirm = 1412, + kCrossOriginWindowPrompt = 1413, + kCrossOriginWindowPrint = 1414, + kMediaStreamOnActive = 1415, + kMediaStreamOnInactive = 1416, + kAddEventListenerPassiveTrue = 1417, + kAddEventListenerPassiveFalse = 1418, + kCSPReferrerDirective = 1419, + kDocumentOpen = 1420, + kElementRequestPointerLockInShadow = 1421, + kShadowRootPointerLockElement = 1422, + kDocumentPointerLockElementInV0Shadow = 1423, + kTextAreaMaxLength = 1424, + kTextAreaMinLength = 1425, + kTopNavigationFromSubFrame = 1426, + kPrefixedElementRequestFullscreenInShadow = 1427, + kMediaSourceAbortRemove = 1428, + kMediaSourceDurationTruncatingBuffered = 1429, + kAudioContextCrossOriginIframe = 1430, + // The above items are available in M53 branch + + kPointerEventSetCapture = 1431, + kPointerEventDispatch = 1432, + kMIDIMessageEventReceivedTime = 1433, + kSummaryElementWithDisplayBlockAuthorRule = 1434, + kV8MediaStream_Active_AttributeGetter = 1435, + kBeforeInstallPromptEvent = 1436, + kBeforeInstallPromptEventUserChoice = 1437, + kBeforeInstallPromptEventPreventDefault = 1438, + kBeforeInstallPromptEventPrompt = 1439, + kExecCommandAltersHTMLStructure = 1440, + kSecureContextCheckPassed = 1441, + kSecureContextCheckFailed = 1442, + kSecureContextCheckForSandboxedOriginPassed = 1443, + kSecureContextCheckForSandboxedOriginFailed = 1444, + kV8DefineGetterOrSetterWouldThrow = 1445, + kV8FunctionConstructorReturnedUndefined = 1446, + kV8BroadcastChannel_Constructor = 1447, + kV8BroadcastChannel_PostMessage_Method = 1448, + kV8BroadcastChannel_Close_Method = 1449, + kTouchStartFired = 1450, + kMouseDownFired = 1451, + kPointerDownFired = 1452, + kPointerDownFiredForTouch = 1453, + kPointerEventDispatchPointerDown = 1454, + kSVGSMILBeginOrEndEventValue = 1455, + kSVGSMILBeginOrEndSyncbaseValue = 1456, + kSVGSMILElementInsertedAfterLoad = 1457, + kV8VisualViewport_OffsetLeft_AttributeGetter = 1458, + kV8VisualViewport_OffsetTop_AttributeGetter = 1459, + kV8VisualViewport_PageLeft_AttributeGetter = 1460, + kV8VisualViewport_PageTop_AttributeGetter = 1461, + kV8VisualViewport_Width_AttributeGetter = 1462, + kV8VisualViewport_Height_AttributeGetter = 1463, + kV8VisualViewport_Scale_AttributeGetter = 1464, + kVisualViewportScrollFired = 1465, + kVisualViewportResizeFired = 1466, + kNodeGetRootNode = 1467, + kSlotChangeEventAddListener = 1468, + kCSSValueAppearanceButtonRendered = 1469, + kCSSValueAppearanceButtonForAnchor = 1470, + kCSSValueAppearanceButtonForButton = 1471, + kCSSValueAppearanceButtonForOtherButtons = 1472, + kCSSValueAppearanceTextFieldRendered = 1473, + kCSSValueAppearanceTextFieldForSearch = 1474, + kCSSValueAppearanceTextFieldForTextField = 1475, + kRTCPeerConnectionGetStats = 1476, + kSVGSMILAnimationAppliedEffect = 1477, + kPerformanceResourceTimingSizes = 1478, + kEventSourceDocument = 1479, + kEventSourceWorker = 1480, + kSingleOriginInTimingAllowOrigin = 1481, + kMultipleOriginsInTimingAllowOrigin = 1482, + kStarInTimingAllowOrigin = 1483, + kSVGSMILAdditiveAnimation = 1484, + kSendBeaconWithNonSimpleContentType = 1485, + kChromeLoadTimesRequestTime = 1486, + kChromeLoadTimesStartLoadTime = 1487, + kChromeLoadTimesCommitLoadTime = 1488, + kChromeLoadTimesFinishDocumentLoadTime = 1489, + kChromeLoadTimesFinishLoadTime = 1490, + kChromeLoadTimesFirstPaintTime = 1491, + kChromeLoadTimesFirstPaintAfterLoadTime = 1492, + kChromeLoadTimesNavigationType = 1493, + kChromeLoadTimesWasFetchedViaSpdy = 1494, + kChromeLoadTimesWasNpnNegotiated = 1495, + kChromeLoadTimesNpnNegotiatedProtocol = 1496, + kChromeLoadTimesWasAlternateProtocolAvailable = 1497, + kChromeLoadTimesConnectionInfo = 1498, + kChromeLoadTimesUnknown = 1499, + kSVGViewElement = 1500, + kWebShareShare = 1501, + kAuxclickAddListenerCount = 1502, + kHTMLCanvasElement = 1503, + kSVGSMILAnimationElementTiming = 1504, + kSVGSMILBeginEndAnimationElement = 1505, + kSVGSMILPausing = 1506, + kSVGSMILCurrentTime = 1507, + kHTMLBodyElementOnSelectionChangeAttribute = 1508, + kForeignFetchInterception = 1509, + kUsbGetDevices = 1519, + kUsbRequestDevice = 1520, + kUsbDeviceOpen = 1521, + kUsbDeviceClose = 1522, + kUsbDeviceSelectConfiguration = 1523, + kUsbDeviceClaimInterface = 1524, + kUsbDeviceReleaseInterface = 1525, + kUsbDeviceSelectAlternateInterface = 1526, + kUsbDeviceControlTransferIn = 1527, + kUsbDeviceControlTransferOut = 1528, + kUsbDeviceClearHalt = 1529, + kUsbDeviceTransferIn = 1530, + kUsbDeviceTransferOut = 1531, + kUsbDeviceIsochronousTransferIn = 1532, + kUsbDeviceIsochronousTransferOut = 1533, + kUsbDeviceReset = 1534, + // The above items are available in M54 branch + + kPointerEnterLeaveFired = 1535, + kPointerOverOutFired = 1536, + kDraggableAttribute = 1539, + kCleanScriptElementWithNonce = 1540, + kPotentiallyInjectedScriptElementWithNonce = 1541, + kPendingStylesheetAddedAfterBodyStarted = 1542, + kUntrustedMouseDownEventDispatchedToSelect = 1543, + kBlockedSniffingAudioToScript = 1544, + kBlockedSniffingVideoToScript = 1545, + kBlockedSniffingCSVToScript = 1546, + kMetaSetCookie = 1547, + kMetaRefresh = 1548, + kMetaSetCookieWhenCSPBlocksInlineScript = 1549, + kMetaRefreshWhenCSPBlocksInlineScript = 1550, + kMiddleClickAutoscrollStart = 1551, + kRTCPeerConnectionCreateOfferOptionsOfferToReceive = 1553, + kDragAndDropScrollStart = 1554, + kPresentationConnectionListConnectionAvailableEventListener = 1555, + kWebAudioAutoplayCrossOriginIframe = 1556, + kVRGetDisplays = 1558, + kXSSAuditorBlockedScript = 1581, + kXSSAuditorBlockedEntirePage = 1582, + kXSSAuditorDisabled = 1583, + kXSSAuditorEnabledFilter = 1584, + kXSSAuditorEnabledBlock = 1585, + kXSSAuditorInvalid = 1586, + kTextInputEventOnInput = 1589, + kTextInputEventOnTextArea = 1590, + kTextInputEventOnContentEditable = 1591, + kTextInputEventOnNotNode = 1592, + kWebkitBeforeTextInsertedOnInput = 1593, + kWebkitBeforeTextInsertedOnTextArea = 1594, + kWebkitBeforeTextInsertedOnContentEditable = 1595, + kWebkitBeforeTextInsertedOnNotNode = 1596, + kWebkitEditableContentChangedOnInput = 1597, + kWebkitEditableContentChangedOnTextArea = 1598, + kWebkitEditableContentChangedOnContentEditable = 1599, + kWebkitEditableContentChangedOnNotNode = 1600, + kV8NavigatorUserMediaError_ConstraintName_AttributeGetter = 1601, + kV8HTMLMediaElement_SrcObject_AttributeGetter = 1602, + kV8HTMLMediaElement_SrcObject_AttributeSetter = 1603, + kCreateObjectURLBlob = 1604, + kCreateObjectURLMediaSource = 1605, + kCreateObjectURLMediaStream = 1606, + kDocumentCreateTouchWindowNull = 1607, + kDocumentCreateTouchWindowWrongType = 1608, + kDocumentCreateTouchTargetNull = 1609, + kDocumentCreateTouchTargetWrongType = 1610, + kDocumentCreateTouchMoreThanSevenArguments = 1612, + kLongTaskObserver = 1615, + kCSSOffsetInEffect = 1617, + // The above items are available in M55 branch + + kVRGetDisplaysInsecureOrigin = 1618, + kVRRequestPresent = 1619, + kVRRequestPresentInsecureOrigin = 1620, + kVRDeprecatedFieldOfView = 1621, + kVideoInCanvas = 1622, + kHiddenAutoplayedVideoInCanvas = 1623, + kOffscreenCanvas = 1624, + kGamepadPose = 1625, + kGamepadHand = 1626, + kGamepadDisplayId = 1627, + kGamepadButtonTouched = 1628, + kGamepadPoseHasOrientation = 1629, + kGamepadPoseHasPosition = 1630, + kGamepadPosePosition = 1631, + kGamepadPoseLinearVelocity = 1632, + kGamepadPoseLinearAcceleration = 1633, + kGamepadPoseOrientation = 1634, + kGamepadPoseAngularVelocity = 1635, + kGamepadPoseAngularAcceleration = 1636, + kV8RTCDataChannel_MaxRetransmitTime_AttributeGetter = 1638, + kV8RTCDataChannel_MaxRetransmits_AttributeGetter = 1639, + kV8RTCDataChannel_Reliable_AttributeGetter = 1640, + kV8RTCPeerConnection_AddStream_Method = 1641, + kV8RTCPeerConnection_CreateDTMFSender_Method = 1642, + kV8RTCPeerConnection_GetLocalStreams_Method = 1643, + kV8RTCPeerConnection_GetRemoteStreams_Method = 1644, + kV8RTCPeerConnection_GetStreamById_Method = 1645, + kV8RTCPeerConnection_RemoveStream_Method = 1646, + kRTCPeerConnectionCreateDataChannelMaxRetransmitTime = 1648, + kRTCPeerConnectionCreateDataChannelMaxRetransmits = 1649, + kAudioContextCreateConstantSource = 1650, + kWebAudioConstantSourceNode = 1651, + kLoopbackEmbeddedInSecureContext = 1652, + kLoopbackEmbeddedInNonSecureContext = 1653, + kBlinkMacSystemFont = 1654, + kRTCIceServerURL = 1656, + kRTCIceServerURLs = 1657, + kOffscreenCanvasTransferToImageBitmap2D = 1658, + kOffscreenCanvasTransferToImageBitmapWebGL = 1659, + kOffscreenCanvasCommit2D = 1660, + kOffscreenCanvasCommitWebGL = 1661, + kRTCConfigurationIceTransportPolicy = 1662, + kRTCConfigurationIceTransports = 1664, + kDocumentFullscreenElementInV0Shadow = 1665, + kScriptWithCSPBypassingSchemeParserInserted = 1666, + kScriptWithCSPBypassingSchemeNotParserInserted = 1667, + kDocumentCreateElement2ndArgStringHandling = 1668, + kV8MediaRecorder_Start_Method = 1669, + kWebBluetoothRequestDevice = 1670, + kUnitlessPerspectiveInPerspectiveProperty = 1671, + kUnitlessPerspectiveInTransformProperty = 1672, + kV8RTCSessionDescription_Type_AttributeGetter = 1673, + kV8RTCSessionDescription_Type_AttributeSetter = 1674, + kV8RTCSessionDescription_Sdp_AttributeGetter = 1675, + kV8RTCSessionDescription_Sdp_AttributeSetter = 1676, + kRTCSessionDescriptionInitNoType = 1677, + kRTCSessionDescriptionInitNoSdp = 1678, + kHTMLMediaElementPreloadForcedMetadata = 1679, + kGenericSensorStart = 1680, + kGenericSensorStop = 1681, + kTouchEventPreventedNoTouchAction = 1682, + kTouchEventPreventedForcedDocumentPassiveNoTouchAction = 1683, + kV8Event_StopPropagation_Method = 1684, + kV8Event_StopImmediatePropagation_Method = 1685, + kImageCaptureConstructor = 1686, + kV8Document_RootScroller_AttributeGetter = 1687, + kV8Document_RootScroller_AttributeSetter = 1688, + kCustomElementRegistryDefine = 1689, + kLinkHeaderServiceWorker = 1690, + kCSSShadowPiercingDescendantCombinator = 1691, + // The above items are available in M56 branch. + + kCSSFlexibleBox = 1692, + kCSSGridLayout = 1693, + kFullscreenAllowedByOrientationChange = 1696, + kServiceWorkerRespondToNavigationRequestWithRedirectedResponse = 1697, + kV8AudioContext_Constructor = 1698, + kV8OfflineAudioContext_Constructor = 1699, + kAppInstalledEventAddListener = 1700, + kAudioContextGetOutputTimestamp = 1701, + kV8MediaStreamAudioDestinationNode_Constructor = 1702, + kV8AnalyserNode_Constructor = 1703, + kV8AudioBuffer_Constructor = 1704, + kV8AudioBufferSourceNode_Constructor = 1705, + kV8AudioProcessingEvent_Constructor = 1706, + kV8BiquadFilterNode_Constructor = 1707, + kV8ChannelMergerNode_Constructor = 1708, + kV8ChannelSplitterNode_Constructor = 1709, + kV8ConstantSourceNode_Constructor = 1710, + kV8ConvolverNode_Constructor = 1711, + kV8DelayNode_Constructor = 1712, + kV8DynamicsCompressorNode_Constructor = 1713, + kV8GainNode_Constructor = 1714, + kV8IIRFilterNode_Constructor = 1715, + kV8MediaElementAudioSourceNode_Constructor = 1716, + kV8MediaStreamAudioSourceNode_Constructor = 1717, + kV8OfflineAudioCompletionEvent_Constructor = 1718, + kV8OscillatorNode_Constructor = 1719, + kV8PannerNode_Constructor = 1720, + kV8PeriodicWave_Constructor = 1721, + kV8StereoPannerNode_Constructor = 1722, + kV8WaveShaperNode_Constructor = 1723, + kV8Headers_GetAll_Method = 1724, + kNavigatorVibrateEngagementNone = 1725, + kNavigatorVibrateEngagementMinimal = 1726, + kNavigatorVibrateEngagementLow = 1727, + kNavigatorVibrateEngagementMedium = 1728, + kNavigatorVibrateEngagementHigh = 1729, + kNavigatorVibrateEngagementMax = 1730, + kAlertEngagementNone = 1731, + kAlertEngagementMinimal = 1732, + kAlertEngagementLow = 1733, + kAlertEngagementMedium = 1734, + kAlertEngagementHigh = 1735, + kAlertEngagementMax = 1736, + kConfirmEngagementNone = 1737, + kConfirmEngagementMinimal = 1738, + kConfirmEngagementLow = 1739, + kConfirmEngagementMedium = 1740, + kConfirmEngagementHigh = 1741, + kConfirmEngagementMax = 1742, + kPromptEngagementNone = 1743, + kPromptEngagementMinimal = 1744, + kPromptEngagementLow = 1745, + kPromptEngagementMedium = 1746, + kPromptEngagementHigh = 1747, + kPromptEngagementMax = 1748, + kTopNavInSandbox = 1749, + kTopNavInSandboxWithoutGesture = 1750, + kTopNavInSandboxWithPerm = 1751, + kTopNavInSandboxWithPermButNoGesture = 1752, + kReferrerPolicyHeader = 1753, + kHTMLAnchorElementReferrerPolicyAttribute = 1754, + kHTMLIFrameElementReferrerPolicyAttribute = 1755, + kHTMLImageElementReferrerPolicyAttribute = 1756, + kHTMLLinkElementReferrerPolicyAttribute = 1757, + kBaseElement = 1758, + kBaseWithCrossOriginHref = 1759, + kBaseWithDataHref = 1760, + kBaseWithNewlinesInTarget = 1761, + kBaseWithOpenBracketInTarget = 1762, + kBaseWouldBeBlockedByDefaultSrc = 1763, + kV8AssigmentExpressionLHSIsCallInSloppy = 1764, + kV8AssigmentExpressionLHSIsCallInStrict = 1765, + kV8PromiseConstructorReturnedUndefined = 1766, + kFormSubmittedWithUnclosedFormControl = 1767, + kScrollbarUseVerticalScrollbarButton = 1777, + kScrollbarUseVerticalScrollbarThumb = 1778, + kScrollbarUseVerticalScrollbarTrack = 1779, + kScrollbarUseHorizontalScrollbarButton = 1780, + kScrollbarUseHorizontalScrollbarThumb = 1781, + kScrollbarUseHorizontalScrollbarTrack = 1782, + kHTMLTableCellElementColspan = 1783, + kHTMLTableCellElementColspanGreaterThan1000 = 1784, + kHTMLTableCellElementColspanGreaterThan8190 = 1785, + kSelectionAddRangeIntersect = 1786, + kPostMessageFromInsecureToSecureToplevel = 1787, + // The above items are available in M57 branch. + + kV8MediaSession_Metadata_AttributeGetter = 1788, + kV8MediaSession_Metadata_AttributeSetter = 1789, + kV8MediaSession_PlaybackState_AttributeGetter = 1790, + kV8MediaSession_PlaybackState_AttributeSetter = 1791, + kV8MediaSession_SetActionHandler_Method = 1792, + kWebNFCPush = 1793, + kWebNFCCancelPush = 1794, + kWebNFCWatch = 1795, + kWebNFCCancelWatch = 1796, + kAudioParamCancelAndHoldAtTime = 1797, + kCSSValueUserModifyReadOnly = 1798, + kCSSValueUserModifyReadWrite = 1799, + kCSSValueUserModifyReadWritePlaintextOnly = 1800, + kCSSValueOnDemand = 1802, + kServiceWorkerNavigationPreload = 1803, + kFullscreenRequestWithPendingElement = 1804, + kHTMLIFrameElementAllowfullscreenAttributeSetAfterContentLoad = 1805, + kPointerEventSetCaptureOutsideDispatch = 1806, + kNotificationPermissionRequestedInsecureOrigin = 1807, + kV8DeprecatedStorageInfo_QueryUsageAndQuota_Method = 1808, + kV8DeprecatedStorageInfo_RequestQuota_Method = 1809, + kV8DeprecatedStorageQuota_QueryUsageAndQuota_Method = 1810, + kV8DeprecatedStorageQuota_RequestQuota_Method = 1811, + kV8FileReaderSync_Constructor = 1812, + kUncancelableTouchEventPreventDefaulted = 1813, + kUncancelableTouchEventDueToMainThreadResponsivenessPreventDefaulted = 1814, + kV8HTMLVideoElement_Poster_AttributeGetter = 1815, + kV8HTMLVideoElement_Poster_AttributeSetter = 1816, + kNotificationPermissionRequestedIframe = 1817, + kPresentationReceiverInsecureOrigin = 1819, + kPresentationReceiverSecureOrigin = 1820, + kPresentationRequestInsecureOrigin = 1821, + kPresentationRequestSecureOrigin = 1822, + kRtcpMuxPolicyNegotiate = 1823, + kDOMClobberedVariableAccessed = 1824, + kHTMLDocumentCreateProcessingInstruction = 1825, + kFetchResponseConstructionWithStream = 1826, + kLocationOrigin = 1827, + kDocumentOrigin = 1828, + kCanvas2DFilter = 1830, + kCanvas2DImageSmoothingQuality = 1831, + kCanvasToBlob = 1832, + kCanvasToDataURL = 1833, + kOffscreenCanvasConvertToBlob = 1834, + kSVGInCanvas2D = 1835, + kSVGInWebGL = 1836, + kSelectionFuncionsChangeFocus = 1837, + kHTMLObjectElementGetter = 1838, + kHTMLObjectElementSetter = 1839, + kHTMLEmbedElementGetter = 1840, + kHTMLEmbedElementSetter = 1841, + kTransformUsesBoxSizeOnSVG = 1842, + // The above items are available in M58 branch. + + kScrollByKeyboardArrowKeys = 1843, + kScrollByKeyboardPageUpDownKeys = 1844, + kScrollByKeyboardHomeEndKeys = 1845, + kScrollByKeyboardSpacebarKey = 1846, + kScrollByTouch = 1847, + kScrollByWheel = 1848, + kScheduledActionIgnored = 1849, + kGetCanvas2DContextAttributes = 1850, + kV8HTMLInputElement_Capture_AttributeGetter = 1851, + kV8HTMLInputElement_Capture_AttributeSetter = 1852, + kHTMLMediaElementControlsListAttribute = 1853, + kHTMLMediaElementControlsListNoDownload = 1854, + kHTMLMediaElementControlsListNoFullscreen = 1855, + kHTMLMediaElementControlsListNoRemotePlayback = 1856, + kPointerEventClickRetargetCausedByCapture = 1857, + kVRDisplayDisplayName = 1861, + kVREyeParametersOffset = 1862, + kVRPoseLinearVelocity = 1863, + kVRPoseLinearAcceleration = 1864, + kVRPoseAngularVelocity = 1865, + kVRPoseAngularAcceleration = 1866, + kCSSOverflowPaged = 1867, + kChildSrcAllowedWorkerThatScriptSrcBlocked = 1868, + kHTMLTableElementPresentationAttributeBackground = 1869, + kV8Navigator_GetInstalledRelatedApps_Method = 1870, + kNamedAccessOnWindow_ChildBrowsingContext = 1871, + kNamedAccessOnWindow_ChildBrowsingContext_CrossOriginNameMismatch = 1872, + kV0CustomElementsRegisterHTMLCustomTag = 1873, + kV0CustomElementsRegisterHTMLTypeExtension = 1874, + kV0CustomElementsRegisterSVGElement = 1875, + kV0CustomElementsRegisterEmbedderElement = 1876, + kV0CustomElementsCreateCustomTagElement = 1877, + kV0CustomElementsCreateTypeExtensionElement = 1878, + kV0CustomElementsConstruct = 1879, + kV8IDBObserver_Observe_Method = 1880, + kV8IDBObserver_Unobserve_Method = 1881, + kWebBluetoothRemoteCharacteristicGetDescriptor = 1882, + kWebBluetoothRemoteCharacteristicGetDescriptors = 1883, + kWebBluetoothRemoteCharacteristicReadValue = 1884, + kWebBluetoothRemoteCharacteristicWriteValue = 1885, + kWebBluetoothRemoteCharacteristicStartNotifications = 1886, + kWebBluetoothRemoteCharacteristicStopNotifications = 1887, + kWebBluetoothRemoteDescriptorReadValue = 1888, + kWebBluetoothRemoteDescriptorWriteValue = 1889, + kWebBluetoothRemoteServerConnect = 1890, + kWebBluetoothRemoteServerDisconnect = 1891, + kWebBluetoothRemoteServerGetPrimaryService = 1892, + kWebBluetoothRemoteServerGetPrimaryServices = 1893, + kWebBluetoothRemoteServiceGetCharacteristic = 1894, + kWebBluetoothRemoteServiceGetCharacteristics = 1895, + kHTMLContentElement = 1896, + kHTMLShadowElement = 1897, + kHTMLSlotElement = 1898, + kAccelerometerConstructor = 1899, + kAbsoluteOrientationSensorConstructor = 1900, + kAmbientLightSensorConstructor = 1901, + kGenericSensorOnActivate = 1902, + kGenericSensorOnChange = 1903, + kGenericSensorOnError = 1904, + kGenericSensorActivated = 1905, + kGyroscopeConstructor = 1906, + kMagnetometerConstructor = 1907, + kOrientationSensorPopulateMatrix = 1908, + kWindowOpenWithInvalidURL = 1909, + kCrossOriginMainFrameNulledNameAccessed = 1910, + kMenuItemElementIconAttribute = 1911, + kWebkitCSSMatrixSetMatrixValue = 1912, + kWebkitCSSMatrixConstructFromString = 1913, + kCanRequestURLHTTPContainingNewline = 1914, + kGetGamepads = 1916, + kV8SVGPathElement_GetPathSegAtLength_Method = 1917, + kMediaStreamConstraintsAudio = 1918, + kMediaStreamConstraintsAudioUnconstrained = 1919, + kMediaStreamConstraintsVideo = 1920, + kMediaStreamConstraintsVideoUnconstrained = 1921, + kMediaStreamConstraintsWidth = 1922, + kMediaStreamConstraintsHeight = 1923, + kMediaStreamConstraintsAspectRatio = 1924, + kMediaStreamConstraintsFrameRate = 1925, + kMediaStreamConstraintsFacingMode = 1926, + kMediaStreamConstraintsVolume = 1927, + kMediaStreamConstraintsSampleRate = 1928, + kMediaStreamConstraintsSampleSize = 1929, + kMediaStreamConstraintsEchoCancellation = 1930, + kMediaStreamConstraintsLatency = 1931, + kMediaStreamConstraintsChannelCount = 1932, + kMediaStreamConstraintsDeviceIdAudio = 1933, + kMediaStreamConstraintsDeviceIdVideo = 1934, + kMediaStreamConstraintsDisableLocalEcho = 1935, + kMediaStreamConstraintsGroupIdAudio = 1936, + kMediaStreamConstraintsGroupIdVideo = 1937, + kMediaStreamConstraintsVideoKind = 1938, + kMediaStreamConstraintsDepthNear = 1939, + kMediaStreamConstraintsDepthFar = 1940, + kMediaStreamConstraintsFocalLengthX = 1941, + kMediaStreamConstraintsFocalLengthY = 1942, + kMediaStreamConstraintsMediaStreamSourceAudio = 1943, + kMediaStreamConstraintsMediaStreamSourceVideo = 1944, + kMediaStreamConstraintsRenderToAssociatedSink = 1945, + kMediaStreamConstraintsHotwordEnabled = 1946, + kMediaStreamConstraintsGoogEchoCancellation = 1947, + kMediaStreamConstraintsGoogExperimentalEchoCancellation = 1948, + kMediaStreamConstraintsGoogAutoGainControl = 1949, + kMediaStreamConstraintsGoogExperimentalAutoGainControl = 1950, + kMediaStreamConstraintsGoogNoiseSuppression = 1951, + kMediaStreamConstraintsGoogHighpassFilter = 1952, + kMediaStreamConstraintsGoogTypingNoiseDetection = 1953, + kMediaStreamConstraintsGoogExperimentalNoiseSuppression = 1954, + kMediaStreamConstraintsGoogBeamforming = 1955, + kMediaStreamConstraintsGoogArrayGeometry = 1956, + kMediaStreamConstraintsGoogAudioMirroring = 1957, + kMediaStreamConstraintsGoogDAEchoCancellation = 1958, + kMediaStreamConstraintsGoogNoiseReduction = 1959, + kMediaStreamConstraintsGoogPowerLineFrequency = 1960, + // The above items are available in M59 branch. + + kViewportFixedPositionUnderFilter = 1961, + kRequestMIDIAccessWithSysExOption = 1962, + kRequestMIDIAccessIframeWithSysExOption = 1963, + kGamepadAxes = 1964, + kGamepadButtons = 1965, + kVibrateWithoutUserGesture = 1966, + kDispatchMouseEventOnDisabledFormControl = 1967, + kElementNameDOMInvalidHTMLParserValid = 1968, + kElementNameDOMValidHTMLParserInvalid = 1969, + kGATTServerDisconnectedEvent = 1970, + kAnchorClickDispatchForNonConnectedNode = 1971, + kHTMLParseErrorNestedForm = 1972, + kFontShapingNotDefGlyphObserved = 1973, + kPostMessageOutgoingWouldBeBlockedByConnectSrc = 1974, + kPostMessageIncomingWouldBeBlockedByConnectSrc = 1975, + kPaymentRequestNetworkNameInSupportedMethods = 1976, + kCrossOriginPropertyAccess = 1977, + kCrossOriginPropertyAccessFromOpener = 1978, + kCredentialManagerCreate = 1979, + kWebDatabaseCreateDropFTS3Table = 1980, + kFieldEditInSecureContext = 1981, + kFieldEditInNonSecureContext = 1982, + kCredentialManagerCredentialRequestOptionsUnmediated = 1983, + kCredentialManagerGetMediationRequired = 1984, + kCredentialManagerIdName = 1985, + kCredentialManagerPasswordName = 1986, + kCredentialManagerAdditionalData = 1987, + kCredentialManagerCustomFetch = 1988, + kNetInfoRtt = 1989, + kNetInfoDownlink = 1990, + kShapeDetection_BarcodeDetectorConstructor = 1991, + kShapeDetection_FaceDetectorConstructor = 1992, + kShapeDetection_TextDetectorConstructor = 1993, + kCredentialManagerCredentialRequestOptionsOnlyUnmediated = 1994, + kInertAttribute = 1995, + kPluginInstanceAccessFromIsolatedWorld = 1996, + kPluginInstanceAccessFromMainWorld = 1997, + kRequestFullscreenForDialogElement = 1998, + kRequestFullscreenForDialogElementInTopLayer = 1999, + kShowModalForElementInFullscreenStack = 2000, + kThreeValuedPositionBackground = 2001, + kThreeValuedPositionBasicShape = 2002, + kThreeValuedPositionGradient = 2003, + kThreeValuedPositionObjectPosition = 2004, + kThreeValuedPositionPerspectiveOrigin = 2005, + kUnitlessZeroAngleFilter = 2007, + kUnitlessZeroAngleGradient = 2008, + kUnitlessZeroAngleTransform = 2010, + kHTMLOListElementStartGetterReversedWithoutStartAttribute = 2011, + kCredentialManagerPreventSilentAccess = 2012, + kNetInfoEffectiveType = 2013, + kV8SpeechRecognition_Start_Method = 2014, + kTableRowDirectionDifferentFromTable = 2015, + kTableSectionDirectionDifferentFromTable = 2016, + // The above items are available in M60 branch. + + kClientHintsDeviceRAM = 2017, + kCSSRegisterProperty = 2018, + kRelativeOrientationSensorConstructor = 2019, + kSmoothScrollJSInterventionActivated = 2020, + kBudgetAPIGetCost = 2021, + kBudgetAPIGetBudget = 2022, + kCrossOriginMainFrameNulledNonEmptyNameAccessed = 2023, + kDeprecatedTimingFunctionStepMiddle = 2024, + kDocumentDomainSetWithNonDefaultPort = 2025, + kDocumentDomainSetWithDefaultPort = 2026, + kFeaturePolicyHeader = 2027, + kFeaturePolicyAllowAttribute = 2028, + kMIDIPortOpen = 2029, + kMIDIOutputSend = 2030, + kMIDIMessageEvent = 2031, + kFetchEventIsReload = 2032, + kServiceWorkerClientFrameType = 2033, + kQuirksModeDocument = 2034, + kLimitedQuirksModeDocument = 2035, + kEncryptedMediaCrossOriginIframe = 2036, + kCSSSelectorWebkitMediaControls = 2037, + kCSSSelectorWebkitMediaControlsOverlayEnclosure = 2038, + kCSSSelectorWebkitMediaControlsOverlayPlayButton = 2039, + kCSSSelectorWebkitMediaControlsEnclosure = 2040, + kCSSSelectorWebkitMediaControlsPanel = 2041, + kCSSSelectorWebkitMediaControlsPlayButton = 2042, + kCSSSelectorWebkitMediaControlsCurrentTimeDisplay = 2043, + kCSSSelectorWebkitMediaControlsTimeRemainingDisplay = 2044, + kCSSSelectorWebkitMediaControlsTimeline = 2045, + kCSSSelectorWebkitMediaControlsTimelineContainer = 2046, + kCSSSelectorWebkitMediaControlsMuteButton = 2047, + kCSSSelectorWebkitMediaControlsVolumeSlider = 2048, + kCSSSelectorWebkitMediaControlsFullscreenButton = 2049, + kCSSSelectorWebkitMediaControlsToggleClosedCaptionsButton = 2050, + + // Add new features immediately above this line. Don't change assigned + // numbers of any item, and don't reuse removed slots. + // Also, run update_use_counter_feature_enum.py in + // chromium/src/tools/metrics/histograms/ to update the UMA mapping. + kNumberOfFeatures, // This enum value must be last. +};
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index eb91c1a2..9a8c68846 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -346,6 +346,11 @@ <int value="157" label="UMA_API_UNSELECT_ROW">unselectRow</int> </enum> +<enum name="AccessPasswordInSettingsEvent"> + <int value="0" label="Viewed"/> + <int value="1" label="Copied"/> +</enum> + <enum name="AccountChooserDismissalReason"> <int value="0" label="Canceled"/> <int value="1" label="Credential chosen"/> @@ -10851,6 +10856,7 @@ <int value="372" label="DeviceSecondFactorAuthentication"/> <int value="373" label="UseSystemDefaultPrinterAsDefault"/> <int value="374" label="DeviceEcryptfsMigrationStrategy"/> + <int value="375" label="SafeBrowsingForTrustedSourcesEnabled"/> </enum> <enum name="EnterprisePolicyInvalidations"> @@ -13566,7 +13572,7 @@ </enum> <enum name="FeatureObserver"> -<!-- Generated from third_party/WebKit/public/platform/WebFeature.h --> +<!-- Generated from third_party/WebKit/public/platform/web_feature.mojom --> <int value="0" label="OBSOLETE_PageDestruction"/> <int value="1" label="LegacyNotifications"/> @@ -31412,6 +31418,12 @@ <int value="2" label="Will retry"/> </enum> +<enum name="ReauthToAccessPasswordInSettingsEvent"> + <int value="0" label="Success"/> + <int value="1" label="Failure"/> + <int value="2" label="Skipped"/> +</enum> + <enum name="RecentTabsAction"> <int value="0" label="Local Session Tab"/> <int value="1" label="Other Device Tab"/> @@ -34012,6 +34024,12 @@ <int value="3" label="Fresh index with cache updated since backend start"/> </enum> +<enum name="SinglePageAppNavigationType"> + <int value="0" label="History push state or replace state"/> + <int value="1" label="Same document backward or forward"/> + <int value="2" label="Other fragment navigation"/> +</enum> + <enum name="SiteEngagementServiceEngagementType"> <int value="0" label="Navigation"/> <int value="1" label="Keypress"/> @@ -37853,6 +37871,136 @@ <int value="59" label=".zip"/> </enum> +<enum name="VirtualKeyboardControllerStateTransition"> + <int value="-7007" label="Invalid_HIDDEN_to_HIDDEN"/> + <int value="-7006" label="Invalid_HIDDEN_to_HIDING"/> + <int value="-7005" label="Invalid_HIDDEN_to_WILL_HIDE"/> + <int value="-7004" label="Invalid_HIDDEN_to_SHOWN"/> + <int value="-7003" label="Invalid_HIDDEN_to_SHOWING"/> + <int value="-7002" label="Invalid_HIDDEN_to_LOADING_EXTENSION"/> + <int value="-7001" label="Invalid_HIDDEN_to_INITIAL"/> + <int value="-7000" label="Invalid_HIDDEN_to_UNKNOWN"/> + <int value="-6007" label="Invalid_HIDING_to_HIDDEN"/> + <int value="-6006" label="Invalid_HIDING_to_HIDING"/> + <int value="-6005" label="Invalid_HIDING_to_WILL_HIDE"/> + <int value="-6004" label="Invalid_HIDING_to_SHOWN"/> + <int value="-6003" label="Invalid_HIDING_to_SHOWING"/> + <int value="-6002" label="Invalid_HIDING_to_LOADING_EXTENSION"/> + <int value="-6001" label="Invalid_HIDING_to_INITIAL"/> + <int value="-6000" label="Invalid_HIDING_to_UNKNOWN"/> + <int value="-5007" label="Invalid_WILL_HIDE_to_HIDDEN"/> + <int value="-5006" label="Invalid_WILL_HIDE_to_HIDING"/> + <int value="-5005" label="Invalid_WILL_HIDE_to_WILL_HIDE"/> + <int value="-5004" label="Invalid_WILL_HIDE_to_SHOWN"/> + <int value="-5003" label="Invalid_WILL_HIDE_to_SHOWING"/> + <int value="-5002" label="Invalid_WILL_HIDE_to_LOADING_EXTENSION"/> + <int value="-5001" label="Invalid_WILL_HIDE_to_INITIAL"/> + <int value="-5000" label="Invalid_WILL_HIDE_to_UNKNOWN"/> + <int value="-4007" label="Invalid_SHOWN_to_HIDDEN"/> + <int value="-4006" label="Invalid_SHOWN_to_HIDING"/> + <int value="-4005" label="Invalid_SHOWN_to_WILL_HIDE"/> + <int value="-4004" label="Invalid_SHOWN_to_SHOWN"/> + <int value="-4003" label="Invalid_SHOWN_to_SHOWING"/> + <int value="-4002" label="Invalid_SHOWN_to_LOADING_EXTENSION"/> + <int value="-4001" label="Invalid_SHOWN_to_INITIAL"/> + <int value="-4000" label="Invalid_SHOWN_to_UNKNOWN"/> + <int value="-3007" label="Invalid_SHOWING_to_HIDDEN"/> + <int value="-3006" label="Invalid_SHOWING_to_HIDING"/> + <int value="-3005" label="Invalid_SHOWING_to_WILL_HIDE"/> + <int value="-3004" label="Invalid_SHOWING_to_SHOWN"/> + <int value="-3003" label="Invalid_SHOWING_to_SHOWING"/> + <int value="-3002" label="Invalid_SHOWING_to_LOADING_EXTENSION"/> + <int value="-3001" label="Invalid_SHOWING_to_INITIAL"/> + <int value="-3000" label="Invalid_SHOWING_to_UNKNOWN"/> + <int value="-2007" label="Invalid_LOADING_EXTENSION_to_HIDDEN"/> + <int value="-2006" label="Invalid_LOADING_EXTENSION_to_HIDING"/> + <int value="-2005" label="Invalid_LOADING_EXTENSION_to_WILL_HIDE"/> + <int value="-2004" label="Invalid_LOADING_EXTENSION_to_SHOWN"/> + <int value="-2003" label="Invalid_LOADING_EXTENSION_to_SHOWING"/> + <int value="-2002" label="Invalid_LOADING_EXTENSION_to_LOADING_EXTENSION"/> + <int value="-2001" label="Invalid_LOADING_EXTENSION_to_INITIAL"/> + <int value="-2000" label="Invalid_LOADING_EXTENSION_to_UNKNOWN"/> + <int value="-1007" label="Invalid_INITIAL_to_HIDDEN"/> + <int value="-1006" label="Invalid_INITIAL_to_HIDING"/> + <int value="-1005" label="Invalid_INITIAL_to_WILL_HIDE"/> + <int value="-1004" label="Invalid_INITIAL_to_SHOWN"/> + <int value="-1003" label="Invalid_INITIAL_to_SHOWING"/> + <int value="-1002" label="Invalid_INITIAL_to_LOADING_EXTENSION"/> + <int value="-1001" label="Invalid_INITIAL_to_INITIAL"/> + <int value="-1000" label="Invalid_INITIAL_to_UNKNOWN"/> + <int value="-7" label="Invalid_UNKNOWN_to_HIDDEN"/> + <int value="-6" label="Invalid_UNKNOWN_to_HIDING"/> + <int value="-5" label="Invalid_UNKNOWN_to_WILL_HIDE"/> + <int value="-4" label="Invalid_UNKNOWN_to_SHOWN"/> + <int value="-3" label="Invalid_UNKNOWN_to_SHOWING"/> + <int value="-2" label="Invalid_UNKNOWN_to_LOADING_EXTENSION"/> + <int value="-1" label="Invalid_UNKNOWN_to_INITIAL"/> + <int value="0" label="Invalid_UNKNOWN_to_UNKNOWN"/> + <int value="1" label="UNKNOWN_to_INITIAL"/> + <int value="2" label="UNKNOWN_to_LOADING_EXTENSION"/> + <int value="3" label="UNKNOWN_to_SHOWING"/> + <int value="4" label="UNKNOWN_to_SHOWN"/> + <int value="5" label="UNKNOWN_to_WILL_HIDE"/> + <int value="6" label="UNKNOWN_to_HIDING"/> + <int value="7" label="UNKNOWN_to_HIDDEN"/> + <int value="1000" label="INITIAL_to_UNKNOWN"/> + <int value="1001" label="INITIAL_to_INITIAL"/> + <int value="1002" label="INITIAL_to_LOADING_EXTENSION"/> + <int value="1003" label="INITIAL_to_SHOWING"/> + <int value="1004" label="INITIAL_to_SHOWN"/> + <int value="1005" label="INITIAL_to_WILL_HIDE"/> + <int value="1006" label="INITIAL_to_HIDING"/> + <int value="1007" label="INITIAL_to_HIDDEN"/> + <int value="2000" label="LOADING_EXTENSION_to_UNKNOWN"/> + <int value="2001" label="LOADING_EXTENSION_to_INITIAL"/> + <int value="2002" label="LOADING_EXTENSION_to_LOADING_EXTENSION"/> + <int value="2003" label="LOADING_EXTENSION_to_SHOWING"/> + <int value="2004" label="LOADING_EXTENSION_to_SHOWN"/> + <int value="2005" label="LOADING_EXTENSION_to_WILL_HIDE"/> + <int value="2006" label="LOADING_EXTENSION_to_HIDING"/> + <int value="2007" label="LOADING_EXTENSION_to_HIDDEN"/> + <int value="3000" label="SHOWING_to_UNKNOWN"/> + <int value="3001" label="SHOWING_to_INITIAL"/> + <int value="3002" label="SHOWING_to_LOADING_EXTENSION"/> + <int value="3003" label="SHOWING_to_SHOWING"/> + <int value="3004" label="SHOWING_to_SHOWN"/> + <int value="3005" label="SHOWING_to_WILL_HIDE"/> + <int value="3006" label="SHOWING_to_HIDING"/> + <int value="3007" label="SHOWING_to_HIDDEN"/> + <int value="4000" label="SHOWN_to_UNKNOWN"/> + <int value="4001" label="SHOWN_to_INITIAL"/> + <int value="4002" label="SHOWN_to_LOADING_EXTENSION"/> + <int value="4003" label="SHOWN_to_SHOWING"/> + <int value="4004" label="SHOWN_to_SHOWN"/> + <int value="4005" label="SHOWN_to_WILL_HIDE"/> + <int value="4006" label="SHOWN_to_HIDING"/> + <int value="4007" label="SHOWN_to_HIDDEN"/> + <int value="5000" label="WILL_HIDE_to_UNKNOWN"/> + <int value="5001" label="WILL_HIDE_to_INITIAL"/> + <int value="5002" label="WILL_HIDE_to_LOADING_EXTENSION"/> + <int value="5003" label="WILL_HIDE_to_SHOWING"/> + <int value="5004" label="WILL_HIDE_to_SHOWN"/> + <int value="5005" label="WILL_HIDE_to_WILL_HIDE"/> + <int value="5006" label="WILL_HIDE_to_HIDING"/> + <int value="5007" label="WILL_HIDE_to_HIDDEN"/> + <int value="6000" label="HIDING_to_UNKNOWN"/> + <int value="6001" label="HIDING_to_INITIAL"/> + <int value="6002" label="HIDING_to_LOADING_EXTENSION"/> + <int value="6003" label="HIDING_to_SHOWING"/> + <int value="6004" label="HIDING_to_SHOWN"/> + <int value="6005" label="HIDING_to_WILL_HIDE"/> + <int value="6006" label="HIDING_to_HIDING"/> + <int value="6007" label="HIDING_to_HIDDEN"/> + <int value="7000" label="HIDDEN_to_UNKNOWN"/> + <int value="7001" label="HIDDEN_to_INITIAL"/> + <int value="7002" label="HIDDEN_to_LOADING_EXTENSION"/> + <int value="7003" label="HIDDEN_to_SHOWING"/> + <int value="7004" label="HIDDEN_to_SHOWN"/> + <int value="7005" label="HIDDEN_to_WILL_HIDE"/> + <int value="7006" label="HIDDEN_to_HIDING"/> + <int value="7007" label="HIDDEN_to_HIDDEN"/> +</enum> + <enum name="VisibleTab"> <int value="0" label="Custom Tab"/> <int value="1" label="Chrome Tab"/>
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 636257b9..0d49c38 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -51607,6 +51607,14 @@ </summary> </histogram> +<histogram name="PasswordManager.AccessPasswordInSettings" + enum="AccessPasswordInSettingsEvent"> + <owner>vabr@chromium.org</owner> + <summary> + Recorded whenever the user accesses the passwords in the settings page. + </summary> +</histogram> + <histogram name="PasswordManager.AccountChooserDialog" enum="AccountChooserDismissalReason"> <obsolete> @@ -52313,6 +52321,16 @@ </summary> </histogram> +<histogram name="PasswordManager.ReauthToAccessPasswordInSettings" + enum="ReauthToAccessPasswordInSettingsEvent"> + <owner>vabr@chromium.org</owner> + <summary> + Recorded whenever the user interacts with reauthentication in order to + access the passwords in settings, or when such reauthentication is skipped + for a well-defined reason. + </summary> +</histogram> + <histogram name="PasswordManager.SavePasswordPromptDisappearedQuickly" enum="Boolean"> <obsolete> @@ -61768,6 +61786,16 @@ </summary> </histogram> +<histogram name="RendererScheduler.UpdateForSameDocumentNavigationCount" + enum="SinglePageAppNavigationType"> + <owner>maxlg@chromium.org</owner> + <summary> + The count of same-document-navigations split by whether it is the + same-document backward/forward navigation, history API navigation, or other + fragment navigation. + </summary> +</histogram> + <histogram name="RendererScheduler.UserModel.GestureDuration" units="ms"> <owner>alexclarke@chromium.org</owner> <summary>Duration of gestures (scrolls and pinches).</summary> @@ -82645,6 +82673,28 @@ </summary> </histogram> +<histogram name="VirtualKeyboard.ControllerStateTransition" + enum="VirtualKeyboardControllerStateTransition"> + <owner>oka@chromium.org</owner> + <summary> + An integer representing a state transition from x to y in the form of x * + 1000 + y. If the transition is not expected, the value is negated. For + example an expected transition from SHOWING (= 2) to SHOWN (= 1) is denoted + as 2001, and an unexpected transition from SHOWING to SHOWING is denoted as + -2002. See KeyboardControllerState for the correspondence between the number + and the enum. + </summary> +</histogram> + +<histogram name="VirtualKeyboard.ControllerStateTransitionIsValid" + enum="BooleanValid"> + <owner>oka@chromium.org</owner> + <summary> + Validity of a state transtion. This is equivalent to the positiveness of + VirtualKeyboard.ControllerStateTransition. + </summary> +</histogram> + <histogram name="VirtualKeyboard.InitLatency.FirstLoad" units="ms"> <owner>oka@chromium.org</owner> <summary>Latency of the keyboard being loaded for the first time.</summary> @@ -85514,6 +85564,28 @@ </summary> </histogram> +<histogram name="WebRTC.Call.TimeReceivingAudioRtpPacketsInSeconds" units="s"> + <owner>saza@chromium.org</owner> + <summary> + The amount of time between the arrival of the first and last audio RTP + packets to pass through a Call object. This is logged when the Call object + is destroyed. This is only logged if audio RTP packets are at some point in + time received, and is a way to omit temporary objects that do not send any + actual media. + </summary> +</histogram> + +<histogram name="WebRTC.Call.TimeReceivingVideoRtpPacketsInSeconds" units="s"> + <owner>saza@chromium.org</owner> + <summary> + The amount of time between the arrival of the first and last video RTP + packets to pass through a Call object. This is logged when the Call object + is destroyed. This is only logged if video RTP packets are at some point in + time received, and is a way to omit temporary objects that do not send any + actual media. + </summary> +</histogram> + <histogram name="WebRTC.Call.VideoBitrateReceivedInKbps" units="kbps"> <owner>holmer@chromium.org</owner> <summary> @@ -86178,6 +86250,22 @@ </summary> </histogram> +<histogram name="WebRTC.Video.InterframeDelayInMs" units="ms"> + <owner>ilnik@chromium.org</owner> + <summary> + The average interframe delay for a received video stream. Recorded when a + stream is removed. + </summary> +</histogram> + +<histogram name="WebRTC.Video.InterframeDelayMaxInMs" units="ms"> + <owner>ilnik@chromium.org</owner> + <summary> + The maximum interframe delay for a received video stream. Recorded when a + stream is removed. + </summary> +</histogram> + <histogram name="WebRTC.Video.JitterBufferDelayInMs" units="ms"> <owner>asapersson@chromium.org</owner> <summary> @@ -86547,6 +86635,22 @@ </summary> </histogram> +<histogram name="WebRTC.Video.Screenshare.InterframeDelayInMs" units="ms"> + <owner>ilnik@chromium.org</owner> + <summary> + The average interframe delay for a received screenshare stream. Recorded + when a stream is removed. + </summary> +</histogram> + +<histogram name="WebRTC.Video.Screenshare.InterframeDelayMaxInMs" units="ms"> + <owner>ilnik@chromium.org</owner> + <summary> + The maximum interframe delay for a received screenshare stream. Recorded + when a stream is removed. + </summary> +</histogram> + <histogram name="WebRTC.Video.Screenshare.KeyFramesSentInPermille" units="permille"> <owner>sprang@chromium.org</owner>
diff --git a/tools/metrics/histograms/update_use_counter_feature_enum.py b/tools/metrics/histograms/update_use_counter_feature_enum.py index e26c2695..f98498a2 100755 --- a/tools/metrics/histograms/update_use_counter_feature_enum.py +++ b/tools/metrics/histograms/update_use_counter_feature_enum.py
@@ -32,9 +32,9 @@ 'https://github.com/GoogleChrome/chromium-dashboard') options, args = parser.parse_args() - source_path = 'third_party/WebKit/public/platform/WebFeature.h' + source_path = 'third_party/WebKit/public/platform/web_feature.mojom' - START_MARKER = '^enum class WebFeature : uint32_t {' + START_MARKER = '^enum WebFeature {' END_MARKER = '^kNumberOfFeatures' if options.dashboard:
diff --git a/tools/perf/benchmarks/blob_storage.py b/tools/perf/benchmarks/blob_storage.py index 951cffb5..40e2f13 100644 --- a/tools/perf/benchmarks/blob_storage.py +++ b/tools/perf/benchmarks/blob_storage.py
@@ -4,6 +4,7 @@ from core import perf_benchmark +from telemetry import benchmark from telemetry.timeline import chrome_trace_category_filter from telemetry.web_perf import timeline_based_measurement @@ -14,6 +15,7 @@ TIMELINE_REQUIRED_CATEGORY = 'blink.console' +@benchmark.Disabled('android') # crbug.com/739214 class BlobStorage(perf_benchmark.PerfBenchmark): """Timeline based measurement benchmark for Blob Storage."""
diff --git a/ui/accessibility/BUILD.gn b/ui/accessibility/BUILD.gn index 422dd09..324df01 100644 --- a/ui/accessibility/BUILD.gn +++ b/ui/accessibility/BUILD.gn
@@ -59,8 +59,6 @@ if (has_native_accessibility) { sources += [ - "platform/ax_fake_caret_win.cc", - "platform/ax_fake_caret_win.h", "platform/ax_platform_node.cc", "platform/ax_platform_node.h", "platform/ax_platform_node_base.cc", @@ -70,6 +68,8 @@ "platform/ax_platform_node_mac.mm", "platform/ax_platform_node_win.cc", "platform/ax_platform_node_win.h", + "platform/ax_system_caret_win.cc", + "platform/ax_system_caret_win.h", ] } @@ -138,6 +138,7 @@ } static_library("test_support") { + testonly = true sources = [ "tree_generator.cc", "tree_generator.h", @@ -156,6 +157,7 @@ } test("accessibility_unittests") { + testonly = true sources = [ "ax_generated_tree_unittest.cc", "ax_node_position_unittest.cc", @@ -181,6 +183,7 @@ if (is_win) { deps += [ "//third_party/iaccessible2" ] + libs = [ "oleacc.lib" ] } }
diff --git a/ui/accessibility/platform/ax_fake_caret_win.cc b/ui/accessibility/platform/ax_system_caret_win.cc similarity index 60% rename from ui/accessibility/platform/ax_fake_caret_win.cc rename to ui/accessibility/platform/ax_system_caret_win.cc index cc25a163..bd6b7e66 100644 --- a/ui/accessibility/platform/ax_fake_caret_win.cc +++ b/ui/accessibility/platform/ax_system_caret_win.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/accessibility/platform/ax_fake_caret_win.h" +#include "ui/accessibility/platform/ax_system_caret_win.h" #include <windows.h> @@ -15,22 +15,24 @@ namespace ui { -AXFakeCaretWin::AXFakeCaretWin(gfx::AcceleratedWidget event_target) +AXSystemCaretWin::AXSystemCaretWin(gfx::AcceleratedWidget event_target) : event_target_(event_target) { caret_ = static_cast<AXPlatformNodeWin*>(AXPlatformNodeWin::Create(this)); data_.id = GetNextAXPlatformNodeUniqueId(); data_.role = AX_ROLE_CARET; + // |get_accState| should return 0 which means that the caret is visible. data_.state = 0; - data_.SetName(L"caret"); + // According to MSDN, "Edit" should be the name of the caret object. + data_.SetName(L"Edit"); data_.offset_container_id = -1; } -AXFakeCaretWin::~AXFakeCaretWin() { +AXSystemCaretWin::~AXSystemCaretWin() { caret_->Destroy(); caret_ = nullptr; } -base::win::ScopedComPtr<IAccessible> AXFakeCaretWin::GetCaret() const { +base::win::ScopedComPtr<IAccessible> AXSystemCaretWin::GetCaret() const { base::win::ScopedComPtr<IAccessible> caret_accessible; HRESULT hr = caret_->QueryInterface( IID_IAccessible, @@ -39,7 +41,7 @@ return caret_accessible; } -void AXFakeCaretWin::MoveCaretTo(const gfx::Rect& bounds) { +void AXSystemCaretWin::MoveCaretTo(const gfx::Rect& bounds) { if (bounds.IsEmpty()) return; data_.location = gfx::RectF(bounds); @@ -49,20 +51,20 @@ } } -const AXNodeData& AXFakeCaretWin::GetData() const { +const AXNodeData& AXSystemCaretWin::GetData() const { return data_; } -const ui::AXTreeData& AXFakeCaretWin::GetTreeData() const { +const ui::AXTreeData& AXSystemCaretWin::GetTreeData() const { CR_DEFINE_STATIC_LOCAL(ui::AXTreeData, empty_data, ()); return empty_data; } -gfx::NativeWindow AXFakeCaretWin::GetTopLevelWidget() { +gfx::NativeWindow AXSystemCaretWin::GetTopLevelWidget() { return nullptr; } -gfx::NativeViewAccessible AXFakeCaretWin::GetParent() { +gfx::NativeViewAccessible AXSystemCaretWin::GetParent() { if (!event_target_) return nullptr; @@ -75,37 +77,39 @@ return nullptr; } -int AXFakeCaretWin::GetChildCount() { +int AXSystemCaretWin::GetChildCount() { return 0; } -gfx::NativeViewAccessible AXFakeCaretWin::ChildAtIndex(int index) { +gfx::NativeViewAccessible AXSystemCaretWin::ChildAtIndex(int index) { return nullptr; } -gfx::Rect AXFakeCaretWin::GetScreenBoundsRect() const { +gfx::Rect AXSystemCaretWin::GetScreenBoundsRect() const { gfx::Rect bounds = ToEnclosingRect(data_.location); return bounds; } -gfx::NativeViewAccessible AXFakeCaretWin::HitTestSync(int x, int y) { +gfx::NativeViewAccessible AXSystemCaretWin::HitTestSync(int x, int y) { return nullptr; } -gfx::NativeViewAccessible AXFakeCaretWin::GetFocus() { +gfx::NativeViewAccessible AXSystemCaretWin::GetFocus() { return nullptr; } -gfx::AcceleratedWidget AXFakeCaretWin::GetTargetForNativeAccessibilityEvent() { +gfx::AcceleratedWidget +AXSystemCaretWin::GetTargetForNativeAccessibilityEvent() { return event_target_; } -bool AXFakeCaretWin::AccessibilityPerformAction(const ui::AXActionData& data) { +bool AXSystemCaretWin::AccessibilityPerformAction( + const ui::AXActionData& data) { return false; } -bool AXFakeCaretWin::ShouldIgnoreHoveredStateForTesting() { - return true; +bool AXSystemCaretWin::ShouldIgnoreHoveredStateForTesting() { + return false; } } // namespace ui
diff --git a/ui/accessibility/platform/ax_fake_caret_win.h b/ui/accessibility/platform/ax_system_caret_win.h similarity index 82% rename from ui/accessibility/platform/ax_fake_caret_win.h rename to ui/accessibility/platform/ax_system_caret_win.h index 90d16fc..e4e2c25 100644 --- a/ui/accessibility/platform/ax_fake_caret_win.h +++ b/ui/accessibility/platform/ax_system_caret_win.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 UI_ACCESSIBILITY_PLATFORM_AX_FAKE_CARET_WIN_H_ -#define UI_ACCESSIBILITY_PLATFORM_AX_FAKE_CARET_WIN_H_ +#ifndef UI_ACCESSIBILITY_PLATFORM_AX_SYSTEM_CARET_WIN_H_ +#define UI_ACCESSIBILITY_PLATFORM_AX_SYSTEM_CARET_WIN_H_ #include <oleacc.h> @@ -24,10 +24,10 @@ // Windows. This is required because Chrome doesn't use the standard system // caret and because some assistive software still relies on specific // accessibility APIs to retrieve the caret position. -class AX_EXPORT AXFakeCaretWin : private AXPlatformNodeDelegate { +class AX_EXPORT AXSystemCaretWin : private AXPlatformNodeDelegate { public: - AXFakeCaretWin(gfx::AcceleratedWidget event_target); - virtual ~AXFakeCaretWin(); + explicit AXSystemCaretWin(gfx::AcceleratedWidget event_target); + virtual ~AXSystemCaretWin(); base::win::ScopedComPtr<IAccessible> GetCaret() const; void MoveCaretTo(const gfx::Rect& bounds); @@ -52,9 +52,9 @@ AXNodeData data_; friend class AXPlatformNodeWin; - DISALLOW_COPY_AND_ASSIGN(AXFakeCaretWin); + DISALLOW_COPY_AND_ASSIGN(AXSystemCaretWin); }; } // namespace ui -#endif // UI_ACCESSIBILITY_PLATFORM_AX_FAKE_CARET_WIN_H_ +#endif // UI_ACCESSIBILITY_PLATFORM_AX_SYSTEM_CARET_WIN_H_
diff --git a/ui/base/ime/input_method_observer.h b/ui/base/ime/input_method_observer.h index 945545ec..069e3aa 100644 --- a/ui/base/ime/input_method_observer.h +++ b/ui/base/ime/input_method_observer.h
@@ -29,7 +29,6 @@ virtual void OnBlur() = 0; // Called whenever the caret bounds is changed for the input client. - // Currently only used by the mock input method for testing. virtual void OnCaretBoundsChanged(const TextInputClient* client) = 0; // Called when either:
diff --git a/ui/base/ime/input_method_win.cc b/ui/base/ime/input_method_win.cc index dae6ca0b..3e33b5a 100644 --- a/ui/base/ime/input_method_win.cc +++ b/ui/base/ime/input_method_win.cc
@@ -230,6 +230,7 @@ void InputMethodWin::OnCaretBoundsChanged(const TextInputClient* client) { if (!IsTextInputClientFocused(client) || !IsWindowFocused(client)) return; + NotifyTextInputCaretBoundsChanged(client); TextInputType text_input_type = GetTextInputType(); if (client == GetTextInputClient() && text_input_type != TEXT_INPUT_TYPE_NONE &&
diff --git a/ui/compositor/transform_animation_curve_adapter.cc b/ui/compositor/transform_animation_curve_adapter.cc index e698be6..0973c67a 100644 --- a/ui/compositor/transform_animation_curve_adapter.cc +++ b/ui/compositor/transform_animation_curve_adapter.cc
@@ -9,6 +9,16 @@ namespace ui { +namespace { + +static cc::TransformOperations WrapTransform(const gfx::Transform& transform) { + cc::TransformOperations operations; + operations.AppendMatrix(transform); + return operations; +} + +} // namespace + TransformAnimationCurveAdapter::TransformAnimationCurveAdapter( gfx::Tween::Type tween_type, gfx::Transform initial_value, @@ -16,10 +26,12 @@ base::TimeDelta duration) : tween_type_(tween_type), initial_value_(initial_value), + initial_wrapped_value_(WrapTransform(initial_value)), target_value_(target_value), + target_wrapped_value_(WrapTransform(target_value)), duration_(duration) { - gfx::DecomposeTransform(&decomposed_initial_value_, initial_value_); - gfx::DecomposeTransform(&decomposed_target_value_, target_value_); + gfx::DecomposeTransform(&decomposed_initial_value_, initial_value); + gfx::DecomposeTransform(&decomposed_target_value_, target_value); } TransformAnimationCurveAdapter::TransformAnimationCurveAdapter( @@ -38,18 +50,19 @@ tween_type_, initial_value_, target_value_, duration_)); } -gfx::Transform TransformAnimationCurveAdapter::GetValue( +cc::TransformOperations TransformAnimationCurveAdapter::GetValue( base::TimeDelta t) const { if (t >= duration_) - return target_value_; + return target_wrapped_value_; if (t <= base::TimeDelta()) - return initial_value_; + return initial_wrapped_value_; double progress = cc::TimeUtil::Divide(t, duration_); gfx::DecomposedTransform to_return = gfx::BlendDecomposedTransforms( decomposed_target_value_, decomposed_initial_value_, gfx::Tween::CalculateValue(tween_type_, progress)); - return gfx::ComposeTransform(to_return); + + return WrapTransform(gfx::ComposeTransform(to_return)); } bool TransformAnimationCurveAdapter::AnimatedBoundsForBox( @@ -90,9 +103,10 @@ base::TimeDelta duration) : base_curve_(base_curve), initial_value_(initial_value), + initial_wrapped_value_(WrapTransform(initial_value)), duration_(duration) { effective_initial_value_ = - base_curve_.GetValue(base::TimeDelta()) * initial_value_; + base_curve_.GetValue(base::TimeDelta()).Apply() * initial_value_; } InverseTransformCurveAdapter::~InverseTransformCurveAdapter() { @@ -108,18 +122,20 @@ new InverseTransformCurveAdapter(base_curve_, initial_value_, duration_)); } -gfx::Transform InverseTransformCurveAdapter::GetValue(base::TimeDelta t) const { +cc::TransformOperations InverseTransformCurveAdapter::GetValue( + base::TimeDelta t) const { if (t <= base::TimeDelta()) - return initial_value_; + return initial_wrapped_value_; - gfx::Transform base_transform = base_curve_.GetValue(t); + gfx::Transform base_transform = base_curve_.GetValue(t).Apply(); // Invert base gfx::Transform to_return(gfx::Transform::kSkipInitialization); bool is_invertible = base_transform.GetInverse(&to_return); DCHECK(is_invertible); to_return.PreconcatTransform(effective_initial_value_); - return to_return; + + return WrapTransform(to_return); } bool InverseTransformCurveAdapter::AnimatedBoundsForBox(
diff --git a/ui/compositor/transform_animation_curve_adapter.h b/ui/compositor/transform_animation_curve_adapter.h index 7d79ea7..53d1d96 100644 --- a/ui/compositor/transform_animation_curve_adapter.h +++ b/ui/compositor/transform_animation_curve_adapter.h
@@ -10,6 +10,7 @@ #include "base/macros.h" #include "base/time/time.h" #include "cc/animation/animation_curve.h" +#include "cc/animation/transform_operations.h" #include "ui/compositor/compositor_export.h" #include "ui/gfx/animation/tween.h" #include "ui/gfx/transform.h" @@ -32,7 +33,7 @@ // TransformAnimationCurve implementation. base::TimeDelta Duration() const override; std::unique_ptr<AnimationCurve> Clone() const override; - gfx::Transform GetValue(base::TimeDelta t) const override; + cc::TransformOperations GetValue(base::TimeDelta t) const override; bool AnimatedBoundsForBox(const gfx::BoxF& box, gfx::BoxF* bounds) const override; bool IsTranslation() const override; @@ -45,7 +46,9 @@ private: gfx::Tween::Type tween_type_; gfx::Transform initial_value_; + cc::TransformOperations initial_wrapped_value_; gfx::Transform target_value_; + cc::TransformOperations target_wrapped_value_; gfx::DecomposedTransform decomposed_initial_value_; gfx::DecomposedTransform decomposed_target_value_; base::TimeDelta duration_; @@ -64,7 +67,7 @@ base::TimeDelta Duration() const override; std::unique_ptr<AnimationCurve> Clone() const override; - gfx::Transform GetValue(base::TimeDelta t) const override; + cc::TransformOperations GetValue(base::TimeDelta t) const override; bool AnimatedBoundsForBox(const gfx::BoxF& box, gfx::BoxF* bounds) const override; bool IsTranslation() const override; @@ -77,6 +80,7 @@ private: TransformAnimationCurveAdapter base_curve_; gfx::Transform initial_value_; + cc::TransformOperations initial_wrapped_value_; gfx::Transform effective_initial_value_; base::TimeDelta duration_;
diff --git a/ui/compositor/transform_animation_curve_adapter_unittest.cc b/ui/compositor/transform_animation_curve_adapter_unittest.cc index 10ee668..b5b44e9 100644 --- a/ui/compositor/transform_animation_curve_adapter_unittest.cc +++ b/ui/compositor/transform_animation_curve_adapter_unittest.cc
@@ -31,29 +31,28 @@ const gfx::Transform effective_child_transform = parent_start * child_transform; - TransformAnimationCurveAdapter parent_curve(gfx::Tween::LINEAR, - parent_start, - parent_target, - duration); + TransformAnimationCurveAdapter parent_curve(gfx::Tween::LINEAR, parent_start, + parent_target, duration); - InverseTransformCurveAdapter child_curve(parent_curve, - child_transform, + InverseTransformCurveAdapter child_curve(parent_curve, child_transform, duration); static const int kSteps = 1000; double step = 1.0 / kSteps; - for (int i = 0; i <= kSteps ; ++i) { + for (int i = 0; i <= kSteps; ++i) { base::TimeDelta time_step = cc::TimeUtil::Scale(duration, i * step); std::ostringstream message; message << "Step " << i << " of " << kSteps; SCOPED_TRACE(message.str()); - gfx::Transform progress_parent_transform = parent_curve.GetValue(time_step); - gfx::Transform progress_child_transform = child_curve.GetValue(time_step); - CheckApproximatelyEqual(effective_child_transform, - progress_parent_transform * - progress_child_transform); + gfx::Transform progress_parent_transform = + parent_curve.GetValue(time_step).Apply(); + gfx::Transform progress_child_transform = + child_curve.GetValue(time_step).Apply(); + CheckApproximatelyEqual( + effective_child_transform, + progress_parent_transform * progress_child_transform); } } -} // namespace +} // namespace -} // namespace ui +} // namespace ui
diff --git a/ui/events/blink/input_handler_proxy.cc b/ui/events/blink/input_handler_proxy.cc index 34a0baa..6da150c1 100644 --- a/ui/events/blink/input_handler_proxy.cc +++ b/ui/events/blink/input_handler_proxy.cc
@@ -327,9 +327,17 @@ if (has_ongoing_compositor_scroll_fling_pinch_) { const auto& gesture_event = ToWebGestureEvent(event_with_callback->event()); - if (gesture_event.source_device == blink::kWebGestureDeviceTouchscreen && - gesture_event.is_source_touch_event_set_non_blocking) { - // Dispatch immediately to avoid regression in + bool is_from_set_non_blocking_touch = + gesture_event.source_device == blink::kWebGestureDeviceTouchscreen && + gesture_event.is_source_touch_event_set_non_blocking; + bool is_scroll_end_from_wheel = + gesture_event.source_device == blink::kWebGestureDeviceTouchpad && + gesture_event.GetType() == blink::WebGestureEvent::kGestureScrollEnd; + if (is_from_set_non_blocking_touch || is_scroll_end_from_wheel) { + // Gesture events was already delayed by blocking events in rAF aligned + // queue. We want to avoid additional one frame delay by flushing the + // VSync queue immediately. + // The first GSU latency was tracked by: // |smoothness.tough_scrolling_cases:first_gesture_scroll_update_latency|. compositor_event_queue_->Queue(std::move(event_with_callback), tick_clock_->NowTicks()); @@ -1084,18 +1092,30 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HitTestTouchEvent( const blink::WebTouchEvent& touch_event, - bool* is_touching_scrolling_layer) { + bool* is_touching_scrolling_layer, + cc::TouchAction* white_listed_touch_action) { *is_touching_scrolling_layer = false; EventDisposition result = DROP_EVENT; for (size_t i = 0; i < touch_event.touches_length; ++i) { + if (touch_event.GetType() == WebInputEvent::kTouchStart) + DCHECK(white_listed_touch_action); + else + DCHECK(!white_listed_touch_action); + if (touch_event.GetType() == WebInputEvent::kTouchStart && touch_event.touches[i].state != WebTouchPoint::kStatePressed) { continue; } + + cc::TouchAction touch_action = cc::kTouchActionAuto; cc::InputHandler::TouchStartOrMoveEventListenerType event_listener_type = input_handler_->EventListenerTypeForTouchStartOrMoveAt( gfx::Point(touch_event.touches[i].PositionInWidget().x, - touch_event.touches[i].PositionInWidget().y)); + touch_event.touches[i].PositionInWidget().y), + &touch_action); + if (white_listed_touch_action) + *white_listed_touch_action &= touch_action; + if (event_listener_type != cc::InputHandler::TouchStartOrMoveEventListenerType::NO_HANDLER) { *is_touching_scrolling_layer = @@ -1146,8 +1166,11 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchStart( const blink::WebTouchEvent& touch_event) { bool is_touching_scrolling_layer; - EventDisposition result = - HitTestTouchEvent(touch_event, &is_touching_scrolling_layer); + cc::TouchAction white_listed_touch_action = cc::kTouchActionAuto; + EventDisposition result = HitTestTouchEvent( + touch_event, &is_touching_scrolling_layer, &white_listed_touch_action); + // TODO(hayleyferr) : Send |white_listed_touch_action| to browser. + // If |result| is still DROP_EVENT look at the touch end handler as // we may not want to discard the entire touch sequence. Note this // code is explicitly after the assignment of the |touch_result_| @@ -1174,7 +1197,8 @@ if (touch_result_ == kEventDispositionUndefined || touch_event.touch_start_or_first_touch_move) { bool is_touching_scrolling_layer; - return HitTestTouchEvent(touch_event, &is_touching_scrolling_layer); + return HitTestTouchEvent(touch_event, &is_touching_scrolling_layer, + nullptr); } return static_cast<EventDisposition>(touch_result_); } @@ -1575,6 +1599,7 @@ synthetic_wheel.delta_x = increment.width; synthetic_wheel.delta_y = increment.height; synthetic_wheel.has_precise_scrolling_deltas = true; + synthetic_wheel.phase = WebMouseWheelEvent::kPhaseChanged; synthetic_wheel.SetPositionInWidget(fling_parameters_.point.x, fling_parameters_.point.y); synthetic_wheel.SetPositionInScreen(fling_parameters_.global_point.x,
diff --git a/ui/events/blink/input_handler_proxy.h b/ui/events/blink/input_handler_proxy.h index 1459fc08..2d3a93f 100644 --- a/ui/events/blink/input_handler_proxy.h +++ b/ui/events/blink/input_handler_proxy.h
@@ -33,6 +33,7 @@ namespace test { class InputHandlerProxyTest; class InputHandlerProxyEventQueueTest; +class TestInputHandlerProxy; } class CompositorThreadEventQueue; @@ -118,6 +119,7 @@ uint32_t reasons); private: + friend class test::TestInputHandlerProxy; friend class test::InputHandlerProxyTest; friend class test::InputHandlerProxyEventQueueTest; @@ -184,8 +186,14 @@ void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); - EventDisposition HitTestTouchEvent(const blink::WebTouchEvent& touch_event, - bool* is_touching_scrolling_layer); + // |is_touching_scrolling_layer| indicates if one of the points that has + // been touched hits a currently scrolling layer. + // |white_listed_touch_action| is the touch_action we are sure will be + // allowed for the given touch event. + EventDisposition HitTestTouchEvent( + const blink::WebTouchEvent& touch_event, + bool* is_touching_scrolling_layer, + cc::TouchAction* white_listed_touch_action); std::unique_ptr<blink::WebGestureCurve> fling_curve_; // Parameters for the active fling animation, stored in case we need to
diff --git a/ui/events/blink/input_handler_proxy_unittest.cc b/ui/events/blink/input_handler_proxy_unittest.cc index 01ebddc..36f79965 100644 --- a/ui/events/blink/input_handler_proxy_unittest.cc +++ b/ui/events/blink/input_handler_proxy_unittest.cc
@@ -33,6 +33,7 @@ #include "ui/events/blink/compositor_thread_event_queue.h" #include "ui/events/blink/did_overscroll_params.h" #include "ui/events/blink/event_with_callback.h" +#include "ui/events/blink/input_handler_proxy.h" #include "ui/events/blink/input_handler_proxy_client.h" #include "ui/events/blink/web_input_event_traits.h" #include "ui/gfx/geometry/scroll_offset.h" @@ -127,19 +128,21 @@ modifiers); } -WebScopedInputEvent CreateGestureScrollFlingPinch(WebInputEvent::Type type, - float deltaYOrScale = 0, - int x = 0, - int y = 0) { +WebScopedInputEvent CreateGestureScrollFlingPinch( + WebInputEvent::Type type, + WebGestureDevice source_device, + float delta_y_or_scale = 0, + int x = 0, + int y = 0) { WebGestureEvent gesture(type, WebInputEvent::kNoModifiers, WebInputEvent::kTimeStampForTesting); - gesture.source_device = blink::kWebGestureDeviceTouchpad; + gesture.source_device = source_device; if (type == WebInputEvent::kGestureScrollUpdate) { - gesture.data.scroll_update.delta_y = deltaYOrScale; + gesture.data.scroll_update.delta_y = delta_y_or_scale; } else if (type == WebInputEvent::kGestureFlingStart) { - gesture.data.fling_start.velocity_y = deltaYOrScale; + gesture.data.fling_start.velocity_y = delta_y_or_scale; } else if (type == WebInputEvent::kGesturePinchUpdate) { - gesture.data.pinch_update.scale = deltaYOrScale; + gesture.data.pinch_update.scale = delta_y_or_scale; gesture.x = x; gesture.y = y; } @@ -215,9 +218,10 @@ MOCK_CONST_METHOD1( GetEventListenerProperties, cc::EventListenerProperties(cc::EventListenerClass event_class)); - MOCK_METHOD1(EventListenerTypeForTouchStartOrMoveAt, + MOCK_METHOD2(EventListenerTypeForTouchStartOrMoveAt, cc::InputHandler::TouchStartOrMoveEventListenerType( - const gfx::Point& point)); + const gfx::Point& point, + cc::TouchAction* touch_action)); MOCK_METHOD0(RequestUpdateForSynchronousInputHandler, void()); MOCK_METHOD1(SetSynchronousInputHandlerRootScrollOffset, @@ -353,6 +357,8 @@ cc::InputHandler::SCROLL_IGNORED, cc::MainThreadScrollingReason::kNotScrollable); +} // namespace + class TestInputHandlerProxy : public InputHandlerProxy { public: TestInputHandlerProxy(cc::InputHandler* input_handler, @@ -365,9 +371,15 @@ uint32_t reasons) { RecordMainThreadScrollingReasons(device, reasons); } -}; -} // namespace + EventDisposition HitTestTouchEventForTest( + const blink::WebTouchEvent& touch_event, + bool* is_touching_scrolling_layer, + cc::TouchAction* white_listed_touch_action) { + return HitTestTouchEvent(touch_event, is_touching_scrolling_layer, + white_listed_touch_action); + } +}; class InputHandlerProxyTest : public testing::Test, @@ -559,12 +571,23 @@ } void HandleGestureEvent(WebInputEvent::Type type, - float deltay_or_scale = 0, + float delta_y_or_scale = 0, int x = 0, int y = 0) { + HandleGestureEventWithSourceDevice( + type, blink::kWebGestureDeviceTouchscreen, delta_y_or_scale, x, y); + } + + void HandleGestureEventWithSourceDevice(WebInputEvent::Type type, + WebGestureDevice source_device, + float delta_y_or_scale = 0, + int x = 0, + int y = 0) { LatencyInfo latency; input_handler_proxy_->HandleInputEventWithLatencyInfo( - CreateGestureScrollFlingPinch(type, deltay_or_scale, x, y), latency, + CreateGestureScrollFlingPinch(type, source_device, delta_y_or_scale, x, + y), + latency, base::Bind( &InputHandlerProxyEventQueueTest::DidHandleInputEventAndOverscroll, weak_ptr_factory_.GetWeakPtr())); @@ -1455,6 +1478,7 @@ fling_global_point.y); expected_wheel.delta_x = fling_delta.x / 10; expected_wheel.has_precise_scrolling_deltas = true; + expected_wheel.phase = WebMouseWheelEvent::kPhaseChanged; EXPECT_CALL(mock_client_, DispatchNonBlockingEventToMainThread_( WheelEventsMatch(expected_wheel))) @@ -2414,6 +2438,94 @@ EXPECT_FALSE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); } +TEST_P(InputHandlerProxyTest, HitTestTouchEventNonNullTouchAction) { + // One of the touch points is on a touch-region. So the event should be sent + // to the main thread. + expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; + VERIFY_AND_RESET_MOCKS(); + + EXPECT_CALL( + mock_input_handler_, + EventListenerTypeForTouchStartOrMoveAt( + testing::Property(&gfx::Point::x, testing::Eq(0)), testing::_)) + .WillOnce(testing::Invoke([](const gfx::Point&, + cc::TouchAction* touch_action) { + *touch_action = cc::kTouchActionMax; + return cc::InputHandler::TouchStartOrMoveEventListenerType::NO_HANDLER; + })); + + EXPECT_CALL( + mock_input_handler_, + EventListenerTypeForTouchStartOrMoveAt( + testing::Property(&gfx::Point::x, testing::Gt(0)), testing::_)) + .WillOnce( + testing::Invoke([](const gfx::Point&, cc::TouchAction* touch_action) { + *touch_action = cc::kTouchActionPanUp; + return cc::InputHandler::TouchStartOrMoveEventListenerType:: + HANDLER_ON_SCROLLING_LAYER; + })); + // Since the second touch point hits a touch-region, there should be no + // hit-testing for the third touch point. + + WebTouchEvent touch(WebInputEvent::kTouchStart, WebInputEvent::kNoModifiers, + WebInputEvent::kTimeStampForTesting); + + touch.touches_length = 3; + touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::kStatePressed, 0, 0); + touch.touches[1] = CreateWebTouchPoint(WebTouchPoint::kStatePressed, 10, 10); + touch.touches[2] = CreateWebTouchPoint(WebTouchPoint::kStatePressed, -10, 10); + + bool is_touching_scrolling_layer; + cc::TouchAction white_listed_touch_action = cc::kTouchActionAuto; + EXPECT_EQ(expected_disposition_, input_handler_->HitTestTouchEventForTest( + touch, &is_touching_scrolling_layer, + &white_listed_touch_action)); + EXPECT_TRUE(is_touching_scrolling_layer); + EXPECT_EQ(white_listed_touch_action, cc::kTouchActionPanUp); + VERIFY_AND_RESET_MOCKS(); +} + +TEST_P(InputHandlerProxyTest, HitTestTouchEventNullTouchAction) { + // One of the touch points is on a touch-region. So the event should be sent + // to the main thread. + expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; + VERIFY_AND_RESET_MOCKS(); + + EXPECT_CALL( + mock_input_handler_, + EventListenerTypeForTouchStartOrMoveAt( + testing::Property(&gfx::Point::x, testing::Eq(0)), testing::_)) + .WillOnce(testing::Return( + cc::InputHandler::TouchStartOrMoveEventListenerType::NO_HANDLER)); + + EXPECT_CALL( + mock_input_handler_, + EventListenerTypeForTouchStartOrMoveAt( + testing::Property(&gfx::Point::x, testing::Gt(0)), testing::_)) + .WillOnce( + testing::Return(cc::InputHandler::TouchStartOrMoveEventListenerType:: + HANDLER_ON_SCROLLING_LAYER)); + // Since the second touch point hits a touch-region, there should be no + // hit-testing for the third touch point. + + WebTouchEvent touch(WebInputEvent::kTouchMove, WebInputEvent::kNoModifiers, + WebInputEvent::kTimeStampForTesting); + + touch.touches_length = 3; + touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::kStatePressed, 0, 0); + touch.touches[1] = CreateWebTouchPoint(WebTouchPoint::kStatePressed, 10, 10); + touch.touches[2] = CreateWebTouchPoint(WebTouchPoint::kStatePressed, -10, 10); + + bool is_touching_scrolling_layer; + cc::TouchAction* white_listed_touch_action = nullptr; + EXPECT_EQ(expected_disposition_, input_handler_->HitTestTouchEventForTest( + touch, &is_touching_scrolling_layer, + white_listed_touch_action)); + EXPECT_TRUE(is_touching_scrolling_layer); + EXPECT_TRUE(!white_listed_touch_action); + VERIFY_AND_RESET_MOCKS(); +} + TEST_P(InputHandlerProxyTest, MultiTouchPointHitTestNegative) { // None of the three touch points fall in the touch region. So the event // should be dropped. @@ -2429,7 +2541,7 @@ GetEventListenerProperties(cc::EventListenerClass::kTouchEndOrCancel)) .WillOnce(testing::Return(cc::EventListenerProperties::kNone)); EXPECT_CALL(mock_input_handler_, - EventListenerTypeForTouchStartOrMoveAt(testing::_)) + EventListenerTypeForTouchStartOrMoveAt(testing::_, testing::_)) .Times(2) .WillRepeatedly(testing::Return( cc::InputHandler::TouchStartOrMoveEventListenerType::NO_HANDLER)); @@ -2452,14 +2564,16 @@ expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; VERIFY_AND_RESET_MOCKS(); - EXPECT_CALL(mock_input_handler_, - EventListenerTypeForTouchStartOrMoveAt( - testing::Property(&gfx::Point::x, testing::Eq(0)))) + EXPECT_CALL( + mock_input_handler_, + EventListenerTypeForTouchStartOrMoveAt( + testing::Property(&gfx::Point::x, testing::Eq(0)), testing::_)) .WillOnce(testing::Return( cc::InputHandler::TouchStartOrMoveEventListenerType::NO_HANDLER)); - EXPECT_CALL(mock_input_handler_, - EventListenerTypeForTouchStartOrMoveAt( - testing::Property(&gfx::Point::x, testing::Gt(0)))) + EXPECT_CALL( + mock_input_handler_, + EventListenerTypeForTouchStartOrMoveAt( + testing::Property(&gfx::Point::x, testing::Gt(0)), testing::_)) .WillOnce( testing::Return(cc::InputHandler::TouchStartOrMoveEventListenerType:: HANDLER_ON_SCROLLING_LAYER)); @@ -2489,7 +2603,7 @@ GetEventListenerProperties(cc::EventListenerClass::kTouchStartOrMove)) .WillRepeatedly(testing::Return(cc::EventListenerProperties::kPassive)); EXPECT_CALL(mock_input_handler_, - EventListenerTypeForTouchStartOrMoveAt(testing::_)) + EventListenerTypeForTouchStartOrMoveAt(testing::_, testing::_)) .WillRepeatedly(testing::Return( cc::InputHandler::TouchStartOrMoveEventListenerType::NO_HANDLER)); @@ -2521,7 +2635,7 @@ GetEventListenerProperties(cc::EventListenerClass::kTouchEndOrCancel)) .WillOnce(testing::Return(cc::EventListenerProperties::kBlocking)); EXPECT_CALL(mock_input_handler_, - EventListenerTypeForTouchStartOrMoveAt(testing::_)) + EventListenerTypeForTouchStartOrMoveAt(testing::_, testing::_)) .WillOnce(testing::Return( cc::InputHandler::TouchStartOrMoveEventListenerType::NO_HANDLER)); @@ -2550,7 +2664,7 @@ GetEventListenerProperties(cc::EventListenerClass::kTouchStartOrMove)) .WillOnce(testing::Return(cc::EventListenerProperties::kPassive)); EXPECT_CALL(mock_input_handler_, - EventListenerTypeForTouchStartOrMoveAt(testing::_)) + EventListenerTypeForTouchStartOrMoveAt(testing::_, testing::_)) .WillOnce(testing::Return( cc::InputHandler::TouchStartOrMoveEventListenerType::NO_HANDLER)); @@ -2562,7 +2676,7 @@ input_handler_->HandleInputEvent(touch)); EXPECT_CALL(mock_input_handler_, - EventListenerTypeForTouchStartOrMoveAt(testing::_)) + EventListenerTypeForTouchStartOrMoveAt(testing::_, testing::_)) .WillOnce(testing::Return( cc::InputHandler::TouchStartOrMoveEventListenerType::HANDLER)); @@ -3352,9 +3466,10 @@ gesture_scroll_end.source_device = blink::kWebGestureDeviceTouchscreen; // Touch start with passive event listener. - EXPECT_CALL(mock_input_handler_, - EventListenerTypeForTouchStartOrMoveAt( - testing::Property(&gfx::Point::x, testing::Gt(0)))) + EXPECT_CALL( + mock_input_handler_, + EventListenerTypeForTouchStartOrMoveAt( + testing::Property(&gfx::Point::x, testing::Gt(0)), testing::_)) .WillOnce(testing::Return( cc::InputHandler::TouchStartOrMoveEventListenerType::NO_HANDLER)); EXPECT_CALL( @@ -3384,9 +3499,10 @@ VERIFY_AND_RESET_MOCKS(); // Touch event with HANDLER_ON_SCROLLING_LAYER event listener. - EXPECT_CALL(mock_input_handler_, - EventListenerTypeForTouchStartOrMoveAt( - testing::Property(&gfx::Point::x, testing::Gt(0)))) + EXPECT_CALL( + mock_input_handler_, + EventListenerTypeForTouchStartOrMoveAt( + testing::Property(&gfx::Point::x, testing::Gt(0)), testing::_)) .WillOnce( testing::Return(cc::InputHandler::TouchStartOrMoveEventListenerType:: HANDLER_ON_SCROLLING_LAYER)); @@ -3615,9 +3731,6 @@ .WillRepeatedly(testing::Return(scroll_result_did_scroll_)); EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)).Times(2); EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()).Times(1); - EXPECT_CALL(mock_input_handler_, - GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) - .WillOnce(testing::Return(cc::EventListenerProperties::kNone)); EXPECT_CALL(mock_input_handler_, PinchGestureBegin()); // Two |GesturePinchUpdate| will be coalesced. EXPECT_CALL(mock_input_handler_, @@ -3834,6 +3947,8 @@ .WillRepeatedly(testing::Return(scroll_result_did_scroll_)); EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)) .Times(::testing::AtLeast(1)); + EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) + .WillOnce(testing::Return(kImplThreadScrollState)); // Simulate scroll. HandleGestureEvent(WebInputEvent::kGestureScrollBegin); @@ -3884,6 +3999,8 @@ .WillRepeatedly(testing::Return(scroll_result_did_scroll_)); EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)) .Times(::testing::AtLeast(1)); + EXPECT_CALL(mock_input_handler_, FlingScrollBegin()) + .WillOnce(testing::Return(kImplThreadScrollState)); // Simulate fling. HandleGestureEvent(WebInputEvent::kGestureScrollBegin); @@ -3904,6 +4021,42 @@ EXPECT_EQ(0ul, event_queue().size()); } +TEST_P(InputHandlerProxyEventQueueTest, TouchpadGestureScrollEndFlushQueue) { + // Handle scroll on compositor. + cc::InputHandlerScrollResult scroll_result_did_scroll_; + scroll_result_did_scroll_.did_scroll = true; + + EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) + .WillRepeatedly(testing::Return(kImplThreadScrollState)); + EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()) + .Times(::testing::AtLeast(1)); + EXPECT_CALL( + mock_input_handler_, + ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Gt(0)))) + .WillRepeatedly(testing::Return(scroll_result_did_scroll_)); + EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)) + .Times(::testing::AtLeast(1)); + + // Simulate scroll. + HandleGestureEventWithSourceDevice(WebInputEvent::kGestureScrollBegin, + blink::kWebGestureDeviceTouchpad); + HandleGestureEventWithSourceDevice(WebInputEvent::kGestureScrollUpdate, + blink::kWebGestureDeviceTouchpad, -20); + + // GSB will be dispatched immediately, GSU will be queued. + EXPECT_EQ(1ul, event_queue().size()); + EXPECT_EQ(1ul, event_disposition_recorder_.size()); + + // Touchpad GSE will flush the queue. + HandleGestureEventWithSourceDevice(WebInputEvent::kGestureScrollEnd, + blink::kWebGestureDeviceTouchpad); + + EXPECT_EQ(0ul, event_queue().size()); + EXPECT_EQ(3ul, event_disposition_recorder_.size()); + EXPECT_FALSE( + input_handler_proxy_->gesture_scroll_on_impl_thread_for_testing()); +} + INSTANTIATE_TEST_CASE_P(AnimateInput, InputHandlerProxyTest, testing::ValuesIn(test_types));
diff --git a/ui/gfx/animation/tween.cc b/ui/gfx/animation/tween.cc index a341548..1cebe30 100644 --- a/ui/gfx/animation/tween.cc +++ b/ui/gfx/animation/tween.cc
@@ -203,4 +203,13 @@ return to_return; } +gfx::SizeF Tween::SizeValueBetween(double value, + const gfx::SizeF& start_size, + const gfx::SizeF& target_size) { + return gfx::SizeF( + Tween::FloatValueBetween(value, start_size.width(), target_size.width()), + Tween::FloatValueBetween(value, start_size.height(), + target_size.height())); +} + } // namespace gfx
diff --git a/ui/gfx/animation/tween.h b/ui/gfx/animation/tween.h index 3be0e95..15107adf 100644 --- a/ui/gfx/animation/tween.h +++ b/ui/gfx/animation/tween.h
@@ -9,6 +9,7 @@ #include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/animation/animation_export.h" #include "ui/gfx/geometry/rect.h" +#include "ui/gfx/geometry/size_f.h" #include "ui/gfx/transform.h" namespace base { @@ -72,6 +73,10 @@ const gfx::Transform& start_transform, const gfx::Transform& target_transform); + static gfx::SizeF SizeValueBetween(double value, + const gfx::SizeF& start_size, + const gfx::SizeF& target_size); + private: Tween(); ~Tween();
diff --git a/ui/gfx/animation/tween_unittest.cc b/ui/gfx/animation/tween_unittest.cc index 1871fc9b..d55904f 100644 --- a/ui/gfx/animation/tween_unittest.cc +++ b/ui/gfx/animation/tween_unittest.cc
@@ -155,5 +155,36 @@ EXPECT_EQ(v2, Tween::ClampedFloatValueBetween(t_after, from, v1, to, v2)); } +TEST(TweenTest, SizeValueBetween) { + const gfx::SizeF s1(12.0f, 24.0f); + const gfx::SizeF s2(36.0f, 48.0f); + + double before = -0.125; + double from = 0.0; + double between = 0.5; + double to = 1.0; + double after = 1.125; + + EXPECT_SIZEF_EQ(gfx::SizeF(9.0f, 21.0f), + Tween::SizeValueBetween(before, s1, s2)); + EXPECT_SIZEF_EQ(s1, Tween::SizeValueBetween(from, s1, s2)); + EXPECT_SIZEF_EQ(gfx::SizeF(24.0f, 36.0f), + Tween::SizeValueBetween(between, s1, s2)); + EXPECT_SIZEF_EQ(s2, Tween::SizeValueBetween(to, s1, s2)); + EXPECT_SIZEF_EQ(gfx::SizeF(39.0f, 51.0f), + Tween::SizeValueBetween(after, s1, s2)); +} + +TEST(TweenTest, SizeValueBetweenClampedExtrapolation) { + const gfx::SizeF s1(0.0f, 0.0f); + const gfx::SizeF s2(36.0f, 48.0f); + + double before = -1.0f; + + // We should not extrapolate in this case as it would result in a negative and + // invalid size. + EXPECT_SIZEF_EQ(s1, Tween::SizeValueBetween(before, s1, s2)); +} + } // namespace } // namespace gfx
diff --git a/ui/gfx/test/gfx_util.cc b/ui/gfx/test/gfx_util.cc index e70b960..e4a1ba8 100644 --- a/ui/gfx/test/gfx_util.cc +++ b/ui/gfx/test/gfx_util.cc
@@ -120,6 +120,19 @@ << "\nWhich is: " << ColorAsString(lhs); } +::testing::AssertionResult AssertSizeFFloatEqual(const char* lhs_expr, + const char* rhs_expr, + const SizeF& lhs, + const SizeF& rhs) { + if (FloatAlmostEqual(lhs.width(), rhs.width()) && + FloatAlmostEqual(lhs.height(), rhs.height())) { + return ::testing::AssertionSuccess(); + } + return ::testing::AssertionFailure() + << "Value of: " << rhs_expr << "\n Actual: " << rhs.ToString() + << "\nExpected: " << lhs_expr << "\nWhich is: " << lhs.ToString(); +} + void PrintTo(const AxisTransform2d& transform, ::std::ostream* os) { *os << transform.ToString(); }
diff --git a/ui/gfx/test/gfx_util.h b/ui/gfx/test/gfx_util.h index e7ed59d..3b01c73 100644 --- a/ui/gfx/test/gfx_util.h +++ b/ui/gfx/test/gfx_util.h
@@ -17,6 +17,7 @@ class BoxF; class PointF; class RectF; +class SizeF; #define EXPECT_AXIS_TRANSFORM2D_EQ(a, b) \ EXPECT_PRED_FORMAT2(::gfx::AssertAxisTransform2dFloatEqual, a, b) @@ -59,6 +60,13 @@ SkColor lhs, SkColor rhs); +#define EXPECT_SIZEF_EQ(a, b) \ + EXPECT_PRED_FORMAT2(::gfx::AssertSizeFFloatEqual, a, b) + +::testing::AssertionResult AssertSizeFFloatEqual(const char* lhs_expr, + const char* rhs_expr, + const SizeF& lhs, + const SizeF& rhs); } // namespace gfx #endif // UI_GFX_TEST_GFX_UTIL_H_
diff --git a/ui/keyboard/keyboard_controller.cc b/ui/keyboard/keyboard_controller.cc index bfe0fc6..8c98f17 100644 --- a/ui/keyboard/keyboard_controller.cc +++ b/ui/keyboard/keyboard_controller.cc
@@ -10,6 +10,7 @@ #include "base/command_line.h" #include "base/location.h" #include "base/macros.h" +#include "base/metrics/histogram_macros.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" @@ -708,9 +709,9 @@ void KeyboardController::CheckStateTransition(KeyboardControllerState prev, KeyboardControllerState next) { std::stringstream error_message; - if (!isAllowedStateStansition(prev, next)) { + const bool valid_transition = isAllowedStateStansition(prev, next); + if (!valid_transition) error_message << "Unexpected transition"; - } // TODO(oka): Add more condition check. // Emit log on release build too for debug. @@ -719,6 +720,15 @@ << "State: " << StateToStr(prev) << " -> " << StateToStr(next) << " " << error_message.str() << " stack trace: " << base::debug::StackTrace(10).ToString(); + + // Emit UMA + const int transition_record = + (valid_transition ? 1 : -1) * + (static_cast<int>(prev) * 1000 + static_cast<int>(next)); + UMA_HISTOGRAM_SPARSE_SLOWLY("VirtualKeyboard.ControllerStateTransition", + transition_record); + UMA_HISTOGRAM_BOOLEAN("VirtualKeyboard.ControllerStateTransitionIsValid", + transition_record > 0); } void KeyboardController::ChangeState(KeyboardControllerState state) {
diff --git a/ui/keyboard/keyboard_controller.h b/ui/keyboard/keyboard_controller.h index 970aa14..c742fcd 100644 --- a/ui/keyboard/keyboard_controller.h +++ b/ui/keyboard/keyboard_controller.h
@@ -47,23 +47,25 @@ }; // Represents the current state of the keyboard managed by the controller. +// Don't change the numeric value of the members because they are used in UMA +// VirtualKeyboard.ControllerStateTransition. enum class KeyboardControllerState { UNKNOWN = 0, - // Keyboard is shown. - SHOWN, - // Keyboard is being shown via animation. - SHOWING, + // Keyboard has never been shown. + INITIAL = 1, // Waiting for an extension to be loaded and then move to SHOWING. - LOADING_EXTENSION, + LOADING_EXTENSION = 2, + // Keyboard is being shown via animation. + SHOWING = 3, + // Keyboard is shown. + SHOWN = 4, // Keyboard is still shown, but will move to HIDING in a short period, or if // an input element gets focused again, will move to SHOWN. - WILL_HIDE, + WILL_HIDE = 5, // Keyboard is being hidden via animation. - HIDING, + HIDING = 6, // Keyboard is hidden, but has shown at least once. - HIDDEN, - // Keyboard has never been shown. - INITIAL, + HIDDEN = 7, }; // Provides control of the virtual keyboard, including providing a container
diff --git a/ui/message_center/views/notification_control_buttons_view.cc b/ui/message_center/views/notification_control_buttons_view.cc index 5d71a10..2db5a2d 100644 --- a/ui/message_center/views/notification_control_buttons_view.cc +++ b/ui/message_center/views/notification_control_buttons_view.cc
@@ -80,7 +80,7 @@ // Add the button at the first. DCHECK_LE(child_count(), 1); AddChildViewAt(settings_button_, 0); - } else if (!show && close_button_) { + } else if (!show && settings_button_) { RemoveChildView(settings_button_); settings_button_ = nullptr; }
diff --git a/ui/message_center/views/notification_header_view.cc b/ui/message_center/views/notification_header_view.cc index 8ce5827..4699b4f 100644 --- a/ui/message_center/views/notification_header_view.cc +++ b/ui/message_center/views/notification_header_view.cc
@@ -6,6 +6,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" +#include "base/time/time.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/color_palette.h" #include "ui/gfx/font_list.h" @@ -34,7 +35,7 @@ constexpr int kHeaderHorizontalSpacing = 2; constexpr int kAppInfoConatainerTopPadding = 12; // Bullet character. The divider symbol between different parts of the header. -constexpr base::char16 kNotificationHeaderDividerSymbol = 0x2022; +constexpr wchar_t kNotificationHeaderDivider[] = L" \u2022 "; // Base ink drop color of action buttons. const SkColor kInkDropBaseColor = SkColorSetRGB(0x0, 0x0, 0x0); @@ -43,6 +44,13 @@ // Highlight (hover) ink drop opacity of action buttons. constexpr float kInkDropHighlightVisibleOpacity = 0.08f; +// base::TimeBase has similar constants, but some of them are missing. +constexpr int64_t kMinuteInMillis = 60LL * 1000LL; +constexpr int64_t kHourInMillis = 60LL * kMinuteInMillis; +constexpr int64_t kDayInMillis = 24LL * kHourInMillis; +// In Android, DateUtils.YEAR_IN_MILLIS is 364 days. +constexpr int64_t kYearInMillis = 364LL * kDayInMillis; + // ExpandButtton forwards all mouse and key events to NotificationHeaderView, // but takes tab focus for accessibility purpose. class ExpandButton : public views::ImageView { @@ -83,6 +91,35 @@ SchedulePaint(); } +// Do relative time string formatting that is similar to +// com.java.android.widget.DateTimeView.updateRelativeTime. +// Chromium has its own base::TimeFormat::Simple(), but none of the formats +// supported by the function is similar to Android's one. +base::string16 FormatToRelativeTime(base::Time past) { + base::Time now = base::Time::Now(); + int64_t duration = (now - past).InMilliseconds(); + if (duration < kMinuteInMillis) { + return l10n_util::GetStringUTF16( + IDS_MESSAGE_NOTIFICATION_NOW_STRING_SHORTEST); + } else if (duration < kHourInMillis) { + int count = static_cast<int>(duration / kMinuteInMillis); + return l10n_util::GetPluralStringFUTF16( + IDS_MESSAGE_NOTIFICATION_DURATION_MINUTES_SHORTEST, count); + } else if (duration < kDayInMillis) { + int count = static_cast<int>(duration / kHourInMillis); + return l10n_util::GetPluralStringFUTF16( + IDS_MESSAGE_NOTIFICATION_DURATION_HOURS_SHORTEST, count); + } else if (duration < kYearInMillis) { + int count = static_cast<int>(duration / kDayInMillis); + return l10n_util::GetPluralStringFUTF16( + IDS_MESSAGE_NOTIFICATION_DURATION_DAYS_SHORTEST, count); + } else { + int count = static_cast<int>(duration / kYearInMillis); + return l10n_util::GetPluralStringFUTF16( + IDS_MESSAGE_NOTIFICATION_DURATION_YEARS_SHORTEST, count); + } +} + } // namespace NotificationHeaderView::NotificationHeaderView(views::ButtonListener* listener) @@ -125,9 +162,7 @@ // Summary text divider summary_text_divider_ = - new views::Label(base::ASCIIToUTF16(" ") + - base::string16(1, kNotificationHeaderDividerSymbol) + - base::ASCIIToUTF16(" ")); + new views::Label(base::WideToUTF16(kNotificationHeaderDivider)); summary_text_divider_->SetFontList(font_list); summary_text_divider_->SetHorizontalAlignment(gfx::ALIGN_LEFT); summary_text_divider_->SetVisible(false); @@ -140,6 +175,21 @@ summary_text_view_->SetVisible(false); app_info_container->AddChildView(summary_text_view_); + // Timestamp divider + timestamp_divider_ = + new views::Label(base::WideToUTF16(kNotificationHeaderDivider)); + timestamp_divider_->SetFontList(font_list); + timestamp_divider_->SetHorizontalAlignment(gfx::ALIGN_LEFT); + timestamp_divider_->SetVisible(false); + app_info_container->AddChildView(timestamp_divider_); + + // Timestamp view + timestamp_view_ = new views::Label(base::string16()); + timestamp_view_->SetFontList(font_list); + timestamp_view_->SetHorizontalAlignment(gfx::ALIGN_LEFT); + timestamp_view_->SetVisible(false); + app_info_container->AddChildView(timestamp_view_); + // Expand button view expand_button_ = new ExpandButton(); app_info_container->AddChildView(expand_button_); @@ -205,6 +255,17 @@ UpdateSummaryTextVisibility(); } +void NotificationHeaderView::SetTimestamp(base::Time past) { + timestamp_view_->SetText(FormatToRelativeTime(past)); + has_timestamp_ = true; + UpdateSummaryTextVisibility(); +} + +void NotificationHeaderView::ClearTimestamp() { + has_timestamp_ = false; + UpdateSummaryTextVisibility(); +} + void NotificationHeaderView::SetExpandButtonEnabled(bool enabled) { // SetInkDropMode iff. the visibility changed. // Otherwise, the ink drop animation cannot finish. @@ -290,6 +351,8 @@ const bool visible = has_progress_ || has_overflow_indicator_; summary_text_divider_->SetVisible(visible); summary_text_view_->SetVisible(visible); + timestamp_divider_->SetVisible(!has_progress_ && has_timestamp_); + timestamp_view_->SetVisible(!has_progress_ && has_timestamp_); Layout(); }
diff --git a/ui/message_center/views/notification_header_view.h b/ui/message_center/views/notification_header_view.h index 0d3f0c3..2471c67a 100644 --- a/ui/message_center/views/notification_header_view.h +++ b/ui/message_center/views/notification_header_view.h
@@ -24,6 +24,7 @@ void SetAppName(const base::string16& name); void SetProgress(int progress); void SetOverflowIndicator(int count); + void SetTimestamp(base::Time past); void SetExpandButtonEnabled(bool enabled); void SetExpanded(bool expanded); void SetSettingsButtonEnabled(bool enabled); @@ -31,6 +32,7 @@ void SetControlButtonsVisible(bool visible); void ClearProgress(); void ClearOverflowIndicator(); + void ClearTimestamp(); bool IsExpandButtonEnabled(); bool IsSettingsButtonEnabled(); bool IsCloseButtonEnabled(); @@ -48,11 +50,14 @@ private: void UpdateControlButtonsVisibility(); + // Update visibility for both |summary_text_view_| and |timestamp_view_|. void UpdateSummaryTextVisibility(); views::Label* app_name_view_ = nullptr; views::Label* summary_text_divider_ = nullptr; views::Label* summary_text_view_ = nullptr; + views::Label* timestamp_divider_ = nullptr; + views::Label* timestamp_view_ = nullptr; views::ImageView* app_icon_view_ = nullptr; views::ImageView* expand_button_ = nullptr; PaddedButton* settings_button_ = nullptr; @@ -63,6 +68,7 @@ bool is_control_buttons_visible_ = false; bool has_progress_ = false; bool has_overflow_indicator_ = false; + bool has_timestamp_ = false; DISALLOW_COPY_AND_ASSIGN(NotificationHeaderView); };
diff --git a/ui/message_center/views/notification_view.cc b/ui/message_center/views/notification_view.cc index 0b15a6a..a1db170 100644 --- a/ui/message_center/views/notification_view.cc +++ b/ui/message_center/views/notification_view.cc
@@ -29,6 +29,7 @@ #include "ui/message_center/views/constants.h" #include "ui/message_center/views/message_center_controller.h" #include "ui/message_center/views/notification_button.h" +#include "ui/message_center/views/notification_control_buttons_view.h" #include "ui/message_center/views/padded_button.h" #include "ui/message_center/views/proportional_image_view.h" #include "ui/native_theme/native_theme.h" @@ -140,34 +141,6 @@ // NotificationView //////////////////////////////////////////////////////////// -views::View* NotificationView::TargetForRect(views::View* root, - const gfx::Rect& rect) { - CHECK_EQ(root, this); - - // TODO(tdanderson): Modify this function to support rect-based event - // targeting. Using the center point of |rect| preserves this function's - // expected behavior for the time being. - gfx::Point point = rect.CenterPoint(); - - // Want to return this for underlying views, otherwise GetCursor is not - // called. But buttons are exceptions, they'll have their own event handlings. - std::vector<views::View*> buttons(action_buttons_.begin(), - action_buttons_.end()); - if (settings_button_view_) - buttons.push_back(settings_button_view_); - if (close_button()) - buttons.push_back(close_button()); - - for (size_t i = 0; i < buttons.size(); ++i) { - gfx::Point point_in_child = point; - ConvertPointToTarget(this, buttons[i], &point_in_child); - if (buttons[i]->HitTestPoint(point_in_child)) - return buttons[i]->GetEventHandlerForPoint(point_in_child); - } - - return root; -} - void NotificationView::CreateOrUpdateViews(const Notification& notification) { CreateOrUpdateTitleView(notification); CreateOrUpdateMessageView(notification); @@ -177,7 +150,6 @@ CreateOrUpdateSmallIconView(notification); CreateOrUpdateImageView(notification); CreateOrUpdateContextMessageView(notification); - CreateOrUpdateSettingsButtonView(notification); CreateOrUpdateActionButtonViews(notification); } @@ -201,6 +173,9 @@ new views::BoxLayout(views::BoxLayout::kVertical)); AddChildView(bottom_view_); + control_buttons_view_ = new NotificationControlButtonsView(this); + AddChildView(control_buttons_view_); + views::ImageView* small_image_view = new views::ImageView(); small_image_view->SetImageSize(gfx::Size(kSmallImageSize, kSmallImageSize)); small_image_view->set_owned_by_client(); @@ -209,11 +184,11 @@ CreateOrUpdateViews(notification); // Put together the different content and control views. Layering those allows - // for proper layout logic and it also allows the close button and small + // for proper layout logic and it also allows the control buttons and small // image to overlap the content as needed to provide large enough click and // touch areas (<http://crbug.com/168822> and <http://crbug.com/168856>). AddChildView(small_image_view_.get()); - CreateOrUpdateCloseButtonView(notification); + UpdateControlButtonsVisibilityWithNotification(notification); SetEventTargeter( std::unique_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); @@ -291,31 +266,17 @@ icon_view_->SetBounds(insets.left(), insets.top(), kNotificationIconSize, kNotificationIconSize); - // Settings & Bottom views. - int bottom_y = insets.top() + std::max(top_height, kNotificationIconSize); - int bottom_height = bottom_view_->GetHeightForWidth(content_width); - - if (settings_button_view_) { - const gfx::Size settings_size(settings_button_view_->GetPreferredSize()); - int marginFromRight = settings_size.width() + kControlButtonPadding; - if (close_button_) - marginFromRight += close_button_->GetPreferredSize().width(); - gfx::Rect settings_rect(insets.left() + content_width - marginFromRight, - GetContentsBounds().y() + kControlButtonPadding, - settings_size.width(), settings_size.height()); - settings_button_view_->SetBoundsRect(settings_rect); - } - - // Close button. - if (close_button_) { - gfx::Rect content_bounds = GetContentsBounds(); - gfx::Size close_size(close_button_->GetPreferredSize()); - gfx::Rect close_rect( - content_bounds.right() - close_size.width() - kControlButtonPadding, - content_bounds.y() + kControlButtonPadding, close_size.width(), - close_size.height()); - close_button_->SetBoundsRect(close_rect); - } + // Control buttons (close and settings buttons). + gfx::Rect control_buttons_bounds(content_bounds); + int buttons_width = control_buttons_view_->GetPreferredSize().width(); + int buttons_height = control_buttons_view_->GetPreferredSize().height(); + control_buttons_bounds.set_x(control_buttons_bounds.right() - buttons_width - + message_center::kControlButtonPadding); + control_buttons_bounds.set_y(control_buttons_bounds.y() + + message_center::kControlButtonPadding); + control_buttons_bounds.set_width(buttons_width); + control_buttons_bounds.set_height(buttons_height); + control_buttons_view_->SetBoundsRect(control_buttons_bounds); // Small icon. gfx::Size small_image_size(small_image_view_->GetPreferredSize()); @@ -326,6 +287,9 @@ kSmallImagePadding)); small_image_view_->SetBoundsRect(small_image_rect); + // Bottom views. + int bottom_y = insets.top() + std::max(top_height, kNotificationIconSize); + int bottom_height = bottom_view_->GetHeightForWidth(content_width); bottom_view_->SetBounds(insets.left(), bottom_y, content_width, bottom_height); } @@ -368,7 +332,7 @@ MessageView::UpdateWithNotification(notification); CreateOrUpdateViews(notification); - CreateOrUpdateCloseButtonView(notification); + UpdateControlButtonsVisibilityWithNotification(notification); Layout(); SchedulePaint(); } @@ -380,18 +344,6 @@ // TODO(dewittj): Remove this hack. std::string id(notification_id()); - if (close_button_ && sender == close_button_.get()) { - // Warning: This causes the NotificationView itself to be deleted, so don't - // do anything afterwards. - OnCloseButtonPressed(); - return; - } - - if (sender == settings_button_view_) { - OnSettingsButtonPressed(); - return; - } - // See if the button pressed was an action button. for (size_t i = 0; i < action_buttons_.size(); ++i) { if (sender == action_buttons_[i]) { @@ -399,20 +351,16 @@ return; } } + + NOTREACHED(); } bool NotificationView::IsCloseButtonFocused() const { - if (!close_button_) - return false; - - const views::FocusManager* focus_manager = GetFocusManager(); - return focus_manager && - focus_manager->GetFocusedView() == close_button_.get(); + return control_buttons_view_->IsCloseButtonFocused(); } void NotificationView::RequestFocusOnCloseButton() { - if (close_button_) - close_button_->RequestFocus(); + control_buttons_view_->RequestFocusOnCloseButton(); } void NotificationView::CreateOrUpdateTitleView( @@ -523,25 +471,6 @@ } } -void NotificationView::CreateOrUpdateSettingsButtonView( - const Notification& notification) { - delete settings_button_view_; - settings_button_view_ = nullptr; - - if (!settings_button_view_ && notification.delegate() && - notification.delegate()->ShouldDisplaySettingsButton()) { - PaddedButton* settings = new PaddedButton(this); - settings->SetImage(views::Button::STATE_NORMAL, GetSettingsIcon()); - settings->SetAccessibleName(l10n_util::GetStringUTF16( - IDS_MESSAGE_NOTIFICATION_SETTINGS_BUTTON_ACCESSIBLE_NAME)); - settings->SetTooltipText(l10n_util::GetStringUTF16( - IDS_MESSAGE_NOTIFICATION_SETTINGS_BUTTON_ACCESSIBLE_NAME)); - settings_button_view_ = settings; - AddChildView(settings_button_view_); - } - UpdateControlButtonsVisibility(); -} - void NotificationView::CreateOrUpdateProgressBarView( const Notification& notification) { if (notification.type() != NOTIFICATION_TYPE_PROGRESS) { @@ -693,48 +622,31 @@ } } -void NotificationView::CreateOrUpdateCloseButtonView( +void NotificationView::UpdateControlButtonsVisibilityWithNotification( const Notification& notification) { - if (!notification.pinned() && !close_button_) { - close_button_ = base::MakeUnique<PaddedButton>(this); - close_button_->SetImage(views::Button::STATE_NORMAL, GetCloseIcon()); - close_button_->SetAccessibleName(l10n_util::GetStringUTF16( - IDS_MESSAGE_CENTER_CLOSE_NOTIFICATION_BUTTON_ACCESSIBLE_NAME)); - close_button_->SetTooltipText(l10n_util::GetStringUTF16( - IDS_MESSAGE_CENTER_CLOSE_NOTIFICATION_BUTTON_TOOLTIP)); - close_button_->set_owned_by_client(); - AddChildView(close_button_.get()); - UpdateControlButtonsVisibility(); - } else if (notification.pinned() && close_button_) { - close_button_.reset(); - } + control_buttons_view_->ShowSettingsButton( + notification.delegate() && + notification.delegate()->ShouldDisplaySettingsButton()); + control_buttons_view_->ShowCloseButton(!notification.pinned()); + UpdateControlButtonsVisibility(); } void NotificationView::UpdateControlButtonsVisibility() { #if defined(OS_CHROMEOS) - // On Chrome OS, the settings button and the close button are shown only when - // the mouse is hovering on the notification. + // On Chrome OS, the settings button and the close button are shown when: + // (1) the mouse is hovering on the notification. + // (2) the focus is on the control buttons. const bool target_visibility = IsMouseHovered() || HasFocus() || - (close_button_ && - (close_button_->HasFocus() || close_button_->IsMouseHovered())) || - (settings_button_view_ && (settings_button_view_->HasFocus() || - settings_button_view_->IsMouseHovered())); + control_buttons_view_->IsCloseButtonFocused() || + control_buttons_view_->IsSettingsButtonFocused(); #else // On non Chrome OS, the settings button and the close button are always // shown. const bool target_visibility = true; #endif - if (close_button_) { - if (target_visibility != close_button_->visible()) - close_button_->SetVisible(target_visibility); - } - - if (settings_button_view_) { - if (target_visibility != settings_button_view_->visible()) - settings_button_view_->SetVisible(target_visibility); - } + control_buttons_view_->SetVisible(target_visibility); } int NotificationView::GetMessageLineLimit(int title_lines, int width) const {
diff --git a/ui/message_center/views/notification_view.h b/ui/message_center/views/notification_view.h index 7fa691a..9a9cf74 100644 --- a/ui/message_center/views/notification_view.h +++ b/ui/message_center/views/notification_view.h
@@ -24,6 +24,7 @@ class BoundedLabel; class NotificationButton; +class NotificationControlButtonsView; class ProportionalImageView; // View that displays all current types of notification (web, basic, image, and @@ -57,9 +58,6 @@ void RequestFocusOnCloseButton() override; void UpdateControlButtonsVisibility() override; - protected: - views::ImageButton* close_button() { return close_button_.get(); } - private: FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, CreateOrUpdateTest); FRIEND_TEST_ALL_PREFIXES(NotificationViewTest, @@ -74,22 +72,19 @@ friend class NotificationViewTest; - // views::ViewTargeterDelegate: - views::View* TargetForRect(views::View* root, const gfx::Rect& rect) override; - void CreateOrUpdateViews(const Notification& notification); void CreateOrUpdateTitleView(const Notification& notification); void CreateOrUpdateMessageView(const Notification& notification); void CreateOrUpdateContextMessageView(const Notification& notification); - void CreateOrUpdateSettingsButtonView(const Notification& notification); void CreateOrUpdateProgressBarView(const Notification& notification); void CreateOrUpdateListItemViews(const Notification& notification); void CreateOrUpdateIconView(const Notification& notification); void CreateOrUpdateSmallIconView(const Notification& notification); void CreateOrUpdateImageView(const Notification& notification); void CreateOrUpdateActionButtonViews(const Notification& notification); - void CreateOrUpdateCloseButtonView(const Notification& notification); + void UpdateControlButtonsVisibilityWithNotification( + const Notification& notification); int GetMessageLineLimit(int title_lines, int width) const; int GetMessageHeight(int width, int limit) const; @@ -108,7 +103,6 @@ BoundedLabel* title_view_ = nullptr; BoundedLabel* message_view_ = nullptr; BoundedLabel* context_message_view_ = nullptr; - views::ImageButton* settings_button_view_ = nullptr; std::vector<views::View*> item_views_; ProportionalImageView* icon_view_ = nullptr; views::View* bottom_view_ = nullptr; @@ -117,8 +111,8 @@ views::ProgressBar* progress_bar_view_ = nullptr; std::vector<NotificationButton*> action_buttons_; std::vector<views::View*> separators_; - std::unique_ptr<views::ImageButton> close_button_ = nullptr; std::unique_ptr<views::ImageView> small_image_view_; + NotificationControlButtonsView* control_buttons_view_; DISALLOW_COPY_AND_ASSIGN(NotificationView); };
diff --git a/ui/message_center/views/notification_view_md.cc b/ui/message_center/views/notification_view_md.cc index 551a8b0..7a86c5b 100644 --- a/ui/message_center/views/notification_view_md.cc +++ b/ui/message_center/views/notification_view_md.cc
@@ -467,6 +467,7 @@ void NotificationViewMD::CreateOrUpdateContextTitleView( const Notification& notification) { header_row_->SetAppName(notification.display_source()); + header_row_->SetTimestamp(notification.timestamp()); } void NotificationViewMD::CreateOrUpdateTitleView(
diff --git a/ui/message_center/views/notification_view_unittest.cc b/ui/message_center/views/notification_view_unittest.cc index 299a106..3e0ee88 100644 --- a/ui/message_center/views/notification_view_unittest.cc +++ b/ui/message_center/views/notification_view_unittest.cc
@@ -29,6 +29,8 @@ #include "ui/message_center/views/message_center_controller.h" #include "ui/message_center/views/message_view_factory.h" #include "ui/message_center/views/notification_button.h" +#include "ui/message_center/views/notification_control_buttons_view.h" +#include "ui/message_center/views/padded_button.h" #include "ui/message_center/views/proportional_image_view.h" #include "ui/views/controls/button/image_button.h" #include "ui/views/layout/fill_layout.h" @@ -160,8 +162,14 @@ } } - views::ImageButton* GetCloseButton() { - return notification_view()->close_button(); + PaddedButton* GetCloseButton() { + return notification_view() + ->control_buttons_view_->close_button_for_testing(); + } + + PaddedButton* GetSettingsButton() { + return notification_view() + ->control_buttons_view_->settings_button_for_testing(); } void UpdateNotificationViews() { @@ -308,11 +316,16 @@ notification()->set_message(base::ASCIIToUTF16("")); notification()->set_icon(gfx::Image()); - notification_view()->CreateOrUpdateViews(*notification()); + notification_view()->UpdateWithNotification(*notification()); EXPECT_TRUE(NULL == notification_view()->title_view_); EXPECT_TRUE(NULL == notification_view()->message_view_); EXPECT_TRUE(NULL == notification_view()->image_view_); - EXPECT_TRUE(NULL == notification_view()->settings_button_view_); + // Notification must have a control buttons view. + EXPECT_TRUE(NULL != notification_view()->control_buttons_view_); + // Notification is not pinned and have a close button by default. + EXPECT_TRUE(NULL != GetCloseButton()); + // Notification doesn't have a settings button by default. + EXPECT_TRUE(NULL == GetSettingsButton()); // We still expect an icon view for all layouts. EXPECT_TRUE(NULL != notification_view()->icon_view_); } @@ -328,11 +341,12 @@ NotifierId(NotifierId::APPLICATION, "extension_id"), *data(), delegate.get()); - notification_view()->CreateOrUpdateViews(notf); + notification_view()->UpdateWithNotification(notf); EXPECT_TRUE(NULL != notification_view()->title_view_); EXPECT_TRUE(NULL != notification_view()->message_view_); EXPECT_TRUE(NULL != notification_view()->context_message_view_); - EXPECT_TRUE(NULL != notification_view()->settings_button_view_); + EXPECT_TRUE(NULL != GetCloseButton()); + EXPECT_TRUE(NULL != GetSettingsButton()); EXPECT_TRUE(NULL != notification_view()->icon_view_); EXPECT_TRUE(NULL == notification_view()->image_view_); @@ -341,21 +355,21 @@ TEST_F(NotificationViewTest, TestLineLimits) { notification()->set_image(CreateTestImage(0, 0)); notification()->set_context_message(base::ASCIIToUTF16("")); - notification_view()->CreateOrUpdateViews(*notification()); + notification_view()->UpdateWithNotification(*notification()); EXPECT_EQ(5, notification_view()->GetMessageLineLimit(0, 360)); EXPECT_EQ(5, notification_view()->GetMessageLineLimit(1, 360)); EXPECT_EQ(3, notification_view()->GetMessageLineLimit(2, 360)); notification()->set_image(CreateTestImage(2, 2)); - notification_view()->CreateOrUpdateViews(*notification()); + notification_view()->UpdateWithNotification(*notification()); EXPECT_EQ(2, notification_view()->GetMessageLineLimit(0, 360)); EXPECT_EQ(2, notification_view()->GetMessageLineLimit(1, 360)); EXPECT_EQ(1, notification_view()->GetMessageLineLimit(2, 360)); notification()->set_context_message(base::ASCIIToUTF16("foo")); - notification_view()->CreateOrUpdateViews(*notification()); + notification_view()->UpdateWithNotification(*notification()); EXPECT_TRUE(notification_view()->context_message_view_ != NULL); @@ -448,7 +462,7 @@ TEST_F(NotificationViewTest, UpdateButtonsStateTest) { notification()->set_buttons(CreateButtons(2)); - notification_view()->CreateOrUpdateViews(*notification()); + notification_view()->UpdateWithNotification(*notification()); widget()->Show(); EXPECT_EQ(views::CustomButton::STATE_NORMAL, @@ -466,7 +480,7 @@ EXPECT_EQ(views::CustomButton::STATE_HOVERED, notification_view()->action_buttons_[0]->state()); - notification_view()->CreateOrUpdateViews(*notification()); + notification_view()->UpdateWithNotification(*notification()); EXPECT_EQ(views::CustomButton::STATE_HOVERED, notification_view()->action_buttons_[0]->state()); @@ -484,7 +498,7 @@ TEST_F(NotificationViewTest, UpdateButtonCountTest) { notification()->set_buttons(CreateButtons(2)); - notification_view()->CreateOrUpdateViews(*notification()); + notification_view()->UpdateWithNotification(*notification()); widget()->Show(); EXPECT_EQ(views::CustomButton::STATE_NORMAL, @@ -509,7 +523,7 @@ notification_view()->action_buttons_[1]->state()); notification()->set_buttons(CreateButtons(1)); - notification_view()->CreateOrUpdateViews(*notification()); + notification_view()->UpdateWithNotification(*notification()); EXPECT_EQ(views::CustomButton::STATE_HOVERED, notification_view()->action_buttons_[0]->state()); @@ -536,19 +550,16 @@ GURL("https://hello.com"), NotifierId(NotifierId::APPLICATION, "extension_id"), *data(), delegate.get()); - notification_view()->CreateOrUpdateViews(notf); + notification_view()->UpdateWithNotification(notf); widget()->Show(); - notification_view()->Layout(); - EXPECT_TRUE(NULL != notification_view()->settings_button_view_); - EXPECT_EQ(views::CustomButton::STATE_NORMAL, - notification_view()->settings_button_view_->state()); + EXPECT_TRUE(NULL != GetSettingsButton()); + EXPECT_EQ(views::CustomButton::STATE_NORMAL, GetSettingsButton()->state()); // Now construct a mouse move event 1 pixel inside the boundary of the action // button. gfx::Point cursor_location(1, 1); - views::View::ConvertPointToScreen(notification_view()->settings_button_view_, - &cursor_location); + views::View::ConvertPointToScreen(GetSettingsButton(), &cursor_location); ui::MouseEvent move(ui::ET_MOUSE_MOVED, cursor_location, cursor_location, ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); widget()->OnMouseEvent(&move); @@ -556,8 +567,7 @@ views::test::WidgetTest::GetEventSink(widget())->OnEventFromSource(&move); EXPECT_FALSE(details.dispatcher_destroyed); - EXPECT_EQ(views::CustomButton::STATE_HOVERED, - notification_view()->settings_button_view_->state()); + EXPECT_EQ(views::CustomButton::STATE_HOVERED, GetSettingsButton()->state()); // Now construct a mouse move event 1 pixel outside the boundary of the // widget. @@ -566,8 +576,7 @@ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); widget()->OnMouseEvent(&move); - EXPECT_EQ(views::CustomButton::STATE_NORMAL, - notification_view()->settings_button_view_->state()); + EXPECT_EQ(views::CustomButton::STATE_NORMAL, GetSettingsButton()->state()); } TEST_F(NotificationViewTest, ViewOrderingTest) {
diff --git a/ui/message_center/views/notifier_settings_view.cc b/ui/message_center/views/notifier_settings_view.cc index 4eafd70..7958f03 100644 --- a/ui/message_center/views/notifier_settings_view.cc +++ b/ui/message_center/views/notifier_settings_view.cc
@@ -440,6 +440,7 @@ AddChildView(title_label_); scroller_ = new views::ScrollView(); + scroller_->SetBackgroundColor(kMessageCenterBackgroundColor); scroller_->SetVerticalScrollBar(new views::OverlayScrollBar(false)); scroller_->SetHorizontalScrollBar(new views::OverlayScrollBar(true)); AddChildView(scroller_);
diff --git a/ui/strings/ui_strings.grd b/ui/strings/ui_strings.grd index 8c97333..e7d71bd 100644 --- a/ui/strings/ui_strings.grd +++ b/ui/strings/ui_strings.grd
@@ -643,6 +643,21 @@ <message name="IDS_MESSAGE_CENTER_NOTIFICATION_PROGRESS_PERCENTAGE" desc="The summary text in a notification that is shown with progress bar."> <ph name="NUMBER">$1<ex>75</ex></ph> % </message> + <message name="IDS_MESSAGE_NOTIFICATION_NOW_STRING_SHORTEST" desc="A string denoting the current point in time that should be as short as possible. Should be same as AndroidPlatform msgId 8912796667087856402. (frameworks/base/core/res/res/values/strings.xml:string:now_string_shortest)"> + now + </message> + <message name="IDS_MESSAGE_NOTIFICATION_DURATION_MINUTES_SHORTEST" desc="Phrase describing a time duration using minutes that is as short as possible, preferrably one character. Should be same as AndroidPlatform msgId 3957499975064245495. (frameworks/base/core/res/res/values/strings.xml:plurals:duration_minutes_shortest) [ICU Syntax]"> + {MINUTES, plural, =1 {1m} other {#m}} + </message> + <message name="IDS_MESSAGE_NOTIFICATION_DURATION_HOURS_SHORTEST" desc="Phrase describing a time duration using hours that is as short as possible, preferrably one character. Should be same as AndroidPlatform msgId 3552182110578602356. (frameworks/base/core/res/res/values/strings.xml:plurals:duration_hours_shortest) [ICU Syntax]"> + {HOURS, plural, =1 {1h} other {#h}} + </message> + <message name="IDS_MESSAGE_NOTIFICATION_DURATION_DAYS_SHORTEST" desc="Phrase describing a time duration using days that is as short as possible, preferrably one character. Should be same as AndroidPlatform msgId 5213655532597081640. (frameworks/base/core/res/res/values/strings.xml:plurals:duration_days_shortest) [ICU Syntax]"> + {DAYS, plural, =1 {1d} other {#d}} + </message> + <message name="IDS_MESSAGE_NOTIFICATION_DURATION_YEARS_SHORTEST" desc="Phrase describing a time duration using years that is as short as possible, preferrably one character. Should be same as AndroidPlatform msgId 7848711145196397042. (frameworks/base/core/res/res/values/strings.xml:plurals:duration_years_shortest) [ICU Syntax]"> + {YEARS, plural, =1 {1y} other {#y}} + </message> <if expr="not use_titlecase"> <message name="IDS_MESSAGE_CENTER_QUIET_MODE_BUTTON_TOOLTIP" desc="The tooltip text for the do not disturb button."> Do not disturb
diff --git a/ui/views/accessibility/DEPS b/ui/views/accessibility/DEPS index 32ae451d..62e6a66 100644 --- a/ui/views/accessibility/DEPS +++ b/ui/views/accessibility/DEPS
@@ -1,3 +1,9 @@ include_rules = [ "+third_party/iaccessible2", ] + +specific_include_rules = { + "ax_system_caret_win_interactive_uitest\.cc": [ + "+mojo/edk/embedder", + ] +}
diff --git a/ui/views/accessibility/ax_system_caret_win_interactive_uitest.cc b/ui/views/accessibility/ax_system_caret_win_interactive_uitest.cc new file mode 100644 index 0000000..290915b2 --- /dev/null +++ b/ui/views/accessibility/ax_system_caret_win_interactive_uitest.cc
@@ -0,0 +1,186 @@ +// Copyright 2017 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 <oleacc.h> +#include <windows.h> + +#include "base/macros.h" +#include "base/path_service.h" +#include "base/strings/utf_string_conversions.h" +#include "base/win/scoped_comptr.h" +#include "base/win/scoped_variant.h" +#include "mojo/edk/embedder/embedder.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/aura/window.h" +#include "ui/aura/window_tree_host.h" +#include "ui/base/ime/input_method.h" +#include "ui/base/ime/text_edit_commands.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/base/ui_base_paths.h" +#include "ui/gfx/geometry/rect.h" +#include "ui/gfx/native_widget_types.h" +#include "ui/gl/test/gl_surface_test_support.h" +#include "ui/views/controls/textfield/textfield.h" +#include "ui/views/controls/textfield/textfield_test_api.h" +#include "ui/views/test/widget_test.h" +#include "ui/views/widget/widget.h" + +namespace views { + +namespace { + +class AXSystemCaretWinTest : public test::WidgetTest { + public: + AXSystemCaretWinTest() : self_(CHILDID_SELF) {} + ~AXSystemCaretWinTest() override {} + + void SetUp() override { + mojo::edk::Init(); + gl::GLSurfaceTestSupport::InitializeOneOff(); + ui::RegisterPathProvider(); + base::FilePath ui_test_pak_path; + ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); + ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); + test::WidgetTest::SetUp(); + + widget_ = CreateNativeDesktopWidget(); + widget_->SetBounds(gfx::Rect(0, 0, 200, 200)); + textfield_ = new Textfield(); + textfield_->SetBounds(0, 0, 200, 20); + textfield_->SetText(base::ASCIIToUTF16("Some text.")); + widget_->GetRootView()->AddChildView(textfield_); + test::WidgetActivationWaiter waiter(widget_, true); + widget_->Show(); + waiter.Wait(); + textfield_->RequestFocus(); + ASSERT_TRUE(widget_->IsActive()); + ASSERT_TRUE(textfield_->HasFocus()); + ASSERT_EQ(ui::TEXT_INPUT_TYPE_TEXT, + widget_->GetInputMethod()->GetTextInputType()); + } + + void TearDown() override { + widget_->CloseNow(); + test::WidgetTest::TearDown(); + ui::ResourceBundle::CleanupSharedInstance(); + } + + protected: + Widget* widget_; + Textfield* textfield_; + base::win::ScopedVariant self_; + + DISALLOW_COPY_AND_ASSIGN(AXSystemCaretWinTest); +}; + +} // namespace + +TEST_F(AXSystemCaretWinTest, TestOnCaretBoundsChangeInTextField) { + TextfieldTestApi textfield_test_api(textfield_); + base::win::ScopedComPtr<IAccessible> caret_accessible; + gfx::NativeWindow native_window = widget_->GetNativeWindow(); + ASSERT_NE(nullptr, native_window); + HWND hwnd = native_window->GetHost()->GetAcceleratedWidget(); + EXPECT_HRESULT_SUCCEEDED(AccessibleObjectFromWindow( + hwnd, static_cast<DWORD>(OBJID_CARET), IID_IAccessible, + reinterpret_cast<void**>(caret_accessible.GetAddressOf()))); + + textfield_test_api.ExecuteTextEditCommand( + ui::TextEditCommand::MOVE_TO_BEGINNING_OF_DOCUMENT); + gfx::Point caret_position = textfield_test_api.GetCursorViewOrigin(); + LONG x, y, width, height; + EXPECT_EQ(S_OK, + caret_accessible->accLocation(&x, &y, &width, &height, self_)); + EXPECT_EQ(caret_position.x(), x); + EXPECT_EQ(caret_position.y(), y); + EXPECT_EQ(1, width); + + textfield_test_api.ExecuteTextEditCommand( + ui::TextEditCommand::MOVE_TO_END_OF_DOCUMENT); + gfx::Point caret_position2 = textfield_test_api.GetCursorViewOrigin(); + EXPECT_NE(caret_position, caret_position2); + EXPECT_EQ(S_OK, + caret_accessible->accLocation(&x, &y, &width, &height, self_)); + EXPECT_EQ(caret_position2.x(), x); + EXPECT_EQ(caret_position2.y(), y); + EXPECT_EQ(1, width); +} + +TEST_F(AXSystemCaretWinTest, TestOnInputTypeChangeInTextField) { + base::win::ScopedComPtr<IAccessible> caret_accessible; + gfx::NativeWindow native_window = widget_->GetNativeWindow(); + ASSERT_NE(nullptr, native_window); + HWND hwnd = native_window->GetHost()->GetAcceleratedWidget(); + EXPECT_HRESULT_SUCCEEDED(AccessibleObjectFromWindow( + hwnd, static_cast<DWORD>(OBJID_CARET), IID_IAccessible, + reinterpret_cast<void**>(caret_accessible.GetAddressOf()))); + LONG x, y, width, height; + EXPECT_EQ(S_OK, + caret_accessible->accLocation(&x, &y, &width, &height, self_)); + + textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); + // Caret object should still be valid. + EXPECT_EQ(S_OK, + caret_accessible->accLocation(&x, &y, &width, &height, self_)); + + // Retrieving the caret again should also work. + caret_accessible.Reset(); + EXPECT_HRESULT_SUCCEEDED(AccessibleObjectFromWindow( + hwnd, static_cast<DWORD>(OBJID_CARET), IID_IAccessible, + reinterpret_cast<void**>(caret_accessible.GetAddressOf()))); + LONG x2, y2, width2, height2; + EXPECT_EQ(S_OK, + caret_accessible->accLocation(&x2, &y2, &width2, &height2, self_)); + EXPECT_EQ(x, x2); + EXPECT_EQ(y, y2); + EXPECT_EQ(width, width2); + EXPECT_EQ(height, height2); +} + +TEST_F(AXSystemCaretWinTest, DISABLED_TestMovingWindow) { + base::win::ScopedComPtr<IAccessible> caret_accessible; + gfx::NativeWindow native_window = widget_->GetNativeWindow(); + ASSERT_NE(nullptr, native_window); + HWND hwnd = native_window->GetHost()->GetAcceleratedWidget(); + EXPECT_HRESULT_SUCCEEDED(AccessibleObjectFromWindow( + hwnd, static_cast<DWORD>(OBJID_CARET), IID_IAccessible, + reinterpret_cast<void**>(caret_accessible.GetAddressOf()))); + LONG x, y, width, height; + EXPECT_EQ(S_OK, + caret_accessible->accLocation(&x, &y, &width, &height, self_)); + + widget_->SetBounds(gfx::Rect(100, 100, 500, 500)); + LONG x2, y2, width2, height2; + caret_accessible.Reset(); + EXPECT_HRESULT_SUCCEEDED(AccessibleObjectFromWindow( + hwnd, static_cast<DWORD>(OBJID_CARET), IID_IAccessible, + reinterpret_cast<void**>(caret_accessible.GetAddressOf()))); + EXPECT_EQ(S_OK, + caret_accessible->accLocation(&x2, &y2, &width2, &height2, self_)); + EXPECT_NE(x, x2); + EXPECT_NE(y, y2); + // The width and height of the caret shouldn't change. + EXPECT_EQ(width, width2); + EXPECT_EQ(height, height2); + + // Try maximizing the window. + SendMessage(hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0); + LONG x3, y3, width3, height3; + EXPECT_HRESULT_FAILED( + caret_accessible->accLocation(&x3, &y3, &width3, &height3, self_)); + caret_accessible.Reset(); + + EXPECT_HRESULT_SUCCEEDED(AccessibleObjectFromWindow( + hwnd, static_cast<DWORD>(OBJID_CARET), IID_IAccessible, + reinterpret_cast<void**>(caret_accessible.GetAddressOf()))); + EXPECT_EQ(S_OK, + caret_accessible->accLocation(&x3, &y3, &width3, &height3, self_)); + EXPECT_NE(x2, x3); + EXPECT_NE(y2, y3); + // The width and height of the caret shouldn't change. + EXPECT_EQ(width, width3); + EXPECT_EQ(height, height3); +} + +} // namespace views
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc index 44940195..5edb560 100644 --- a/ui/views/controls/textfield/textfield.cc +++ b/ui/views/controls/textfield/textfield.cc
@@ -338,6 +338,7 @@ model_->Append(new_text); OnCaretBoundsChanged(); SchedulePaint(); + NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_CHANGED, true); } void Textfield::InsertOrReplaceText(const base::string16& new_text) {
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc index 8295d4d..9393967 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
@@ -600,6 +600,10 @@ //////////////////////////////////////////////////////////////////////////////// // DesktopWindowTreeHostWin, HWNDMessageHandlerDelegate implementation: +ui::InputMethod* DesktopWindowTreeHostWin::GetHWNDMessageDelegateInputMethod() { + return GetInputMethod(); +} + bool DesktopWindowTreeHostWin::HasNonClientView() const { return has_non_client_view_; }
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h index 6099dc1..3f1c7bf 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
@@ -19,9 +19,13 @@ } } +namespace ui { +class InputMethod; +} // namespace ui + namespace wm { class ScopedTooltipDisabler; -} +} // namespace wm namespace views { class DesktopDragDropClientWin; @@ -135,6 +139,7 @@ void OnWindowHidingAnimationCompleted() override; // Overridden from HWNDMessageHandlerDelegate: + ui::InputMethod* GetHWNDMessageDelegateInputMethod() override; bool HasNonClientView() const override; FrameMode GetFrameMode() const override; bool HasFrame() const override;
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index 01c3728..5190e41 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc
@@ -21,8 +21,14 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "base/trace_event/trace_event.h" +#include "base/win/scoped_comptr.h" #include "base/win/scoped_gdi_object.h" #include "base/win/windows_version.h" +#include "ui/accessibility/platform/ax_platform_node_win.h" +#include "ui/accessibility/platform/ax_system_caret_win.h" +#include "ui/base/ime/input_method.h" +#include "ui/base/ime/text_input_client.h" +#include "ui/base/ime/text_input_type.h" #include "ui/base/view_prop.h" #include "ui/base/win/internal_constants.h" #include "ui/base/win/lock_state.h" @@ -362,6 +368,8 @@ weak_factory_(this) {} HWNDMessageHandler::~HWNDMessageHandler() { + DCHECK(delegate_->GetHWNDMessageDelegateInputMethod()); + delegate_->GetHWNDMessageDelegateInputMethod()->RemoveObserver(this); delegate_ = NULL; // Prevent calls back into this class via WNDPROC now that we've been // destroyed. @@ -395,6 +403,8 @@ prop_window_target_.reset(new ui::ViewProp(hwnd(), ui::WindowEventTarget::kWin32InputEventTarget, static_cast<ui::WindowEventTarget*>(this))); + DCHECK(delegate_->GetHWNDMessageDelegateInputMethod()); + delegate_->GetHWNDMessageDelegateInputMethod()->AddObserver(this); // Direct Manipulation is enabled on Windows 10+. The CreateInstance function // returns NULL if Direct Manipulation is not available. @@ -949,6 +959,46 @@ return result; } +void HWNDMessageHandler::OnTextInputTypeChanged( + const ui::TextInputClient* client) { + if (!client || client->GetTextInputType() == ui::TEXT_INPUT_TYPE_NONE) { + DestroyAXSystemCaret(); + return; + } + + OnCaretBoundsChanged(client); +} + +void HWNDMessageHandler::OnFocus() {} + +void HWNDMessageHandler::OnBlur() {} + +void HWNDMessageHandler::OnCaretBoundsChanged( + const ui::TextInputClient* client) { + if (!client || client->GetTextInputType() == ui::TEXT_INPUT_TYPE_NONE) + return; + + if (!ax_system_caret_) + ax_system_caret_ = std::make_unique<ui::AXSystemCaretWin>(hwnd()); + + const gfx::Rect dip_caret_bounds(client->GetCaretBounds()); + gfx::Rect caret_bounds = + display::win::ScreenWin::DIPToScreenRect(hwnd(), dip_caret_bounds); + // Collapse any selection. + caret_bounds.set_width(1); + ax_system_caret_->MoveCaretTo(caret_bounds); +} + +void HWNDMessageHandler::OnTextInputStateChanged( + const ui::TextInputClient* client) {} + +void HWNDMessageHandler::OnInputMethodDestroyed( + const ui::InputMethod* input_method) { + DestroyAXSystemCaret(); +} + +void HWNDMessageHandler::OnShowImeIfNeeded() {} + LRESULT HWNDMessageHandler::HandleMouseMessage(unsigned int message, WPARAM w_param, LPARAM l_param, @@ -1533,10 +1583,14 @@ // Retrieve MSAA dispatch object for the root view. base::win::ScopedComPtr<IAccessible> root( delegate_->GetNativeViewAccessible()); - - // Create a reference that MSAA will marshall to the client. reference_result = LresultFromObject(IID_IAccessible, w_param, static_cast<IAccessible*>(root.Detach())); + } else if (::GetFocus() == hwnd() && ax_system_caret_ && + static_cast<DWORD>(OBJID_CARET) == obj_id) { + base::win::ScopedComPtr<IAccessible> ax_system_caret_accessible = + ax_system_caret_->GetCaret(); + reference_result = LresultFromObject(IID_IAccessible, w_param, + ax_system_caret_accessible.Detach()); } return reference_result; @@ -2180,6 +2234,7 @@ (notification_code & sc_mask) == SC_MAXIMIZE || (notification_code & sc_mask) == SC_RESTORE) { delegate_->ResetWindowControls(); + DestroyAXSystemCaret(); } else if ((notification_code & sc_mask) == SC_MOVE || (notification_code & sc_mask) == SC_SIZE) { if (!IsVisible()) { @@ -2188,6 +2243,7 @@ SetWindowLong(hwnd(), GWL_STYLE, GetWindowLong(hwnd(), GWL_STYLE) | WS_VISIBLE); } + DestroyAXSystemCaret(); } } @@ -3002,4 +3058,8 @@ SetBoundsInternal(shrunk_rect, false); } +void HWNDMessageHandler::DestroyAXSystemCaret() { + ax_system_caret_ = nullptr; +} + } // namespace views
diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h index bdfbaff..a1379ad 100644 --- a/ui/views/win/hwnd_message_handler.h +++ b/ui/views/win/hwnd_message_handler.h
@@ -21,6 +21,7 @@ #include "base/win/scoped_gdi_object.h" #include "base/win/win_util.h" #include "ui/accessibility/ax_enums.h" +#include "ui/base/ime/input_method_observer.h" #include "ui/base/ui_base_types.h" #include "ui/base/win/window_event_target.h" #include "ui/events/event.h" @@ -38,6 +39,9 @@ } // namespace gfx namespace ui { +class AXSystemCaretWin; +class InputMethod; +class TextInputClient; class ViewProp; } @@ -117,9 +121,9 @@ // used by both a views::NativeWidget and an aura::WindowTreeHost // implementation. // TODO(beng): This object should eventually *become* the WindowImpl. -class VIEWS_EXPORT HWNDMessageHandler : - public gfx::WindowImpl, - public ui::WindowEventTarget { +class VIEWS_EXPORT HWNDMessageHandler : public gfx::WindowImpl, + public ui::InputMethodObserver, + public ui::WindowEventTarget { public: explicit HWNDMessageHandler(HWNDMessageHandlerDelegate* delegate); ~HWNDMessageHandler() override; @@ -227,6 +231,15 @@ HICON GetSmallWindowIcon() const override; LRESULT OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) override; + // Overridden from InputMethodObserver + void OnTextInputTypeChanged(const ui::TextInputClient* client) override; + void OnFocus() override; + void OnBlur() override; + void OnCaretBoundsChanged(const ui::TextInputClient* client) override; + void OnTextInputStateChanged(const ui::TextInputClient* client) override; + void OnInputMethodDestroyed(const ui::InputMethod* input_method) override; + void OnShowImeIfNeeded() override; + // Overridden from WindowEventTarget LRESULT HandleMouseMessage(unsigned int message, WPARAM w_param, @@ -574,6 +587,11 @@ // px on activation loss to a window on the same monitor. void OnBackgroundFullscreen(); + // Deletes the system caret used for accessibility. This will result in any + // clients that are still holding onto its |IAccessible| to get a failure code + // if they request its location. + void DestroyAXSystemCaret(); + HWNDMessageHandlerDelegate* delegate_; std::unique_ptr<FullscreenHandler> fullscreen_handler_; @@ -698,6 +716,9 @@ std::unique_ptr<WindowsSessionChangeObserver> windows_session_change_observer_; + // Some assistive software need to track the location of the caret. + std::unique_ptr<ui::AXSystemCaretWin> ax_system_caret_; + // This class provides functionality to register the legacy window as a // Direct Manipulation consumer. This allows us to support smooth scroll // in Chrome on Windows 10.
diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h index f5328c4..72d321394 100644 --- a/ui/views/win/hwnd_message_handler_delegate.h +++ b/ui/views/win/hwnd_message_handler_delegate.h
@@ -16,6 +16,7 @@ namespace ui { class Accelerator; +class InputMethod; class KeyEvent; class MouseEvent; class TouchEvent; @@ -33,6 +34,9 @@ // notifications from the underlying HWND and service requests for data. class VIEWS_EXPORT HWNDMessageHandlerDelegate { public: + // Returns the input method currently used in this window. + virtual ui::InputMethod* GetHWNDMessageDelegateInputMethod() = 0; + // True if the widget associated with this window has a non-client view. virtual bool HasNonClientView() const = 0;
diff --git a/url/mojo/BUILD.gn b/url/mojo/BUILD.gn index eaedafc..970ed7a 100644 --- a/url/mojo/BUILD.gn +++ b/url/mojo/BUILD.gn
@@ -10,7 +10,7 @@ ] # TODO(crbug.com/699569): Convert to use the new JS bindings. - use_new_js_bindings = false + js_bindings_mode = "both" } mojom("url_mojom_origin") { @@ -23,7 +23,7 @@ ] # TODO(crbug.com/699569): Convert to use the new JS bindings. - use_new_js_bindings = false + js_bindings_mode = "both" } mojom("test_url_mojom_gurl") {